<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cvc4.stanford.edu/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lianah</id>
		<title>CVC4 - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://cvc4.stanford.edu/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lianah"/>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/wiki/Special:Contributions/Lianah"/>
		<updated>2026-04-04T17:15:39Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.4</generator>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4018</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4018"/>
				<updated>2012-12-01T01:16:19Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* bitvectors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=CVC language=&lt;br /&gt;
&lt;br /&gt;
==Finding these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/cvc&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
=SMT-LIB=&lt;br /&gt;
&lt;br /&gt;
We recommend [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's excellent tutorial on SMT-LIB].  When running examples from this tutorial, we recommend using CVC4's ''--smtlib-strict'' command line option, which enters a stricter compliance mode.&lt;br /&gt;
&lt;br /&gt;
CVC4 should be compliant with [http://www.smtlib.org/ the standard], and thus also with David Cok's tutorial, except for some unsupported functionality as outlined in the [[User's Manual#CVC4's support for the SMT-LIB language|SMT-LIB compliance section of the User's Manual]].  If you find something that you believe to be nonconformant, please [http://cvc4.cs.nyu.edu/bugs/ report it as a bug].&lt;br /&gt;
&lt;br /&gt;
=C++ API=&lt;br /&gt;
* helloworld : a simple example to start off with&lt;br /&gt;
* linear_arith : real and integer linear arithmetic&lt;br /&gt;
* combination : integer and uninterpreted function example&lt;br /&gt;
* bitvectors : bit-vectors example&lt;br /&gt;
* bitvectors_and_arrays : integer and uninterpreted function example&lt;br /&gt;
* quantifiers&lt;br /&gt;
&lt;br /&gt;
==Finding and compiling these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/api&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
To compile everything in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory, you can issue the command &amp;lt;code&amp;gt;make examples&amp;lt;/code&amp;gt; from the top-level of the source distribution.  This will first build CVC4 (if it isn't already built) and then the examples.  Some examples from the directory may not be compiled, if (for instance) you haven't built with support for Java, or if you haven't built with support for the compatibility interface; however, all native C++ API examples should be, and those are the only ones appearing in this section.&lt;br /&gt;
&lt;br /&gt;
Note that the example API code in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory is intended to be compiled and linked against a CVC4 library built from the source tree.  If you try to compile them yourself, against a CVC4 library installed (for example) in &amp;lt;code&amp;gt;/usr&amp;lt;/code&amp;gt;, you may find that certain headers cannot be found.  There is an easy fix.  CVC4 #includes like the following:&lt;br /&gt;
 #include &amp;quot;expr/expr.h&amp;quot;&lt;br /&gt;
should be rewritten to this form:&lt;br /&gt;
 #include &amp;lt;cvc4/expr/expr.h&amp;gt;&lt;br /&gt;
or, most likely, you can remove all such #includes and replace with this single one:&lt;br /&gt;
 #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example code is not installed by &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==helloworld==&lt;br /&gt;
To get used to CVC4, let us go through the following example line-by-line:&lt;br /&gt;
  #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
  using namespace CVC4;&lt;br /&gt;
  int main() {&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
    SmtEngine smt(&amp;amp;em);&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
(The example can be found in examples/api/helloworld.cpp.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First we include the standard &amp;lt;iostream&amp;gt; library, and next we include the public interface for CVC4:&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cvc4/cvc4.h&amp;lt;/code&amp;gt; includes definitions for all of the classes we'll need including ExprManager, Expr and SmtEngine.  All of CVC4 lives in the namespace CVC4 and to save a bit of typing let's use the namespace.  Now construct a new ExprManager named em.&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
ExprManagers are in charge of constructing and managing symbolic expressions in CVC4.  We then construct the expression Expr helloworld.&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
helloworld is a symbolic variable with the name &amp;quot;Hello World!&amp;quot; and the type boolean. Note that we ask em to both make the variable and to get em.booleanType(). We now make the main driver for CVC4 reasoning the SmtEngine smt using em as its ExprManager.&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
Finally we print helloworld and query the SmtEngine if the boolean variable helloworld is valid.&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
We can compile the program helloworld from helloworld.cpp by linking against &amp;lt;code&amp;gt;-lcvc4&amp;lt;/code&amp;gt;&lt;br /&gt;
 $ g++ helloworld.cpp -o helloworld -lcvc4&lt;br /&gt;
 $ ./helloworld&lt;br /&gt;
 Hello World! is invalid&lt;br /&gt;
This should all work if libcvc4 was installed using &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.  If you used &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt; to a non-standard location, look at instructions for [[Build Problems#make_install_to_a_non-standard_prefix|using non-standard prefix]]. If you insist on not-using make, look at instructions for [[Build_Problems#libcvc4_without_make_install]].&lt;br /&gt;
&lt;br /&gt;
==linear_arith==&lt;br /&gt;
With helloworld under our belt, let's try to work through the more advanced examples/api/linear_arith.cpp . In this example, we'll try to show that for &amp;lt;math&amp;gt; x \in \mathbb{Z}, y \in \mathbb{R}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;x \geq 3 y, x \leq y, -2 &amp;lt; x &amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt; \max y - x = \frac{2}{3}&amp;lt;/math&amp;gt;.&lt;br /&gt;
We can do this by first showing that these assumptions entail &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;, and then showing that &amp;lt;math&amp;gt; y - x = \frac{2}{3}&amp;lt;/math&amp;gt; is consistent with the assumptions.&lt;br /&gt;
&lt;br /&gt;
We use the same basic skeleton of includes/namespaces/main as before.  We make an ExprManager and SmtEngine as before.&lt;br /&gt;
  ExprManager em;&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
We now set on option on the SmtEngine to enable incremental or multiple query solving, which we will take advantage of.&lt;br /&gt;
  smt.setOption(&amp;quot;incremental&amp;quot;, SExpr(&amp;quot;true&amp;quot;)); // Enable incremental solving&lt;br /&gt;
We get the Types real and integer from em, and we make x and y variables of the respective types.&lt;br /&gt;
  Type real = em.realType();&lt;br /&gt;
  Type integer = em.integerType();&lt;br /&gt;
  Expr x = em.mkVar(&amp;quot;x&amp;quot;, integer);&lt;br /&gt;
  Expr y = em.mkVar(&amp;quot;y&amp;quot;, real);&lt;br /&gt;
We now make Exprs for the 3 Rational constants in the formulas using [[Expr#Constants|em.mkConst()]]:&lt;br /&gt;
  Expr three = em.mkConst(Rational(3));&lt;br /&gt;
  Expr neg2 = em.mkConst(Rational(-2));&lt;br /&gt;
  Expr two_thirds = em.mkConst(Rational(2,3));&lt;br /&gt;
We will now make the intermediate terms using mkExpr. &lt;br /&gt;
  Expr three_y = em.mkExpr(kind::MULT, three, y);&lt;br /&gt;
  Expr diff = em.mkExpr(kind::MINUS, y, x);&lt;br /&gt;
The first argument to mkExpr is a Kind. Kind is an enum covering all of the various expressions that CVC4 can make.  Common operators have fairly standard ALL_CAPS names, such as LEQ, MINUS, AND, BITVECTOR_NAND, and so on.  Kind's are in the namespace CVC4::kind.  For more information see [[Expr#Constants]].&lt;br /&gt;
&lt;br /&gt;
Using these intermediate terms, we make the following formulas in the same way we made terms.&lt;br /&gt;
  Expr x_geq_3y = em.mkExpr(kind::GEQ, x, three_y);&lt;br /&gt;
  Expr x_leq_y = em.mkExpr(kind::LEQ, x, y);&lt;br /&gt;
  Expr neg2_lt_x = em.mkExpr(kind::LT, neg2, x);&lt;br /&gt;
&lt;br /&gt;
We now assert the assumptions in the SmtEngine:&lt;br /&gt;
  Expr assumptions =&lt;br /&gt;
    em.mkExpr(kind::AND, x_geq_3y, x_leq_y, neg2_lt_x);&lt;br /&gt;
  smt.assertFormula(assumptions);&lt;br /&gt;
Alternatively, we could have asserted x_geq_3y, x_leq_y, and neg2_lt_x individually.  It is worth pointing out that these are asserted at decision level 0.  Modern DPLL(T) solvers are stack based. We can push the stack(), add assertions and then pop() assertions off of the stack.&lt;br /&gt;
&lt;br /&gt;
We can now prove that &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;.  We first make an Expr for this literal. We now push() the SmtEngine, query the SmtEngine for the validity of the literal given the assumptions, and pop() the SmtEngine.&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_leq_two_thirds = em.mkExpr(kind::LEQ, diff, two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Prove that &amp;quot; &amp;lt;&amp;lt; diff_leq_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report VALID.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.query(diff_leq_two_thirds) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
It is worth noting that the push() and pop() are not strictly needed in order to not effect context level 0. This is because SmtEngine guards query(phi), checkSat(phi) with internal pushes and pops so phi does not effect the current context.  It is needed below; however, as the second lemma is proved in the following fashion:&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_is_two_thirds = em.mkExpr(kind::EQUAL, diff, two_thirds);&lt;br /&gt;
  smt.assertFormula(diff_is_two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Show that the asserts are consistent with &amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; diff_is_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report SAT.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.checkSat(em.mkConst(true)) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
== bitvectors ==&lt;br /&gt;
&lt;br /&gt;
In this example we will prove the equivalence of three different pieces of code. The example is adapted from the book [http://www.hackersdelight.org/ A Hacker's Delight] by Henry S. Warren. The code can be found in /examples/api/bitvectors.cpp. &lt;br /&gt;
Given a variable x, that can only have one of two values: a or b, we want to assign to x a value different than the current one. For example if x was equal to a we want to assign to it b. The most straightforward implementation of this is the following:&lt;br /&gt;
&lt;br /&gt;
  if (x == a) x = b; &lt;br /&gt;
  else x = a; &lt;br /&gt;
&lt;br /&gt;
or more concise: &lt;br /&gt;
&lt;br /&gt;
  x = x == a ? b : a; // (0)&lt;br /&gt;
&lt;br /&gt;
However, the following two pieces of code provide a more efficient implementation: &lt;br /&gt;
&lt;br /&gt;
  x = a + b - x; // (1) &lt;br /&gt;
  &lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  x = a ^ b ^ x; // (2)&lt;br /&gt;
&lt;br /&gt;
We will encode the problem using the theory of bit-vectors and check that the three implementations are indeed equivalent. &lt;br /&gt;
Let's analyze the code in bitvector.cpp line by line. Because we are interested in checking two different problems we will turn on incremental mode and specify the logic, to increase efficiency of solving:&lt;br /&gt;
&lt;br /&gt;
  smt.setOption(&amp;quot;incremental&amp;quot;, true); // Enable incremental solving&lt;br /&gt;
  smt.setLogic(&amp;quot;QF_BV&amp;quot;);              // Set the logic&lt;br /&gt;
&lt;br /&gt;
To make a bit-vector variable we must first make a bit-vector type. The factory method that constructs a bit-vector type requires the width of the bit-vector as an argument. In our example we will assume we are modeling a 32-bit machine:&lt;br /&gt;
&lt;br /&gt;
  // Creating a bit-vector type of width 32&lt;br /&gt;
  Type bitvector32 = em.mkBitVectorType(32);&lt;br /&gt;
&lt;br /&gt;
Creating variables and expressions follows the same pattern as in previous examples. We will first create the input variables x, a and b:&lt;br /&gt;
&lt;br /&gt;
  // Variables&lt;br /&gt;
  Expr x = em.mkVar(&amp;quot;x&amp;quot;, bitvector32);&lt;br /&gt;
  Expr a = em.mkVar(&amp;quot;a&amp;quot;, bitvector32);&lt;br /&gt;
  Expr b = em.mkVar(&amp;quot;b&amp;quot;, bitvector32);&lt;br /&gt;
&lt;br /&gt;
The first assumption constraints x to be equal to either a or b:&lt;br /&gt;
&lt;br /&gt;
  // First encode the assumption that x must be equal to a or b&lt;br /&gt;
  Expr x_eq_a = em.mkExpr(kind::EQUAL, x, a); &lt;br /&gt;
  Expr x_eq_b = em.mkExpr(kind::EQUAL, x, b);&lt;br /&gt;
  Expr assumption = em.mkExpr(kind::OR, x_eq_a, x_eq_b); &lt;br /&gt;
&lt;br /&gt;
Because we will need this assumption to prove all following properties we can just assert it to the solver in the current context. &lt;br /&gt;
  // Assert the assumption&lt;br /&gt;
  smt.assertFormula(assumption); &lt;br /&gt;
&lt;br /&gt;
To model the semantics of the instructions we need to introduce a new variable for x for each program state. Here new_x will represent the value of x after executing code (0). We will use new_x_ to represent the value of x after executing code (1) first, and then after executing code (2). &lt;br /&gt;
&lt;br /&gt;
  // Introduce a new variable for the new value of x after assignment. &lt;br /&gt;
  Expr new_x = em.mkVar(&amp;quot;new_x&amp;quot;, bitvector32); // x after executing code (0) &lt;br /&gt;
  Expr new_x_ = em.mkVar(&amp;quot;new_x_&amp;quot;, bitvector32); // x after executing code (1) or (2)&lt;br /&gt;
&lt;br /&gt;
We can encode the assignment in code (0) in a straightforward manner by using a term-ITE (if-then-else) expression which captures the semantics of the C++ (cond ? val1 : val2).  &lt;br /&gt;
&lt;br /&gt;
   // new_x = x == a ? b : a; &lt;br /&gt;
  Expr ite = em.mkExpr(kind::ITE, x_eq_a, b, a); &lt;br /&gt;
  Expr assignment0 = em.mkExpr(kind::EQUAL, new_x, ite); &lt;br /&gt;
&lt;br /&gt;
  // Assert the encoding of code (0)&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Asserting &amp;quot; &amp;lt;&amp;lt; assignment0 &amp;lt;&amp;lt; &amp;quot; to CVC4 &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  smt.assertFormula(assignment0);&lt;br /&gt;
&lt;br /&gt;
Because the assertions we have so far are the only ones that will be used in both queries we can now push a new context: &lt;br /&gt;
&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Pushing a new context.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.push();&lt;br /&gt;
  &lt;br /&gt;
Next, we move to encoding the semantics of code (1) in a similar  manner as before: &lt;br /&gt;
&lt;br /&gt;
  // Encoding code (1)&lt;br /&gt;
  // new_x_ = a xor b xor x&lt;br /&gt;
  Expr a_xor_b_xor_x = em.mkExpr(kind::BITVECTOR_XOR, a, b, x); &lt;br /&gt;
  Expr assignment1 = em.mkExpr(kind::EQUAL, new_x_, a_xor_b_xor_x);&lt;br /&gt;
&lt;br /&gt;
  // Assert encoding to CVC4 in current context; &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Asserting &amp;quot; &amp;lt;&amp;lt; assignment1 &amp;lt;&amp;lt; &amp;quot; to CVC4 &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  smt.assertFormula(assignment1);&lt;br /&gt;
&lt;br /&gt;
And we check that the value of x after executing code (0) is the same as that after executing code (1):&lt;br /&gt;
&lt;br /&gt;
  Expr new_x_eq_new_x_ = em.mkExpr(kind::EQUAL, new_x, new_x_);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Querying: &amp;quot; &amp;lt;&amp;lt; new_x_eq_new_x_ &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Expect valid. &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; CVC4: &amp;quot; &amp;lt;&amp;lt; smt.query(new_x_eq_new_x_) &amp;lt;&amp;lt; endl; &lt;br /&gt;
&lt;br /&gt;
Note that we are using smt.query(f) which checks for the validity of the formula f under the current assumptions i.e. that checking whether the current assertions imply (not f) is unsat.  &lt;br /&gt;
Now that we are done with checking the first equivalence, we can pop the context: &lt;br /&gt;
&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Popping context. &amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
Note that poping the context will remove the assertion saying new_x_ = a xor b xor x.&lt;br /&gt;
&lt;br /&gt;
We follow a similar pattern to check the second equivalence:&lt;br /&gt;
&lt;br /&gt;
  // Encoding code (2)&lt;br /&gt;
  // new_x_ = a + b - x&lt;br /&gt;
  Expr a_plus_b = em.mkExpr(kind::BITVECTOR_PLUS, a, b); &lt;br /&gt;
  Expr a_plus_b_minus_x = em.mkExpr(kind::BITVECTOR_SUB, a_plus_b, x); &lt;br /&gt;
  Expr assignment2 = em.mkExpr(kind::EQUAL, new_x_, a_plus_b_minus_x);&lt;br /&gt;
  &lt;br /&gt;
  // Assert encoding to CVC4 in current context; &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Asserting &amp;quot; &amp;lt;&amp;lt; assignment2 &amp;lt;&amp;lt; &amp;quot; to CVC4 &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  smt.assertFormula(assignment1);&lt;br /&gt;
&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Querying: &amp;quot; &amp;lt;&amp;lt; new_x_eq_new_x_ &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Expect valid. &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; CVC4: &amp;quot; &amp;lt;&amp;lt; smt.query(new_x_eq_new_x_) &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
=Java API=&lt;br /&gt;
=Parallel Solving=&lt;br /&gt;
===Obtaining===&lt;br /&gt;
* Download a statically built binary supporting parallel solving: [http://cvc4.cs.nyu.edu/cvc4-builds/portfolio-x86_64-linux-opt Optimized build]&lt;br /&gt;
* If compiling from source, specify by '''--with-portfolio''' option to the configure script. This will create an additional binary '''pcvc4''' which supports parallel solving.&lt;br /&gt;
 ./configure --with-portfolio [...]&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
*The '''pcvc4''' binary allows the user to run multiple instances of the solver simultaneously on the input problem. Each thread can be configured differently by specifying thread-specific options using '''--thread''N''=&amp;quot; &amp;lt;thread-specific-options&amp;gt; &amp;quot;'''. For example,&lt;br /&gt;
 pcvc4 --thread0=&amp;quot;--decision=internal&amp;quot; --thread1=&amp;quot;--decision=justification&amp;quot; input.smt2&lt;br /&gt;
will run two solver threads with different decision heuristics. The solver will stop as soon as one of threads has an answer.&lt;br /&gt;
&lt;br /&gt;
* The default number of threads is 2. The number of threads can be specified using '''--threads''' option. Note that any of the options specified outside all of the --thread''i''=&amp;quot;...&amp;quot; will be applied to all threads. For instance, in&lt;br /&gt;
 pcvc4 --threads=3 \&lt;br /&gt;
        --thread0=&amp;quot;--random-seed=10&amp;quot; \&lt;br /&gt;
        --thread1=&amp;quot;--random-seed=20&amp;quot; \&lt;br /&gt;
        --thread2=&amp;quot;--random-seed=30&amp;quot; \&lt;br /&gt;
        --simplification=none \&lt;br /&gt;
        input.smt2&lt;br /&gt;
three threads will be run, all with simplification disabled, and different random seeds for the SAT solver.&lt;br /&gt;
&lt;br /&gt;
* We also allow sharing of ''conflict clauses'' across different threads. By default, this is disabled but may he enabled by using the '''--filter-lemma-length''' option. For example,&lt;br /&gt;
 pcvc4 --filter-lemma-length=5 ...&lt;br /&gt;
will share all lemmas having 5 or less literals.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4017</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4017"/>
				<updated>2012-12-01T01:15:23Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* bitvectors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=CVC language=&lt;br /&gt;
&lt;br /&gt;
==Finding these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/cvc&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
=SMT-LIB=&lt;br /&gt;
&lt;br /&gt;
We recommend [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's excellent tutorial on SMT-LIB].  When running examples from this tutorial, we recommend using CVC4's ''--smtlib-strict'' command line option, which enters a stricter compliance mode.&lt;br /&gt;
&lt;br /&gt;
CVC4 should be compliant with [http://www.smtlib.org/ the standard], and thus also with David Cok's tutorial, except for some unsupported functionality as outlined in the [[User's Manual#CVC4's support for the SMT-LIB language|SMT-LIB compliance section of the User's Manual]].  If you find something that you believe to be nonconformant, please [http://cvc4.cs.nyu.edu/bugs/ report it as a bug].&lt;br /&gt;
&lt;br /&gt;
=C++ API=&lt;br /&gt;
* helloworld : a simple example to start off with&lt;br /&gt;
* linear_arith : real and integer linear arithmetic&lt;br /&gt;
* combination : integer and uninterpreted function example&lt;br /&gt;
* bitvectors : bit-vectors example&lt;br /&gt;
* bitvectors_and_arrays : integer and uninterpreted function example&lt;br /&gt;
* quantifiers&lt;br /&gt;
&lt;br /&gt;
==Finding and compiling these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/api&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
To compile everything in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory, you can issue the command &amp;lt;code&amp;gt;make examples&amp;lt;/code&amp;gt; from the top-level of the source distribution.  This will first build CVC4 (if it isn't already built) and then the examples.  Some examples from the directory may not be compiled, if (for instance) you haven't built with support for Java, or if you haven't built with support for the compatibility interface; however, all native C++ API examples should be, and those are the only ones appearing in this section.&lt;br /&gt;
&lt;br /&gt;
Note that the example API code in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory is intended to be compiled and linked against a CVC4 library built from the source tree.  If you try to compile them yourself, against a CVC4 library installed (for example) in &amp;lt;code&amp;gt;/usr&amp;lt;/code&amp;gt;, you may find that certain headers cannot be found.  There is an easy fix.  CVC4 #includes like the following:&lt;br /&gt;
 #include &amp;quot;expr/expr.h&amp;quot;&lt;br /&gt;
should be rewritten to this form:&lt;br /&gt;
 #include &amp;lt;cvc4/expr/expr.h&amp;gt;&lt;br /&gt;
or, most likely, you can remove all such #includes and replace with this single one:&lt;br /&gt;
 #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example code is not installed by &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==helloworld==&lt;br /&gt;
To get used to CVC4, let us go through the following example line-by-line:&lt;br /&gt;
  #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
  using namespace CVC4;&lt;br /&gt;
  int main() {&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
    SmtEngine smt(&amp;amp;em);&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
(The example can be found in examples/api/helloworld.cpp.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First we include the standard &amp;lt;iostream&amp;gt; library, and next we include the public interface for CVC4:&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cvc4/cvc4.h&amp;lt;/code&amp;gt; includes definitions for all of the classes we'll need including ExprManager, Expr and SmtEngine.  All of CVC4 lives in the namespace CVC4 and to save a bit of typing let's use the namespace.  Now construct a new ExprManager named em.&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
ExprManagers are in charge of constructing and managing symbolic expressions in CVC4.  We then construct the expression Expr helloworld.&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
helloworld is a symbolic variable with the name &amp;quot;Hello World!&amp;quot; and the type boolean. Note that we ask em to both make the variable and to get em.booleanType(). We now make the main driver for CVC4 reasoning the SmtEngine smt using em as its ExprManager.&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
Finally we print helloworld and query the SmtEngine if the boolean variable helloworld is valid.&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
We can compile the program helloworld from helloworld.cpp by linking against &amp;lt;code&amp;gt;-lcvc4&amp;lt;/code&amp;gt;&lt;br /&gt;
 $ g++ helloworld.cpp -o helloworld -lcvc4&lt;br /&gt;
 $ ./helloworld&lt;br /&gt;
 Hello World! is invalid&lt;br /&gt;
This should all work if libcvc4 was installed using &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.  If you used &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt; to a non-standard location, look at instructions for [[Build Problems#make_install_to_a_non-standard_prefix|using non-standard prefix]]. If you insist on not-using make, look at instructions for [[Build_Problems#libcvc4_without_make_install]].&lt;br /&gt;
&lt;br /&gt;
==linear_arith==&lt;br /&gt;
With helloworld under our belt, let's try to work through the more advanced examples/api/linear_arith.cpp . In this example, we'll try to show that for &amp;lt;math&amp;gt; x \in \mathbb{Z}, y \in \mathbb{R}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;x \geq 3 y, x \leq y, -2 &amp;lt; x &amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt; \max y - x = \frac{2}{3}&amp;lt;/math&amp;gt;.&lt;br /&gt;
We can do this by first showing that these assumptions entail &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;, and then showing that &amp;lt;math&amp;gt; y - x = \frac{2}{3}&amp;lt;/math&amp;gt; is consistent with the assumptions.&lt;br /&gt;
&lt;br /&gt;
We use the same basic skeleton of includes/namespaces/main as before.  We make an ExprManager and SmtEngine as before.&lt;br /&gt;
  ExprManager em;&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
We now set on option on the SmtEngine to enable incremental or multiple query solving, which we will take advantage of.&lt;br /&gt;
  smt.setOption(&amp;quot;incremental&amp;quot;, SExpr(&amp;quot;true&amp;quot;)); // Enable incremental solving&lt;br /&gt;
We get the Types real and integer from em, and we make x and y variables of the respective types.&lt;br /&gt;
  Type real = em.realType();&lt;br /&gt;
  Type integer = em.integerType();&lt;br /&gt;
  Expr x = em.mkVar(&amp;quot;x&amp;quot;, integer);&lt;br /&gt;
  Expr y = em.mkVar(&amp;quot;y&amp;quot;, real);&lt;br /&gt;
We now make Exprs for the 3 Rational constants in the formulas using [[Expr#Constants|em.mkConst()]]:&lt;br /&gt;
  Expr three = em.mkConst(Rational(3));&lt;br /&gt;
  Expr neg2 = em.mkConst(Rational(-2));&lt;br /&gt;
  Expr two_thirds = em.mkConst(Rational(2,3));&lt;br /&gt;
We will now make the intermediate terms using mkExpr. &lt;br /&gt;
  Expr three_y = em.mkExpr(kind::MULT, three, y);&lt;br /&gt;
  Expr diff = em.mkExpr(kind::MINUS, y, x);&lt;br /&gt;
The first argument to mkExpr is a Kind. Kind is an enum covering all of the various expressions that CVC4 can make.  Common operators have fairly standard ALL_CAPS names, such as LEQ, MINUS, AND, BITVECTOR_NAND, and so on.  Kind's are in the namespace CVC4::kind.  For more information see [[Expr#Constants]].&lt;br /&gt;
&lt;br /&gt;
Using these intermediate terms, we make the following formulas in the same way we made terms.&lt;br /&gt;
  Expr x_geq_3y = em.mkExpr(kind::GEQ, x, three_y);&lt;br /&gt;
  Expr x_leq_y = em.mkExpr(kind::LEQ, x, y);&lt;br /&gt;
  Expr neg2_lt_x = em.mkExpr(kind::LT, neg2, x);&lt;br /&gt;
&lt;br /&gt;
We now assert the assumptions in the SmtEngine:&lt;br /&gt;
  Expr assumptions =&lt;br /&gt;
    em.mkExpr(kind::AND, x_geq_3y, x_leq_y, neg2_lt_x);&lt;br /&gt;
  smt.assertFormula(assumptions);&lt;br /&gt;
Alternatively, we could have asserted x_geq_3y, x_leq_y, and neg2_lt_x individually.  It is worth pointing out that these are asserted at decision level 0.  Modern DPLL(T) solvers are stack based. We can push the stack(), add assertions and then pop() assertions off of the stack.&lt;br /&gt;
&lt;br /&gt;
We can now prove that &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;.  We first make an Expr for this literal. We now push() the SmtEngine, query the SmtEngine for the validity of the literal given the assumptions, and pop() the SmtEngine.&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_leq_two_thirds = em.mkExpr(kind::LEQ, diff, two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Prove that &amp;quot; &amp;lt;&amp;lt; diff_leq_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report VALID.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.query(diff_leq_two_thirds) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
It is worth noting that the push() and pop() are not strictly needed in order to not effect context level 0. This is because SmtEngine guards query(phi), checkSat(phi) with internal pushes and pops so phi does not effect the current context.  It is needed below; however, as the second lemma is proved in the following fashion:&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_is_two_thirds = em.mkExpr(kind::EQUAL, diff, two_thirds);&lt;br /&gt;
  smt.assertFormula(diff_is_two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Show that the asserts are consistent with &amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; diff_is_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report SAT.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.checkSat(em.mkConst(true)) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
== bitvectors ==&lt;br /&gt;
&lt;br /&gt;
In this example we will prove the equivalence of three different pieces of code. The example is adapted from the book [http://www.hackersdelight.org/ A Hacker's Delight] by Henry S. Warren. The code can be found in /examples/api/bitvectors.cpp. &lt;br /&gt;
Given a variable x, that can only have one of two values: a or b, we want to assign to x a value different than the current one. For example if x was equal to a we want to assign to it b. The most straightforward implementation of this is the following:&lt;br /&gt;
&lt;br /&gt;
  if (x == a) x = b; &lt;br /&gt;
  else x = a; &lt;br /&gt;
&lt;br /&gt;
or more concise: &lt;br /&gt;
&lt;br /&gt;
  x = x == a ? b : a; // (0)&lt;br /&gt;
&lt;br /&gt;
However, the following two pieces of code provide a more efficient implementation: &lt;br /&gt;
&lt;br /&gt;
  x = a + b - x; // (1) &lt;br /&gt;
  &lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  x = a ^ b ^ x; // (2)&lt;br /&gt;
&lt;br /&gt;
We will encode the problem using the theory of bit-vectors and check that the three implementations are indeed equivalent. &lt;br /&gt;
Let's analyze the code in bitvector.cpp line by line. Because we are interested in checking two different problems we will turn on incremental mode and specify the logic, to increase efficiency of solving:&lt;br /&gt;
&lt;br /&gt;
  smt.setOption(&amp;quot;incremental&amp;quot;, true); // Enable incremental solving&lt;br /&gt;
  smt.setLogic(&amp;quot;QF_BV&amp;quot;);              // Set the logic&lt;br /&gt;
&lt;br /&gt;
To make a bit-vector variable we must first make a bit-vector type. The factory method that constructs a bit-vector type requires the width of the bit-vector as an argument. In our example we will assume we are modeling a 32-bit machine:&lt;br /&gt;
&lt;br /&gt;
  // Creating a bit-vector type of width 32&lt;br /&gt;
  Type bitvector32 = em.mkBitVectorType(32);&lt;br /&gt;
&lt;br /&gt;
Creating variables and expressions follows the same pattern as in previous examples. We will first create the input variables x, a and b:&lt;br /&gt;
&lt;br /&gt;
  // Variables&lt;br /&gt;
  Expr x = em.mkVar(&amp;quot;x&amp;quot;, bitvector32);&lt;br /&gt;
  Expr a = em.mkVar(&amp;quot;a&amp;quot;, bitvector32);&lt;br /&gt;
  Expr b = em.mkVar(&amp;quot;b&amp;quot;, bitvector32);&lt;br /&gt;
&lt;br /&gt;
The first assumption constraints x to be equal to either a or b:&lt;br /&gt;
&lt;br /&gt;
  // First encode the assumption that x must be equal to a or b&lt;br /&gt;
  Expr x_eq_a = em.mkExpr(kind::EQUAL, x, a); &lt;br /&gt;
  Expr x_eq_b = em.mkExpr(kind::EQUAL, x, b);&lt;br /&gt;
  Expr assumption = em.mkExpr(kind::OR, x_eq_a, x_eq_b); &lt;br /&gt;
&lt;br /&gt;
Because we will need this assumption to prove all following properties we can just assert it to the solver in the current context. &lt;br /&gt;
  // Assert the assumption&lt;br /&gt;
  smt.assertFormula(assumption); &lt;br /&gt;
&lt;br /&gt;
To model the semantics of the instructions we need to introduce a new variable for x for each program state. Here new_x will represent the value of x after executing code (0). We will use new_x_ to represent the value of x after executing code (1) first, and then after executing code (2). &lt;br /&gt;
&lt;br /&gt;
  // Introduce a new variable for the new value of x after assignment. &lt;br /&gt;
  Expr new_x = em.mkVar(&amp;quot;new_x&amp;quot;, bitvector32); // x after executing code (0) &lt;br /&gt;
  Expr new_x_ = em.mkVar(&amp;quot;new_x_&amp;quot;, bitvector32); // x after executing code (1) or (2)&lt;br /&gt;
&lt;br /&gt;
We can encode the assignment in code (0) in a straightforward manner by using a term-ITE (if-then-else) expression which captures the semantics of an if then else: &lt;br /&gt;
&lt;br /&gt;
   // new_x = x == a ? b : a; &lt;br /&gt;
  Expr ite = em.mkExpr(kind::ITE, x_eq_a, b, a); &lt;br /&gt;
  Expr assignment0 = em.mkExpr(kind::EQUAL, new_x, ite); &lt;br /&gt;
&lt;br /&gt;
  // Assert the encoding of code (0)&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Asserting &amp;quot; &amp;lt;&amp;lt; assignment0 &amp;lt;&amp;lt; &amp;quot; to CVC4 &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  smt.assertFormula(assignment0);&lt;br /&gt;
&lt;br /&gt;
Because the assertions we have so far are the only ones that will be used in both queries we can now push a new context: &lt;br /&gt;
&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Pushing a new context.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.push();&lt;br /&gt;
  &lt;br /&gt;
Next, we move to encoding the semantics of code (1) in a similar  manner as before: &lt;br /&gt;
&lt;br /&gt;
  // Encoding code (1)&lt;br /&gt;
  // new_x_ = a xor b xor x&lt;br /&gt;
  Expr a_xor_b_xor_x = em.mkExpr(kind::BITVECTOR_XOR, a, b, x); &lt;br /&gt;
  Expr assignment1 = em.mkExpr(kind::EQUAL, new_x_, a_xor_b_xor_x);&lt;br /&gt;
&lt;br /&gt;
  // Assert encoding to CVC4 in current context; &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Asserting &amp;quot; &amp;lt;&amp;lt; assignment1 &amp;lt;&amp;lt; &amp;quot; to CVC4 &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  smt.assertFormula(assignment1);&lt;br /&gt;
&lt;br /&gt;
And we check that the value of x after executing code (0) is the same as that after executing code (1):&lt;br /&gt;
&lt;br /&gt;
  Expr new_x_eq_new_x_ = em.mkExpr(kind::EQUAL, new_x, new_x_);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Querying: &amp;quot; &amp;lt;&amp;lt; new_x_eq_new_x_ &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Expect valid. &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; CVC4: &amp;quot; &amp;lt;&amp;lt; smt.query(new_x_eq_new_x_) &amp;lt;&amp;lt; endl; &lt;br /&gt;
&lt;br /&gt;
Note that we are using smt.query(f) which checks for the validity of the formula f under the current assumptions i.e. that checking whether the current assertions imply (not f) is unsat.  &lt;br /&gt;
Now that we are done with checking the first equivalence, we can pop the context: &lt;br /&gt;
&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Popping context. &amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
Note that poping the context will remove the assertion saying new_x_ = a xor b xor x.&lt;br /&gt;
&lt;br /&gt;
We follow a similar pattern to check the second equivalence:&lt;br /&gt;
&lt;br /&gt;
  // Encoding code (2)&lt;br /&gt;
  // new_x_ = a + b - x&lt;br /&gt;
  Expr a_plus_b = em.mkExpr(kind::BITVECTOR_PLUS, a, b); &lt;br /&gt;
  Expr a_plus_b_minus_x = em.mkExpr(kind::BITVECTOR_SUB, a_plus_b, x); &lt;br /&gt;
  Expr assignment2 = em.mkExpr(kind::EQUAL, new_x_, a_plus_b_minus_x);&lt;br /&gt;
  &lt;br /&gt;
  // Assert encoding to CVC4 in current context; &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Asserting &amp;quot; &amp;lt;&amp;lt; assignment2 &amp;lt;&amp;lt; &amp;quot; to CVC4 &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  smt.assertFormula(assignment1);&lt;br /&gt;
&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Querying: &amp;quot; &amp;lt;&amp;lt; new_x_eq_new_x_ &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; Expect valid. &amp;quot; &amp;lt;&amp;lt; endl; &lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot; CVC4: &amp;quot; &amp;lt;&amp;lt; smt.query(new_x_eq_new_x_) &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
=Java API=&lt;br /&gt;
=Parallel Solving=&lt;br /&gt;
===Obtaining===&lt;br /&gt;
* Download a statically built binary supporting parallel solving: [http://cvc4.cs.nyu.edu/cvc4-builds/portfolio-x86_64-linux-opt Optimized build]&lt;br /&gt;
* If compiling from source, specify by '''--with-portfolio''' option to the configure script. This will create an additional binary '''pcvc4''' which supports parallel solving.&lt;br /&gt;
 ./configure --with-portfolio [...]&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
*The '''pcvc4''' binary allows the user to run multiple instances of the solver simultaneously on the input problem. Each thread can be configured differently by specifying thread-specific options using '''--thread''N''=&amp;quot; &amp;lt;thread-specific-options&amp;gt; &amp;quot;'''. For example,&lt;br /&gt;
 pcvc4 --thread0=&amp;quot;--decision=internal&amp;quot; --thread1=&amp;quot;--decision=justification&amp;quot; input.smt2&lt;br /&gt;
will run two solver threads with different decision heuristics. The solver will stop as soon as one of threads has an answer.&lt;br /&gt;
&lt;br /&gt;
* The default number of threads is 2. The number of threads can be specified using '''--threads''' option. Note that any of the options specified outside all of the --thread''i''=&amp;quot;...&amp;quot; will be applied to all threads. For instance, in&lt;br /&gt;
 pcvc4 --threads=3 \&lt;br /&gt;
        --thread0=&amp;quot;--random-seed=10&amp;quot; \&lt;br /&gt;
        --thread1=&amp;quot;--random-seed=20&amp;quot; \&lt;br /&gt;
        --thread2=&amp;quot;--random-seed=30&amp;quot; \&lt;br /&gt;
        --simplification=none \&lt;br /&gt;
        input.smt2&lt;br /&gt;
three threads will be run, all with simplification disabled, and different random seeds for the SAT solver.&lt;br /&gt;
&lt;br /&gt;
* We also allow sharing of ''conflict clauses'' across different threads. By default, this is disabled but may he enabled by using the '''--filter-lemma-length''' option. For example,&lt;br /&gt;
 pcvc4 --filter-lemma-length=5 ...&lt;br /&gt;
will share all lemmas having 5 or less literals.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4014</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4014"/>
				<updated>2012-12-01T00:57:11Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* bitvectors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=CVC language=&lt;br /&gt;
&lt;br /&gt;
==Finding these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/cvc&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
=SMT-LIB=&lt;br /&gt;
&lt;br /&gt;
We recommend [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's excellent tutorial on SMT-LIB].  When running examples from this tutorial, we recommend using CVC4's ''--smtlib-strict'' command line option, which enters a stricter compliance mode.&lt;br /&gt;
&lt;br /&gt;
CVC4 should be compliant with [http://www.smtlib.org/ the standard], and thus also with David Cok's tutorial, except for some unsupported functionality as outlined in the [[User's Manual#CVC4's support for the SMT-LIB language|SMT-LIB compliance section of the User's Manual]].  If you find something that you believe to be nonconformant, please [http://cvc4.cs.nyu.edu/bugs/ report it as a bug].&lt;br /&gt;
&lt;br /&gt;
=C++ API=&lt;br /&gt;
* helloworld : a simple example to start off with&lt;br /&gt;
* linear_arith : real and integer linear arithmetic&lt;br /&gt;
* combination : integer and uninterpreted function example&lt;br /&gt;
* bitvectors : bit-vectors example&lt;br /&gt;
* bitvectors_and_arrays : integer and uninterpreted function example&lt;br /&gt;
* quantifiers&lt;br /&gt;
&lt;br /&gt;
==Finding and compiling these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/api&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
To compile everything in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory, you can issue the command &amp;lt;code&amp;gt;make examples&amp;lt;/code&amp;gt; from the top-level of the source distribution.  This will first build CVC4 (if it isn't already built) and then the examples.  Some examples from the directory may not be compiled, if (for instance) you haven't built with support for Java, or if you haven't built with support for the compatibility interface; however, all native C++ API examples should be, and those are the only ones appearing in this section.&lt;br /&gt;
&lt;br /&gt;
Note that the example API code in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory is intended to be compiled and linked against a CVC4 library built from the source tree.  If you try to compile them yourself, against a CVC4 library installed (for example) in &amp;lt;code&amp;gt;/usr&amp;lt;/code&amp;gt;, you may find that certain headers cannot be found.  There is an easy fix.  CVC4 #includes like the following:&lt;br /&gt;
 #include &amp;quot;expr/expr.h&amp;quot;&lt;br /&gt;
should be rewritten to this form:&lt;br /&gt;
 #include &amp;lt;cvc4/expr/expr.h&amp;gt;&lt;br /&gt;
or, most likely, you can remove all such #includes and replace with this single one:&lt;br /&gt;
 #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example code is not installed by &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==helloworld==&lt;br /&gt;
To get used to CVC4, let us go through the following example line-by-line:&lt;br /&gt;
  #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
  using namespace CVC4;&lt;br /&gt;
  int main() {&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
    SmtEngine smt(&amp;amp;em);&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
(The example can be found in examples/api/helloworld.cpp.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First we include the standard &amp;lt;iostream&amp;gt; library, and next we include the public interface for CVC4:&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cvc4/cvc4.h&amp;lt;/code&amp;gt; includes definitions for all of the classes we'll need including ExprManager, Expr and SmtEngine.  All of CVC4 lives in the namespace CVC4 and to save a bit of typing let's use the namespace.  Now construct a new ExprManager named em.&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
ExprManagers are in charge of constructing and managing symbolic expressions in CVC4.  We then construct the expression Expr helloworld.&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
helloworld is a symbolic variable with the name &amp;quot;Hello World!&amp;quot; and the type boolean. Note that we ask em to both make the variable and to get em.booleanType(). We now make the main driver for CVC4 reasoning the SmtEngine smt using em as its ExprManager.&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
Finally we print helloworld and query the SmtEngine if the boolean variable helloworld is valid.&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
We can compile the program helloworld from helloworld.cpp by linking against &amp;lt;code&amp;gt;-lcvc4&amp;lt;/code&amp;gt;&lt;br /&gt;
 $ g++ helloworld.cpp -o helloworld -lcvc4&lt;br /&gt;
 $ ./helloworld&lt;br /&gt;
 Hello World! is invalid&lt;br /&gt;
This should all work if libcvc4 was installed using &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.  If you used &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt; to a non-standard location, look at instructions for [[Build Problems#make_install_to_a_non-standard_prefix|using non-standard prefix]]. If you insist on not-using make, look at instructions for [[Build_Problems#libcvc4_without_make_install]].&lt;br /&gt;
&lt;br /&gt;
==linear_arith==&lt;br /&gt;
With helloworld under our belt, let's try to work through the more advanced examples/api/linear_arith.cpp . In this example, we'll try to show that for &amp;lt;math&amp;gt; x \in \mathbb{Z}, y \in \mathbb{R}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;x \geq 3 y, x \leq y, -2 &amp;lt; x &amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt; \max y - x = \frac{2}{3}&amp;lt;/math&amp;gt;.&lt;br /&gt;
We can do this by first showing that these assumptions entail &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;, and then showing that &amp;lt;math&amp;gt; y - x = \frac{2}{3}&amp;lt;/math&amp;gt; is consistent with the assumptions.&lt;br /&gt;
&lt;br /&gt;
We use the same basic skeleton of includes/namespaces/main as before.  We make an ExprManager and SmtEngine as before.&lt;br /&gt;
  ExprManager em;&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
We now set on option on the SmtEngine to enable incremental or multiple query solving, which we will take advantage of.&lt;br /&gt;
  smt.setOption(&amp;quot;incremental&amp;quot;, SExpr(&amp;quot;true&amp;quot;)); // Enable incremental solving&lt;br /&gt;
We get the Types real and integer from em, and we make x and y variables of the respective types.&lt;br /&gt;
  Type real = em.realType();&lt;br /&gt;
  Type integer = em.integerType();&lt;br /&gt;
  Expr x = em.mkVar(&amp;quot;x&amp;quot;, integer);&lt;br /&gt;
  Expr y = em.mkVar(&amp;quot;y&amp;quot;, real);&lt;br /&gt;
We now make Exprs for the 3 Rational constants in the formulas using [[Expr#Constants|em.mkConst()]]:&lt;br /&gt;
  Expr three = em.mkConst(Rational(3));&lt;br /&gt;
  Expr neg2 = em.mkConst(Rational(-2));&lt;br /&gt;
  Expr two_thirds = em.mkConst(Rational(2,3));&lt;br /&gt;
We will now make the intermediate terms using mkExpr. &lt;br /&gt;
  Expr three_y = em.mkExpr(kind::MULT, three, y);&lt;br /&gt;
  Expr diff = em.mkExpr(kind::MINUS, y, x);&lt;br /&gt;
The first argument to mkExpr is a Kind. Kind is an enum covering all of the various expressions that CVC4 can make.  Common operators have fairly standard ALL_CAPS names, such as LEQ, MINUS, AND, BITVECTOR_NAND, and so on.  Kind's are in the namespace CVC4::kind.  For more information see [[Expr#Constants]].&lt;br /&gt;
&lt;br /&gt;
Using these intermediate terms, we make the following formulas in the same way we made terms.&lt;br /&gt;
  Expr x_geq_3y = em.mkExpr(kind::GEQ, x, three_y);&lt;br /&gt;
  Expr x_leq_y = em.mkExpr(kind::LEQ, x, y);&lt;br /&gt;
  Expr neg2_lt_x = em.mkExpr(kind::LT, neg2, x);&lt;br /&gt;
&lt;br /&gt;
We now assert the assumptions in the SmtEngine:&lt;br /&gt;
  Expr assumptions =&lt;br /&gt;
    em.mkExpr(kind::AND, x_geq_3y, x_leq_y, neg2_lt_x);&lt;br /&gt;
  smt.assertFormula(assumptions);&lt;br /&gt;
Alternatively, we could have asserted x_geq_3y, x_leq_y, and neg2_lt_x individually.  It is worth pointing out that these are asserted at decision level 0.  Modern DPLL(T) solvers are stack based. We can push the stack(), add assertions and then pop() assertions off of the stack.&lt;br /&gt;
&lt;br /&gt;
We can now prove that &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;.  We first make an Expr for this literal. We now push() the SmtEngine, query the SmtEngine for the validity of the literal given the assumptions, and pop() the SmtEngine.&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_leq_two_thirds = em.mkExpr(kind::LEQ, diff, two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Prove that &amp;quot; &amp;lt;&amp;lt; diff_leq_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report VALID.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.query(diff_leq_two_thirds) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
It is worth noting that the push() and pop() are not strictly needed in order to not effect context level 0. This is because SmtEngine guards query(phi), checkSat(phi) with internal pushes and pops so phi does not effect the current context.  It is needed below; however, as the second lemma is proved in the following fashion:&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_is_two_thirds = em.mkExpr(kind::EQUAL, diff, two_thirds);&lt;br /&gt;
  smt.assertFormula(diff_is_two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Show that the asserts are consistent with &amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; diff_is_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report SAT.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.checkSat(em.mkConst(true)) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
== bitvectors ==&lt;br /&gt;
&lt;br /&gt;
In this example we will prove the equivalence of three different pieces of code. The example is adapted from the book [http://www.hackersdelight.org/ A Hacker's Delight] by Henry S. Warren. The code can be found in /examples/api/bitvectors.cpp. &lt;br /&gt;
Given a variable x, that can only have one of two values: a or b, we want to assign to x a value different than the current one. For example if x was equal to a we want to assign to it b. The most straightforward implementation of this is the following:&lt;br /&gt;
&lt;br /&gt;
  if (x == a) x = b; // (0)&lt;br /&gt;
  else x = a; &lt;br /&gt;
&lt;br /&gt;
However, the following two pieces of code provide a more efficient implementation: &lt;br /&gt;
&lt;br /&gt;
  x = a + b - x; // (1) &lt;br /&gt;
  &lt;br /&gt;
or &lt;br /&gt;
&lt;br /&gt;
  x = a ^ b ^ x; // (2)&lt;br /&gt;
&lt;br /&gt;
We will encode the problem using the theory of bit-vectors and check that the three implementations are indeed equivalent. &lt;br /&gt;
Let's analyze the code in bitvector.cpp line by line. Because we are interested in checking two different problems we will turn on incremental mode and specify the logic, to increase efficiency of solving:&lt;br /&gt;
&lt;br /&gt;
  smt.setOption(&amp;quot;incremental&amp;quot;, true); // Enable incremental solving&lt;br /&gt;
  smt.setLogic(&amp;quot;QF_BV&amp;quot;);              // Set the logic&lt;br /&gt;
&lt;br /&gt;
To make a bit-vector variable we must first make a bit-vector type. The factory method that constructs a bit-vector type requires the width of the bit-vector as an argument. In our example we will assume we are modeling a 32-bit machine:&lt;br /&gt;
&lt;br /&gt;
  // Creating a bit-vector type of width 32&lt;br /&gt;
  Type bitvector32 = em.mkBitVectorType(32);&lt;br /&gt;
&lt;br /&gt;
Creating variables and expressions follows the same pattern as in previous examples.&lt;br /&gt;
&lt;br /&gt;
=Java API=&lt;br /&gt;
=Parallel Solving=&lt;br /&gt;
===Obtaining===&lt;br /&gt;
* Download a statically built binary supporting parallel solving: [http://cvc4.cs.nyu.edu/cvc4-builds/portfolio-x86_64-linux-opt Optimized build]&lt;br /&gt;
* If compiling from source, specify by '''--with-portfolio''' option to the configure script. This will create an additional binary '''pcvc4''' which supports parallel solving.&lt;br /&gt;
 ./configure --with-portfolio [...]&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
*The '''pcvc4''' binary allows the user to run multiple instances of the solver simultaneously on the input problem. Each thread can be configured differently by specifying thread-specific options using '''--thread''N''=&amp;quot; &amp;lt;thread-specific-options&amp;gt; &amp;quot;'''. For example,&lt;br /&gt;
 pcvc4 --thread0=&amp;quot;--decision=internal&amp;quot; --thread1=&amp;quot;--decision=justification&amp;quot; input.smt2&lt;br /&gt;
will run two solver threads with different decision heuristics. The solver will stop as soon as one of threads has an answer.&lt;br /&gt;
&lt;br /&gt;
* The default number of threads is 2. The number of threads can be specified using '''--threads''' option. Note that any of the options specified outside all of the --thread''i''=&amp;quot;...&amp;quot; will be applied to all threads. For instance, in&lt;br /&gt;
 pcvc4 --threads=3 \&lt;br /&gt;
        --thread0=&amp;quot;--random-seed=10&amp;quot; \&lt;br /&gt;
        --thread1=&amp;quot;--random-seed=20&amp;quot; \&lt;br /&gt;
        --thread2=&amp;quot;--random-seed=30&amp;quot; \&lt;br /&gt;
        --simplification=none \&lt;br /&gt;
        input.smt2&lt;br /&gt;
three threads will be run, all with simplification disabled, and different random seeds for the SAT solver.&lt;br /&gt;
&lt;br /&gt;
* We also allow sharing of ''conflict clauses'' across different threads. By default, this is disabled but may he enabled by using the '''--filter-lemma-length''' option. For example,&lt;br /&gt;
 pcvc4 --filter-lemma-length=5 ...&lt;br /&gt;
will share all lemmas having 5 or less literals.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4013</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4013"/>
				<updated>2012-12-01T00:44:37Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* linear_arith */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=CVC language=&lt;br /&gt;
&lt;br /&gt;
==Finding these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/cvc&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
=SMT-LIB=&lt;br /&gt;
&lt;br /&gt;
We recommend [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's excellent tutorial on SMT-LIB].  When running examples from this tutorial, we recommend using CVC4's ''--smtlib-strict'' command line option, which enters a stricter compliance mode.&lt;br /&gt;
&lt;br /&gt;
CVC4 should be compliant with [http://www.smtlib.org/ the standard], and thus also with David Cok's tutorial, except for some unsupported functionality as outlined in the [[User's Manual#CVC4's support for the SMT-LIB language|SMT-LIB compliance section of the User's Manual]].  If you find something that you believe to be nonconformant, please [http://cvc4.cs.nyu.edu/bugs/ report it as a bug].&lt;br /&gt;
&lt;br /&gt;
=C++ API=&lt;br /&gt;
* helloworld : a simple example to start off with&lt;br /&gt;
* linear_arith : real and integer linear arithmetic&lt;br /&gt;
* combination : integer and uninterpreted function example&lt;br /&gt;
* bitvectors : bit-vectors example&lt;br /&gt;
* bitvectors_and_arrays : integer and uninterpreted function example&lt;br /&gt;
* quantifiers&lt;br /&gt;
&lt;br /&gt;
==Finding and compiling these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/api&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
To compile everything in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory, you can issue the command &amp;lt;code&amp;gt;make examples&amp;lt;/code&amp;gt; from the top-level of the source distribution.  This will first build CVC4 (if it isn't already built) and then the examples.  Some examples from the directory may not be compiled, if (for instance) you haven't built with support for Java, or if you haven't built with support for the compatibility interface; however, all native C++ API examples should be, and those are the only ones appearing in this section.&lt;br /&gt;
&lt;br /&gt;
Note that the example API code in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory is intended to be compiled and linked against a CVC4 library built from the source tree.  If you try to compile them yourself, against a CVC4 library installed (for example) in &amp;lt;code&amp;gt;/usr&amp;lt;/code&amp;gt;, you may find that certain headers cannot be found.  There is an easy fix.  CVC4 #includes like the following:&lt;br /&gt;
 #include &amp;quot;expr/expr.h&amp;quot;&lt;br /&gt;
should be rewritten to this form:&lt;br /&gt;
 #include &amp;lt;cvc4/expr/expr.h&amp;gt;&lt;br /&gt;
or, most likely, you can remove all such #includes and replace with this single one:&lt;br /&gt;
 #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example code is not installed by &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==helloworld==&lt;br /&gt;
To get used to CVC4, let us go through the following example line-by-line:&lt;br /&gt;
  #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
  using namespace CVC4;&lt;br /&gt;
  int main() {&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
    SmtEngine smt(&amp;amp;em);&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
(The example can be found in examples/api/helloworld.cpp.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First we include the standard &amp;lt;iostream&amp;gt; library, and next we include the public interface for CVC4:&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cvc4/cvc4.h&amp;lt;/code&amp;gt; includes definitions for all of the classes we'll need including ExprManager, Expr and SmtEngine.  All of CVC4 lives in the namespace CVC4 and to save a bit of typing let's use the namespace.  Now construct a new ExprManager named em.&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
ExprManagers are in charge of constructing and managing symbolic expressions in CVC4.  We then construct the expression Expr helloworld.&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
helloworld is a symbolic variable with the name &amp;quot;Hello World!&amp;quot; and the type boolean. Note that we ask em to both make the variable and to get em.booleanType(). We now make the main driver for CVC4 reasoning the SmtEngine smt using em as its ExprManager.&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
Finally we print helloworld and query the SmtEngine if the boolean variable helloworld is valid.&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
We can compile the program helloworld from helloworld.cpp by linking against &amp;lt;code&amp;gt;-lcvc4&amp;lt;/code&amp;gt;&lt;br /&gt;
 $ g++ helloworld.cpp -o helloworld -lcvc4&lt;br /&gt;
 $ ./helloworld&lt;br /&gt;
 Hello World! is invalid&lt;br /&gt;
This should all work if libcvc4 was installed using &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.  If you used &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt; to a non-standard location, look at instructions for [[Build Problems#make_install_to_a_non-standard_prefix|using non-standard prefix]]. If you insist on not-using make, look at instructions for [[Build_Problems#libcvc4_without_make_install]].&lt;br /&gt;
&lt;br /&gt;
==linear_arith==&lt;br /&gt;
With helloworld under our belt, let's try to work through the more advanced examples/api/linear_arith.cpp . In this example, we'll try to show that for &amp;lt;math&amp;gt; x \in \mathbb{Z}, y \in \mathbb{R}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;x \geq 3 y, x \leq y, -2 &amp;lt; x &amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt; \max y - x = \frac{2}{3}&amp;lt;/math&amp;gt;.&lt;br /&gt;
We can do this by first showing that these assumptions entail &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;, and then showing that &amp;lt;math&amp;gt; y - x = \frac{2}{3}&amp;lt;/math&amp;gt; is consistent with the assumptions.&lt;br /&gt;
&lt;br /&gt;
We use the same basic skeleton of includes/namespaces/main as before.  We make an ExprManager and SmtEngine as before.&lt;br /&gt;
  ExprManager em;&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
We now set on option on the SmtEngine to enable incremental or multiple query solving, which we will take advantage of.&lt;br /&gt;
  smt.setOption(&amp;quot;incremental&amp;quot;, SExpr(&amp;quot;true&amp;quot;)); // Enable incremental solving&lt;br /&gt;
We get the Types real and integer from em, and we make x and y variables of the respective types.&lt;br /&gt;
  Type real = em.realType();&lt;br /&gt;
  Type integer = em.integerType();&lt;br /&gt;
  Expr x = em.mkVar(&amp;quot;x&amp;quot;, integer);&lt;br /&gt;
  Expr y = em.mkVar(&amp;quot;y&amp;quot;, real);&lt;br /&gt;
We now make Exprs for the 3 Rational constants in the formulas using [[Expr#Constants|em.mkConst()]]:&lt;br /&gt;
  Expr three = em.mkConst(Rational(3));&lt;br /&gt;
  Expr neg2 = em.mkConst(Rational(-2));&lt;br /&gt;
  Expr two_thirds = em.mkConst(Rational(2,3));&lt;br /&gt;
We will now make the intermediate terms using mkExpr. &lt;br /&gt;
  Expr three_y = em.mkExpr(kind::MULT, three, y);&lt;br /&gt;
  Expr diff = em.mkExpr(kind::MINUS, y, x);&lt;br /&gt;
The first argument to mkExpr is a Kind. Kind is an enum covering all of the various expressions that CVC4 can make.  Common operators have fairly standard ALL_CAPS names, such as LEQ, MINUS, AND, BITVECTOR_NAND, and so on.  Kind's are in the namespace CVC4::kind.  For more information see [[Expr#Constants]].&lt;br /&gt;
&lt;br /&gt;
Using these intermediate terms, we make the following formulas in the same way we made terms.&lt;br /&gt;
  Expr x_geq_3y = em.mkExpr(kind::GEQ, x, three_y);&lt;br /&gt;
  Expr x_leq_y = em.mkExpr(kind::LEQ, x, y);&lt;br /&gt;
  Expr neg2_lt_x = em.mkExpr(kind::LT, neg2, x);&lt;br /&gt;
&lt;br /&gt;
We now assert the assumptions in the SmtEngine:&lt;br /&gt;
  Expr assumptions =&lt;br /&gt;
    em.mkExpr(kind::AND, x_geq_3y, x_leq_y, neg2_lt_x);&lt;br /&gt;
  smt.assertFormula(assumptions);&lt;br /&gt;
Alternatively, we could have asserted x_geq_3y, x_leq_y, and neg2_lt_x individually.  It is worth pointing out that these are asserted at decision level 0.  Modern DPLL(T) solvers are stack based. We can push the stack(), add assertions and then pop() assertions off of the stack.&lt;br /&gt;
&lt;br /&gt;
We can now prove that &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;.  We first make an Expr for this literal. We now push() the SmtEngine, query the SmtEngine for the validity of the literal given the assumptions, and pop() the SmtEngine.&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_leq_two_thirds = em.mkExpr(kind::LEQ, diff, two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Prove that &amp;quot; &amp;lt;&amp;lt; diff_leq_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report VALID.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.query(diff_leq_two_thirds) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
It is worth noting that the push() and pop() are not strictly needed in order to not effect context level 0. This is because SmtEngine guards query(phi), checkSat(phi) with internal pushes and pops so phi does not effect the current context.  It is needed below; however, as the second lemma is proved in the following fashion:&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_is_two_thirds = em.mkExpr(kind::EQUAL, diff, two_thirds);&lt;br /&gt;
  smt.assertFormula(diff_is_two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Show that the asserts are consistent with &amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; diff_is_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report SAT.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.checkSat(em.mkConst(true)) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
== bitvectors ==&lt;br /&gt;
&lt;br /&gt;
=Java API=&lt;br /&gt;
=Parallel Solving=&lt;br /&gt;
===Obtaining===&lt;br /&gt;
* Download a statically built binary supporting parallel solving: [http://cvc4.cs.nyu.edu/cvc4-builds/portfolio-x86_64-linux-opt Optimized build]&lt;br /&gt;
* If compiling from source, specify by '''--with-portfolio''' option to the configure script. This will create an additional binary '''pcvc4''' which supports parallel solving.&lt;br /&gt;
 ./configure --with-portfolio [...]&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
*The '''pcvc4''' binary allows the user to run multiple instances of the solver simultaneously on the input problem. Each thread can be configured differently by specifying thread-specific options using '''--thread''N''=&amp;quot; &amp;lt;thread-specific-options&amp;gt; &amp;quot;'''. For example,&lt;br /&gt;
 pcvc4 --thread0=&amp;quot;--decision=internal&amp;quot; --thread1=&amp;quot;--decision=justification&amp;quot; input.smt2&lt;br /&gt;
will run two solver threads with different decision heuristics. The solver will stop as soon as one of threads has an answer.&lt;br /&gt;
&lt;br /&gt;
* The default number of threads is 2. The number of threads can be specified using '''--threads''' option. Note that any of the options specified outside all of the --thread''i''=&amp;quot;...&amp;quot; will be applied to all threads. For instance, in&lt;br /&gt;
 pcvc4 --threads=3 \&lt;br /&gt;
        --thread0=&amp;quot;--random-seed=10&amp;quot; \&lt;br /&gt;
        --thread1=&amp;quot;--random-seed=20&amp;quot; \&lt;br /&gt;
        --thread2=&amp;quot;--random-seed=30&amp;quot; \&lt;br /&gt;
        --simplification=none \&lt;br /&gt;
        input.smt2&lt;br /&gt;
three threads will be run, all with simplification disabled, and different random seeds for the SAT solver.&lt;br /&gt;
&lt;br /&gt;
* We also allow sharing of ''conflict clauses'' across different threads. By default, this is disabled but may he enabled by using the '''--filter-lemma-length''' option. For example,&lt;br /&gt;
 pcvc4 --filter-lemma-length=5 ...&lt;br /&gt;
will share all lemmas having 5 or less literals.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4012</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Tutorials&amp;diff=4012"/>
				<updated>2012-12-01T00:43:09Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* C++ API */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=CVC language=&lt;br /&gt;
&lt;br /&gt;
==Finding these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/cvc&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
=SMT-LIB=&lt;br /&gt;
&lt;br /&gt;
We recommend [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's excellent tutorial on SMT-LIB].  When running examples from this tutorial, we recommend using CVC4's ''--smtlib-strict'' command line option, which enters a stricter compliance mode.&lt;br /&gt;
&lt;br /&gt;
CVC4 should be compliant with [http://www.smtlib.org/ the standard], and thus also with David Cok's tutorial, except for some unsupported functionality as outlined in the [[User's Manual#CVC4's support for the SMT-LIB language|SMT-LIB compliance section of the User's Manual]].  If you find something that you believe to be nonconformant, please [http://cvc4.cs.nyu.edu/bugs/ report it as a bug].&lt;br /&gt;
&lt;br /&gt;
=C++ API=&lt;br /&gt;
* helloworld : a simple example to start off with&lt;br /&gt;
* linear_arith : real and integer linear arithmetic&lt;br /&gt;
* combination : integer and uninterpreted function example&lt;br /&gt;
* bitvectors : bit-vectors example&lt;br /&gt;
* bitvectors_and_arrays : integer and uninterpreted function example&lt;br /&gt;
* quantifiers&lt;br /&gt;
&lt;br /&gt;
==Finding and compiling these examples==&lt;br /&gt;
&lt;br /&gt;
Except where noted below, tutorial code appearing in this section is kept in the &amp;lt;code&amp;gt;examples/api&amp;lt;/code&amp;gt; directory of the CVC4 source distribution.  However, tutorial material on this page might be more recent than your CVC4 download.  Please refer to the [http://cvc4.cs.nyu.edu/builds/src/ most recent nightly build] for the most recent tutorial code.&lt;br /&gt;
&lt;br /&gt;
To compile everything in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory, you can issue the command &amp;lt;code&amp;gt;make examples&amp;lt;/code&amp;gt; from the top-level of the source distribution.  This will first build CVC4 (if it isn't already built) and then the examples.  Some examples from the directory may not be compiled, if (for instance) you haven't built with support for Java, or if you haven't built with support for the compatibility interface; however, all native C++ API examples should be, and those are the only ones appearing in this section.&lt;br /&gt;
&lt;br /&gt;
Note that the example API code in the &amp;lt;code&amp;gt;examples/&amp;lt;/code&amp;gt; directory is intended to be compiled and linked against a CVC4 library built from the source tree.  If you try to compile them yourself, against a CVC4 library installed (for example) in &amp;lt;code&amp;gt;/usr&amp;lt;/code&amp;gt;, you may find that certain headers cannot be found.  There is an easy fix.  CVC4 #includes like the following:&lt;br /&gt;
 #include &amp;quot;expr/expr.h&amp;quot;&lt;br /&gt;
should be rewritten to this form:&lt;br /&gt;
 #include &amp;lt;cvc4/expr/expr.h&amp;gt;&lt;br /&gt;
or, most likely, you can remove all such #includes and replace with this single one:&lt;br /&gt;
 #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example code is not installed by &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==helloworld==&lt;br /&gt;
To get used to CVC4, let us go through the following example line-by-line:&lt;br /&gt;
  #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
  using namespace CVC4;&lt;br /&gt;
  int main() {&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
    SmtEngine smt(&amp;amp;em);&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    return 0;&lt;br /&gt;
  }&lt;br /&gt;
(The example can be found in examples/api/helloworld.cpp.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First we include the standard &amp;lt;iostream&amp;gt; library, and next we include the public interface for CVC4:&lt;br /&gt;
  #include &amp;lt;cvc4/cvc4.h&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cvc4/cvc4.h&amp;lt;/code&amp;gt; includes definitions for all of the classes we'll need including ExprManager, Expr and SmtEngine.  All of CVC4 lives in the namespace CVC4 and to save a bit of typing let's use the namespace.  Now construct a new ExprManager named em.&lt;br /&gt;
    ExprManager em;&lt;br /&gt;
ExprManagers are in charge of constructing and managing symbolic expressions in CVC4.  We then construct the expression Expr helloworld.&lt;br /&gt;
    Expr helloworld = em.mkVar(&amp;quot;Hello World!&amp;quot;, em.booleanType());&lt;br /&gt;
helloworld is a symbolic variable with the name &amp;quot;Hello World!&amp;quot; and the type boolean. Note that we ask em to both make the variable and to get em.booleanType(). We now make the main driver for CVC4 reasoning the SmtEngine smt using em as its ExprManager.&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
Finally we print helloworld and query the SmtEngine if the boolean variable helloworld is valid.&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; helloworld &amp;lt;&amp;lt; &amp;quot; is &amp;quot; &amp;lt;&amp;lt; smt.query(helloworld) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
We can compile the program helloworld from helloworld.cpp by linking against &amp;lt;code&amp;gt;-lcvc4&amp;lt;/code&amp;gt;&lt;br /&gt;
 $ g++ helloworld.cpp -o helloworld -lcvc4&lt;br /&gt;
 $ ./helloworld&lt;br /&gt;
 Hello World! is invalid&lt;br /&gt;
This should all work if libcvc4 was installed using &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt;.  If you used &amp;lt;code&amp;gt;make install&amp;lt;/code&amp;gt; to a non-standard location, look at instructions for [[Build Problems#make_install_to_a_non-standard_prefix|using non-standard prefix]]. If you insist on not-using make, look at instructions for [[Build_Problems#libcvc4_without_make_install]].&lt;br /&gt;
&lt;br /&gt;
==linear_arith==&lt;br /&gt;
With helloworld under our belt, let's try to work through the more advanced examples/api/linear_arith.cpp . In this example, we'll try to show that for &amp;lt;math&amp;gt; x \in \mathbb{Z}, y \in \mathbb{R}&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;x \geq 3 y, x \leq y, -2 &amp;lt; x &amp;lt;/math&amp;gt; then &amp;lt;math&amp;gt; \max y - x = \frac{2}{3}&amp;lt;/math&amp;gt;.&lt;br /&gt;
We can do this by first showing that these assumptions entail &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;, and then showing that &amp;lt;math&amp;gt; y - x = \frac{2}{3}&amp;lt;/math&amp;gt; is consistent with the assumptions.&lt;br /&gt;
&lt;br /&gt;
We use the same basic skeleton of includes/namespaces/main as before.  We make an ExprManager and SmtEngine as before.&lt;br /&gt;
  ExprManager em;&lt;br /&gt;
  SmtEngine smt(&amp;amp;em);&lt;br /&gt;
We now set on option on the SmtEngine to enable incremental or multiple query solving, which we will take advantage of.&lt;br /&gt;
  smt.setOption(&amp;quot;incremental&amp;quot;, SExpr(&amp;quot;true&amp;quot;)); // Enable incremental solving&lt;br /&gt;
We get the Types real and integer from em, and we make x and y variables of the respective types.&lt;br /&gt;
  Type real = em.realType();&lt;br /&gt;
  Type integer = em.integerType();&lt;br /&gt;
  Expr x = em.mkVar(&amp;quot;x&amp;quot;, integer);&lt;br /&gt;
  Expr y = em.mkVar(&amp;quot;y&amp;quot;, real);&lt;br /&gt;
We now make Exprs for the 3 Rational constants in the formulas using [[Expr#Constants|em.mkConst()]]:&lt;br /&gt;
  Expr three = em.mkConst(Rational(3));&lt;br /&gt;
  Expr neg2 = em.mkConst(Rational(-2));&lt;br /&gt;
  Expr two_thirds = em.mkConst(Rational(2,3));&lt;br /&gt;
We will now make the intermediate terms using mkExpr. &lt;br /&gt;
  Expr three_y = em.mkExpr(kind::MULT, three, y);&lt;br /&gt;
  Expr diff = em.mkExpr(kind::MINUS, y, x);&lt;br /&gt;
The first argument to mkExpr is a Kind. Kind is an enum covering all of the various expressions that CVC4 can make.  Common operators have fairly standard ALL_CAPS names, such as LEQ, MINUS, AND, BITVECTOR_NAND, and so on.  Kind's are in the namespace CVC4::kind.  For more information see [[Expr#Constants]].&lt;br /&gt;
&lt;br /&gt;
Using these intermediate terms, we make the following formulas in the same way we made terms.&lt;br /&gt;
  Expr x_geq_3y = em.mkExpr(kind::GEQ, x, three_y);&lt;br /&gt;
  Expr x_leq_y = em.mkExpr(kind::LEQ, x, y);&lt;br /&gt;
  Expr neg2_lt_x = em.mkExpr(kind::LT, neg2, x);&lt;br /&gt;
&lt;br /&gt;
We now assert the assumptions in the SmtEngine:&lt;br /&gt;
  Expr assumptions =&lt;br /&gt;
    em.mkExpr(kind::AND, x_geq_3y, x_leq_y, neg2_lt_x);&lt;br /&gt;
  smt.assertFormula(assumptions);&lt;br /&gt;
Alternatively, we could have asserted x_geq_3y, x_leq_y, and neg2_lt_x individually.  It is worth pointing out that these are asserted at decision level 0.  Modern DPLL(T) solvers are stack based. We can push the stack(), add assertions and then pop() assertions off of the stack.&lt;br /&gt;
&lt;br /&gt;
We can now prove that &amp;lt;math&amp;gt; y - x \leq \frac{2}{3}&amp;lt;/math&amp;gt;.  We first make an Expr for this literal. We now push() the SmtEngine, query the SmtEngine for the validity of the literal given the assumptions, and pop() the SmtEngine.&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_leq_two_thirds = em.mkExpr(kind::LEQ, diff, two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Prove that &amp;quot; &amp;lt;&amp;lt; diff_leq_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report VALID.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.query(diff_leq_two_thirds) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
It is worth noting that the push() and pop() are not strictly needed in order to not effect context level 0. This is because SmtEngine guards query(phi), checkSat(phi) with internal pushes and pops so phi does not effect the current context.  It is needed below; however, as the second lemma is proved in the following fashion:&lt;br /&gt;
  smt.push();&lt;br /&gt;
  Expr diff_is_two_thirds = em.mkExpr(kind::EQUAL, diff, two_thirds);&lt;br /&gt;
  smt.assertFormula(diff_is_two_thirds);&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Show that the asserts are consistent with &amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; diff_is_two_thirds &amp;lt;&amp;lt; &amp;quot; with CVC4.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;CVC4 should report SAT.&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Result from CVC4 is: &amp;quot; &amp;lt;&amp;lt; smt.checkSat(em.mkConst(true)) &amp;lt;&amp;lt; endl;&lt;br /&gt;
  smt.pop();&lt;br /&gt;
&lt;br /&gt;
=Java API=&lt;br /&gt;
=Parallel Solving=&lt;br /&gt;
===Obtaining===&lt;br /&gt;
* Download a statically built binary supporting parallel solving: [http://cvc4.cs.nyu.edu/cvc4-builds/portfolio-x86_64-linux-opt Optimized build]&lt;br /&gt;
* If compiling from source, specify by '''--with-portfolio''' option to the configure script. This will create an additional binary '''pcvc4''' which supports parallel solving.&lt;br /&gt;
 ./configure --with-portfolio [...]&lt;br /&gt;
&lt;br /&gt;
===Running===&lt;br /&gt;
*The '''pcvc4''' binary allows the user to run multiple instances of the solver simultaneously on the input problem. Each thread can be configured differently by specifying thread-specific options using '''--thread''N''=&amp;quot; &amp;lt;thread-specific-options&amp;gt; &amp;quot;'''. For example,&lt;br /&gt;
 pcvc4 --thread0=&amp;quot;--decision=internal&amp;quot; --thread1=&amp;quot;--decision=justification&amp;quot; input.smt2&lt;br /&gt;
will run two solver threads with different decision heuristics. The solver will stop as soon as one of threads has an answer.&lt;br /&gt;
&lt;br /&gt;
* The default number of threads is 2. The number of threads can be specified using '''--threads''' option. Note that any of the options specified outside all of the --thread''i''=&amp;quot;...&amp;quot; will be applied to all threads. For instance, in&lt;br /&gt;
 pcvc4 --threads=3 \&lt;br /&gt;
        --thread0=&amp;quot;--random-seed=10&amp;quot; \&lt;br /&gt;
        --thread1=&amp;quot;--random-seed=20&amp;quot; \&lt;br /&gt;
        --thread2=&amp;quot;--random-seed=30&amp;quot; \&lt;br /&gt;
        --simplification=none \&lt;br /&gt;
        input.smt2&lt;br /&gt;
three threads will be run, all with simplification disabled, and different random seeds for the SAT solver.&lt;br /&gt;
&lt;br /&gt;
* We also allow sharing of ''conflict clauses'' across different threads. By default, this is disabled but may he enabled by using the '''--filter-lemma-length''' option. For example,&lt;br /&gt;
 pcvc4 --filter-lemma-length=5 ...&lt;br /&gt;
will share all lemmas having 5 or less literals.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3993</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3993"/>
				<updated>2012-11-30T19:54:12Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Getting CVC4 binaries */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. It is a work in progress. &lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
==Getting CVC4 binaries==&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
&lt;br /&gt;
To install CVC4 on an Ubuntu Machine follow the instructions below. First add the CVC4 respository to /etc/apt/source.list by inserting the following two lines at the end of the file:&lt;br /&gt;
  # CVC4 repository&lt;br /&gt;
  deb http://cvc4.cs.nyu.edu/debian/ unstable/&lt;br /&gt;
  deb-src http://cvc4.cs.nyu.edu/debian/ unstable/&lt;br /&gt;
&lt;br /&gt;
To run CVC4 as a binary you only need the first line but to use the library API you will also need the source package. &lt;br /&gt;
Make sure to update the respository list by running:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
&lt;br /&gt;
Now you can simply install CVC4 as you would any other piece of sofware using the command:&lt;br /&gt;
  sudo apt-get install cvc4&lt;br /&gt;
&lt;br /&gt;
If you want to use CVC4 as a library also install the following packages: libcvc4-dev, and libcvc4-parser-dev.&lt;br /&gt;
&lt;br /&gt;
==Building CVC4 from source==&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
&lt;br /&gt;
To build CVC4 from source the following steps are required. After downloading the source files first install antlr by running the following script in the CVC4 contrib directory:&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
The next step is to configure CVC4:&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
And then finally compile it:&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: .cvc for CVC4's native language, .smt2 for SMT-LIB 2.0 and .smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Advanced features=&lt;br /&gt;
&lt;br /&gt;
This section describes some features of CVC4 of interest to developers and advanced users. &lt;br /&gt;
&lt;br /&gt;
==Resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
==Dumping API calls or preprocessed output==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Changing the output language==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Proof support==&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
==Parallel solving==&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with the theory of inductive&lt;br /&gt;
datatypes. This limitation will be addressed in a future release.&lt;br /&gt;
&lt;br /&gt;
==Emacs support==&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_CVC4&amp;diff=3971</id>
		<title>About CVC4</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_CVC4&amp;diff=3971"/>
				<updated>2012-11-28T16:46:08Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] (for a more formal introduction to SMT see the following  book chapter [https://cs.nyu.edu/~barrett/pubs/BSST09.pdf Satisfiability Modulo Theories] ). Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories.&lt;br /&gt;
&lt;br /&gt;
CVC4 currently has support for the following theories:&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
=History of CVC=&lt;br /&gt;
&lt;br /&gt;
[[File:svc.gif|thumb|border|100px|The SVC logo.]]&lt;br /&gt;
[[File:cvc3_logo.jpg|thumb|border|100px|The CVC3 logo.]]&lt;br /&gt;
[[File:cvc3_night_logo.png|thumb|border|100px|The CVC3 &amp;quot;by night&amp;quot; logo, used for nightly builds and regressions.]]&lt;br /&gt;
[[File:cvc3cvc4.png|thumb|border|100px|An early CVC4 logo.]]&lt;br /&gt;
&lt;br /&gt;
The Cooperating Validity Checker series has a long history.  The&lt;br /&gt;
Stanford Validity Checker (SVC) came first in 1996, incorporating&lt;br /&gt;
theories and its own SAT solver.  Its successor, the Cooperating&lt;br /&gt;
Validity Checker (CVC), had a more optimized internal design, produced&lt;br /&gt;
proofs, used the Chaff SAT solver, and featured a number of usability&lt;br /&gt;
enhancements.  Its name comes from the cooperative nature of decision&lt;br /&gt;
procedures in Nelson-Oppen theory combination, which share amongst&lt;br /&gt;
each other equalities between shared terms.  CVC Lite, first made&lt;br /&gt;
available in 2003, was a rewrite of CVC that attempted to make CVC&lt;br /&gt;
more flexible (hence the &amp;quot;lite&amp;quot;) while extending the feature set: CVC&lt;br /&gt;
Lite supported quantifiers where its predecessors did not.  CVC3 was a&lt;br /&gt;
major overhaul of portions of CVC Lite: it added better decision&lt;br /&gt;
procedure implementations, added support for using MiniSat in the&lt;br /&gt;
core, and had generally better performance.&lt;br /&gt;
&lt;br /&gt;
[[File:cvc4-logo.png|thumb|border|100px|The CVC4 logo.]]&lt;br /&gt;
CVC4 is the new version, the fifth generation of this validity checker&lt;br /&gt;
line that is now celebrating sixteen years of heritage.  It represents&lt;br /&gt;
a complete re-evaluation of the core architecture to be both&lt;br /&gt;
performant and to serve as a cutting-edge research vehicle for the&lt;br /&gt;
next several years.  Rather than taking CVC3 and redesigning problem&lt;br /&gt;
parts, we've taken a clean-room approach, starting from scratch.&lt;br /&gt;
Before using any designs from CVC3, we have thoroughly scrutinized,&lt;br /&gt;
vetted, and updated them.  Many parts of CVC4 bear only a superficial&lt;br /&gt;
resemblance, if any, to their correspondent in CVC3.&lt;br /&gt;
&lt;br /&gt;
However, CVC4 is fundamentally similar to CVC3 and many other modern&lt;br /&gt;
SMT solvers: it is a DPLL(T) solver, with a SAT solver at its core and&lt;br /&gt;
a delegation path to different decision procedure implementations,&lt;br /&gt;
each in charge of solving formulas in some background theory.&lt;br /&gt;
&lt;br /&gt;
The re-evaluation and ground-up rewrite was necessitated, we felt, by&lt;br /&gt;
the performance characteristics of CVC3.  CVC3 has many useful&lt;br /&gt;
features, but some core aspects of the design led to high memory use,&lt;br /&gt;
and the use of heavyweight computation (where more nimble engineering&lt;br /&gt;
approaches could suffice) makes CVC3 a much slower prover than other&lt;br /&gt;
tools.  As these designs are central to CVC3, a new version was&lt;br /&gt;
preferable to a selective re-engineering, which would have ballooned&lt;br /&gt;
in short order.  Some specific deficiencies of CVC3 are mentioned in&lt;br /&gt;
this article.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3970</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3970"/>
				<updated>2012-11-28T16:41:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. It is a work in progress. &lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
==Getting CVC4 binaries==&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Building CVC4 from source==&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
&lt;br /&gt;
To build CVC4 from source the following steps are required. After downloading the source files first install antlr by running the following script in the CVC4 contrib directory:&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
The next step is to configure CVC4:&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
And then finally compile it:&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: .cvc for CVC4's native language, .smt2 for SMT-LIB 2.0 and .smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Advanced features=&lt;br /&gt;
&lt;br /&gt;
This section describes some features of CVC4 of interest to developers and advanced users. &lt;br /&gt;
&lt;br /&gt;
==Resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
==Dumping API calls or preprocessed output==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Changing the output language==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Proof support==&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
==Parallel solving==&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with the theory of inductive&lt;br /&gt;
datatypes. This limitation will be addressed in a future release.&lt;br /&gt;
&lt;br /&gt;
==Emacs support==&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_CVC4&amp;diff=3967</id>
		<title>About CVC4</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_CVC4&amp;diff=3967"/>
				<updated>2012-11-28T16:35:14Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: moved The History of CVC4 to About CVC4&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:svc.gif|thumb|border|100px|The SVC logo.]]&lt;br /&gt;
[[File:cvc3_logo.jpg|thumb|border|100px|The CVC3 logo.]]&lt;br /&gt;
[[File:cvc3_night_logo.png|thumb|border|100px|The CVC3 &amp;quot;by night&amp;quot; logo, used for nightly builds and regressions.]]&lt;br /&gt;
[[File:cvc3cvc4.png|thumb|border|100px|An early CVC4 logo.]]&lt;br /&gt;
&lt;br /&gt;
The Cooperating Validity Checker series has a long history.  The&lt;br /&gt;
Stanford Validity Checker (SVC) came first in 1996, incorporating&lt;br /&gt;
theories and its own SAT solver.  Its successor, the Cooperating&lt;br /&gt;
Validity Checker (CVC), had a more optimized internal design, produced&lt;br /&gt;
proofs, used the Chaff SAT solver, and featured a number of usability&lt;br /&gt;
enhancements.  Its name comes from the cooperative nature of decision&lt;br /&gt;
procedures in Nelson-Oppen theory combination, which share amongst&lt;br /&gt;
each other equalities between shared terms.  CVC Lite, first made&lt;br /&gt;
available in 2003, was a rewrite of CVC that attempted to make CVC&lt;br /&gt;
more flexible (hence the &amp;quot;lite&amp;quot;) while extending the feature set: CVC&lt;br /&gt;
Lite supported quantifiers where its predecessors did not.  CVC3 was a&lt;br /&gt;
major overhaul of portions of CVC Lite: it added better decision&lt;br /&gt;
procedure implementations, added support for using MiniSat in the&lt;br /&gt;
core, and had generally better performance.&lt;br /&gt;
&lt;br /&gt;
[[File:cvc4-logo.png|thumb|border|100px|The CVC4 logo.]]&lt;br /&gt;
CVC4 is the new version, the fifth generation of this validity checker&lt;br /&gt;
line that is now celebrating sixteen years of heritage.  It represents&lt;br /&gt;
a complete re-evaluation of the core architecture to be both&lt;br /&gt;
performant and to serve as a cutting-edge research vehicle for the&lt;br /&gt;
next several years.  Rather than taking CVC3 and redesigning problem&lt;br /&gt;
parts, we've taken a clean-room approach, starting from scratch.&lt;br /&gt;
Before using any designs from CVC3, we have thoroughly scrutinized,&lt;br /&gt;
vetted, and updated them.  Many parts of CVC4 bear only a superficial&lt;br /&gt;
resemblance, if any, to their correspondent in CVC3.&lt;br /&gt;
&lt;br /&gt;
However, CVC4 is fundamentally similar to CVC3 and many other modern&lt;br /&gt;
SMT solvers: it is a DPLL(T) solver, with a SAT solver at its core and&lt;br /&gt;
a delegation path to different decision procedure implementations,&lt;br /&gt;
each in charge of solving formulas in some background theory.&lt;br /&gt;
&lt;br /&gt;
The re-evaluation and ground-up rewrite was necessitated, we felt, by&lt;br /&gt;
the performance characteristics of CVC3.  CVC3 has many useful&lt;br /&gt;
features, but some core aspects of the design led to high memory use,&lt;br /&gt;
and the use of heavyweight computation (where more nimble engineering&lt;br /&gt;
approaches could suffice) makes CVC3 a much slower prover than other&lt;br /&gt;
tools.  As these designs are central to CVC3, a new version was&lt;br /&gt;
preferable to a selective re-engineering, which would have ballooned&lt;br /&gt;
in short order.  Some specific deficiencies of CVC3 are mentioned in&lt;br /&gt;
this article.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3957</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3957"/>
				<updated>2012-11-27T21:06:02Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Useful command-line options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
==Getting CVC4 binaries==&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Building CVC4 from source==&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
&lt;br /&gt;
To build CVC4 from source the following steps are required. After downloading the source files first install antlr by running the following script in the CVC4 contrib directory:&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
The next step is to configure CVC4:&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
And then finally compile it:&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Advanced features=&lt;br /&gt;
&lt;br /&gt;
This section describes some features of CVC4 of interest to developers and advanced users. &lt;br /&gt;
&lt;br /&gt;
==Resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
==Dumping API calls or preprocessed output==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Changing the output language==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Proof support==&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
==Portfolio solving==&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
==Emacs support==&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3956</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3956"/>
				<updated>2012-11-27T21:04:49Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
==Getting CVC4 binaries==&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Building CVC4 from source==&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
&lt;br /&gt;
To build CVC4 from source the following steps are required. After downloading the source files first install antlr by running the following script in the CVC4 contrib directory:&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
The next step is to configure CVC4:&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
And then finally compile it:&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Advanced features=&lt;br /&gt;
&lt;br /&gt;
This section describes some features of CVC4 of interest to developers and advanced users. &lt;br /&gt;
&lt;br /&gt;
==Useful command-line options==&lt;br /&gt;
&lt;br /&gt;
Some useful CVC4 command line options include enabling outputting statistics and setting resource limits. &lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
==Dumping API calls or preprocessed output==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Changing the output language==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Proof support==&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
==Portfolio solving==&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
==Emacs support==&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3955</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3955"/>
				<updated>2012-11-27T21:04:18Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
==Getting CVC4 binaries==&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Building CVC4 from source==&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
&lt;br /&gt;
To build CVC4 from source the following steps are required. After downloading the source files first install antlr by running the following script in the CVC4 contrib directory:&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
The next step is to configure CVC4:&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
And then finally compile it:&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Advanced features=&lt;br /&gt;
&lt;br /&gt;
This section describes some features of CVC4 of interest to developers and advanced users. &lt;br /&gt;
&lt;br /&gt;
==Useful command-line options==&lt;br /&gt;
&lt;br /&gt;
Some useful CVC4 command line options include enabling outputting statistics and setting resource limits. &lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
==Dumping API calls or preprocessed output==&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
[to do]&lt;br /&gt;
&lt;br /&gt;
==Proof support==&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
==Portfolio solving==&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
==Emacs support==&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3954</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3954"/>
				<updated>2012-11-27T20:59:08Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Getting CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
==Getting CVC4 binaries==&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Building CVC4 from source==&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
&lt;br /&gt;
To build CVC4 from source the following steps are required. After downloading the source files first install antlr by running the following script in the CVC4 contrib directory:&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
The next step is to configure CVC4:&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
And then finally compile it:&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3953</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3953"/>
				<updated>2012-11-27T20:58:26Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Getting CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
&lt;br /&gt;
To build CVC4 from source the following steps are required. After downloading the source files first install antlr by running the following script in the CVC4 contrib directory:&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
The next step is to configure CVC4:&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
And then finally compile it:&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3952</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3952"/>
				<updated>2012-11-27T20:56:56Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Building from source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
If you choose to build from source please read the [[ Building CVC4 from source #Building_CVC4 from_a_repository_checkout | following instructions ]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To build CVC4 from source the following steps are required. After downloading the source files first install antlr by running the following script in the CVC4 contrib directory:&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
The next step is to configure CVC4:&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
And then finally compile it:&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3951</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3951"/>
				<updated>2012-11-27T20:50:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Getting CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
If you choose to build from source please read the [[ Building CVC4 from source #Building_CVC4 from_a_repository_checkout | following instructions ]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3950</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3950"/>
				<updated>2012-11-27T20:47:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
If you choose to build from source please read the [[ Building CVC4 from source #Building_CVC4 from_a_repository_checkout | following instructions ]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3949</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3949"/>
				<updated>2012-11-27T20:46:48Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Getting CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/ http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
If you choose to build from source please read the [[ Building CVC4 from source #Building_CVC4 from_a_repository_checkout | following instructions ]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3948</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3948"/>
				<updated>2012-11-27T20:43:49Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Getting CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
If you choose to build from source please read the [[ Building CVC4 from source #Building_CVC4 from_a_repository_checkout | following instructions ]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3947</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3947"/>
				<updated>2012-11-27T20:43:16Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Getting CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] which is currently hosted by [http://cims.nyu.edu/ CIMS] and therefore requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
If you choose to build from source please read the following instructions [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3946</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3946"/>
				<updated>2012-11-27T20:42:15Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Obtaining and compiling CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
=Getting CVC4=&lt;br /&gt;
&lt;br /&gt;
Both pre-compiled binaries and the source code for CVC4 are available for download from [http://cvc4.cs.nyu.edu/builds/]. &lt;br /&gt;
&lt;br /&gt;
The most recent binaries can be downloaded from our Nightly Builds pages: &lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries. The source-code is also available in the [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository], currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. &lt;br /&gt;
If you choose to build from source please read the following instructions [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
For a comprehensive list of dependencies and more detailed build instructions see [[Building CVC4 from source]].&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3945</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3945"/>
				<updated>2012-11-27T20:13:52Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. The currently supported theories are: &lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3944</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3944"/>
				<updated>2012-11-27T20:04:28Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories Satisifiability Modulo Theories (SMT) ] solver. It is an automated validity checker for many sorted (i.e. typed) first-order logic with build-in theories. The theories we currently support are:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3943</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3943"/>
				<updated>2012-11-27T20:03:03Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes information on installing and using CVC4. CVC4 is a [http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories | Satisifiability Modulo Theories (SMT) ] solver. It is an automated validity checker for many sorted (i.e. typed) first-order logic with build-in theories. The theories we currently support are:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic)&lt;br /&gt;
* bit-vectors,&lt;br /&gt;
* arrays&lt;br /&gt;
* tuples&lt;br /&gt;
* records&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3942</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3942"/>
				<updated>2012-11-27T19:20:59Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* CVC4's support for the SMT-LIB language */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3941</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3941"/>
				<updated>2012-11-27T19:20:28Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* CVC4's input languages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* CVC4's native language (see [[CVC4's native language | this]] for a language description)&lt;br /&gt;
* SMT-LIB 2.0  (see [http://www.grammatech.com/resources/smt/SMTLIBTutorial.pdf David Cok's SMT-LIB tutorial])&lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3940</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3940"/>
				<updated>2012-11-27T19:16:13Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* CVC4's input languages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* [[CVC4's native language ]]&lt;br /&gt;
* SMT-LIB 2.0 &lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $ cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3939</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3939"/>
				<updated>2012-11-27T19:15:53Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* CVC4's input languages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* [[CVC4's native language ]]&lt;br /&gt;
* SMT-LIB 2.0 &lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
 $cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3938</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3938"/>
				<updated>2012-11-27T19:15:26Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* CVC4's input languages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* [[CVC4's native language ]]&lt;br /&gt;
* SMT-LIB 2.0 &lt;br /&gt;
* SMT-LIB 1.0&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: cvc for CVC4's native language, smt2 for SMT-LIB 2.0 and smt for SMT-LIB 1.0. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options type:&lt;br /&gt;
       $cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3937</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3937"/>
				<updated>2012-11-27T19:14:25Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* CVC4's input languages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
When not used in interactive mode, CVC4 can read its input from an external file. It accepts the following input languages: &lt;br /&gt;
&lt;br /&gt;
* [[CVC4's native language ]]&lt;br /&gt;
* SMT-LIB v2 &lt;br /&gt;
* SMT-LIB v1&lt;br /&gt;
&lt;br /&gt;
CVC4 tries to automatically recognize the input language based on the file's extension: .cvc for CVC4's native language, .smt2 for SMT-LIB v2 and .smt for SMT-LIB v1. If the file extension does not match one of the previously mentioned ones you can specify the input language via the command line flag --lang. To see all language options run:&lt;br /&gt;
       $cvc4 --lang help&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Building_CVC4_from_source&amp;diff=3936</id>
		<title>Building CVC4 from source</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Building_CVC4_from_source&amp;diff=3936"/>
				<updated>2012-11-27T19:09:45Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To compile CVC4 from a source package you must do the following:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
&lt;br /&gt;
To do so run the following commands in the CVC4 directory:&lt;br /&gt;
&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
Below are more details instructions about the various dependencies and options. &lt;br /&gt;
&lt;br /&gt;
=Common make Options=&lt;br /&gt;
* &amp;quot;''make install''&amp;quot; will install into the &amp;quot;--prefix&amp;quot; option you gave to&lt;br /&gt;
the configure script (''/usr/local'' by default).&lt;br /&gt;
    ./configure --prefix=~/install_targets/cvc4 ...&lt;br /&gt;
    make install&lt;br /&gt;
* '''You should run &amp;quot;''make check''&amp;quot;''' before installation to ensure that CVC4 has been&lt;br /&gt;
built correctly.  In particular, GCC version 4.5.1 seems to have a&lt;br /&gt;
bug in the optimizer that results in incorrect behavior (and wrong&lt;br /&gt;
results) in many builds.  This is a known problem for Minisat, and&lt;br /&gt;
since Minisat is at the core of CVC4, a problem for CVC4.  &amp;quot;''make check''&amp;quot;&lt;br /&gt;
easily detects this problem (by showing a number of FAILed test cases).&lt;br /&gt;
It is ok if the unit tests aren't run as part of &amp;quot;''make check''&amp;quot;, but all&lt;br /&gt;
system tests and regression tests should pass without incident.&lt;br /&gt;
* To build API documentation, use &amp;quot;''make doc''&amp;quot;.  Documentation is produced&lt;br /&gt;
under ''builds/doc/'' but is not installed by &amp;quot;''make install''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Examples and tutorials are not installed with &amp;quot;''make install''.&amp;quot;  See [[#Examples_and_tutorials_are_not_built_or_installed|below]].&lt;br /&gt;
&lt;br /&gt;
For more information about the build system itself (probably not&lt;br /&gt;
necessary for casual users), see the [[#Appendix:_Build_architecture|Appendix]] at the bottom of this&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
=Common configure Options=&lt;br /&gt;
*'''--prefix=PREFIX''' install architecture-independent files in PREFIX (by default /usr/local)&lt;br /&gt;
*'''--with-build={production,debug,default,competition}''' &lt;br /&gt;
*'''--with-antlr-dir=PATH'''&lt;br /&gt;
*'''--with-cln'''/'''--with-gmp''' selects the numbers package to use by default ([[#Optional requirements]])&lt;br /&gt;
*'''--enable-static-binary''' build a fully statically-linked binary. (This is recommended for Mac OS X users that want to be able to use gdb.)&lt;br /&gt;
*'''ANTLR=PATH''' location of the antlr3 script&lt;br /&gt;
*'''--with-boost=DIR''' installation location of the boost libraries (most users will not need this)&lt;br /&gt;
&lt;br /&gt;
See '''./configure --help''' for more.&lt;br /&gt;
&lt;br /&gt;
=Build dependencies=&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are required to run CVC4. Versions&lt;br /&gt;
given are minimum versions; more recent versions should be compatible.&lt;br /&gt;
&lt;br /&gt;
*'''GNU C and C++''' (gcc and g++), reasonably recent versions&lt;br /&gt;
*'''GNU Make'''&lt;br /&gt;
*'''GNU Bash'''&lt;br /&gt;
*'''GMP v4.2''' (GNU Multi-Precision arithmetic library)&lt;br /&gt;
*'''libantlr3c v3.2 or v3.4''' (ANTLR parser generator C support library)&lt;br /&gt;
*'''The Boost C++ base libraries'''&lt;br /&gt;
*'''MacPorts'''   [highly recommended if on a Mac; see [[#MacPorts]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardest to obtain and install is the libantlr3c requirement, and&lt;br /&gt;
is explained [[#Installing libantlr3c: ANTLR parser generator C support library|next]].&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;make&amp;quot; is non-GNU on your system, make sure to invoke &amp;quot;gmake&amp;quot; (or&lt;br /&gt;
whatever GNU Make is installed as).  If your usual shell is not Bash,&lt;br /&gt;
the configure script should auto-correct this.  If it does not, you'll&lt;br /&gt;
see strange shell syntax errors, and you may need to explicitly set&lt;br /&gt;
SHELL or CONFIG_SHELL to the location of bash on your system.&lt;br /&gt;
&lt;br /&gt;
==Installing libantlr3c: ANTLR parser generator C support library==&lt;br /&gt;
&lt;br /&gt;
For libantlr3c, you can use the convenience script in&lt;br /&gt;
''contrib/get-antlr-3.4'' in the source distribution---this will download, patch, compile and install&lt;br /&gt;
libantlr3c into your cvc4 directory as ''cvc4/antlr-3.4/''.&lt;br /&gt;
  cd contrib&lt;br /&gt;
  ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
CVC4 must be configured with the antlr library installation directory, '''--with-antlr-dir''', and an antlr executable script file, '''ANTLR'''.  If libantlr3c was installed via get-antlr-3.4, the following configure line should suffice for CVC44&lt;br /&gt;
  ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
For 64 bit machines, libantlr3c needs to be configured with 64 bit explicitly&lt;br /&gt;
  ./configure --enable-64bit ...&lt;br /&gt;
The get-antlr-3.4 script makes a guess at whether the machine is 64 bit and adds the appropriate flag.&lt;br /&gt;
To force the script to compile 32 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86&amp;quot; ./get-antlr3.4&lt;br /&gt;
To force the script to compile 64 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86_64&amp;quot; ./get-antlr3.4&lt;br /&gt;
&lt;br /&gt;
For a longer discussion, instructions for manual installation, and more in depth troubleshooting, see [[Developer's Guide#ANTLR3]].&lt;br /&gt;
&lt;br /&gt;
==MacPorts==&lt;br /&gt;
&lt;br /&gt;
On a Mac, it is '''highly''' recommended that you use MacPorts (see&lt;br /&gt;
http://www.macports.org/).  Doing so is easy.  Then, simply run the&lt;br /&gt;
script ''contrib/mac-build'', which installs a few ports from the MacPorts&lt;br /&gt;
repository, then compiles and installs antlr3c using the ''get-antlr-3.4''&lt;br /&gt;
script.  The mac-build script should set you up&lt;br /&gt;
with all requirements, and will tell you how to configure CVC4 when it&lt;br /&gt;
completes successfully.&lt;br /&gt;
&lt;br /&gt;
==Installing the Boost C++ base libraries==&lt;br /&gt;
&lt;br /&gt;
A Boost package is available on most Linux distributions; check yours&lt;br /&gt;
for a package named something like libboost-dev or boost-devel.  There&lt;br /&gt;
are a number of additional Boost packages in some distributions, but&lt;br /&gt;
this &amp;quot;basic&amp;quot; one should be sufficient for building CVC4.&lt;br /&gt;
&lt;br /&gt;
Should you want to install Boost manually, or to learn more about the&lt;br /&gt;
Boost project, please visit http://www.boost.org/.&lt;br /&gt;
&lt;br /&gt;
=Optional requirements=&lt;br /&gt;
&lt;br /&gt;
None of these is required, but can improve CVC4 as described below:&lt;br /&gt;
&lt;br /&gt;
*'''Optional: SWIG 2.0.x''' (Simplified Wrapper and Interface Generator)&lt;br /&gt;
*'''Optional: CLN v1.3 or newer''' (Class Library for Numbers)&lt;br /&gt;
*'''Optional: CUDD v2.4.2 or newer''' (Colorado University Decision Diagram package)&lt;br /&gt;
*'''Optional: GNU Readline library''' (for an improved interactive experience)&lt;br /&gt;
*'''Optional: The Boost C++ threading library''' (libboost_thread)&lt;br /&gt;
*'''Optional: CxxTest unit testing framework'''&lt;br /&gt;
&lt;br /&gt;
SWIG is necessary to build the Java API (and of course a JDK is&lt;br /&gt;
necessary, too).  SWIG 1.x won't work; you'll need 2.0, and the more&lt;br /&gt;
recent the better.  On Mac, we've seen SWIG segfault when generating&lt;br /&gt;
CVC4 language bindings; version 2.0.8 or higher is recommended to&lt;br /&gt;
avoid this.  See [[#Language_bindings|Language bindings]] below for build instructions.&lt;br /&gt;
&lt;br /&gt;
CLN is an alternative multiprecision arithmetic package that can offer&lt;br /&gt;
better performance and memory footprint than GMP.  CLN is covered by&lt;br /&gt;
the GNU General Public License, version 3; so if you choose to use&lt;br /&gt;
CVC4 with CLN support, you are licensing CVC4 under that same license.&lt;br /&gt;
(Usually CVC4's license is more permissive than GPL is; see the file&lt;br /&gt;
COPYING in the CVC4 source distribution for details.)  Please visit&lt;br /&gt;
http://www.ginac.de/CLN/ for more details about CLN.&lt;br /&gt;
&lt;br /&gt;
CUDD is a decision diagram package that changes the behavior of the&lt;br /&gt;
CVC4 arithmetic solver in some cases; it may or may not improve the&lt;br /&gt;
arithmetic solver's performance.  See [[#Building_with_CUDD_(optional)|below]] for instructions on&lt;br /&gt;
obtaining and building CUDD.&lt;br /&gt;
&lt;br /&gt;
The GNU Readline library is optionally used to provide command&lt;br /&gt;
editing, tab completion, and history functionality at the CVC prompt&lt;br /&gt;
(when running in interactive mode).  Check your distribution for a&lt;br /&gt;
package named &amp;quot;libreadline-dev&amp;quot; or &amp;quot;readline-devel&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
The Boost C++ threading library (often packaged independently of the&lt;br /&gt;
Boost base library) is needed to run CVC4 in &amp;quot;portfolio&amp;quot;&lt;br /&gt;
(multithreaded) mode.  Check your distribution for a package named&lt;br /&gt;
&amp;quot;libboost-thread-dev&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
CxxTest is necessary to run CVC4's unit tests (included with the&lt;br /&gt;
distribution).  Running these is not really required for users of&lt;br /&gt;
CVC4; &amp;quot;make check&amp;quot; will skip unit tests if CxxTest isn't available,&lt;br /&gt;
and go on to run the extensive system- and regression-tests in the&lt;br /&gt;
source tree.  However, if you're interested, you can download CxxTest&lt;br /&gt;
at http://cxxtest.com/ .&lt;br /&gt;
&lt;br /&gt;
==Building with CUDD (optional)==&lt;br /&gt;
&lt;br /&gt;
CUDD, if desired, must be installed delicately.  The CVC4 configure&lt;br /&gt;
script attempts to auto-detect the locations and names of CUDD headers&lt;br /&gt;
and libraries the way that the Fedora RPMs install them, the way that&lt;br /&gt;
our NYU-provided Debian packages install them, and the way they exist&lt;br /&gt;
when you download and build the CUDD sources directly.  If you install&lt;br /&gt;
from Fedora RPMs or our Debian packages, the process should be&lt;br /&gt;
completely automatic, since the libraries and headers are installed in&lt;br /&gt;
a standard location.  If you download the sources yourself, you need&lt;br /&gt;
to build them in a special way.  Fortunately, the&lt;br /&gt;
&amp;quot;contrib/build-cudd-2.4.2-with-libtool.sh&amp;quot; script in the CVC4 source&lt;br /&gt;
tree does exactly what you need: it patches the CUDD makefiles to use&lt;br /&gt;
libtool, builds the libtool libraries, then reverses the patch to&lt;br /&gt;
leave the makefiles as they were.  Once you run this script on an&lt;br /&gt;
unpacked CUDD 2.4.2 source distribution, then CVC4's configure script&lt;br /&gt;
should pick up the libraries if you provide&lt;br /&gt;
--with-cudd-dir=/PATH/TO/CUDD/SOURCES.&lt;br /&gt;
&lt;br /&gt;
If you want to force linking to CUDD, provide --with-cudd to the&lt;br /&gt;
configure script; this makes it a hard requirement rather than an&lt;br /&gt;
optional add-on.&lt;br /&gt;
&lt;br /&gt;
The NYU-provided Debian packaging of CUDD 2.4.2 and CUDD 2.5.0 are&lt;br /&gt;
here (along with the CVC4 Debian packages):&lt;br /&gt;
&lt;br /&gt;
  deb http://cvc4.cs.nyu.edu/debian/ unstable/&lt;br /&gt;
&lt;br /&gt;
On Debian (and Debian-derived distributions like Ubuntu), you only&lt;br /&gt;
need to drop that one line in your /etc/apt/sources.list file, then install with your favorite package manager.&lt;br /&gt;
&lt;br /&gt;
The Debian source package &amp;quot;cudd&amp;quot;, available from the same repository,&lt;br /&gt;
includes a diff of all changes made to cudd makefiles.&lt;br /&gt;
&lt;br /&gt;
=Language bindings=&lt;br /&gt;
&lt;br /&gt;
There are several options available for using CVC4 from the API.&lt;br /&gt;
&lt;br /&gt;
First, CVC4 offers a complete and flexible API for manipulating&lt;br /&gt;
expressions, maintaining a stack of assertions, and checking&lt;br /&gt;
satisfiability, and related things.  The C++ libraries (libcvc4.so and&lt;br /&gt;
libcvc4parser.so) and required headers are installed normally via a&lt;br /&gt;
&amp;quot;make install&amp;quot;.  This API is also available from Java (via CVC4.jar&lt;br /&gt;
and libcvc4jni.so) by configuring with --enable-language-bindings=java.&lt;br /&gt;
You'll also need SWIG 2.0 installed (and you might need to help&lt;br /&gt;
configure find it if you installed it in a nonstandard place with&lt;br /&gt;
--with-swig-dir=/path/to/swig/installation).  You may also need to&lt;br /&gt;
give the configure script the path to your Java headers (in&lt;br /&gt;
particular, jni.h).  You might do so with (for example):&lt;br /&gt;
&lt;br /&gt;
  ./configure --enable-language-bindings=java \&lt;br /&gt;
      JAVA_CPPFLAGS=-I/usr/lib/jvm/java-6-openjdk-amd64/include&lt;br /&gt;
&lt;br /&gt;
There is also a &amp;quot;C++ compatibility API&amp;quot; (''#include &amp;lt;cvc4/cvc3_compat.h&amp;gt;''&lt;br /&gt;
and link against libcvc4compat.so) that attempts to maintain&lt;br /&gt;
source-level backwards-compatibility with the CVC3 C++ API.  The&lt;br /&gt;
compatibility library is built by default, and&lt;br /&gt;
''--enable-language-bindings=java'' enables the Java compatibility library&lt;br /&gt;
(CVC4compat.jar and libcvc4compatjni.so).&lt;br /&gt;
''--enable-language-bindings=c'' enables the C compatibility library&lt;br /&gt;
(''#include &amp;lt;cvc4/bindings/compat/c/c_interface.h&amp;gt;'' and link against&lt;br /&gt;
libcvc4bindings_c_compat.so), and if you want both C and Java&lt;br /&gt;
bindings, use ''--enable-language-bindings=c,java''.  These compatibility&lt;br /&gt;
language bindings do NOT require SWIG.&lt;br /&gt;
&lt;br /&gt;
The ''examples/'' directory in the source distribution includes some basic examples (the &amp;quot;simple vc&amp;quot;&lt;br /&gt;
and &amp;quot;simple vc compat&amp;quot; family of examples) of all these interfaces.&lt;br /&gt;
&lt;br /&gt;
In principle, since we use SWIG to generate the native Java API, we&lt;br /&gt;
could support other languages as well.  However, using CVC4 from other&lt;br /&gt;
languages is not supported, nor expected to work, at this time.  If&lt;br /&gt;
you're interested in helping to develop, maintain, and test a language&lt;br /&gt;
binding, please contact us via the users' mailing list at&lt;br /&gt;
cvc-users@cs.nyu.edu.&lt;br /&gt;
&lt;br /&gt;
=Building CVC4 from a repository checkout=&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are additionally required to build&lt;br /&gt;
CVC4 from from a repository checkout rather than from a prepared&lt;br /&gt;
source tarball.&lt;br /&gt;
&lt;br /&gt;
*'''Automake v1.11'''&lt;br /&gt;
*'''Autoconf v2.61'''&lt;br /&gt;
*'''Libtool v2.2'''&lt;br /&gt;
*'''ANTLR3 v3.2 or v3.4'''&lt;br /&gt;
*'''Java Development Kit''' ([http://www.antlr.org/wiki/pages/viewpage.action?pageId=728 required for ANTLR3])&lt;br /&gt;
&lt;br /&gt;
First, use &amp;quot;''./autogen.sh''&amp;quot; to create the configure script.  Then&lt;br /&gt;
proceed as normal for any distribution tarball.  The parsers are&lt;br /&gt;
pre-generated for the tarballs, but don't exist in the repository; hence the extra ANTLR3 and JDK requirements to&lt;br /&gt;
generate the source code for the parsers, when building from the&lt;br /&gt;
repository.&lt;br /&gt;
&lt;br /&gt;
=Examples and tutorials are not built or installed=&lt;br /&gt;
&lt;br /&gt;
Examples are not built by &amp;quot;''make''&amp;quot; or &amp;quot;''make install''&amp;quot;.  See&lt;br /&gt;
''examples/README'' in the source distribution for information on what to find in the ''examples/''&lt;br /&gt;
directory, as well as information about building and installing them.&lt;br /&gt;
&lt;br /&gt;
=Appendix: Build architecture=&lt;br /&gt;
&lt;br /&gt;
The build system is generated by automake, libtool, and autoconf.  It&lt;br /&gt;
is somewhat nonstandard, though, which (for one thing) requires that&lt;br /&gt;
GNU Make be used.  If you ./configure in the top-level source&lt;br /&gt;
directory, the objects will actually all appear in&lt;br /&gt;
builds/${arch}/${build_id}.  This is to allow multiple, separate&lt;br /&gt;
builds in the same place (e.g., an assertions-enabled debugging build&lt;br /&gt;
alongside a production build), without changing directories at the&lt;br /&gt;
shell.  The &amp;quot;current&amp;quot; build is maintained, and you can still use&lt;br /&gt;
(e.g.) &amp;quot;make -C src/main&amp;quot; to rebuild objects in just one subdirectory.&lt;br /&gt;
&lt;br /&gt;
You can also create your own build directory inside or outside of the&lt;br /&gt;
source tree and configure from there.  All objects will then be built&lt;br /&gt;
in that directory, and you'll ultimately find the &amp;quot;cvc4&amp;quot; binary in&lt;br /&gt;
src/main/, and the libraries under src/ and src/parser/.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3935</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3935"/>
				<updated>2012-11-27T18:40:22Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* CVC4's native input language */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
CVC4 accepts its input in one of the following languages:&lt;br /&gt;
&lt;br /&gt;
* [[CVC4's native language ]]&lt;br /&gt;
* SMT-LIB v2&lt;br /&gt;
* SMT-LIB v1&lt;br /&gt;
&lt;br /&gt;
The input language can be set via the command line &lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=CVC4%27s_native_language&amp;diff=3934</id>
		<title>CVC4's native language</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=CVC4%27s_native_language&amp;diff=3934"/>
				<updated>2012-11-27T18:40:12Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: Created page with &amp;quot;The native input language consists of a sequence of symbol declarations and commands, each followed by a semicolon (&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;).  Any text after the first occurrence of a per…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The native input language consists of a sequence of symbol declarations and commands, each followed by a semicolon (&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Any text after the first occurrence of a percent character and to the end of the current line is a comment:&lt;br /&gt;
&lt;br /&gt;
 %%% This is a native language comment&lt;br /&gt;
&lt;br /&gt;
== Type System ==&lt;br /&gt;
&lt;br /&gt;
CVC4's type system includes a set of built-in types which can be expanded with additional user-defined types.&lt;br /&gt;
&lt;br /&gt;
The type system consists of ''first-order'' types, ''subtypes'' of first-order types, and ''higher-order'' types,  all of which are interpreted as sets. &lt;br /&gt;
For convenience, we will sometimes identify below the interpretation of a type with the type itself.&lt;br /&gt;
&lt;br /&gt;
First-order types consist of basic types and structured types. The basic types are &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, as well as user-defined basic types (also called uninterpreted types). &lt;br /&gt;
The structured types are array, tuple, record types, and ML-style user-defined (inductive) datatypes.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Currently, subtypes consist only of the built-in subtype &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;!-- and are covered in the [[#Subtypes|Subtypes]] section. --&amp;gt;&lt;br /&gt;
Support for CVC3-style user-defined subtypes will be added in a later release.&lt;br /&gt;
&lt;br /&gt;
Function types are the only higher-order types.&lt;br /&gt;
More precisely, they are just second-order types &lt;br /&gt;
since function symbols in CVC4, both built-in and user-defined, can take as argument or return only values of &lt;br /&gt;
a first-order type.&lt;br /&gt;
&lt;br /&gt;
=== Basic Types ===&lt;br /&gt;
&lt;br /&gt;
==== The BOOLEAN Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; type is interpreted as the two-element set of Boolean values&lt;br /&gt;
&amp;lt;math&amp;gt;\{\mathrm{TRUE},\; \mathrm{FALSE}\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
'''Note:''' CVC4's treatment of this type differs from CVC3's where &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; is used only as the type of formulas, but not as value type. CVC3 follows the two-tiered structure of classical first-order logic &lt;br /&gt;
which distinguishes between formulas and terms, and allows terms to occur in formulas but not vice versa (with the exception of the IF-THEN-ELSE construct).&lt;br /&gt;
CVC4 drops the distinction between terms and formulas and defines the latter just as terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. As such, formulas can occur as subterms of possibly non-Boolean terms.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 [To do]&lt;br /&gt;
&lt;br /&gt;
==== The REAL Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; type is interpreted as the set of real numbers.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical reals,&lt;br /&gt;
not the floating point numbers.&lt;br /&gt;
Support for floating point types is planned for future versions.&lt;br /&gt;
&lt;br /&gt;
 x, y : REAL;&lt;br /&gt;
 QUERY (( x &amp;lt;= y ) AND ( y &amp;lt;= x )) =&amp;gt; ( x = y );&lt;br /&gt;
&lt;br /&gt;
==== The INT Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; type is interpreted as the set of integer numbers&lt;br /&gt;
and is considered as a subtype of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The latter means in particular that it is possible to mix integer and real terms &lt;br /&gt;
in expressions without the need of an explicit ''upcasting'' operator.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical integers,&lt;br /&gt;
not the finite precision machine integers used in most programming languages. &lt;br /&gt;
The latter are models by [[ #Bitvectors | bit vector ]] types.&lt;br /&gt;
&lt;br /&gt;
 x, y : INT;&lt;br /&gt;
 QUERY ((2 * x + 4 * y &amp;lt;= 1) AND ( y &amp;gt;= x)) =&amp;gt; (x &amp;lt;= 0);&lt;br /&gt;
 z : REAL;&lt;br /&gt;
 QUERY (2 * x + z &amp;lt;= 3.5) AND (z &amp;gt;= 1);&lt;br /&gt;
&lt;br /&gt;
==== Bit Vector Types ====&lt;br /&gt;
&lt;br /&gt;
For every positive integer &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, the type &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; is interpreted as the set of all bit vectors of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
A rich set of bit vector operators is supported.&lt;br /&gt;
&lt;br /&gt;
==== User-defined Basic Types ====&lt;br /&gt;
&lt;br /&gt;
Users can define new basic types &lt;br /&gt;
(often referred to as ''uninterpreted'' types in the SMT literature).&lt;br /&gt;
Each such type is interpreted as a set of unspecified cardinality &lt;br /&gt;
but disjoint from any other type. &lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Can we specify cardinalities? &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
User-defined basic types are created by declarations like the following:&lt;br /&gt;
&lt;br /&gt;
 % User declarations of basic types:&lt;br /&gt;
 &lt;br /&gt;
 MyBrandNewType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 Apples, Oranges: TYPE;&lt;br /&gt;
&lt;br /&gt;
=== Structured Types ===&lt;br /&gt;
&lt;br /&gt;
CVC4's structured types are divided in the following families. &lt;br /&gt;
&lt;br /&gt;
==== Array Types ====&lt;br /&gt;
&lt;br /&gt;
Array types are created by the mixfix type constructors &amp;lt;math&amp;gt;\mathrm{ARRAY}\ \_\ \mathrm{OF}\ \_&amp;lt;/math&amp;gt; &lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 I : TYPE;&lt;br /&gt;
 &lt;br /&gt;
 %% Array types:&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with indices from I and values from REAL&lt;br /&gt;
 Array1: TYPE = ARRAY I OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer indices and array values &lt;br /&gt;
 Array2: TYPE = ARRAY INT OF (ARRAY INT OF REAL);&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer pair indices and integer values&lt;br /&gt;
 IntMatrix: TYPE = ARRAY [INT, INT] OF INT;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
An array type of the form &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1\ \mathrm{OF}\ T_2&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the set of all total maps from &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
The main difference with the function type &amp;lt;math&amp;gt;T_1 \to T_2&amp;lt;/math&amp;gt; is that arrays, &lt;br /&gt;
contrary to functions, are first-class objects of the language, that is, values of an array&lt;br /&gt;
type can be arguments or results of functions. &lt;br /&gt;
Furthermore, array types come equipped with an update operation.&lt;br /&gt;
&lt;br /&gt;
==== Tuple Types ====&lt;br /&gt;
&lt;br /&gt;
Tuple types are created by the mixfix type constructors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l} [\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ \ ,\ \_\ ] \\[1ex] \ldots \end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 IntArray: TYPE = ARRAY INT OF INT;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple type declarations&lt;br /&gt;
 &lt;br /&gt;
 RealPair: TYPE = [REAL, REAL]&lt;br /&gt;
 &lt;br /&gt;
 MyTuple: TYPE = [ REAL, IntArray, [INT, INT] ];&lt;br /&gt;
&lt;br /&gt;
A tuple type of the form &amp;lt;math&amp;gt;[T_1, \ldots, T_n]&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Note that while the types &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and &lt;br /&gt;
&amp;lt;math&amp;gt;[T_1 \times \cdots \times T_n] \to T&amp;lt;/math&amp;gt; are semantically equivalent, &lt;br /&gt;
they are operationally different in CVC4. &lt;br /&gt;
The first is the type of functions that take &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; arguments &lt;br /&gt;
of respective type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;T_n&amp;lt;/math&amp;gt;, &lt;br /&gt;
while the second is the type of functions that take one argument of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-tuple type.&lt;br /&gt;
&lt;br /&gt;
==== Record Types ====&lt;br /&gt;
&lt;br /&gt;
Similar to, but more general than tuple types, record types are created by type constructors of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
[\#\ l_1: \_\ ,\ \ldots\ ,\ l_n: \_\ \#]&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;l_1,\ldots, l_n&amp;lt;/math&amp;gt; are field labels, &lt;br /&gt;
and the arguments can be instantiated with any first-order types.&lt;br /&gt;
&lt;br /&gt;
 MyType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 % Record declaration&lt;br /&gt;
 &lt;br /&gt;
 RecordType: TYPE = [# id: REAL, age: INT, info: MyType #];&lt;br /&gt;
&lt;br /&gt;
The order of the fields in a record type is meaningful: &lt;br /&gt;
permuting the field names gives a different type. &lt;br /&gt;
&lt;br /&gt;
Note that record types are non-recursive. &lt;br /&gt;
For instance, it is not possible to declare a record type called &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt; containing &lt;br /&gt;
a field of type &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt;. &lt;br /&gt;
Recursive types are provided in CVC4 by the more general inductive data types.&lt;br /&gt;
(As a matter of fact, both record and tuple types are implemented internally as inductive data types.)&lt;br /&gt;
&lt;br /&gt;
==== Inductive Data Types ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inductive data types in CVC4 are similar to inductive data types of functional languages.&lt;br /&gt;
They can be parametric or not.&lt;br /&gt;
&lt;br /&gt;
===== Non-Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Non-parametric data types are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE} \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1 &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2 &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
Such declarations define the data types &amp;lt;math&amp;gt;A_1, \ldots, A_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
For each data type &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; they introduce:&lt;br /&gt;
&lt;br /&gt;
* constructor symbols &amp;lt;math&amp;gt;cons&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;(T_1, \ldots, T_k) \to \mathit{type\_name}_i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* selector symbols &amp;lt;math&amp;gt;\mathit{sel}_j&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to T_j&amp;lt;/math&amp;gt;, and&lt;br /&gt;
* tester symbols &amp;lt;math&amp;gt;\mathit{is\_cons}&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that permitting more than one data type to be defined in the same declarations allows &lt;br /&gt;
the definition of mutually recursive types.&lt;br /&gt;
&lt;br /&gt;
 % simple enumeration type&lt;br /&gt;
 &lt;br /&gt;
 % implicitly defined are the testers: is_red, is_yellow and is_blue&lt;br /&gt;
 % (similarly for the other data types)&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   PrimaryColor = red | yellow | blue&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % infinite set of pairwise distinct values ..., v(-1), v(0), v(1), ...&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Id = v (id: INT)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % ML-style integer lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   IntList = nil | ins (head: INT, tail: IntList)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % AST for lamba calculus&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Term = var (index: INT)&lt;br /&gt;
        | apply (arg_1: Term, arg_2: Term)&lt;br /&gt;
        | lambda (arg: INT, body: Term)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Trees&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Tree = tree (value: REAL, children: TreeList),&lt;br /&gt;
   TreeList = nil_tl&lt;br /&gt;
            | ins_tl (first_t1: Tree, rest_t1: TreeList)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
Constructor, selector and tester symbols defined for a data type have global scope. &lt;br /&gt;
So, for example, it is not possible for two different data types to use &lt;br /&gt;
the same name for a constructor.&lt;br /&gt;
&lt;br /&gt;
An inductive data type is interpreted as a term algebra constructed by the constructor symbols &lt;br /&gt;
over some sets of generators. &lt;br /&gt;
For example, the type &amp;lt;code&amp;gt;IntList&amp;lt;/code&amp;gt; defined above is interpreted as the set &lt;br /&gt;
of all terms constructed with &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ins&amp;lt;/code&amp;gt; over the integers.&lt;br /&gt;
&lt;br /&gt;
===== Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Parametric data types are infinite families of (non-parametric) data types &lt;br /&gt;
with each family parametrized by one or more type variables.&lt;br /&gt;
They are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE}  \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1[X_{1,1}, \ldots, X_{1,p_1}] &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2[X_{2,1}, \ldots, X_{2,p_2}] &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n[X_{n,1}, \ldots, X_{n,p_n}] &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name parametrized by the type variables &amp;lt;math&amp;gt;X_{i,1}, \ldots, X_{i,p_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, &lt;br /&gt;
possibly parametrized by &amp;lt;math&amp;gt;X_1, \ldots, X_p&amp;lt;/math&amp;gt;, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 % Parametric pairs&lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Pair[X, Y] = pair (first: X, second: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 % Parametric lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Parametric trees using the list type above&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   Tree[X] = node (value: X, children: List[Tree[X]]),&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
The declarations above define infinitely many types of the form &lt;br /&gt;
Pair[S,T], List[T] and Tree[T] where S and T are first-order types.&lt;br /&gt;
Note that the identifier &amp;lt;code&amp;gt;List&amp;lt;/code&amp;gt; above, for example, by itself does not denote a type.&lt;br /&gt;
In contrast, the terms &amp;lt;code&amp;gt;List[Real]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[List[Real]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[Tree[INT]]&amp;lt;/code&amp;gt;,&lt;br /&gt;
and so on do.&lt;br /&gt;
&lt;br /&gt;
===== Restriction to Inductive Types =====&lt;br /&gt;
&lt;br /&gt;
By adopting a term algebra semantics, CVC4 allows only ''inductive'' data types, &lt;br /&gt;
that is, data types whose values are essentially (labeled, ordered) finite trees. &lt;br /&gt;
Infinite structures such as streams or even finite but cyclic ones &lt;br /&gt;
such as circular lists are then excluded. &lt;br /&gt;
For instance, none of the following declarations define inductive data types, &lt;br /&gt;
and are rejected by CVC4:&lt;br /&gt;
&lt;br /&gt;
 DATATYPE&lt;br /&gt;
  IntStream = s (first:INT, rest: IntStream)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
  RationalTree = node1 (child: RationalTree)&lt;br /&gt;
               | node2 (left_child: RationalTree, right_child:RationalTree)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   T1 =  c1 (s1: T2),&lt;br /&gt;
   T2 =  c2 (s2: T1)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
In concrete, a declaration of &amp;lt;math&amp;gt;n \geq 1&amp;lt;/math&amp;gt; datatypes &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; will be rejected if for any one of the types &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;, it is impossible to build a finite term of that type using only the constructors of &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; and free constants of type other than &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Inductive data types are the only types where the user also chooses names for the built-in operations to:&lt;br /&gt;
&lt;br /&gt;
* construct a value of the type (with the constructors),&lt;br /&gt;
* extract components from a value (with the selectors), or&lt;br /&gt;
* check if a value was constructed with a certain constructor or not (with the testers).&lt;br /&gt;
&lt;br /&gt;
For all the other types, CVC4 provides predefined names for the built-in operations on the type.&lt;br /&gt;
&lt;br /&gt;
=== Function Types ===&lt;br /&gt;
&lt;br /&gt;
Function (&amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt;) types are created by the mixfix type constructors&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\_ \to \_ \\[1ex] (\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] (\ \_\ ,\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] \ldots &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
whose arguments can be instantiated by any first-order type.&lt;br /&gt;
&lt;br /&gt;
 % Function type declarations&lt;br /&gt;
 &lt;br /&gt;
 UnaryFunType: TYPE = INT -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 BinaryFunType: TYPE = (REAL, REAL) -&amp;gt; ARRAY REAL OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 TernaryFunType: TYPE = (REAL, BITVECTOR(4), INT) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
A function type of the form &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; is interpreted as the set of all ''total'' functions from the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The example above also shows how to introduce type names. &lt;br /&gt;
A name like &amp;lt;code&amp;gt;UnaryFunType&amp;lt;/code&amp;gt; above is just an abbreviation for the type &amp;lt;math&amp;gt;\mathrm{INT} \to \mathrm{REAL}&amp;lt;/math&amp;gt; and can be used interchangeably with it.&lt;br /&gt;
&lt;br /&gt;
In general, any type defined by a type expression &amp;lt;code&amp;gt;E&amp;lt;/code&amp;gt; can be given a name with the declaration:&lt;br /&gt;
&lt;br /&gt;
 name : TYPE = E;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Type Checking ===&lt;br /&gt;
&lt;br /&gt;
In CVC4, formulas and terms are statically typed at the level of types &lt;br /&gt;
(as opposed to subtypes) according to the usual rules of first-order many-sorted logic,&lt;br /&gt;
with the main difference that formulas are just terms of type &amp;lt;math&amp;gt;BOOLEAN&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* each variable has one associated first-order type,&lt;br /&gt;
* each constant symbol has one or more associated first-order types,&lt;br /&gt;
* each function symbol has one or more associated function types,&lt;br /&gt;
* the type of a term consisting just of a variable is the type associated to that variable,&lt;br /&gt;
* the type of a term consisting just of a constant symbol is the type associated to that constant symbol,&lt;br /&gt;
* the term obtained by applying a function symbol &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; to the terms &amp;lt;math&amp;gt;t_1, \ldots, t_n&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and each &amp;lt;math&amp;gt;t_i&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Attempting to enter an ill-typed term will result in an error.&lt;br /&gt;
&lt;br /&gt;
Another significant difference with standard many-sorted logic is that &lt;br /&gt;
some built-in symbols are parametrically polymorphic. &lt;br /&gt;
For instance, the function symbol for extracting the element of any array has &lt;br /&gt;
type &amp;lt;math&amp;gt;(\mathit{ARRAY}\ T_1\ \mathit{OF}\ T_2,\; T_1) \to T_2&amp;lt;/math&amp;gt; &lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1, T_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Type Ascription ====&lt;br /&gt;
&lt;br /&gt;
By the type inference rules above some terms might have more than one type.&lt;br /&gt;
This can happen with terms built with polymorphic data type constructors&lt;br /&gt;
that have more than one return type for the same input type.&lt;br /&gt;
In that case, a type ascription operator (&amp;lt;code&amp;gt;::&amp;lt;/code&amp;gt;) must be applied &lt;br /&gt;
to the constructor to specify the intended return type.&lt;br /&gt;
&lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = cons(1, nil::List[REAL]);&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Union[X, Y] = left(val_l: X) | right(val_r: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = left::Union[BOOLEAN, REAL](TRUE);&lt;br /&gt;
&lt;br /&gt;
The constant symbol &amp;lt;math&amp;gt;\mathrm{nil}&amp;lt;/math&amp;gt; declared above has infinitely many types &lt;br /&gt;
(&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{REAL}]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{List}[\mathrm{BOOLEAN}]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[[\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;, ...)&lt;br /&gt;
CVC4's type checker requires the user to indicate explicitly the type &lt;br /&gt;
of each occurrence of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; in a term. &lt;br /&gt;
Similarly, &lt;br /&gt;
the injection operator &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; has infinitely many return types &lt;br /&gt;
for the same input type, for instance:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{REAL}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, [\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
and so on.&lt;br /&gt;
Applications of &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; need to specify the intended returned typed, as shown above.&lt;br /&gt;
&lt;br /&gt;
== Terms and Formulas ==&lt;br /&gt;
&lt;br /&gt;
In addition to type expressions, CVC4 has expressions for terms and for formulas &lt;br /&gt;
(i.e., terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;). &lt;br /&gt;
By and large, these are standard first-order terms built out of typed variables, &lt;br /&gt;
predefined theory-specific operators, free (i.e., user-defined) function symbols, &lt;br /&gt;
and quantifiers. &lt;br /&gt;
Extensions include an if-then-else operator, lambda abstractions, and local symbol &lt;br /&gt;
declarations, as illustrated below. &lt;br /&gt;
Note that these extensions still keep CVC4's language first-order. &lt;br /&gt;
In particular, lambda abstractions are restricted to take and return only terms of &lt;br /&gt;
a first-order type. &lt;br /&gt;
Similarly, variables can only be of a first-order type.&lt;br /&gt;
&lt;br /&gt;
A number of built-in function symbols (for instance, the arithmetic ones) are used &lt;br /&gt;
as infix operators. All user-defined symbols are used as prefix ones.&lt;br /&gt;
&lt;br /&gt;
User-defined, i.e., free, function symbols include ''constant symbols'' and &lt;br /&gt;
''predicate symbols'', respectively  nullary function symbols and function symbols &lt;br /&gt;
with a &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; return type. &lt;br /&gt;
These symbols are introduced with global declarations of the form &lt;br /&gt;
&amp;lt;math&amp;gt; f_1, \ldots, f_m: T;&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;f_i&amp;lt;/math&amp;gt; are the names of the symbols and &lt;br /&gt;
&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is their type:&lt;br /&gt;
&lt;br /&gt;
 % integer constants&lt;br /&gt;
 &lt;br /&gt;
 a, b, c: INT;&lt;br /&gt;
 &lt;br /&gt;
 % real constants&lt;br /&gt;
 &lt;br /&gt;
 x, y, z: REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function&lt;br /&gt;
 &lt;br /&gt;
 f1: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % binary function&lt;br /&gt;
 &lt;br /&gt;
 f2: (REAL, INT) -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function with a tuple argument&lt;br /&gt;
 &lt;br /&gt;
 f3: [INT, REAL] -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % binary predicate&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, REAL) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % Propositional &amp;quot;variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 P, Q; BOOLEAN;&lt;br /&gt;
&lt;br /&gt;
Like type declarations, function symbol declarations like the above have global scope &lt;br /&gt;
and must be unique. &lt;br /&gt;
In other words, it is not possible to declare a function symbol globally more than once&lt;br /&gt;
in the same lexical scope. &lt;br /&gt;
This entails among other things that globally-defined free symbols cannot be overloaded &lt;br /&gt;
with different types and that theory symbols cannot be redeclared globally as free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Global symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
As with types, a function symbol can be defined as the name of another term &lt;br /&gt;
of the corresponding type. &lt;br /&gt;
With constant symbols, this is done with a declaration of the form &amp;lt;math&amp;gt;f:T = t;&amp;lt;/math&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
 c: INT;&lt;br /&gt;
 &lt;br /&gt;
 i: INT = 5 + 3*c;  % i is effectively a shorthand for 5 + 3*c&lt;br /&gt;
 &lt;br /&gt;
 j: REAL = 3/4;&lt;br /&gt;
 &lt;br /&gt;
 t: [REAL, INT] = (2/3, -4);&lt;br /&gt;
 &lt;br /&gt;
 r: [# key: INT, value: REAL #] = (# key := 4, value := (c + 1)/2 #);&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN = FORALL (x:INT): x &amp;lt;= 0 OR x &amp;gt; c ;&lt;br /&gt;
&lt;br /&gt;
A restriction on constants of type &amp;lt;math&amp;gt;\mathit{BOOLEAN}&amp;lt;/math&amp;gt; is that their value &lt;br /&gt;
can only be a closed formula, that is, a formula with no free variables.&lt;br /&gt;
&lt;br /&gt;
A term and its name can be used interchangeably in later expressions. &lt;br /&gt;
Named terms are often useful for shared subterms (terms used several times in different places) &lt;br /&gt;
since their use can make the input exponentially more concise. &lt;br /&gt;
Named terms are processed very efficiently by CVC4. &lt;br /&gt;
It is much more efficient to associate a complex term with a name directly rather than &lt;br /&gt;
to declare a constant and later assert that it is equal to the same term. &lt;br /&gt;
This point is explained in more detail later in section [[Commands | Commands]].&lt;br /&gt;
&lt;br /&gt;
More generally, in CVC4 one can associate a term to function symbols of any arity. &lt;br /&gt;
For non-constant function symbols this is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;f:(T_1, \ldots, T_n) \to T = \mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t\;;&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is any term of type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; with free variables &lt;br /&gt;
in &amp;lt;math&amp;gt;\{x_1, \ldots, x_n\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The lambda binder has the usual semantics and conforms to the usual lexical scoping rules: &lt;br /&gt;
within the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; the declaration of the symbols &amp;lt;math&amp;gt;x_1, \ldots, x_n&amp;lt;/math&amp;gt; &lt;br /&gt;
as local variables of respective type &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; hides any previous&lt;br /&gt;
declarations of those symbols that are in scope.&lt;br /&gt;
&lt;br /&gt;
As a general shorthand, when &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; consecutive types &lt;br /&gt;
&amp;lt;math&amp;gt;T_i, \ldots, T_{i+k-1}&amp;lt;/math&amp;gt;  in the lambda expression &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t&amp;lt;/math&amp;gt; are identical, the syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x_i,\ldots, x_{i+k-1}:T_i,\ldots, x:T_n): t&amp;lt;/math&amp;gt;&lt;br /&gt;
can also be used.&lt;br /&gt;
&lt;br /&gt;
 % Global declaration of x as a unary function symbol&lt;br /&gt;
 &lt;br /&gt;
 x: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Local declarations of x as variable (hiding the global one)&lt;br /&gt;
 &lt;br /&gt;
 f: REAL -&amp;gt; REAL = LAMBDA (x: REAL): 2*x + 3;&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, INT) -&amp;gt; BOOLEAN = LAMBDA (x,i: INT): i*x - 1 &amp;gt; 0;&lt;br /&gt;
 &lt;br /&gt;
 g: (REAL, INT) -&amp;gt; [REAL, INT] = LAMBDA (x: REAL, i:INT): (x + 1, i - 3);&lt;br /&gt;
&lt;br /&gt;
Note that lambda definitions are not recursive: &lt;br /&gt;
the symbol being defined cannot occur in the body of the lambda term.&lt;br /&gt;
They should be understood as macros.&lt;br /&gt;
For instance, any occurrence of the term &amp;lt;math&amp;gt;f(t)&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; is as defined above will be treated &lt;br /&gt;
as if it was the term &amp;lt;math&amp;gt;(2*t + 3)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Local symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
Constant and function symbols can also be declared locally anywhere within a term &lt;br /&gt;
by means of a let binder. &lt;br /&gt;
This is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f = t \ \mathrm{IN}\ t' ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is a term with no free variables, possibly a lambda term.&lt;br /&gt;
Let binders can be nested arbitrarily and follow the usual lexical scoping rules.&lt;br /&gt;
The following general form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1, f_2 = t_2, \ldots, f_n = t_m \ \mathrm{IN}\ t ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
can be use above can used as a shorthand for&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1\ \mathrm{IN}\ &lt;br /&gt;
 \mathrm{LET}\ f_2 = t_2\ \mathrm{IN}\ &lt;br /&gt;
 \ldots \ &lt;br /&gt;
 \mathrm{LET}\ f_n = t_m \ \mathrm{IN}\ t ;&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL =&lt;br /&gt;
   LET x1 = 42,&lt;br /&gt;
       g = LAMBDA(x:INT): x + 1,&lt;br /&gt;
       x2 = 2*x1 + 7/2&lt;br /&gt;
   IN&lt;br /&gt;
      (LET x3 = g(x1) IN x3 + x2) / x1;&lt;br /&gt;
&lt;br /&gt;
Note that the same symbol = is used, unambiguously, in the syntax of global declarations, &lt;br /&gt;
let declarations, and as a predicate symbol.&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
A &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; term with a multiple symbols defines them sequentially.&lt;br /&gt;
A parallel version of the &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; construct will be introduced in a later version.&lt;br /&gt;
&lt;br /&gt;
== Built-in theories and their symbols ==&lt;br /&gt;
&lt;br /&gt;
In addition to user-defined symbols, CVC4 terms can use a number of predefined symbols: &lt;br /&gt;
the logical symbols, such as &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, etc., &lt;br /&gt;
as well as theory symbols, function symbols belonging to one of the built-in theories. &lt;br /&gt;
They are described next, with the theory symbols grouped by theory.&lt;br /&gt;
&lt;br /&gt;
=== Logical Symbols ===&lt;br /&gt;
&lt;br /&gt;
The logical symbols in CVC4's language include &lt;br /&gt;
the equality and disequality predicate symbols, respectively written as = and /=, &lt;br /&gt;
the multiarity disequality symbol &amp;lt;math&amp;gt;\mathrm{DISTINCT}&amp;lt;/math&amp;gt;, &lt;br /&gt;
together with the logical constants &amp;lt;math&amp;gt;\mathrm{TRUE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{FALSE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
the connectives &amp;lt;math&amp;gt;\mathrm{NOT}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{XOR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt;, and &lt;br /&gt;
the first-order quantifiers &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt;, &lt;br /&gt;
all with the standard many-sorted logic semantics.&lt;br /&gt;
&lt;br /&gt;
The binary connectives have infix syntax and type &lt;br /&gt;
&amp;lt;math&amp;gt;(\mathrm{BOOLEAN},\mathrm{BOOLEAN}) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The symbols = and /=, which are also infix, are instead parametrically polymorphic, &lt;br /&gt;
having type &amp;lt;math&amp;gt;(T,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
They are interpreted respectively as the identity relation and its complement.&lt;br /&gt;
&lt;br /&gt;
The DISTINCT symbol is both overloaded and polymorphic. &lt;br /&gt;
It has type &amp;lt;math&amp;gt;(T,...,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every sequence &amp;lt;math&amp;gt;(T,...,T)&amp;lt;/math&amp;gt; of length &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; &lt;br /&gt;
and first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
For each &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, it is interpreted as the relation &lt;br /&gt;
that holds exactly for tuples of pairwise distinct elements.&lt;br /&gt;
&lt;br /&gt;
The syntax for quantifiers is similar to that of the lambda binder.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a formula built just of these logical symbols and variables:&lt;br /&gt;
&lt;br /&gt;
 A, B: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 q: BOOLEAN = FORALL (x,y: A, i,j,k: B): &lt;br /&gt;
                i = j AND i /= k =&amp;gt; EXISTS (z: A): x /= z OR z /= y;&lt;br /&gt;
&lt;br /&gt;
Binding and scoping of quantified variables follows the same rules as &lt;br /&gt;
in let expressions. &lt;br /&gt;
In particular, a quantifier will shadow in its scope any constant and function symbols&lt;br /&gt;
with the same name as one of the variables it quantifies:&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 i, j: INT;&lt;br /&gt;
 &lt;br /&gt;
 % The first occurrence of i and of j in f are constant symbols,&lt;br /&gt;
 % the others are variables.&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN =  i = j AND FORALL (i,j: A): i = j OR i /= j;&lt;br /&gt;
&lt;br /&gt;
Optionally, it is also possible to specify instantiation patterns &lt;br /&gt;
for quantified variables. &lt;br /&gt;
The general syntax for a quantified formula &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; with patterns is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Q\;(x_1:T_1, \ldots, x_k:T_k):\; p_1: \ldots\; p_n:\; \varphi&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; is &lt;br /&gt;
either &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\varphi&amp;lt;/math&amp;gt; is a term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &lt;br /&gt;
and each of the &amp;lt;math&amp;gt;p_i&amp;lt;/math&amp;gt;'s, &lt;br /&gt;
a pattern for the quantifier &amp;lt;math&amp;gt;Q\;(x_1:T_1, \ldots, x_k:T_k)&amp;lt;/math&amp;gt;, has the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{PATTERN}\; (t_1, \ldots, t_m)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;t_1, \ldots, t_m&amp;lt;/math&amp;gt; are &lt;br /&gt;
arbitrary binder-free terms (no lets, no quantifiers). &lt;br /&gt;
Those terms can contain (free) variables, typically, but not exclusively, &lt;br /&gt;
drawn from &amp;lt;math&amp;gt;x_1, \ldots, x_k&amp;lt;/math&amp;gt;. &lt;br /&gt;
(Additional variables can occur if &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; occurs in a bigger formula &lt;br /&gt;
binding those variables.)&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 b, c: A;&lt;br /&gt;
 p, q: A -&amp;gt; BOOLEAN;&lt;br /&gt;
 r: (A, A) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x0, x1, x2: A):&lt;br /&gt;
          PATTERN (r(x0, x1), r(x1, x2)): &lt;br /&gt;
          (r(x0, x1) AND r(x1, x2)) =&amp;gt; r(x0, x2) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x: A):&lt;br /&gt;
          PATTERN (r(x, b)): &lt;br /&gt;
          PATTERN (r(x, c)): &lt;br /&gt;
          p(x) =&amp;gt; q(x) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT EXISTS (y: A):&lt;br /&gt;
          FORALL (x: A):&lt;br /&gt;
            PATTERN (r(x, y), p(y)): &lt;br /&gt;
            r(x, y) =&amp;gt; q(x) ;&lt;br /&gt;
&lt;br /&gt;
Patterns have no logical meaning: &lt;br /&gt;
adding them to a formula does not change its semantics. &lt;br /&gt;
Their purpose is purely operational, as explained in &lt;br /&gt;
the [[#Instantiation Patterns | Instantiation Patterns]] section.&lt;br /&gt;
&lt;br /&gt;
In addition to these constructs, CVC4 also has a general mixfix conditional operator &lt;br /&gt;
of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{IF}\ b\ \mathrm{THEN}\ t\ \mathrm{ELSIF}\ b_1\ \mathrm{THEN}\ t_1\ \ldots\ \mathrm{ELSIF}\ b_n\ \mathrm{THEN}\ t_n\ \mathrm{ELSE}\ t_{n+1}\ \mathrm{ENDIF}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt; where &lt;br /&gt;
&amp;lt;math&amp;gt;b, b_1, \ldots, b_n&amp;lt;/math&amp;gt; are terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; and&lt;br /&gt;
&amp;lt;math&amp;gt;t, t_1, \ldots, t_n, t_{n+1}&amp;lt;/math&amp;gt; are terms of the same first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 % Conditional term&lt;br /&gt;
 x, y, z, w: REAL;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL = &lt;br /&gt;
   IF x &amp;gt; 0 THEN y&lt;br /&gt;
   ELSIF x &amp;gt;= 1 THEN z&lt;br /&gt;
   ELSIF x &amp;gt; 2 THEN w&lt;br /&gt;
   ELSE 2/3 ENDIF;&lt;br /&gt;
&lt;br /&gt;
=== User-defined Functions and Types ===&lt;br /&gt;
&lt;br /&gt;
The theory of user-defined functions,also know in the SMT literature as &lt;br /&gt;
the theory ''Equality over Uninterpreted Functions'', or ''EUF'', is in effect &lt;br /&gt;
a family of theories of equality parametrized by the basic types and the free symbols &lt;br /&gt;
a user can define during a run of CVC4.&lt;br /&gt;
&lt;br /&gt;
This theory has no built-in symbols (other than the logical ones).&lt;br /&gt;
Its types consist of ''all and only'' the user-defined types.&lt;br /&gt;
Its function symbols consist of ''all and only'' the user-defined free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
The real arithmetic theory has two types:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{INTEGER}&amp;lt;/math&amp;gt;&lt;br /&gt;
with the latter a subtype of the first.&lt;br /&gt;
Its built-in symbols for the usual arithmetic constants &lt;br /&gt;
and operators over the type &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, each with the expected type: &lt;br /&gt;
all numerals 0, 1, ..., as well as - (both unary and binary), +, *, /, &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=. &lt;br /&gt;
Application of the binary symbols are in infix form.&lt;br /&gt;
Note that + is only binary, and so an expression such as +4 is ill-formed.&lt;br /&gt;
&lt;br /&gt;
Rational values can be expressed in decimal or fractional format,&lt;br /&gt;
e.g., 0.1, 23.243241, 1/2, 3/4, and so on.&lt;br /&gt;
A leading 0 is mandatory for decimal numbers smaller than one &lt;br /&gt;
(e.g., the syntax .3 cannot be used as a shorthand for 0.3).&lt;br /&gt;
However, a trailing 0 is ''not'' required for decimals that are whole numbers&lt;br /&gt;
(e.g., 3. is allowed as a shorthand for 3.0).&lt;br /&gt;
The size of the numerals used in the representation of natural and rational numbers &lt;br /&gt;
is unbounded; more accurately, bounded only by the amount of available memory.&lt;br /&gt;
&lt;br /&gt;
=== Bit vectors ===&lt;br /&gt;
&lt;br /&gt;
=== Arrays ===&lt;br /&gt;
&lt;br /&gt;
The theory of arrays is a parametric theory of (total) unary maps. &lt;br /&gt;
It comes equipped with mixfix polymorphic selection and update operators, respectively&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\_[\_]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_&amp;lt;/math&amp;gt; .&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
The semantics of these operators is the expected one:&lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
if &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1 \mathrm{OF}\ T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, and&lt;br /&gt;
&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a[i]&amp;lt;/math&amp;gt; denotes the value that &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; associates to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a\ \mathrm{WITH}\ [i]\ := v&amp;lt;/math&amp;gt; denotes a map that associates &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and is otherwise identical to &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;.&lt;br /&gt;
Sequential updates can be chained with the shorthand syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_, \ldots, [\_]\ := \_&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 A: TYPE = ARRAY INT OF REAL;&lt;br /&gt;
 a: A;&lt;br /&gt;
 i: INT = 4;&lt;br /&gt;
 &lt;br /&gt;
 % selection:&lt;br /&gt;
 &lt;br /&gt;
 elem: REAL = a[i];&lt;br /&gt;
 &lt;br /&gt;
 % update&lt;br /&gt;
 &lt;br /&gt;
 a1: A = a WITH [10] := 1/2;&lt;br /&gt;
 &lt;br /&gt;
 % sequential update &lt;br /&gt;
 % (syntactic sugar for (a WITH [10] := 2/3) WITH [42] := 3/2)&lt;br /&gt;
 &lt;br /&gt;
 a2: A = a WITH [10] := 2/3, [42] := 3/2;&lt;br /&gt;
&lt;br /&gt;
Since arrays are just maps, equality between them is extensional, that is, &lt;br /&gt;
for two arrays of the same type to be different they have to map at least one&lt;br /&gt;
index to differ values.&lt;br /&gt;
&lt;br /&gt;
=== Data types ===&lt;br /&gt;
&lt;br /&gt;
The theory of inductive data types is in fact a family of theories parametrized &lt;br /&gt;
by a data type declaration specifying constructors and selectors &lt;br /&gt;
for one or more user-defined data types.&lt;br /&gt;
&lt;br /&gt;
No built-in operators other than equality and disequality are provided &lt;br /&gt;
for this family in the native language. &lt;br /&gt;
Each user-provided data type declaration, however, generates constructor, selector and tester operators &lt;br /&gt;
as described in the [[#Inductive Data Types | Inductive Data Types]] section.&lt;br /&gt;
&lt;br /&gt;
=== Tuples and Records ===&lt;br /&gt;
&lt;br /&gt;
Semantically both records and tuples can be seen as special instances &lt;br /&gt;
of inductive data types.&lt;br /&gt;
CVC4 implements them internally indeed as data types.&lt;br /&gt;
In essence, a record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt;&lt;br /&gt;
is encoded as a data type of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
 \mathrm{DATATYPE} \\&lt;br /&gt;
 \ \ \mathrm{Record} = \mathit{rec}(l_0:T_0, \ldots, l_n:T_n) \\&lt;br /&gt;
 \mathrm{END};&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tuples of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; are in turn special cases of records whose field names are &lt;br /&gt;
the numerals from &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Externally, tuples and records have their own syntax for constructor and selector operators.&lt;br /&gt;
* Records of type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; have the associated  record constructor &amp;lt;math&amp;gt;(\#\ l_0 := \_,\; \ldots,\; l_n := \_\ \#)&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Tuples of type &amp;lt;math&amp;gt;[\ T_0, \ldots, T_n\ ]&amp;lt;/math&amp;gt; have the associated tuple constructor &amp;lt;math&amp;gt;(\ \_,\; \ldots,\; \_\ )&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The selector operators on records and tuples follows a dot notation syntax.&lt;br /&gt;
&lt;br /&gt;
 % Record construction and field selection&lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x: Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 k: INT = x.key;&lt;br /&gt;
 v: REAL = x.weight;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple construction and projection&lt;br /&gt;
 y: [REAL, INT, REAL] = ( 4/5, 9, 11/9 );&lt;br /&gt;
 first_elem: REAL = y.0;&lt;br /&gt;
 third_elem: REAL = y.2;&lt;br /&gt;
&lt;br /&gt;
Differently from data types, records and tuples are also provided with built-in update operators similar in syntax and semantics to the update operator for arrays. &lt;br /&gt;
More precisely, for each record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; and&lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\_\ \mathrm{WITH}\ .l_i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator maps a record &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; of that type and a value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; &lt;br /&gt;
of type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; to the record that stores &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in field &amp;lt;math&amp;gt;l_i&amp;lt;/math&amp;gt; &lt;br /&gt;
and is otherwise identical to &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;. &lt;br /&gt;
Analogously, for each tuple type &amp;lt;math&amp;gt;[T_0, \ldots, T_n]&amp;lt;/math&amp;gt; and &lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \_\ \mathrm{WITH}\ .i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with similar semantics.&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = x WITH .weight := 48;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = y WITH .1 := 3; &lt;br /&gt;
 &lt;br /&gt;
 Updates to a nested component can be combined in a single WITH operator:&lt;br /&gt;
 &lt;br /&gt;
 Cache: TYPE = ARRAY [0..100] OF [# addr: INT, data: REAL #];&lt;br /&gt;
 State: TYPE = [# pc: INT, cache: Cache #];&lt;br /&gt;
 &lt;br /&gt;
 s0: State;&lt;br /&gt;
 s1: State = s0 WITH .cache[10].data := 2/3;&lt;br /&gt;
&lt;br /&gt;
Note that, differently from updates on arrays, tuple and record updates are &lt;br /&gt;
just additional syntactic sugar. &lt;br /&gt;
For instance, the record &amp;lt;code&amp;gt;x1&amp;lt;/code&amp;gt; and tuple &amp;lt;code&amp;gt;y1&amp;lt;/code&amp;gt; defined above &lt;br /&gt;
could have been equivalently defined as follows:&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = (# key := x.key,  weight := 48 #);&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = ( y.0, 3, y.1 );&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to declarations of types and function symbols, &lt;br /&gt;
the CVC4 native language contains the following commands:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ASSERT}\ F&amp;lt;/math&amp;gt; -- Add the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; to the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
* [[#CHECKSAT|&amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is satisfiable in the current logical context (&amp;lt;math&amp;gt;\Gamma \not\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{CONTINUE}&amp;lt;/math&amp;gt; -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, search for a counter-example different from the current one.&lt;br /&gt;
* [[#COUNTEREXAMPLE|&amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print the context that is a witness for invalidity/satisfiability.&lt;br /&gt;
* [[#COUNTERMODEL|&amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print a model that makes the formula invalid/satisfiable. The model is provided in terms of concrete values for each free symbol.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{OPTION}\ o\ v&amp;lt;/math&amp;gt; -- Set the command-line option flag &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; to value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The argument &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; is provide as a string literal enclosed in double-quotes and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; as an integer value.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; -- Equivalent to &amp;lt;math&amp;gt;\mathrm{POPTO}\ 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* [[#POPTO|&amp;lt;math&amp;gt;\mathrm{POPTO}\ n&amp;lt;/math&amp;gt;]] -- Restore the system to the state it was in right before the most recent call to &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; made from stack level &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. Note that the current stack level is printed as part of the output of the &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; command.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; -- Save (checkpoint) the current state of the system.&lt;br /&gt;
* [[#QUERY|&amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is valid in the current logical context (&amp;lt;math&amp;gt;\Gamma\models_T F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* [[#RESTART|&amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, repeat the check but with the additional assumption &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; in the context.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PRINT}\ t&amp;lt;/math&amp;gt; -- Parse and print back the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRANSFORM}\ t&amp;lt;/math&amp;gt; -- Simplify the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and print the result.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; -- Print all the formulas in the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The remaining commands take a single argument, given as a string literal enclosed in double-quotes.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ECHO}\ s&amp;lt;/math&amp;gt; -- Print string &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{INCLUDE}\ f&amp;lt;/math&amp;gt; -- Read commands from file &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRACE}\ f&amp;lt;/math&amp;gt; -- Turn on tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{UNTRACE}\ f&amp;lt;/math&amp;gt; -- Turn off tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we explain some of the above commands in more detail.&lt;br /&gt;
&lt;br /&gt;
=== QUERY ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; invokes the core functionality of CVC4 to check &lt;br /&gt;
the validity of the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; with respect to the assertions made thus far,&lt;br /&gt;
which constitute the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;. &lt;br /&gt;
The argument &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; must be well typed term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;,&lt;br /&gt;
as described in [[#Terms and Formulas | Terms and Formulas]].&lt;br /&gt;
&lt;br /&gt;
The execution of this command always terminates and produces one of three possible answers: &lt;br /&gt;
&amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* A &amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;. After a query returning such an answer, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is exactly as it was before the query.&lt;br /&gt;
* An &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \not\models_T F&amp;lt;/math&amp;gt;, that is, there is a model of the background theory &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Gamma \cup \{\mathrm{NOT}\ F\}&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; returns &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is augmented with a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of ground (i.e., variable-free) literals such that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but &amp;lt;math&amp;gt;\Gamma\cup\Delta\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;. In fact, in this case &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; ''propositionally entails'' &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;, in the sense that, every truth assignment to the literals of &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; falsifies &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;. We call the new context &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; a ''counterexample'' for &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
* An &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; answer is similar to an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer in that additional literals are added to the context which propositionally entail &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;. The difference in this case is that CVC4 cannot guarantee that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is actually satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
CVC4 may report &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; when the context or the query contains&lt;br /&gt;
non-linear arithmetic terms or quantifiers.&lt;br /&gt;
In all other cases, it is expected to be sound and complete, &lt;br /&gt;
i.e., to report &amp;lt;code&amp;gt;Valid&amp;lt;/code&amp;gt; if &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;&lt;br /&gt;
and &amp;lt;code&amp;gt;Invalid&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
After an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; (resp. &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;) answer,&lt;br /&gt;
counterexamples (resp. possible counterexamples) can be obtained with &lt;br /&gt;
a &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
or &amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt; command. &lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
WHERE always prints out all of &amp;lt;math&amp;gt;\Gamma\cup C&amp;lt;/math&amp;gt;. COUNTEREXAMPLE may sometimes be more selective, printing a subset of those formulas from the context which are sufficient for a counterexample.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; command may modify &lt;br /&gt;
the current context, if one needs to check several formulas in a row &lt;br /&gt;
in the same context, it is a good idea to surround every &lt;br /&gt;
query by a &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; invocation&lt;br /&gt;
in order to preserve the context:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
&lt;br /&gt;
=== CHECKSAT ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt; behaves identically &lt;br /&gt;
to &amp;lt;math&amp;gt;\mathrm{QUERY}\ \mathrm{NOT}\ F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== RESTART ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt; can only be invoked after an invalid query. &lt;br /&gt;
For example, in an interactive setting:&lt;br /&gt;
&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
 CVC4&amp;gt; invalid&lt;br /&gt;
 &lt;br /&gt;
 RESTART &amp;lt;formula2&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
Functionally, the behavior of the above command sequence is identical to the following:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
 ASSERT &amp;lt;formula2&amp;gt;;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
The advantage of using the &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; command is that &lt;br /&gt;
the first command sequence may be executed much more efficiently that the second.&lt;br /&gt;
The reason is that with &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; CVC4 will re-use&lt;br /&gt;
what it has learned while answering the previous query rather than starting &lt;br /&gt;
over from scratch.&lt;br /&gt;
&lt;br /&gt;
=== COUNTERMODEL ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== COUNTEREXAMPLE ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== POPTO ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
== Instantiation Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVC4 processes each universally quantified formula in the current context &lt;br /&gt;
by adding instances of the formula obtained by replacing its universal variables &lt;br /&gt;
with ground terms. &lt;br /&gt;
Patterns restrict the choice of ground terms for the quantified variables, &lt;br /&gt;
with the goal of controlling the potential explosion of ground instances. &lt;br /&gt;
In essence, adding patterns to a formula is a way for the user to tell CVC4 &lt;br /&gt;
to focus only on certain instances which, in the user's opinion, will be &lt;br /&gt;
most helpful during a proof.&lt;br /&gt;
&lt;br /&gt;
In more detail, patterns have the following effect on formulas that are found &lt;br /&gt;
in the logical context or get added to it later while CVC4 is trying to prove &lt;br /&gt;
the validity of some formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If a formula in the current context starts with an existential quantifier, &lt;br /&gt;
CVC4 ''Skolemizes'' it, that is, replaces it in the context with the formula &lt;br /&gt;
obtained by substituting the existentially quantified variables &lt;br /&gt;
by fresh constants and dropping the quantifier. &lt;br /&gt;
Any patterns for the existential quantifier are simply ignored.&lt;br /&gt;
&lt;br /&gt;
If a formula starts with a universal quantifier &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{FORALL}\; (x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt;, &lt;br /&gt;
CVC4 adds to the context a number of instances of the formula, &lt;br /&gt;
with the goal of using them to prove the query &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; valid. &lt;br /&gt;
An instance is obtained by replacing each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; with a ground term&lt;br /&gt;
of the same type occurring in one of the formulas in the context, &lt;br /&gt;
and dropping the universal quantifier. &lt;br /&gt;
If &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; occurs in a pattern &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{PATTERN}\; (t_1, \ldots, t_m)&amp;lt;/math&amp;gt; for the quantifier, &lt;br /&gt;
it will be instantiated only with terms obtained by simultaneously matching &lt;br /&gt;
all the terms in the pattern against ground terms in the current context &lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Specifically, the matching process produces one or more substitutions &lt;br /&gt;
&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; for the variables in &amp;lt;math&amp;gt;(t_1, \ldots, t_m)&amp;lt;/math&amp;gt; &lt;br /&gt;
which satisfy the following invariant: &lt;br /&gt;
for each &amp;lt;math&amp;gt;i = 1, \ldots, m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\sigma(t_i)&amp;lt;/math&amp;gt; is &lt;br /&gt;
a ground term and there is a ground term &amp;lt;math&amp;gt;s_i&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
such that &amp;lt;math&amp;gt;\Gamma \models_T \sigma(t_i) = s_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
The variables of &amp;lt;math&amp;gt;(x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt; that occur &lt;br /&gt;
in the pattern are instantiated only with those substitutions &lt;br /&gt;
(while any remaining variables are instantiated arbitrarily).&lt;br /&gt;
&lt;br /&gt;
The Skolemized version or the added instances of a context formula may themselves &lt;br /&gt;
start with a quantifier. &lt;br /&gt;
The same instantiation process is applied to them too, recursively.&lt;br /&gt;
&lt;br /&gt;
Note that the matching mechanism is not limited to syntactic matching &lt;br /&gt;
but is modulo the equations asserted in the context. &lt;br /&gt;
Because of decidability and/or efficiency limitations, the matching process &lt;br /&gt;
is not exhaustive. &lt;br /&gt;
CVC4 will typically miss some substitutions that satisfy the invariant above. &lt;br /&gt;
As a consequence, it might fail to prove the validity of the query formula &lt;br /&gt;
&amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;, which makes CVC4 incomplete for contexts containing &lt;br /&gt;
quantified formulas. &lt;br /&gt;
It should be noted though that exhaustive matching, which can be achieved &lt;br /&gt;
simply by not specifying any patterns, does not yield completeness anyway &lt;br /&gt;
since the instantiation of universal variables is still restricted &lt;br /&gt;
to just the ground terms in the context,&lt;br /&gt;
whereas in general additional ground terms might be needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 == Subtypes ==&lt;br /&gt;
&lt;br /&gt;
=== Subtype Checking ===&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3933</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3933"/>
				<updated>2012-11-27T18:36:05Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* CVC4's native input language */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's input languages=&lt;br /&gt;
&lt;br /&gt;
CVC4 accepts its input in one of the following languages:&lt;br /&gt;
&lt;br /&gt;
* [[CVC4's native language ]]&lt;br /&gt;
* SMT-LIB v2&lt;br /&gt;
* SMT-LIB v1&lt;br /&gt;
&lt;br /&gt;
The input language can be set via the command line &lt;br /&gt;
&lt;br /&gt;
=CVC4's native input language=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The native input language consists of a sequence of symbol declarations and commands, each followed by a semicolon (&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Any text after the first occurrence of a percent character and to the end of the current line is a comment:&lt;br /&gt;
&lt;br /&gt;
 %%% This is a native language comment&lt;br /&gt;
&lt;br /&gt;
== Type System ==&lt;br /&gt;
&lt;br /&gt;
CVC4's type system includes a set of built-in types which can be expanded with additional user-defined types.&lt;br /&gt;
&lt;br /&gt;
The type system consists of ''first-order'' types, ''subtypes'' of first-order types, and ''higher-order'' types,  all of which are interpreted as sets. &lt;br /&gt;
For convenience, we will sometimes identify below the interpretation of a type with the type itself.&lt;br /&gt;
&lt;br /&gt;
First-order types consist of basic types and structured types. The basic types are &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, as well as user-defined basic types (also called uninterpreted types). &lt;br /&gt;
The structured types are array, tuple, record types, and ML-style user-defined (inductive) datatypes.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Currently, subtypes consist only of the built-in subtype &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;!-- and are covered in the [[#Subtypes|Subtypes]] section. --&amp;gt;&lt;br /&gt;
Support for CVC3-style user-defined subtypes will be added in a later release.&lt;br /&gt;
&lt;br /&gt;
Function types are the only higher-order types.&lt;br /&gt;
More precisely, they are just second-order types &lt;br /&gt;
since function symbols in CVC4, both built-in and user-defined, can take as argument or return only values of &lt;br /&gt;
a first-order type.&lt;br /&gt;
&lt;br /&gt;
=== Basic Types ===&lt;br /&gt;
&lt;br /&gt;
==== The BOOLEAN Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; type is interpreted as the two-element set of Boolean values&lt;br /&gt;
&amp;lt;math&amp;gt;\{\mathrm{TRUE},\; \mathrm{FALSE}\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
'''Note:''' CVC4's treatment of this type differs from CVC3's where &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; is used only as the type of formulas, but not as value type. CVC3 follows the two-tiered structure of classical first-order logic &lt;br /&gt;
which distinguishes between formulas and terms, and allows terms to occur in formulas but not vice versa (with the exception of the IF-THEN-ELSE construct).&lt;br /&gt;
CVC4 drops the distinction between terms and formulas and defines the latter just as terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. As such, formulas can occur as subterms of possibly non-Boolean terms.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 [To do]&lt;br /&gt;
&lt;br /&gt;
==== The REAL Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; type is interpreted as the set of real numbers.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical reals,&lt;br /&gt;
not the floating point numbers.&lt;br /&gt;
Support for floating point types is planned for future versions.&lt;br /&gt;
&lt;br /&gt;
 x, y : REAL;&lt;br /&gt;
 QUERY (( x &amp;lt;= y ) AND ( y &amp;lt;= x )) =&amp;gt; ( x = y );&lt;br /&gt;
&lt;br /&gt;
==== The INT Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; type is interpreted as the set of integer numbers&lt;br /&gt;
and is considered as a subtype of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The latter means in particular that it is possible to mix integer and real terms &lt;br /&gt;
in expressions without the need of an explicit ''upcasting'' operator.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical integers,&lt;br /&gt;
not the finite precision machine integers used in most programming languages. &lt;br /&gt;
The latter are models by [[ #Bitvectors | bit vector ]] types.&lt;br /&gt;
&lt;br /&gt;
 x, y : INT;&lt;br /&gt;
 QUERY ((2 * x + 4 * y &amp;lt;= 1) AND ( y &amp;gt;= x)) =&amp;gt; (x &amp;lt;= 0);&lt;br /&gt;
 z : REAL;&lt;br /&gt;
 QUERY (2 * x + z &amp;lt;= 3.5) AND (z &amp;gt;= 1);&lt;br /&gt;
&lt;br /&gt;
==== Bit Vector Types ====&lt;br /&gt;
&lt;br /&gt;
For every positive integer &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, the type &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; is interpreted as the set of all bit vectors of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
A rich set of bit vector operators is supported.&lt;br /&gt;
&lt;br /&gt;
==== User-defined Basic Types ====&lt;br /&gt;
&lt;br /&gt;
Users can define new basic types &lt;br /&gt;
(often referred to as ''uninterpreted'' types in the SMT literature).&lt;br /&gt;
Each such type is interpreted as a set of unspecified cardinality &lt;br /&gt;
but disjoint from any other type. &lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Can we specify cardinalities? &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
User-defined basic types are created by declarations like the following:&lt;br /&gt;
&lt;br /&gt;
 % User declarations of basic types:&lt;br /&gt;
 &lt;br /&gt;
 MyBrandNewType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 Apples, Oranges: TYPE;&lt;br /&gt;
&lt;br /&gt;
=== Structured Types ===&lt;br /&gt;
&lt;br /&gt;
CVC4's structured types are divided in the following families. &lt;br /&gt;
&lt;br /&gt;
==== Array Types ====&lt;br /&gt;
&lt;br /&gt;
Array types are created by the mixfix type constructors &amp;lt;math&amp;gt;\mathrm{ARRAY}\ \_\ \mathrm{OF}\ \_&amp;lt;/math&amp;gt; &lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 I : TYPE;&lt;br /&gt;
 &lt;br /&gt;
 %% Array types:&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with indices from I and values from REAL&lt;br /&gt;
 Array1: TYPE = ARRAY I OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer indices and array values &lt;br /&gt;
 Array2: TYPE = ARRAY INT OF (ARRAY INT OF REAL);&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer pair indices and integer values&lt;br /&gt;
 IntMatrix: TYPE = ARRAY [INT, INT] OF INT;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
An array type of the form &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1\ \mathrm{OF}\ T_2&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the set of all total maps from &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
The main difference with the function type &amp;lt;math&amp;gt;T_1 \to T_2&amp;lt;/math&amp;gt; is that arrays, &lt;br /&gt;
contrary to functions, are first-class objects of the language, that is, values of an array&lt;br /&gt;
type can be arguments or results of functions. &lt;br /&gt;
Furthermore, array types come equipped with an update operation.&lt;br /&gt;
&lt;br /&gt;
==== Tuple Types ====&lt;br /&gt;
&lt;br /&gt;
Tuple types are created by the mixfix type constructors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l} [\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ \ ,\ \_\ ] \\[1ex] \ldots \end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 IntArray: TYPE = ARRAY INT OF INT;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple type declarations&lt;br /&gt;
 &lt;br /&gt;
 RealPair: TYPE = [REAL, REAL]&lt;br /&gt;
 &lt;br /&gt;
 MyTuple: TYPE = [ REAL, IntArray, [INT, INT] ];&lt;br /&gt;
&lt;br /&gt;
A tuple type of the form &amp;lt;math&amp;gt;[T_1, \ldots, T_n]&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Note that while the types &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and &lt;br /&gt;
&amp;lt;math&amp;gt;[T_1 \times \cdots \times T_n] \to T&amp;lt;/math&amp;gt; are semantically equivalent, &lt;br /&gt;
they are operationally different in CVC4. &lt;br /&gt;
The first is the type of functions that take &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; arguments &lt;br /&gt;
of respective type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;T_n&amp;lt;/math&amp;gt;, &lt;br /&gt;
while the second is the type of functions that take one argument of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-tuple type.&lt;br /&gt;
&lt;br /&gt;
==== Record Types ====&lt;br /&gt;
&lt;br /&gt;
Similar to, but more general than tuple types, record types are created by type constructors of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
[\#\ l_1: \_\ ,\ \ldots\ ,\ l_n: \_\ \#]&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;l_1,\ldots, l_n&amp;lt;/math&amp;gt; are field labels, &lt;br /&gt;
and the arguments can be instantiated with any first-order types.&lt;br /&gt;
&lt;br /&gt;
 MyType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 % Record declaration&lt;br /&gt;
 &lt;br /&gt;
 RecordType: TYPE = [# id: REAL, age: INT, info: MyType #];&lt;br /&gt;
&lt;br /&gt;
The order of the fields in a record type is meaningful: &lt;br /&gt;
permuting the field names gives a different type. &lt;br /&gt;
&lt;br /&gt;
Note that record types are non-recursive. &lt;br /&gt;
For instance, it is not possible to declare a record type called &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt; containing &lt;br /&gt;
a field of type &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt;. &lt;br /&gt;
Recursive types are provided in CVC4 by the more general inductive data types.&lt;br /&gt;
(As a matter of fact, both record and tuple types are implemented internally as inductive data types.)&lt;br /&gt;
&lt;br /&gt;
==== Inductive Data Types ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inductive data types in CVC4 are similar to inductive data types of functional languages.&lt;br /&gt;
They can be parametric or not.&lt;br /&gt;
&lt;br /&gt;
===== Non-Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Non-parametric data types are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE} \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1 &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2 &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
Such declarations define the data types &amp;lt;math&amp;gt;A_1, \ldots, A_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
For each data type &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; they introduce:&lt;br /&gt;
&lt;br /&gt;
* constructor symbols &amp;lt;math&amp;gt;cons&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;(T_1, \ldots, T_k) \to \mathit{type\_name}_i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* selector symbols &amp;lt;math&amp;gt;\mathit{sel}_j&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to T_j&amp;lt;/math&amp;gt;, and&lt;br /&gt;
* tester symbols &amp;lt;math&amp;gt;\mathit{is\_cons}&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that permitting more than one data type to be defined in the same declarations allows &lt;br /&gt;
the definition of mutually recursive types.&lt;br /&gt;
&lt;br /&gt;
 % simple enumeration type&lt;br /&gt;
 &lt;br /&gt;
 % implicitly defined are the testers: is_red, is_yellow and is_blue&lt;br /&gt;
 % (similarly for the other data types)&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   PrimaryColor = red | yellow | blue&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % infinite set of pairwise distinct values ..., v(-1), v(0), v(1), ...&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Id = v (id: INT)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % ML-style integer lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   IntList = nil | ins (head: INT, tail: IntList)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % AST for lamba calculus&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Term = var (index: INT)&lt;br /&gt;
        | apply (arg_1: Term, arg_2: Term)&lt;br /&gt;
        | lambda (arg: INT, body: Term)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Trees&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Tree = tree (value: REAL, children: TreeList),&lt;br /&gt;
   TreeList = nil_tl&lt;br /&gt;
            | ins_tl (first_t1: Tree, rest_t1: TreeList)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
Constructor, selector and tester symbols defined for a data type have global scope. &lt;br /&gt;
So, for example, it is not possible for two different data types to use &lt;br /&gt;
the same name for a constructor.&lt;br /&gt;
&lt;br /&gt;
An inductive data type is interpreted as a term algebra constructed by the constructor symbols &lt;br /&gt;
over some sets of generators. &lt;br /&gt;
For example, the type &amp;lt;code&amp;gt;IntList&amp;lt;/code&amp;gt; defined above is interpreted as the set &lt;br /&gt;
of all terms constructed with &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ins&amp;lt;/code&amp;gt; over the integers.&lt;br /&gt;
&lt;br /&gt;
===== Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Parametric data types are infinite families of (non-parametric) data types &lt;br /&gt;
with each family parametrized by one or more type variables.&lt;br /&gt;
They are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE}  \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1[X_{1,1}, \ldots, X_{1,p_1}] &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2[X_{2,1}, \ldots, X_{2,p_2}] &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n[X_{n,1}, \ldots, X_{n,p_n}] &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name parametrized by the type variables &amp;lt;math&amp;gt;X_{i,1}, \ldots, X_{i,p_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, &lt;br /&gt;
possibly parametrized by &amp;lt;math&amp;gt;X_1, \ldots, X_p&amp;lt;/math&amp;gt;, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 % Parametric pairs&lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Pair[X, Y] = pair (first: X, second: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 % Parametric lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Parametric trees using the list type above&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   Tree[X] = node (value: X, children: List[Tree[X]]),&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
The declarations above define infinitely many types of the form &lt;br /&gt;
Pair[S,T], List[T] and Tree[T] where S and T are first-order types.&lt;br /&gt;
Note that the identifier &amp;lt;code&amp;gt;List&amp;lt;/code&amp;gt; above, for example, by itself does not denote a type.&lt;br /&gt;
In contrast, the terms &amp;lt;code&amp;gt;List[Real]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[List[Real]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[Tree[INT]]&amp;lt;/code&amp;gt;,&lt;br /&gt;
and so on do.&lt;br /&gt;
&lt;br /&gt;
===== Restriction to Inductive Types =====&lt;br /&gt;
&lt;br /&gt;
By adopting a term algebra semantics, CVC4 allows only ''inductive'' data types, &lt;br /&gt;
that is, data types whose values are essentially (labeled, ordered) finite trees. &lt;br /&gt;
Infinite structures such as streams or even finite but cyclic ones &lt;br /&gt;
such as circular lists are then excluded. &lt;br /&gt;
For instance, none of the following declarations define inductive data types, &lt;br /&gt;
and are rejected by CVC4:&lt;br /&gt;
&lt;br /&gt;
 DATATYPE&lt;br /&gt;
  IntStream = s (first:INT, rest: IntStream)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
  RationalTree = node1 (child: RationalTree)&lt;br /&gt;
               | node2 (left_child: RationalTree, right_child:RationalTree)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   T1 =  c1 (s1: T2),&lt;br /&gt;
   T2 =  c2 (s2: T1)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
In concrete, a declaration of &amp;lt;math&amp;gt;n \geq 1&amp;lt;/math&amp;gt; datatypes &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; will be rejected if for any one of the types &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;, it is impossible to build a finite term of that type using only the constructors of &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; and free constants of type other than &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Inductive data types are the only types where the user also chooses names for the built-in operations to:&lt;br /&gt;
&lt;br /&gt;
* construct a value of the type (with the constructors),&lt;br /&gt;
* extract components from a value (with the selectors), or&lt;br /&gt;
* check if a value was constructed with a certain constructor or not (with the testers).&lt;br /&gt;
&lt;br /&gt;
For all the other types, CVC4 provides predefined names for the built-in operations on the type.&lt;br /&gt;
&lt;br /&gt;
=== Function Types ===&lt;br /&gt;
&lt;br /&gt;
Function (&amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt;) types are created by the mixfix type constructors&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\_ \to \_ \\[1ex] (\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] (\ \_\ ,\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] \ldots &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
whose arguments can be instantiated by any first-order type.&lt;br /&gt;
&lt;br /&gt;
 % Function type declarations&lt;br /&gt;
 &lt;br /&gt;
 UnaryFunType: TYPE = INT -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 BinaryFunType: TYPE = (REAL, REAL) -&amp;gt; ARRAY REAL OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 TernaryFunType: TYPE = (REAL, BITVECTOR(4), INT) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
A function type of the form &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; is interpreted as the set of all ''total'' functions from the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The example above also shows how to introduce type names. &lt;br /&gt;
A name like &amp;lt;code&amp;gt;UnaryFunType&amp;lt;/code&amp;gt; above is just an abbreviation for the type &amp;lt;math&amp;gt;\mathrm{INT} \to \mathrm{REAL}&amp;lt;/math&amp;gt; and can be used interchangeably with it.&lt;br /&gt;
&lt;br /&gt;
In general, any type defined by a type expression &amp;lt;code&amp;gt;E&amp;lt;/code&amp;gt; can be given a name with the declaration:&lt;br /&gt;
&lt;br /&gt;
 name : TYPE = E;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Type Checking ===&lt;br /&gt;
&lt;br /&gt;
In CVC4, formulas and terms are statically typed at the level of types &lt;br /&gt;
(as opposed to subtypes) according to the usual rules of first-order many-sorted logic,&lt;br /&gt;
with the main difference that formulas are just terms of type &amp;lt;math&amp;gt;BOOLEAN&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* each variable has one associated first-order type,&lt;br /&gt;
* each constant symbol has one or more associated first-order types,&lt;br /&gt;
* each function symbol has one or more associated function types,&lt;br /&gt;
* the type of a term consisting just of a variable is the type associated to that variable,&lt;br /&gt;
* the type of a term consisting just of a constant symbol is the type associated to that constant symbol,&lt;br /&gt;
* the term obtained by applying a function symbol &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; to the terms &amp;lt;math&amp;gt;t_1, \ldots, t_n&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and each &amp;lt;math&amp;gt;t_i&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Attempting to enter an ill-typed term will result in an error.&lt;br /&gt;
&lt;br /&gt;
Another significant difference with standard many-sorted logic is that &lt;br /&gt;
some built-in symbols are parametrically polymorphic. &lt;br /&gt;
For instance, the function symbol for extracting the element of any array has &lt;br /&gt;
type &amp;lt;math&amp;gt;(\mathit{ARRAY}\ T_1\ \mathit{OF}\ T_2,\; T_1) \to T_2&amp;lt;/math&amp;gt; &lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1, T_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Type Ascription ====&lt;br /&gt;
&lt;br /&gt;
By the type inference rules above some terms might have more than one type.&lt;br /&gt;
This can happen with terms built with polymorphic data type constructors&lt;br /&gt;
that have more than one return type for the same input type.&lt;br /&gt;
In that case, a type ascription operator (&amp;lt;code&amp;gt;::&amp;lt;/code&amp;gt;) must be applied &lt;br /&gt;
to the constructor to specify the intended return type.&lt;br /&gt;
&lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = cons(1, nil::List[REAL]);&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Union[X, Y] = left(val_l: X) | right(val_r: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = left::Union[BOOLEAN, REAL](TRUE);&lt;br /&gt;
&lt;br /&gt;
The constant symbol &amp;lt;math&amp;gt;\mathrm{nil}&amp;lt;/math&amp;gt; declared above has infinitely many types &lt;br /&gt;
(&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{REAL}]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{List}[\mathrm{BOOLEAN}]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[[\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;, ...)&lt;br /&gt;
CVC4's type checker requires the user to indicate explicitly the type &lt;br /&gt;
of each occurrence of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; in a term. &lt;br /&gt;
Similarly, &lt;br /&gt;
the injection operator &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; has infinitely many return types &lt;br /&gt;
for the same input type, for instance:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{REAL}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, [\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
and so on.&lt;br /&gt;
Applications of &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; need to specify the intended returned typed, as shown above.&lt;br /&gt;
&lt;br /&gt;
== Terms and Formulas ==&lt;br /&gt;
&lt;br /&gt;
In addition to type expressions, CVC4 has expressions for terms and for formulas &lt;br /&gt;
(i.e., terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;). &lt;br /&gt;
By and large, these are standard first-order terms built out of typed variables, &lt;br /&gt;
predefined theory-specific operators, free (i.e., user-defined) function symbols, &lt;br /&gt;
and quantifiers. &lt;br /&gt;
Extensions include an if-then-else operator, lambda abstractions, and local symbol &lt;br /&gt;
declarations, as illustrated below. &lt;br /&gt;
Note that these extensions still keep CVC4's language first-order. &lt;br /&gt;
In particular, lambda abstractions are restricted to take and return only terms of &lt;br /&gt;
a first-order type. &lt;br /&gt;
Similarly, variables can only be of a first-order type.&lt;br /&gt;
&lt;br /&gt;
A number of built-in function symbols (for instance, the arithmetic ones) are used &lt;br /&gt;
as infix operators. All user-defined symbols are used as prefix ones.&lt;br /&gt;
&lt;br /&gt;
User-defined, i.e., free, function symbols include ''constant symbols'' and &lt;br /&gt;
''predicate symbols'', respectively  nullary function symbols and function symbols &lt;br /&gt;
with a &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; return type. &lt;br /&gt;
These symbols are introduced with global declarations of the form &lt;br /&gt;
&amp;lt;math&amp;gt; f_1, \ldots, f_m: T;&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;f_i&amp;lt;/math&amp;gt; are the names of the symbols and &lt;br /&gt;
&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is their type:&lt;br /&gt;
&lt;br /&gt;
 % integer constants&lt;br /&gt;
 &lt;br /&gt;
 a, b, c: INT;&lt;br /&gt;
 &lt;br /&gt;
 % real constants&lt;br /&gt;
 &lt;br /&gt;
 x, y, z: REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function&lt;br /&gt;
 &lt;br /&gt;
 f1: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % binary function&lt;br /&gt;
 &lt;br /&gt;
 f2: (REAL, INT) -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function with a tuple argument&lt;br /&gt;
 &lt;br /&gt;
 f3: [INT, REAL] -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % binary predicate&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, REAL) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % Propositional &amp;quot;variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 P, Q; BOOLEAN;&lt;br /&gt;
&lt;br /&gt;
Like type declarations, function symbol declarations like the above have global scope &lt;br /&gt;
and must be unique. &lt;br /&gt;
In other words, it is not possible to declare a function symbol globally more than once&lt;br /&gt;
in the same lexical scope. &lt;br /&gt;
This entails among other things that globally-defined free symbols cannot be overloaded &lt;br /&gt;
with different types and that theory symbols cannot be redeclared globally as free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Global symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
As with types, a function symbol can be defined as the name of another term &lt;br /&gt;
of the corresponding type. &lt;br /&gt;
With constant symbols, this is done with a declaration of the form &amp;lt;math&amp;gt;f:T = t;&amp;lt;/math&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
 c: INT;&lt;br /&gt;
 &lt;br /&gt;
 i: INT = 5 + 3*c;  % i is effectively a shorthand for 5 + 3*c&lt;br /&gt;
 &lt;br /&gt;
 j: REAL = 3/4;&lt;br /&gt;
 &lt;br /&gt;
 t: [REAL, INT] = (2/3, -4);&lt;br /&gt;
 &lt;br /&gt;
 r: [# key: INT, value: REAL #] = (# key := 4, value := (c + 1)/2 #);&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN = FORALL (x:INT): x &amp;lt;= 0 OR x &amp;gt; c ;&lt;br /&gt;
&lt;br /&gt;
A restriction on constants of type &amp;lt;math&amp;gt;\mathit{BOOLEAN}&amp;lt;/math&amp;gt; is that their value &lt;br /&gt;
can only be a closed formula, that is, a formula with no free variables.&lt;br /&gt;
&lt;br /&gt;
A term and its name can be used interchangeably in later expressions. &lt;br /&gt;
Named terms are often useful for shared subterms (terms used several times in different places) &lt;br /&gt;
since their use can make the input exponentially more concise. &lt;br /&gt;
Named terms are processed very efficiently by CVC4. &lt;br /&gt;
It is much more efficient to associate a complex term with a name directly rather than &lt;br /&gt;
to declare a constant and later assert that it is equal to the same term. &lt;br /&gt;
This point is explained in more detail later in section [[Commands | Commands]].&lt;br /&gt;
&lt;br /&gt;
More generally, in CVC4 one can associate a term to function symbols of any arity. &lt;br /&gt;
For non-constant function symbols this is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;f:(T_1, \ldots, T_n) \to T = \mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t\;;&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is any term of type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; with free variables &lt;br /&gt;
in &amp;lt;math&amp;gt;\{x_1, \ldots, x_n\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The lambda binder has the usual semantics and conforms to the usual lexical scoping rules: &lt;br /&gt;
within the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; the declaration of the symbols &amp;lt;math&amp;gt;x_1, \ldots, x_n&amp;lt;/math&amp;gt; &lt;br /&gt;
as local variables of respective type &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; hides any previous&lt;br /&gt;
declarations of those symbols that are in scope.&lt;br /&gt;
&lt;br /&gt;
As a general shorthand, when &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; consecutive types &lt;br /&gt;
&amp;lt;math&amp;gt;T_i, \ldots, T_{i+k-1}&amp;lt;/math&amp;gt;  in the lambda expression &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t&amp;lt;/math&amp;gt; are identical, the syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x_i,\ldots, x_{i+k-1}:T_i,\ldots, x:T_n): t&amp;lt;/math&amp;gt;&lt;br /&gt;
can also be used.&lt;br /&gt;
&lt;br /&gt;
 % Global declaration of x as a unary function symbol&lt;br /&gt;
 &lt;br /&gt;
 x: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Local declarations of x as variable (hiding the global one)&lt;br /&gt;
 &lt;br /&gt;
 f: REAL -&amp;gt; REAL = LAMBDA (x: REAL): 2*x + 3;&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, INT) -&amp;gt; BOOLEAN = LAMBDA (x,i: INT): i*x - 1 &amp;gt; 0;&lt;br /&gt;
 &lt;br /&gt;
 g: (REAL, INT) -&amp;gt; [REAL, INT] = LAMBDA (x: REAL, i:INT): (x + 1, i - 3);&lt;br /&gt;
&lt;br /&gt;
Note that lambda definitions are not recursive: &lt;br /&gt;
the symbol being defined cannot occur in the body of the lambda term.&lt;br /&gt;
They should be understood as macros.&lt;br /&gt;
For instance, any occurrence of the term &amp;lt;math&amp;gt;f(t)&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; is as defined above will be treated &lt;br /&gt;
as if it was the term &amp;lt;math&amp;gt;(2*t + 3)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Local symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
Constant and function symbols can also be declared locally anywhere within a term &lt;br /&gt;
by means of a let binder. &lt;br /&gt;
This is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f = t \ \mathrm{IN}\ t' ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is a term with no free variables, possibly a lambda term.&lt;br /&gt;
Let binders can be nested arbitrarily and follow the usual lexical scoping rules.&lt;br /&gt;
The following general form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1, f_2 = t_2, \ldots, f_n = t_m \ \mathrm{IN}\ t ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
can be use above can used as a shorthand for&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1\ \mathrm{IN}\ &lt;br /&gt;
 \mathrm{LET}\ f_2 = t_2\ \mathrm{IN}\ &lt;br /&gt;
 \ldots \ &lt;br /&gt;
 \mathrm{LET}\ f_n = t_m \ \mathrm{IN}\ t ;&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL =&lt;br /&gt;
   LET x1 = 42,&lt;br /&gt;
       g = LAMBDA(x:INT): x + 1,&lt;br /&gt;
       x2 = 2*x1 + 7/2&lt;br /&gt;
   IN&lt;br /&gt;
      (LET x3 = g(x1) IN x3 + x2) / x1;&lt;br /&gt;
&lt;br /&gt;
Note that the same symbol = is used, unambiguously, in the syntax of global declarations, &lt;br /&gt;
let declarations, and as a predicate symbol.&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
A &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; term with a multiple symbols defines them sequentially.&lt;br /&gt;
A parallel version of the &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; construct will be introduced in a later version.&lt;br /&gt;
&lt;br /&gt;
== Built-in theories and their symbols ==&lt;br /&gt;
&lt;br /&gt;
In addition to user-defined symbols, CVC4 terms can use a number of predefined symbols: &lt;br /&gt;
the logical symbols, such as &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, etc., &lt;br /&gt;
as well as theory symbols, function symbols belonging to one of the built-in theories. &lt;br /&gt;
They are described next, with the theory symbols grouped by theory.&lt;br /&gt;
&lt;br /&gt;
=== Logical Symbols ===&lt;br /&gt;
&lt;br /&gt;
The logical symbols in CVC4's language include &lt;br /&gt;
the equality and disequality predicate symbols, respectively written as = and /=, &lt;br /&gt;
the multiarity disequality symbol &amp;lt;math&amp;gt;\mathrm{DISTINCT}&amp;lt;/math&amp;gt;, &lt;br /&gt;
together with the logical constants &amp;lt;math&amp;gt;\mathrm{TRUE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{FALSE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
the connectives &amp;lt;math&amp;gt;\mathrm{NOT}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{XOR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt;, and &lt;br /&gt;
the first-order quantifiers &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt;, &lt;br /&gt;
all with the standard many-sorted logic semantics.&lt;br /&gt;
&lt;br /&gt;
The binary connectives have infix syntax and type &lt;br /&gt;
&amp;lt;math&amp;gt;(\mathrm{BOOLEAN},\mathrm{BOOLEAN}) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The symbols = and /=, which are also infix, are instead parametrically polymorphic, &lt;br /&gt;
having type &amp;lt;math&amp;gt;(T,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
They are interpreted respectively as the identity relation and its complement.&lt;br /&gt;
&lt;br /&gt;
The DISTINCT symbol is both overloaded and polymorphic. &lt;br /&gt;
It has type &amp;lt;math&amp;gt;(T,...,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every sequence &amp;lt;math&amp;gt;(T,...,T)&amp;lt;/math&amp;gt; of length &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; &lt;br /&gt;
and first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
For each &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, it is interpreted as the relation &lt;br /&gt;
that holds exactly for tuples of pairwise distinct elements.&lt;br /&gt;
&lt;br /&gt;
The syntax for quantifiers is similar to that of the lambda binder.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a formula built just of these logical symbols and variables:&lt;br /&gt;
&lt;br /&gt;
 A, B: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 q: BOOLEAN = FORALL (x,y: A, i,j,k: B): &lt;br /&gt;
                i = j AND i /= k =&amp;gt; EXISTS (z: A): x /= z OR z /= y;&lt;br /&gt;
&lt;br /&gt;
Binding and scoping of quantified variables follows the same rules as &lt;br /&gt;
in let expressions. &lt;br /&gt;
In particular, a quantifier will shadow in its scope any constant and function symbols&lt;br /&gt;
with the same name as one of the variables it quantifies:&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 i, j: INT;&lt;br /&gt;
 &lt;br /&gt;
 % The first occurrence of i and of j in f are constant symbols,&lt;br /&gt;
 % the others are variables.&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN =  i = j AND FORALL (i,j: A): i = j OR i /= j;&lt;br /&gt;
&lt;br /&gt;
Optionally, it is also possible to specify instantiation patterns &lt;br /&gt;
for quantified variables. &lt;br /&gt;
The general syntax for a quantified formula &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; with patterns is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Q\;(x_1:T_1, \ldots, x_k:T_k):\; p_1: \ldots\; p_n:\; \varphi&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; is &lt;br /&gt;
either &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\varphi&amp;lt;/math&amp;gt; is a term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &lt;br /&gt;
and each of the &amp;lt;math&amp;gt;p_i&amp;lt;/math&amp;gt;'s, &lt;br /&gt;
a pattern for the quantifier &amp;lt;math&amp;gt;Q\;(x_1:T_1, \ldots, x_k:T_k)&amp;lt;/math&amp;gt;, has the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{PATTERN}\; (t_1, \ldots, t_m)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;t_1, \ldots, t_m&amp;lt;/math&amp;gt; are &lt;br /&gt;
arbitrary binder-free terms (no lets, no quantifiers). &lt;br /&gt;
Those terms can contain (free) variables, typically, but not exclusively, &lt;br /&gt;
drawn from &amp;lt;math&amp;gt;x_1, \ldots, x_k&amp;lt;/math&amp;gt;. &lt;br /&gt;
(Additional variables can occur if &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; occurs in a bigger formula &lt;br /&gt;
binding those variables.)&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 b, c: A;&lt;br /&gt;
 p, q: A -&amp;gt; BOOLEAN;&lt;br /&gt;
 r: (A, A) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x0, x1, x2: A):&lt;br /&gt;
          PATTERN (r(x0, x1), r(x1, x2)): &lt;br /&gt;
          (r(x0, x1) AND r(x1, x2)) =&amp;gt; r(x0, x2) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x: A):&lt;br /&gt;
          PATTERN (r(x, b)): &lt;br /&gt;
          PATTERN (r(x, c)): &lt;br /&gt;
          p(x) =&amp;gt; q(x) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT EXISTS (y: A):&lt;br /&gt;
          FORALL (x: A):&lt;br /&gt;
            PATTERN (r(x, y), p(y)): &lt;br /&gt;
            r(x, y) =&amp;gt; q(x) ;&lt;br /&gt;
&lt;br /&gt;
Patterns have no logical meaning: &lt;br /&gt;
adding them to a formula does not change its semantics. &lt;br /&gt;
Their purpose is purely operational, as explained in &lt;br /&gt;
the [[#Instantiation Patterns | Instantiation Patterns]] section.&lt;br /&gt;
&lt;br /&gt;
In addition to these constructs, CVC4 also has a general mixfix conditional operator &lt;br /&gt;
of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{IF}\ b\ \mathrm{THEN}\ t\ \mathrm{ELSIF}\ b_1\ \mathrm{THEN}\ t_1\ \ldots\ \mathrm{ELSIF}\ b_n\ \mathrm{THEN}\ t_n\ \mathrm{ELSE}\ t_{n+1}\ \mathrm{ENDIF}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt; where &lt;br /&gt;
&amp;lt;math&amp;gt;b, b_1, \ldots, b_n&amp;lt;/math&amp;gt; are terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; and&lt;br /&gt;
&amp;lt;math&amp;gt;t, t_1, \ldots, t_n, t_{n+1}&amp;lt;/math&amp;gt; are terms of the same first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 % Conditional term&lt;br /&gt;
 x, y, z, w: REAL;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL = &lt;br /&gt;
   IF x &amp;gt; 0 THEN y&lt;br /&gt;
   ELSIF x &amp;gt;= 1 THEN z&lt;br /&gt;
   ELSIF x &amp;gt; 2 THEN w&lt;br /&gt;
   ELSE 2/3 ENDIF;&lt;br /&gt;
&lt;br /&gt;
=== User-defined Functions and Types ===&lt;br /&gt;
&lt;br /&gt;
The theory of user-defined functions,also know in the SMT literature as &lt;br /&gt;
the theory ''Equality over Uninterpreted Functions'', or ''EUF'', is in effect &lt;br /&gt;
a family of theories of equality parametrized by the basic types and the free symbols &lt;br /&gt;
a user can define during a run of CVC4.&lt;br /&gt;
&lt;br /&gt;
This theory has no built-in symbols (other than the logical ones).&lt;br /&gt;
Its types consist of ''all and only'' the user-defined types.&lt;br /&gt;
Its function symbols consist of ''all and only'' the user-defined free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
The real arithmetic theory has two types:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{INTEGER}&amp;lt;/math&amp;gt;&lt;br /&gt;
with the latter a subtype of the first.&lt;br /&gt;
Its built-in symbols for the usual arithmetic constants &lt;br /&gt;
and operators over the type &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, each with the expected type: &lt;br /&gt;
all numerals 0, 1, ..., as well as - (both unary and binary), +, *, /, &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=. &lt;br /&gt;
Application of the binary symbols are in infix form.&lt;br /&gt;
Note that + is only binary, and so an expression such as +4 is ill-formed.&lt;br /&gt;
&lt;br /&gt;
Rational values can be expressed in decimal or fractional format,&lt;br /&gt;
e.g., 0.1, 23.243241, 1/2, 3/4, and so on.&lt;br /&gt;
A leading 0 is mandatory for decimal numbers smaller than one &lt;br /&gt;
(e.g., the syntax .3 cannot be used as a shorthand for 0.3).&lt;br /&gt;
However, a trailing 0 is ''not'' required for decimals that are whole numbers&lt;br /&gt;
(e.g., 3. is allowed as a shorthand for 3.0).&lt;br /&gt;
The size of the numerals used in the representation of natural and rational numbers &lt;br /&gt;
is unbounded; more accurately, bounded only by the amount of available memory.&lt;br /&gt;
&lt;br /&gt;
=== Bit vectors ===&lt;br /&gt;
&lt;br /&gt;
=== Arrays ===&lt;br /&gt;
&lt;br /&gt;
The theory of arrays is a parametric theory of (total) unary maps. &lt;br /&gt;
It comes equipped with mixfix polymorphic selection and update operators, respectively&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\_[\_]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_&amp;lt;/math&amp;gt; .&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
The semantics of these operators is the expected one:&lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
if &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1 \mathrm{OF}\ T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, and&lt;br /&gt;
&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a[i]&amp;lt;/math&amp;gt; denotes the value that &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; associates to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a\ \mathrm{WITH}\ [i]\ := v&amp;lt;/math&amp;gt; denotes a map that associates &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and is otherwise identical to &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;.&lt;br /&gt;
Sequential updates can be chained with the shorthand syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_, \ldots, [\_]\ := \_&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 A: TYPE = ARRAY INT OF REAL;&lt;br /&gt;
 a: A;&lt;br /&gt;
 i: INT = 4;&lt;br /&gt;
 &lt;br /&gt;
 % selection:&lt;br /&gt;
 &lt;br /&gt;
 elem: REAL = a[i];&lt;br /&gt;
 &lt;br /&gt;
 % update&lt;br /&gt;
 &lt;br /&gt;
 a1: A = a WITH [10] := 1/2;&lt;br /&gt;
 &lt;br /&gt;
 % sequential update &lt;br /&gt;
 % (syntactic sugar for (a WITH [10] := 2/3) WITH [42] := 3/2)&lt;br /&gt;
 &lt;br /&gt;
 a2: A = a WITH [10] := 2/3, [42] := 3/2;&lt;br /&gt;
&lt;br /&gt;
Since arrays are just maps, equality between them is extensional, that is, &lt;br /&gt;
for two arrays of the same type to be different they have to map at least one&lt;br /&gt;
index to differ values.&lt;br /&gt;
&lt;br /&gt;
=== Data types ===&lt;br /&gt;
&lt;br /&gt;
The theory of inductive data types is in fact a family of theories parametrized &lt;br /&gt;
by a data type declaration specifying constructors and selectors &lt;br /&gt;
for one or more user-defined data types.&lt;br /&gt;
&lt;br /&gt;
No built-in operators other than equality and disequality are provided &lt;br /&gt;
for this family in the native language. &lt;br /&gt;
Each user-provided data type declaration, however, generates constructor, selector and tester operators &lt;br /&gt;
as described in the [[#Inductive Data Types | Inductive Data Types]] section.&lt;br /&gt;
&lt;br /&gt;
=== Tuples and Records ===&lt;br /&gt;
&lt;br /&gt;
Semantically both records and tuples can be seen as special instances &lt;br /&gt;
of inductive data types.&lt;br /&gt;
CVC4 implements them internally indeed as data types.&lt;br /&gt;
In essence, a record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt;&lt;br /&gt;
is encoded as a data type of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
 \mathrm{DATATYPE} \\&lt;br /&gt;
 \ \ \mathrm{Record} = \mathit{rec}(l_0:T_0, \ldots, l_n:T_n) \\&lt;br /&gt;
 \mathrm{END};&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tuples of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; are in turn special cases of records whose field names are &lt;br /&gt;
the numerals from &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Externally, tuples and records have their own syntax for constructor and selector operators.&lt;br /&gt;
* Records of type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; have the associated  record constructor &amp;lt;math&amp;gt;(\#\ l_0 := \_,\; \ldots,\; l_n := \_\ \#)&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Tuples of type &amp;lt;math&amp;gt;[\ T_0, \ldots, T_n\ ]&amp;lt;/math&amp;gt; have the associated tuple constructor &amp;lt;math&amp;gt;(\ \_,\; \ldots,\; \_\ )&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The selector operators on records and tuples follows a dot notation syntax.&lt;br /&gt;
&lt;br /&gt;
 % Record construction and field selection&lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x: Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 k: INT = x.key;&lt;br /&gt;
 v: REAL = x.weight;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple construction and projection&lt;br /&gt;
 y: [REAL, INT, REAL] = ( 4/5, 9, 11/9 );&lt;br /&gt;
 first_elem: REAL = y.0;&lt;br /&gt;
 third_elem: REAL = y.2;&lt;br /&gt;
&lt;br /&gt;
Differently from data types, records and tuples are also provided with built-in update operators similar in syntax and semantics to the update operator for arrays. &lt;br /&gt;
More precisely, for each record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; and&lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\_\ \mathrm{WITH}\ .l_i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator maps a record &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; of that type and a value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; &lt;br /&gt;
of type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; to the record that stores &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in field &amp;lt;math&amp;gt;l_i&amp;lt;/math&amp;gt; &lt;br /&gt;
and is otherwise identical to &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;. &lt;br /&gt;
Analogously, for each tuple type &amp;lt;math&amp;gt;[T_0, \ldots, T_n]&amp;lt;/math&amp;gt; and &lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \_\ \mathrm{WITH}\ .i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with similar semantics.&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = x WITH .weight := 48;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = y WITH .1 := 3; &lt;br /&gt;
 &lt;br /&gt;
 Updates to a nested component can be combined in a single WITH operator:&lt;br /&gt;
 &lt;br /&gt;
 Cache: TYPE = ARRAY [0..100] OF [# addr: INT, data: REAL #];&lt;br /&gt;
 State: TYPE = [# pc: INT, cache: Cache #];&lt;br /&gt;
 &lt;br /&gt;
 s0: State;&lt;br /&gt;
 s1: State = s0 WITH .cache[10].data := 2/3;&lt;br /&gt;
&lt;br /&gt;
Note that, differently from updates on arrays, tuple and record updates are &lt;br /&gt;
just additional syntactic sugar. &lt;br /&gt;
For instance, the record &amp;lt;code&amp;gt;x1&amp;lt;/code&amp;gt; and tuple &amp;lt;code&amp;gt;y1&amp;lt;/code&amp;gt; defined above &lt;br /&gt;
could have been equivalently defined as follows:&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = (# key := x.key,  weight := 48 #);&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = ( y.0, 3, y.1 );&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to declarations of types and function symbols, &lt;br /&gt;
the CVC4 native language contains the following commands:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ASSERT}\ F&amp;lt;/math&amp;gt; -- Add the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; to the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
* [[#CHECKSAT|&amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is satisfiable in the current logical context (&amp;lt;math&amp;gt;\Gamma \not\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{CONTINUE}&amp;lt;/math&amp;gt; -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, search for a counter-example different from the current one.&lt;br /&gt;
* [[#COUNTEREXAMPLE|&amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print the context that is a witness for invalidity/satisfiability.&lt;br /&gt;
* [[#COUNTERMODEL|&amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print a model that makes the formula invalid/satisfiable. The model is provided in terms of concrete values for each free symbol.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{OPTION}\ o\ v&amp;lt;/math&amp;gt; -- Set the command-line option flag &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; to value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The argument &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; is provide as a string literal enclosed in double-quotes and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; as an integer value.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; -- Equivalent to &amp;lt;math&amp;gt;\mathrm{POPTO}\ 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* [[#POPTO|&amp;lt;math&amp;gt;\mathrm{POPTO}\ n&amp;lt;/math&amp;gt;]] -- Restore the system to the state it was in right before the most recent call to &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; made from stack level &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. Note that the current stack level is printed as part of the output of the &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; command.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; -- Save (checkpoint) the current state of the system.&lt;br /&gt;
* [[#QUERY|&amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is valid in the current logical context (&amp;lt;math&amp;gt;\Gamma\models_T F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* [[#RESTART|&amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, repeat the check but with the additional assumption &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; in the context.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PRINT}\ t&amp;lt;/math&amp;gt; -- Parse and print back the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRANSFORM}\ t&amp;lt;/math&amp;gt; -- Simplify the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and print the result.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; -- Print all the formulas in the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The remaining commands take a single argument, given as a string literal enclosed in double-quotes.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ECHO}\ s&amp;lt;/math&amp;gt; -- Print string &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{INCLUDE}\ f&amp;lt;/math&amp;gt; -- Read commands from file &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRACE}\ f&amp;lt;/math&amp;gt; -- Turn on tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{UNTRACE}\ f&amp;lt;/math&amp;gt; -- Turn off tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we explain some of the above commands in more detail.&lt;br /&gt;
&lt;br /&gt;
=== QUERY ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; invokes the core functionality of CVC4 to check &lt;br /&gt;
the validity of the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; with respect to the assertions made thus far,&lt;br /&gt;
which constitute the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;. &lt;br /&gt;
The argument &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; must be well typed term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;,&lt;br /&gt;
as described in [[#Terms and Formulas | Terms and Formulas]].&lt;br /&gt;
&lt;br /&gt;
The execution of this command always terminates and produces one of three possible answers: &lt;br /&gt;
&amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* A &amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;. After a query returning such an answer, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is exactly as it was before the query.&lt;br /&gt;
* An &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \not\models_T F&amp;lt;/math&amp;gt;, that is, there is a model of the background theory &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Gamma \cup \{\mathrm{NOT}\ F\}&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; returns &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is augmented with a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of ground (i.e., variable-free) literals such that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but &amp;lt;math&amp;gt;\Gamma\cup\Delta\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;. In fact, in this case &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; ''propositionally entails'' &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;, in the sense that, every truth assignment to the literals of &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; falsifies &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;. We call the new context &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; a ''counterexample'' for &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
* An &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; answer is similar to an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer in that additional literals are added to the context which propositionally entail &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;. The difference in this case is that CVC4 cannot guarantee that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is actually satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
CVC4 may report &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; when the context or the query contains&lt;br /&gt;
non-linear arithmetic terms or quantifiers.&lt;br /&gt;
In all other cases, it is expected to be sound and complete, &lt;br /&gt;
i.e., to report &amp;lt;code&amp;gt;Valid&amp;lt;/code&amp;gt; if &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;&lt;br /&gt;
and &amp;lt;code&amp;gt;Invalid&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
After an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; (resp. &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;) answer,&lt;br /&gt;
counterexamples (resp. possible counterexamples) can be obtained with &lt;br /&gt;
a &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
or &amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt; command. &lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
WHERE always prints out all of &amp;lt;math&amp;gt;\Gamma\cup C&amp;lt;/math&amp;gt;. COUNTEREXAMPLE may sometimes be more selective, printing a subset of those formulas from the context which are sufficient for a counterexample.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; command may modify &lt;br /&gt;
the current context, if one needs to check several formulas in a row &lt;br /&gt;
in the same context, it is a good idea to surround every &lt;br /&gt;
query by a &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; invocation&lt;br /&gt;
in order to preserve the context:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
&lt;br /&gt;
=== CHECKSAT ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt; behaves identically &lt;br /&gt;
to &amp;lt;math&amp;gt;\mathrm{QUERY}\ \mathrm{NOT}\ F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== RESTART ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt; can only be invoked after an invalid query. &lt;br /&gt;
For example, in an interactive setting:&lt;br /&gt;
&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
 CVC4&amp;gt; invalid&lt;br /&gt;
 &lt;br /&gt;
 RESTART &amp;lt;formula2&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
Functionally, the behavior of the above command sequence is identical to the following:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
 ASSERT &amp;lt;formula2&amp;gt;;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
The advantage of using the &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; command is that &lt;br /&gt;
the first command sequence may be executed much more efficiently that the second.&lt;br /&gt;
The reason is that with &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; CVC4 will re-use&lt;br /&gt;
what it has learned while answering the previous query rather than starting &lt;br /&gt;
over from scratch.&lt;br /&gt;
&lt;br /&gt;
=== COUNTERMODEL ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== COUNTEREXAMPLE ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== POPTO ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
== Instantiation Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVC4 processes each universally quantified formula in the current context &lt;br /&gt;
by adding instances of the formula obtained by replacing its universal variables &lt;br /&gt;
with ground terms. &lt;br /&gt;
Patterns restrict the choice of ground terms for the quantified variables, &lt;br /&gt;
with the goal of controlling the potential explosion of ground instances. &lt;br /&gt;
In essence, adding patterns to a formula is a way for the user to tell CVC4 &lt;br /&gt;
to focus only on certain instances which, in the user's opinion, will be &lt;br /&gt;
most helpful during a proof.&lt;br /&gt;
&lt;br /&gt;
In more detail, patterns have the following effect on formulas that are found &lt;br /&gt;
in the logical context or get added to it later while CVC4 is trying to prove &lt;br /&gt;
the validity of some formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If a formula in the current context starts with an existential quantifier, &lt;br /&gt;
CVC4 ''Skolemizes'' it, that is, replaces it in the context with the formula &lt;br /&gt;
obtained by substituting the existentially quantified variables &lt;br /&gt;
by fresh constants and dropping the quantifier. &lt;br /&gt;
Any patterns for the existential quantifier are simply ignored.&lt;br /&gt;
&lt;br /&gt;
If a formula starts with a universal quantifier &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{FORALL}\; (x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt;, &lt;br /&gt;
CVC4 adds to the context a number of instances of the formula, &lt;br /&gt;
with the goal of using them to prove the query &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; valid. &lt;br /&gt;
An instance is obtained by replacing each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; with a ground term&lt;br /&gt;
of the same type occurring in one of the formulas in the context, &lt;br /&gt;
and dropping the universal quantifier. &lt;br /&gt;
If &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; occurs in a pattern &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{PATTERN}\; (t_1, \ldots, t_m)&amp;lt;/math&amp;gt; for the quantifier, &lt;br /&gt;
it will be instantiated only with terms obtained by simultaneously matching &lt;br /&gt;
all the terms in the pattern against ground terms in the current context &lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Specifically, the matching process produces one or more substitutions &lt;br /&gt;
&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; for the variables in &amp;lt;math&amp;gt;(t_1, \ldots, t_m)&amp;lt;/math&amp;gt; &lt;br /&gt;
which satisfy the following invariant: &lt;br /&gt;
for each &amp;lt;math&amp;gt;i = 1, \ldots, m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\sigma(t_i)&amp;lt;/math&amp;gt; is &lt;br /&gt;
a ground term and there is a ground term &amp;lt;math&amp;gt;s_i&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
such that &amp;lt;math&amp;gt;\Gamma \models_T \sigma(t_i) = s_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
The variables of &amp;lt;math&amp;gt;(x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt; that occur &lt;br /&gt;
in the pattern are instantiated only with those substitutions &lt;br /&gt;
(while any remaining variables are instantiated arbitrarily).&lt;br /&gt;
&lt;br /&gt;
The Skolemized version or the added instances of a context formula may themselves &lt;br /&gt;
start with a quantifier. &lt;br /&gt;
The same instantiation process is applied to them too, recursively.&lt;br /&gt;
&lt;br /&gt;
Note that the matching mechanism is not limited to syntactic matching &lt;br /&gt;
but is modulo the equations asserted in the context. &lt;br /&gt;
Because of decidability and/or efficiency limitations, the matching process &lt;br /&gt;
is not exhaustive. &lt;br /&gt;
CVC4 will typically miss some substitutions that satisfy the invariant above. &lt;br /&gt;
As a consequence, it might fail to prove the validity of the query formula &lt;br /&gt;
&amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;, which makes CVC4 incomplete for contexts containing &lt;br /&gt;
quantified formulas. &lt;br /&gt;
It should be noted though that exhaustive matching, which can be achieved &lt;br /&gt;
simply by not specifying any patterns, does not yield completeness anyway &lt;br /&gt;
since the instantiation of universal variables is still restricted &lt;br /&gt;
to just the ground terms in the context,&lt;br /&gt;
whereas in general additional ground terms might be needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 == Subtypes ==&lt;br /&gt;
&lt;br /&gt;
=== Subtype Checking ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3932</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3932"/>
				<updated>2012-11-27T18:31:31Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Using the CVC4 binary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
Once installed, the CVC4 driver binary (&amp;quot;cvc4&amp;quot;) can be executed to directly enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's native input language=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The native input language consists of a sequence of symbol declarations and commands, each followed by a semicolon (&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Any text after the first occurrence of a percent character and to the end of the current line is a comment:&lt;br /&gt;
&lt;br /&gt;
 %%% This is a native language comment&lt;br /&gt;
&lt;br /&gt;
== Type System ==&lt;br /&gt;
&lt;br /&gt;
CVC4's type system includes a set of built-in types which can be expanded with additional user-defined types.&lt;br /&gt;
&lt;br /&gt;
The type system consists of ''first-order'' types, ''subtypes'' of first-order types, and ''higher-order'' types,  all of which are interpreted as sets. &lt;br /&gt;
For convenience, we will sometimes identify below the interpretation of a type with the type itself.&lt;br /&gt;
&lt;br /&gt;
First-order types consist of basic types and structured types. The basic types are &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, as well as user-defined basic types (also called uninterpreted types). &lt;br /&gt;
The structured types are array, tuple, record types, and ML-style user-defined (inductive) datatypes.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Currently, subtypes consist only of the built-in subtype &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;!-- and are covered in the [[#Subtypes|Subtypes]] section. --&amp;gt;&lt;br /&gt;
Support for CVC3-style user-defined subtypes will be added in a later release.&lt;br /&gt;
&lt;br /&gt;
Function types are the only higher-order types.&lt;br /&gt;
More precisely, they are just second-order types &lt;br /&gt;
since function symbols in CVC4, both built-in and user-defined, can take as argument or return only values of &lt;br /&gt;
a first-order type.&lt;br /&gt;
&lt;br /&gt;
=== Basic Types ===&lt;br /&gt;
&lt;br /&gt;
==== The BOOLEAN Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; type is interpreted as the two-element set of Boolean values&lt;br /&gt;
&amp;lt;math&amp;gt;\{\mathrm{TRUE},\; \mathrm{FALSE}\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
'''Note:''' CVC4's treatment of this type differs from CVC3's where &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; is used only as the type of formulas, but not as value type. CVC3 follows the two-tiered structure of classical first-order logic &lt;br /&gt;
which distinguishes between formulas and terms, and allows terms to occur in formulas but not vice versa (with the exception of the IF-THEN-ELSE construct).&lt;br /&gt;
CVC4 drops the distinction between terms and formulas and defines the latter just as terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. As such, formulas can occur as subterms of possibly non-Boolean terms.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 [To do]&lt;br /&gt;
&lt;br /&gt;
==== The REAL Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; type is interpreted as the set of real numbers.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical reals,&lt;br /&gt;
not the floating point numbers.&lt;br /&gt;
Support for floating point types is planned for future versions.&lt;br /&gt;
&lt;br /&gt;
 x, y : REAL;&lt;br /&gt;
 QUERY (( x &amp;lt;= y ) AND ( y &amp;lt;= x )) =&amp;gt; ( x = y );&lt;br /&gt;
&lt;br /&gt;
==== The INT Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; type is interpreted as the set of integer numbers&lt;br /&gt;
and is considered as a subtype of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The latter means in particular that it is possible to mix integer and real terms &lt;br /&gt;
in expressions without the need of an explicit ''upcasting'' operator.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical integers,&lt;br /&gt;
not the finite precision machine integers used in most programming languages. &lt;br /&gt;
The latter are models by [[ #Bitvectors | bit vector ]] types.&lt;br /&gt;
&lt;br /&gt;
 x, y : INT;&lt;br /&gt;
 QUERY ((2 * x + 4 * y &amp;lt;= 1) AND ( y &amp;gt;= x)) =&amp;gt; (x &amp;lt;= 0);&lt;br /&gt;
 z : REAL;&lt;br /&gt;
 QUERY (2 * x + z &amp;lt;= 3.5) AND (z &amp;gt;= 1);&lt;br /&gt;
&lt;br /&gt;
==== Bit Vector Types ====&lt;br /&gt;
&lt;br /&gt;
For every positive integer &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, the type &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; is interpreted as the set of all bit vectors of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
A rich set of bit vector operators is supported.&lt;br /&gt;
&lt;br /&gt;
==== User-defined Basic Types ====&lt;br /&gt;
&lt;br /&gt;
Users can define new basic types &lt;br /&gt;
(often referred to as ''uninterpreted'' types in the SMT literature).&lt;br /&gt;
Each such type is interpreted as a set of unspecified cardinality &lt;br /&gt;
but disjoint from any other type. &lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Can we specify cardinalities? &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
User-defined basic types are created by declarations like the following:&lt;br /&gt;
&lt;br /&gt;
 % User declarations of basic types:&lt;br /&gt;
 &lt;br /&gt;
 MyBrandNewType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 Apples, Oranges: TYPE;&lt;br /&gt;
&lt;br /&gt;
=== Structured Types ===&lt;br /&gt;
&lt;br /&gt;
CVC4's structured types are divided in the following families. &lt;br /&gt;
&lt;br /&gt;
==== Array Types ====&lt;br /&gt;
&lt;br /&gt;
Array types are created by the mixfix type constructors &amp;lt;math&amp;gt;\mathrm{ARRAY}\ \_\ \mathrm{OF}\ \_&amp;lt;/math&amp;gt; &lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 I : TYPE;&lt;br /&gt;
 &lt;br /&gt;
 %% Array types:&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with indices from I and values from REAL&lt;br /&gt;
 Array1: TYPE = ARRAY I OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer indices and array values &lt;br /&gt;
 Array2: TYPE = ARRAY INT OF (ARRAY INT OF REAL);&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer pair indices and integer values&lt;br /&gt;
 IntMatrix: TYPE = ARRAY [INT, INT] OF INT;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
An array type of the form &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1\ \mathrm{OF}\ T_2&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the set of all total maps from &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
The main difference with the function type &amp;lt;math&amp;gt;T_1 \to T_2&amp;lt;/math&amp;gt; is that arrays, &lt;br /&gt;
contrary to functions, are first-class objects of the language, that is, values of an array&lt;br /&gt;
type can be arguments or results of functions. &lt;br /&gt;
Furthermore, array types come equipped with an update operation.&lt;br /&gt;
&lt;br /&gt;
==== Tuple Types ====&lt;br /&gt;
&lt;br /&gt;
Tuple types are created by the mixfix type constructors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l} [\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ \ ,\ \_\ ] \\[1ex] \ldots \end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 IntArray: TYPE = ARRAY INT OF INT;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple type declarations&lt;br /&gt;
 &lt;br /&gt;
 RealPair: TYPE = [REAL, REAL]&lt;br /&gt;
 &lt;br /&gt;
 MyTuple: TYPE = [ REAL, IntArray, [INT, INT] ];&lt;br /&gt;
&lt;br /&gt;
A tuple type of the form &amp;lt;math&amp;gt;[T_1, \ldots, T_n]&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Note that while the types &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and &lt;br /&gt;
&amp;lt;math&amp;gt;[T_1 \times \cdots \times T_n] \to T&amp;lt;/math&amp;gt; are semantically equivalent, &lt;br /&gt;
they are operationally different in CVC4. &lt;br /&gt;
The first is the type of functions that take &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; arguments &lt;br /&gt;
of respective type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;T_n&amp;lt;/math&amp;gt;, &lt;br /&gt;
while the second is the type of functions that take one argument of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-tuple type.&lt;br /&gt;
&lt;br /&gt;
==== Record Types ====&lt;br /&gt;
&lt;br /&gt;
Similar to, but more general than tuple types, record types are created by type constructors of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
[\#\ l_1: \_\ ,\ \ldots\ ,\ l_n: \_\ \#]&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;l_1,\ldots, l_n&amp;lt;/math&amp;gt; are field labels, &lt;br /&gt;
and the arguments can be instantiated with any first-order types.&lt;br /&gt;
&lt;br /&gt;
 MyType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 % Record declaration&lt;br /&gt;
 &lt;br /&gt;
 RecordType: TYPE = [# id: REAL, age: INT, info: MyType #];&lt;br /&gt;
&lt;br /&gt;
The order of the fields in a record type is meaningful: &lt;br /&gt;
permuting the field names gives a different type. &lt;br /&gt;
&lt;br /&gt;
Note that record types are non-recursive. &lt;br /&gt;
For instance, it is not possible to declare a record type called &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt; containing &lt;br /&gt;
a field of type &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt;. &lt;br /&gt;
Recursive types are provided in CVC4 by the more general inductive data types.&lt;br /&gt;
(As a matter of fact, both record and tuple types are implemented internally as inductive data types.)&lt;br /&gt;
&lt;br /&gt;
==== Inductive Data Types ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inductive data types in CVC4 are similar to inductive data types of functional languages.&lt;br /&gt;
They can be parametric or not.&lt;br /&gt;
&lt;br /&gt;
===== Non-Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Non-parametric data types are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE} \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1 &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2 &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
Such declarations define the data types &amp;lt;math&amp;gt;A_1, \ldots, A_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
For each data type &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; they introduce:&lt;br /&gt;
&lt;br /&gt;
* constructor symbols &amp;lt;math&amp;gt;cons&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;(T_1, \ldots, T_k) \to \mathit{type\_name}_i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* selector symbols &amp;lt;math&amp;gt;\mathit{sel}_j&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to T_j&amp;lt;/math&amp;gt;, and&lt;br /&gt;
* tester symbols &amp;lt;math&amp;gt;\mathit{is\_cons}&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that permitting more than one data type to be defined in the same declarations allows &lt;br /&gt;
the definition of mutually recursive types.&lt;br /&gt;
&lt;br /&gt;
 % simple enumeration type&lt;br /&gt;
 &lt;br /&gt;
 % implicitly defined are the testers: is_red, is_yellow and is_blue&lt;br /&gt;
 % (similarly for the other data types)&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   PrimaryColor = red | yellow | blue&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % infinite set of pairwise distinct values ..., v(-1), v(0), v(1), ...&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Id = v (id: INT)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % ML-style integer lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   IntList = nil | ins (head: INT, tail: IntList)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % AST for lamba calculus&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Term = var (index: INT)&lt;br /&gt;
        | apply (arg_1: Term, arg_2: Term)&lt;br /&gt;
        | lambda (arg: INT, body: Term)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Trees&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Tree = tree (value: REAL, children: TreeList),&lt;br /&gt;
   TreeList = nil_tl&lt;br /&gt;
            | ins_tl (first_t1: Tree, rest_t1: TreeList)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
Constructor, selector and tester symbols defined for a data type have global scope. &lt;br /&gt;
So, for example, it is not possible for two different data types to use &lt;br /&gt;
the same name for a constructor.&lt;br /&gt;
&lt;br /&gt;
An inductive data type is interpreted as a term algebra constructed by the constructor symbols &lt;br /&gt;
over some sets of generators. &lt;br /&gt;
For example, the type &amp;lt;code&amp;gt;IntList&amp;lt;/code&amp;gt; defined above is interpreted as the set &lt;br /&gt;
of all terms constructed with &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ins&amp;lt;/code&amp;gt; over the integers.&lt;br /&gt;
&lt;br /&gt;
===== Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Parametric data types are infinite families of (non-parametric) data types &lt;br /&gt;
with each family parametrized by one or more type variables.&lt;br /&gt;
They are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE}  \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1[X_{1,1}, \ldots, X_{1,p_1}] &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2[X_{2,1}, \ldots, X_{2,p_2}] &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n[X_{n,1}, \ldots, X_{n,p_n}] &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name parametrized by the type variables &amp;lt;math&amp;gt;X_{i,1}, \ldots, X_{i,p_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, &lt;br /&gt;
possibly parametrized by &amp;lt;math&amp;gt;X_1, \ldots, X_p&amp;lt;/math&amp;gt;, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 % Parametric pairs&lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Pair[X, Y] = pair (first: X, second: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 % Parametric lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Parametric trees using the list type above&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   Tree[X] = node (value: X, children: List[Tree[X]]),&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
The declarations above define infinitely many types of the form &lt;br /&gt;
Pair[S,T], List[T] and Tree[T] where S and T are first-order types.&lt;br /&gt;
Note that the identifier &amp;lt;code&amp;gt;List&amp;lt;/code&amp;gt; above, for example, by itself does not denote a type.&lt;br /&gt;
In contrast, the terms &amp;lt;code&amp;gt;List[Real]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[List[Real]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[Tree[INT]]&amp;lt;/code&amp;gt;,&lt;br /&gt;
and so on do.&lt;br /&gt;
&lt;br /&gt;
===== Restriction to Inductive Types =====&lt;br /&gt;
&lt;br /&gt;
By adopting a term algebra semantics, CVC4 allows only ''inductive'' data types, &lt;br /&gt;
that is, data types whose values are essentially (labeled, ordered) finite trees. &lt;br /&gt;
Infinite structures such as streams or even finite but cyclic ones &lt;br /&gt;
such as circular lists are then excluded. &lt;br /&gt;
For instance, none of the following declarations define inductive data types, &lt;br /&gt;
and are rejected by CVC4:&lt;br /&gt;
&lt;br /&gt;
 DATATYPE&lt;br /&gt;
  IntStream = s (first:INT, rest: IntStream)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
  RationalTree = node1 (child: RationalTree)&lt;br /&gt;
               | node2 (left_child: RationalTree, right_child:RationalTree)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   T1 =  c1 (s1: T2),&lt;br /&gt;
   T2 =  c2 (s2: T1)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
In concrete, a declaration of &amp;lt;math&amp;gt;n \geq 1&amp;lt;/math&amp;gt; datatypes &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; will be rejected if for any one of the types &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;, it is impossible to build a finite term of that type using only the constructors of &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; and free constants of type other than &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Inductive data types are the only types where the user also chooses names for the built-in operations to:&lt;br /&gt;
&lt;br /&gt;
* construct a value of the type (with the constructors),&lt;br /&gt;
* extract components from a value (with the selectors), or&lt;br /&gt;
* check if a value was constructed with a certain constructor or not (with the testers).&lt;br /&gt;
&lt;br /&gt;
For all the other types, CVC4 provides predefined names for the built-in operations on the type.&lt;br /&gt;
&lt;br /&gt;
=== Function Types ===&lt;br /&gt;
&lt;br /&gt;
Function (&amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt;) types are created by the mixfix type constructors&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\_ \to \_ \\[1ex] (\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] (\ \_\ ,\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] \ldots &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
whose arguments can be instantiated by any first-order type.&lt;br /&gt;
&lt;br /&gt;
 % Function type declarations&lt;br /&gt;
 &lt;br /&gt;
 UnaryFunType: TYPE = INT -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 BinaryFunType: TYPE = (REAL, REAL) -&amp;gt; ARRAY REAL OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 TernaryFunType: TYPE = (REAL, BITVECTOR(4), INT) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
A function type of the form &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; is interpreted as the set of all ''total'' functions from the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The example above also shows how to introduce type names. &lt;br /&gt;
A name like &amp;lt;code&amp;gt;UnaryFunType&amp;lt;/code&amp;gt; above is just an abbreviation for the type &amp;lt;math&amp;gt;\mathrm{INT} \to \mathrm{REAL}&amp;lt;/math&amp;gt; and can be used interchangeably with it.&lt;br /&gt;
&lt;br /&gt;
In general, any type defined by a type expression &amp;lt;code&amp;gt;E&amp;lt;/code&amp;gt; can be given a name with the declaration:&lt;br /&gt;
&lt;br /&gt;
 name : TYPE = E;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Type Checking ===&lt;br /&gt;
&lt;br /&gt;
In CVC4, formulas and terms are statically typed at the level of types &lt;br /&gt;
(as opposed to subtypes) according to the usual rules of first-order many-sorted logic,&lt;br /&gt;
with the main difference that formulas are just terms of type &amp;lt;math&amp;gt;BOOLEAN&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* each variable has one associated first-order type,&lt;br /&gt;
* each constant symbol has one or more associated first-order types,&lt;br /&gt;
* each function symbol has one or more associated function types,&lt;br /&gt;
* the type of a term consisting just of a variable is the type associated to that variable,&lt;br /&gt;
* the type of a term consisting just of a constant symbol is the type associated to that constant symbol,&lt;br /&gt;
* the term obtained by applying a function symbol &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; to the terms &amp;lt;math&amp;gt;t_1, \ldots, t_n&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and each &amp;lt;math&amp;gt;t_i&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Attempting to enter an ill-typed term will result in an error.&lt;br /&gt;
&lt;br /&gt;
Another significant difference with standard many-sorted logic is that &lt;br /&gt;
some built-in symbols are parametrically polymorphic. &lt;br /&gt;
For instance, the function symbol for extracting the element of any array has &lt;br /&gt;
type &amp;lt;math&amp;gt;(\mathit{ARRAY}\ T_1\ \mathit{OF}\ T_2,\; T_1) \to T_2&amp;lt;/math&amp;gt; &lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1, T_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Type Ascription ====&lt;br /&gt;
&lt;br /&gt;
By the type inference rules above some terms might have more than one type.&lt;br /&gt;
This can happen with terms built with polymorphic data type constructors&lt;br /&gt;
that have more than one return type for the same input type.&lt;br /&gt;
In that case, a type ascription operator (&amp;lt;code&amp;gt;::&amp;lt;/code&amp;gt;) must be applied &lt;br /&gt;
to the constructor to specify the intended return type.&lt;br /&gt;
&lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = cons(1, nil::List[REAL]);&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Union[X, Y] = left(val_l: X) | right(val_r: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = left::Union[BOOLEAN, REAL](TRUE);&lt;br /&gt;
&lt;br /&gt;
The constant symbol &amp;lt;math&amp;gt;\mathrm{nil}&amp;lt;/math&amp;gt; declared above has infinitely many types &lt;br /&gt;
(&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{REAL}]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{List}[\mathrm{BOOLEAN}]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[[\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;, ...)&lt;br /&gt;
CVC4's type checker requires the user to indicate explicitly the type &lt;br /&gt;
of each occurrence of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; in a term. &lt;br /&gt;
Similarly, &lt;br /&gt;
the injection operator &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; has infinitely many return types &lt;br /&gt;
for the same input type, for instance:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{REAL}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, [\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
and so on.&lt;br /&gt;
Applications of &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; need to specify the intended returned typed, as shown above.&lt;br /&gt;
&lt;br /&gt;
== Terms and Formulas ==&lt;br /&gt;
&lt;br /&gt;
In addition to type expressions, CVC4 has expressions for terms and for formulas &lt;br /&gt;
(i.e., terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;). &lt;br /&gt;
By and large, these are standard first-order terms built out of typed variables, &lt;br /&gt;
predefined theory-specific operators, free (i.e., user-defined) function symbols, &lt;br /&gt;
and quantifiers. &lt;br /&gt;
Extensions include an if-then-else operator, lambda abstractions, and local symbol &lt;br /&gt;
declarations, as illustrated below. &lt;br /&gt;
Note that these extensions still keep CVC4's language first-order. &lt;br /&gt;
In particular, lambda abstractions are restricted to take and return only terms of &lt;br /&gt;
a first-order type. &lt;br /&gt;
Similarly, variables can only be of a first-order type.&lt;br /&gt;
&lt;br /&gt;
A number of built-in function symbols (for instance, the arithmetic ones) are used &lt;br /&gt;
as infix operators. All user-defined symbols are used as prefix ones.&lt;br /&gt;
&lt;br /&gt;
User-defined, i.e., free, function symbols include ''constant symbols'' and &lt;br /&gt;
''predicate symbols'', respectively  nullary function symbols and function symbols &lt;br /&gt;
with a &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; return type. &lt;br /&gt;
These symbols are introduced with global declarations of the form &lt;br /&gt;
&amp;lt;math&amp;gt; f_1, \ldots, f_m: T;&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;f_i&amp;lt;/math&amp;gt; are the names of the symbols and &lt;br /&gt;
&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is their type:&lt;br /&gt;
&lt;br /&gt;
 % integer constants&lt;br /&gt;
 &lt;br /&gt;
 a, b, c: INT;&lt;br /&gt;
 &lt;br /&gt;
 % real constants&lt;br /&gt;
 &lt;br /&gt;
 x, y, z: REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function&lt;br /&gt;
 &lt;br /&gt;
 f1: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % binary function&lt;br /&gt;
 &lt;br /&gt;
 f2: (REAL, INT) -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function with a tuple argument&lt;br /&gt;
 &lt;br /&gt;
 f3: [INT, REAL] -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % binary predicate&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, REAL) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % Propositional &amp;quot;variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 P, Q; BOOLEAN;&lt;br /&gt;
&lt;br /&gt;
Like type declarations, function symbol declarations like the above have global scope &lt;br /&gt;
and must be unique. &lt;br /&gt;
In other words, it is not possible to declare a function symbol globally more than once&lt;br /&gt;
in the same lexical scope. &lt;br /&gt;
This entails among other things that globally-defined free symbols cannot be overloaded &lt;br /&gt;
with different types and that theory symbols cannot be redeclared globally as free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Global symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
As with types, a function symbol can be defined as the name of another term &lt;br /&gt;
of the corresponding type. &lt;br /&gt;
With constant symbols, this is done with a declaration of the form &amp;lt;math&amp;gt;f:T = t;&amp;lt;/math&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
 c: INT;&lt;br /&gt;
 &lt;br /&gt;
 i: INT = 5 + 3*c;  % i is effectively a shorthand for 5 + 3*c&lt;br /&gt;
 &lt;br /&gt;
 j: REAL = 3/4;&lt;br /&gt;
 &lt;br /&gt;
 t: [REAL, INT] = (2/3, -4);&lt;br /&gt;
 &lt;br /&gt;
 r: [# key: INT, value: REAL #] = (# key := 4, value := (c + 1)/2 #);&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN = FORALL (x:INT): x &amp;lt;= 0 OR x &amp;gt; c ;&lt;br /&gt;
&lt;br /&gt;
A restriction on constants of type &amp;lt;math&amp;gt;\mathit{BOOLEAN}&amp;lt;/math&amp;gt; is that their value &lt;br /&gt;
can only be a closed formula, that is, a formula with no free variables.&lt;br /&gt;
&lt;br /&gt;
A term and its name can be used interchangeably in later expressions. &lt;br /&gt;
Named terms are often useful for shared subterms (terms used several times in different places) &lt;br /&gt;
since their use can make the input exponentially more concise. &lt;br /&gt;
Named terms are processed very efficiently by CVC4. &lt;br /&gt;
It is much more efficient to associate a complex term with a name directly rather than &lt;br /&gt;
to declare a constant and later assert that it is equal to the same term. &lt;br /&gt;
This point is explained in more detail later in section [[Commands | Commands]].&lt;br /&gt;
&lt;br /&gt;
More generally, in CVC4 one can associate a term to function symbols of any arity. &lt;br /&gt;
For non-constant function symbols this is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;f:(T_1, \ldots, T_n) \to T = \mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t\;;&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is any term of type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; with free variables &lt;br /&gt;
in &amp;lt;math&amp;gt;\{x_1, \ldots, x_n\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The lambda binder has the usual semantics and conforms to the usual lexical scoping rules: &lt;br /&gt;
within the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; the declaration of the symbols &amp;lt;math&amp;gt;x_1, \ldots, x_n&amp;lt;/math&amp;gt; &lt;br /&gt;
as local variables of respective type &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; hides any previous&lt;br /&gt;
declarations of those symbols that are in scope.&lt;br /&gt;
&lt;br /&gt;
As a general shorthand, when &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; consecutive types &lt;br /&gt;
&amp;lt;math&amp;gt;T_i, \ldots, T_{i+k-1}&amp;lt;/math&amp;gt;  in the lambda expression &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t&amp;lt;/math&amp;gt; are identical, the syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x_i,\ldots, x_{i+k-1}:T_i,\ldots, x:T_n): t&amp;lt;/math&amp;gt;&lt;br /&gt;
can also be used.&lt;br /&gt;
&lt;br /&gt;
 % Global declaration of x as a unary function symbol&lt;br /&gt;
 &lt;br /&gt;
 x: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Local declarations of x as variable (hiding the global one)&lt;br /&gt;
 &lt;br /&gt;
 f: REAL -&amp;gt; REAL = LAMBDA (x: REAL): 2*x + 3;&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, INT) -&amp;gt; BOOLEAN = LAMBDA (x,i: INT): i*x - 1 &amp;gt; 0;&lt;br /&gt;
 &lt;br /&gt;
 g: (REAL, INT) -&amp;gt; [REAL, INT] = LAMBDA (x: REAL, i:INT): (x + 1, i - 3);&lt;br /&gt;
&lt;br /&gt;
Note that lambda definitions are not recursive: &lt;br /&gt;
the symbol being defined cannot occur in the body of the lambda term.&lt;br /&gt;
They should be understood as macros.&lt;br /&gt;
For instance, any occurrence of the term &amp;lt;math&amp;gt;f(t)&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; is as defined above will be treated &lt;br /&gt;
as if it was the term &amp;lt;math&amp;gt;(2*t + 3)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Local symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
Constant and function symbols can also be declared locally anywhere within a term &lt;br /&gt;
by means of a let binder. &lt;br /&gt;
This is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f = t \ \mathrm{IN}\ t' ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is a term with no free variables, possibly a lambda term.&lt;br /&gt;
Let binders can be nested arbitrarily and follow the usual lexical scoping rules.&lt;br /&gt;
The following general form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1, f_2 = t_2, \ldots, f_n = t_m \ \mathrm{IN}\ t ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
can be use above can used as a shorthand for&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1\ \mathrm{IN}\ &lt;br /&gt;
 \mathrm{LET}\ f_2 = t_2\ \mathrm{IN}\ &lt;br /&gt;
 \ldots \ &lt;br /&gt;
 \mathrm{LET}\ f_n = t_m \ \mathrm{IN}\ t ;&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL =&lt;br /&gt;
   LET x1 = 42,&lt;br /&gt;
       g = LAMBDA(x:INT): x + 1,&lt;br /&gt;
       x2 = 2*x1 + 7/2&lt;br /&gt;
   IN&lt;br /&gt;
      (LET x3 = g(x1) IN x3 + x2) / x1;&lt;br /&gt;
&lt;br /&gt;
Note that the same symbol = is used, unambiguously, in the syntax of global declarations, &lt;br /&gt;
let declarations, and as a predicate symbol.&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
A &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; term with a multiple symbols defines them sequentially.&lt;br /&gt;
A parallel version of the &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; construct will be introduced in a later version.&lt;br /&gt;
&lt;br /&gt;
== Built-in theories and their symbols ==&lt;br /&gt;
&lt;br /&gt;
In addition to user-defined symbols, CVC4 terms can use a number of predefined symbols: &lt;br /&gt;
the logical symbols, such as &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, etc., &lt;br /&gt;
as well as theory symbols, function symbols belonging to one of the built-in theories. &lt;br /&gt;
They are described next, with the theory symbols grouped by theory.&lt;br /&gt;
&lt;br /&gt;
=== Logical Symbols ===&lt;br /&gt;
&lt;br /&gt;
The logical symbols in CVC4's language include &lt;br /&gt;
the equality and disequality predicate symbols, respectively written as = and /=, &lt;br /&gt;
the multiarity disequality symbol &amp;lt;math&amp;gt;\mathrm{DISTINCT}&amp;lt;/math&amp;gt;, &lt;br /&gt;
together with the logical constants &amp;lt;math&amp;gt;\mathrm{TRUE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{FALSE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
the connectives &amp;lt;math&amp;gt;\mathrm{NOT}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{XOR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt;, and &lt;br /&gt;
the first-order quantifiers &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt;, &lt;br /&gt;
all with the standard many-sorted logic semantics.&lt;br /&gt;
&lt;br /&gt;
The binary connectives have infix syntax and type &lt;br /&gt;
&amp;lt;math&amp;gt;(\mathrm{BOOLEAN},\mathrm{BOOLEAN}) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The symbols = and /=, which are also infix, are instead parametrically polymorphic, &lt;br /&gt;
having type &amp;lt;math&amp;gt;(T,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
They are interpreted respectively as the identity relation and its complement.&lt;br /&gt;
&lt;br /&gt;
The DISTINCT symbol is both overloaded and polymorphic. &lt;br /&gt;
It has type &amp;lt;math&amp;gt;(T,...,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every sequence &amp;lt;math&amp;gt;(T,...,T)&amp;lt;/math&amp;gt; of length &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; &lt;br /&gt;
and first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
For each &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, it is interpreted as the relation &lt;br /&gt;
that holds exactly for tuples of pairwise distinct elements.&lt;br /&gt;
&lt;br /&gt;
The syntax for quantifiers is similar to that of the lambda binder.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a formula built just of these logical symbols and variables:&lt;br /&gt;
&lt;br /&gt;
 A, B: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 q: BOOLEAN = FORALL (x,y: A, i,j,k: B): &lt;br /&gt;
                i = j AND i /= k =&amp;gt; EXISTS (z: A): x /= z OR z /= y;&lt;br /&gt;
&lt;br /&gt;
Binding and scoping of quantified variables follows the same rules as &lt;br /&gt;
in let expressions. &lt;br /&gt;
In particular, a quantifier will shadow in its scope any constant and function symbols&lt;br /&gt;
with the same name as one of the variables it quantifies:&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 i, j: INT;&lt;br /&gt;
 &lt;br /&gt;
 % The first occurrence of i and of j in f are constant symbols,&lt;br /&gt;
 % the others are variables.&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN =  i = j AND FORALL (i,j: A): i = j OR i /= j;&lt;br /&gt;
&lt;br /&gt;
Optionally, it is also possible to specify instantiation patterns &lt;br /&gt;
for quantified variables. &lt;br /&gt;
The general syntax for a quantified formula &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; with patterns is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Q\;(x_1:T_1, \ldots, x_k:T_k):\; p_1: \ldots\; p_n:\; \varphi&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; is &lt;br /&gt;
either &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\varphi&amp;lt;/math&amp;gt; is a term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &lt;br /&gt;
and each of the &amp;lt;math&amp;gt;p_i&amp;lt;/math&amp;gt;'s, &lt;br /&gt;
a pattern for the quantifier &amp;lt;math&amp;gt;Q\;(x_1:T_1, \ldots, x_k:T_k)&amp;lt;/math&amp;gt;, has the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{PATTERN}\; (t_1, \ldots, t_m)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;t_1, \ldots, t_m&amp;lt;/math&amp;gt; are &lt;br /&gt;
arbitrary binder-free terms (no lets, no quantifiers). &lt;br /&gt;
Those terms can contain (free) variables, typically, but not exclusively, &lt;br /&gt;
drawn from &amp;lt;math&amp;gt;x_1, \ldots, x_k&amp;lt;/math&amp;gt;. &lt;br /&gt;
(Additional variables can occur if &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; occurs in a bigger formula &lt;br /&gt;
binding those variables.)&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 b, c: A;&lt;br /&gt;
 p, q: A -&amp;gt; BOOLEAN;&lt;br /&gt;
 r: (A, A) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x0, x1, x2: A):&lt;br /&gt;
          PATTERN (r(x0, x1), r(x1, x2)): &lt;br /&gt;
          (r(x0, x1) AND r(x1, x2)) =&amp;gt; r(x0, x2) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x: A):&lt;br /&gt;
          PATTERN (r(x, b)): &lt;br /&gt;
          PATTERN (r(x, c)): &lt;br /&gt;
          p(x) =&amp;gt; q(x) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT EXISTS (y: A):&lt;br /&gt;
          FORALL (x: A):&lt;br /&gt;
            PATTERN (r(x, y), p(y)): &lt;br /&gt;
            r(x, y) =&amp;gt; q(x) ;&lt;br /&gt;
&lt;br /&gt;
Patterns have no logical meaning: &lt;br /&gt;
adding them to a formula does not change its semantics. &lt;br /&gt;
Their purpose is purely operational, as explained in &lt;br /&gt;
the [[#Instantiation Patterns | Instantiation Patterns]] section.&lt;br /&gt;
&lt;br /&gt;
In addition to these constructs, CVC4 also has a general mixfix conditional operator &lt;br /&gt;
of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{IF}\ b\ \mathrm{THEN}\ t\ \mathrm{ELSIF}\ b_1\ \mathrm{THEN}\ t_1\ \ldots\ \mathrm{ELSIF}\ b_n\ \mathrm{THEN}\ t_n\ \mathrm{ELSE}\ t_{n+1}\ \mathrm{ENDIF}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt; where &lt;br /&gt;
&amp;lt;math&amp;gt;b, b_1, \ldots, b_n&amp;lt;/math&amp;gt; are terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; and&lt;br /&gt;
&amp;lt;math&amp;gt;t, t_1, \ldots, t_n, t_{n+1}&amp;lt;/math&amp;gt; are terms of the same first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 % Conditional term&lt;br /&gt;
 x, y, z, w: REAL;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL = &lt;br /&gt;
   IF x &amp;gt; 0 THEN y&lt;br /&gt;
   ELSIF x &amp;gt;= 1 THEN z&lt;br /&gt;
   ELSIF x &amp;gt; 2 THEN w&lt;br /&gt;
   ELSE 2/3 ENDIF;&lt;br /&gt;
&lt;br /&gt;
=== User-defined Functions and Types ===&lt;br /&gt;
&lt;br /&gt;
The theory of user-defined functions,also know in the SMT literature as &lt;br /&gt;
the theory ''Equality over Uninterpreted Functions'', or ''EUF'', is in effect &lt;br /&gt;
a family of theories of equality parametrized by the basic types and the free symbols &lt;br /&gt;
a user can define during a run of CVC4.&lt;br /&gt;
&lt;br /&gt;
This theory has no built-in symbols (other than the logical ones).&lt;br /&gt;
Its types consist of ''all and only'' the user-defined types.&lt;br /&gt;
Its function symbols consist of ''all and only'' the user-defined free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
The real arithmetic theory has two types:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{INTEGER}&amp;lt;/math&amp;gt;&lt;br /&gt;
with the latter a subtype of the first.&lt;br /&gt;
Its built-in symbols for the usual arithmetic constants &lt;br /&gt;
and operators over the type &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, each with the expected type: &lt;br /&gt;
all numerals 0, 1, ..., as well as - (both unary and binary), +, *, /, &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=. &lt;br /&gt;
Application of the binary symbols are in infix form.&lt;br /&gt;
Note that + is only binary, and so an expression such as +4 is ill-formed.&lt;br /&gt;
&lt;br /&gt;
Rational values can be expressed in decimal or fractional format,&lt;br /&gt;
e.g., 0.1, 23.243241, 1/2, 3/4, and so on.&lt;br /&gt;
A leading 0 is mandatory for decimal numbers smaller than one &lt;br /&gt;
(e.g., the syntax .3 cannot be used as a shorthand for 0.3).&lt;br /&gt;
However, a trailing 0 is ''not'' required for decimals that are whole numbers&lt;br /&gt;
(e.g., 3. is allowed as a shorthand for 3.0).&lt;br /&gt;
The size of the numerals used in the representation of natural and rational numbers &lt;br /&gt;
is unbounded; more accurately, bounded only by the amount of available memory.&lt;br /&gt;
&lt;br /&gt;
=== Bit vectors ===&lt;br /&gt;
&lt;br /&gt;
=== Arrays ===&lt;br /&gt;
&lt;br /&gt;
The theory of arrays is a parametric theory of (total) unary maps. &lt;br /&gt;
It comes equipped with mixfix polymorphic selection and update operators, respectively&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\_[\_]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_&amp;lt;/math&amp;gt; .&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
The semantics of these operators is the expected one:&lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
if &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1 \mathrm{OF}\ T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, and&lt;br /&gt;
&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a[i]&amp;lt;/math&amp;gt; denotes the value that &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; associates to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a\ \mathrm{WITH}\ [i]\ := v&amp;lt;/math&amp;gt; denotes a map that associates &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and is otherwise identical to &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;.&lt;br /&gt;
Sequential updates can be chained with the shorthand syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_, \ldots, [\_]\ := \_&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 A: TYPE = ARRAY INT OF REAL;&lt;br /&gt;
 a: A;&lt;br /&gt;
 i: INT = 4;&lt;br /&gt;
 &lt;br /&gt;
 % selection:&lt;br /&gt;
 &lt;br /&gt;
 elem: REAL = a[i];&lt;br /&gt;
 &lt;br /&gt;
 % update&lt;br /&gt;
 &lt;br /&gt;
 a1: A = a WITH [10] := 1/2;&lt;br /&gt;
 &lt;br /&gt;
 % sequential update &lt;br /&gt;
 % (syntactic sugar for (a WITH [10] := 2/3) WITH [42] := 3/2)&lt;br /&gt;
 &lt;br /&gt;
 a2: A = a WITH [10] := 2/3, [42] := 3/2;&lt;br /&gt;
&lt;br /&gt;
Since arrays are just maps, equality between them is extensional, that is, &lt;br /&gt;
for two arrays of the same type to be different they have to map at least one&lt;br /&gt;
index to differ values.&lt;br /&gt;
&lt;br /&gt;
=== Data types ===&lt;br /&gt;
&lt;br /&gt;
The theory of inductive data types is in fact a family of theories parametrized &lt;br /&gt;
by a data type declaration specifying constructors and selectors &lt;br /&gt;
for one or more user-defined data types.&lt;br /&gt;
&lt;br /&gt;
No built-in operators other than equality and disequality are provided &lt;br /&gt;
for this family in the native language. &lt;br /&gt;
Each user-provided data type declaration, however, generates constructor, selector and tester operators &lt;br /&gt;
as described in the [[#Inductive Data Types | Inductive Data Types]] section.&lt;br /&gt;
&lt;br /&gt;
=== Tuples and Records ===&lt;br /&gt;
&lt;br /&gt;
Semantically both records and tuples can be seen as special instances &lt;br /&gt;
of inductive data types.&lt;br /&gt;
CVC4 implements them internally indeed as data types.&lt;br /&gt;
In essence, a record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt;&lt;br /&gt;
is encoded as a data type of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
 \mathrm{DATATYPE} \\&lt;br /&gt;
 \ \ \mathrm{Record} = \mathit{rec}(l_0:T_0, \ldots, l_n:T_n) \\&lt;br /&gt;
 \mathrm{END};&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tuples of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; are in turn special cases of records whose field names are &lt;br /&gt;
the numerals from &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Externally, tuples and records have their own syntax for constructor and selector operators.&lt;br /&gt;
* Records of type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; have the associated  record constructor &amp;lt;math&amp;gt;(\#\ l_0 := \_,\; \ldots,\; l_n := \_\ \#)&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Tuples of type &amp;lt;math&amp;gt;[\ T_0, \ldots, T_n\ ]&amp;lt;/math&amp;gt; have the associated tuple constructor &amp;lt;math&amp;gt;(\ \_,\; \ldots,\; \_\ )&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The selector operators on records and tuples follows a dot notation syntax.&lt;br /&gt;
&lt;br /&gt;
 % Record construction and field selection&lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x: Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 k: INT = x.key;&lt;br /&gt;
 v: REAL = x.weight;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple construction and projection&lt;br /&gt;
 y: [REAL, INT, REAL] = ( 4/5, 9, 11/9 );&lt;br /&gt;
 first_elem: REAL = y.0;&lt;br /&gt;
 third_elem: REAL = y.2;&lt;br /&gt;
&lt;br /&gt;
Differently from data types, records and tuples are also provided with built-in update operators similar in syntax and semantics to the update operator for arrays. &lt;br /&gt;
More precisely, for each record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; and&lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\_\ \mathrm{WITH}\ .l_i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator maps a record &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; of that type and a value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; &lt;br /&gt;
of type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; to the record that stores &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in field &amp;lt;math&amp;gt;l_i&amp;lt;/math&amp;gt; &lt;br /&gt;
and is otherwise identical to &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;. &lt;br /&gt;
Analogously, for each tuple type &amp;lt;math&amp;gt;[T_0, \ldots, T_n]&amp;lt;/math&amp;gt; and &lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \_\ \mathrm{WITH}\ .i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with similar semantics.&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = x WITH .weight := 48;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = y WITH .1 := 3; &lt;br /&gt;
 &lt;br /&gt;
 Updates to a nested component can be combined in a single WITH operator:&lt;br /&gt;
 &lt;br /&gt;
 Cache: TYPE = ARRAY [0..100] OF [# addr: INT, data: REAL #];&lt;br /&gt;
 State: TYPE = [# pc: INT, cache: Cache #];&lt;br /&gt;
 &lt;br /&gt;
 s0: State;&lt;br /&gt;
 s1: State = s0 WITH .cache[10].data := 2/3;&lt;br /&gt;
&lt;br /&gt;
Note that, differently from updates on arrays, tuple and record updates are &lt;br /&gt;
just additional syntactic sugar. &lt;br /&gt;
For instance, the record &amp;lt;code&amp;gt;x1&amp;lt;/code&amp;gt; and tuple &amp;lt;code&amp;gt;y1&amp;lt;/code&amp;gt; defined above &lt;br /&gt;
could have been equivalently defined as follows:&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = (# key := x.key,  weight := 48 #);&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = ( y.0, 3, y.1 );&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to declarations of types and function symbols, &lt;br /&gt;
the CVC4 native language contains the following commands:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ASSERT}\ F&amp;lt;/math&amp;gt; -- Add the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; to the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
* [[#CHECKSAT|&amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is satisfiable in the current logical context (&amp;lt;math&amp;gt;\Gamma \not\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{CONTINUE}&amp;lt;/math&amp;gt; -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, search for a counter-example different from the current one.&lt;br /&gt;
* [[#COUNTEREXAMPLE|&amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print the context that is a witness for invalidity/satisfiability.&lt;br /&gt;
* [[#COUNTERMODEL|&amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print a model that makes the formula invalid/satisfiable. The model is provided in terms of concrete values for each free symbol.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{OPTION}\ o\ v&amp;lt;/math&amp;gt; -- Set the command-line option flag &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; to value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The argument &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; is provide as a string literal enclosed in double-quotes and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; as an integer value.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; -- Equivalent to &amp;lt;math&amp;gt;\mathrm{POPTO}\ 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* [[#POPTO|&amp;lt;math&amp;gt;\mathrm{POPTO}\ n&amp;lt;/math&amp;gt;]] -- Restore the system to the state it was in right before the most recent call to &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; made from stack level &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. Note that the current stack level is printed as part of the output of the &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; command.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; -- Save (checkpoint) the current state of the system.&lt;br /&gt;
* [[#QUERY|&amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is valid in the current logical context (&amp;lt;math&amp;gt;\Gamma\models_T F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* [[#RESTART|&amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, repeat the check but with the additional assumption &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; in the context.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PRINT}\ t&amp;lt;/math&amp;gt; -- Parse and print back the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRANSFORM}\ t&amp;lt;/math&amp;gt; -- Simplify the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and print the result.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; -- Print all the formulas in the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The remaining commands take a single argument, given as a string literal enclosed in double-quotes.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ECHO}\ s&amp;lt;/math&amp;gt; -- Print string &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{INCLUDE}\ f&amp;lt;/math&amp;gt; -- Read commands from file &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRACE}\ f&amp;lt;/math&amp;gt; -- Turn on tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{UNTRACE}\ f&amp;lt;/math&amp;gt; -- Turn off tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we explain some of the above commands in more detail.&lt;br /&gt;
&lt;br /&gt;
=== QUERY ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; invokes the core functionality of CVC4 to check &lt;br /&gt;
the validity of the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; with respect to the assertions made thus far,&lt;br /&gt;
which constitute the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;. &lt;br /&gt;
The argument &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; must be well typed term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;,&lt;br /&gt;
as described in [[#Terms and Formulas | Terms and Formulas]].&lt;br /&gt;
&lt;br /&gt;
The execution of this command always terminates and produces one of three possible answers: &lt;br /&gt;
&amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* A &amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;. After a query returning such an answer, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is exactly as it was before the query.&lt;br /&gt;
* An &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \not\models_T F&amp;lt;/math&amp;gt;, that is, there is a model of the background theory &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Gamma \cup \{\mathrm{NOT}\ F\}&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; returns &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is augmented with a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of ground (i.e., variable-free) literals such that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but &amp;lt;math&amp;gt;\Gamma\cup\Delta\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;. In fact, in this case &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; ''propositionally entails'' &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;, in the sense that, every truth assignment to the literals of &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; falsifies &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;. We call the new context &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; a ''counterexample'' for &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
* An &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; answer is similar to an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer in that additional literals are added to the context which propositionally entail &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;. The difference in this case is that CVC4 cannot guarantee that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is actually satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
CVC4 may report &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; when the context or the query contains&lt;br /&gt;
non-linear arithmetic terms or quantifiers.&lt;br /&gt;
In all other cases, it is expected to be sound and complete, &lt;br /&gt;
i.e., to report &amp;lt;code&amp;gt;Valid&amp;lt;/code&amp;gt; if &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;&lt;br /&gt;
and &amp;lt;code&amp;gt;Invalid&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
After an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; (resp. &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;) answer,&lt;br /&gt;
counterexamples (resp. possible counterexamples) can be obtained with &lt;br /&gt;
a &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
or &amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt; command. &lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
WHERE always prints out all of &amp;lt;math&amp;gt;\Gamma\cup C&amp;lt;/math&amp;gt;. COUNTEREXAMPLE may sometimes be more selective, printing a subset of those formulas from the context which are sufficient for a counterexample.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; command may modify &lt;br /&gt;
the current context, if one needs to check several formulas in a row &lt;br /&gt;
in the same context, it is a good idea to surround every &lt;br /&gt;
query by a &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; invocation&lt;br /&gt;
in order to preserve the context:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
&lt;br /&gt;
=== CHECKSAT ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt; behaves identically &lt;br /&gt;
to &amp;lt;math&amp;gt;\mathrm{QUERY}\ \mathrm{NOT}\ F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== RESTART ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt; can only be invoked after an invalid query. &lt;br /&gt;
For example, in an interactive setting:&lt;br /&gt;
&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
 CVC4&amp;gt; invalid&lt;br /&gt;
 &lt;br /&gt;
 RESTART &amp;lt;formula2&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
Functionally, the behavior of the above command sequence is identical to the following:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
 ASSERT &amp;lt;formula2&amp;gt;;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
The advantage of using the &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; command is that &lt;br /&gt;
the first command sequence may be executed much more efficiently that the second.&lt;br /&gt;
The reason is that with &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; CVC4 will re-use&lt;br /&gt;
what it has learned while answering the previous query rather than starting &lt;br /&gt;
over from scratch.&lt;br /&gt;
&lt;br /&gt;
=== COUNTERMODEL ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== COUNTEREXAMPLE ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== POPTO ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
== Instantiation Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVC4 processes each universally quantified formula in the current context &lt;br /&gt;
by adding instances of the formula obtained by replacing its universal variables &lt;br /&gt;
with ground terms. &lt;br /&gt;
Patterns restrict the choice of ground terms for the quantified variables, &lt;br /&gt;
with the goal of controlling the potential explosion of ground instances. &lt;br /&gt;
In essence, adding patterns to a formula is a way for the user to tell CVC4 &lt;br /&gt;
to focus only on certain instances which, in the user's opinion, will be &lt;br /&gt;
most helpful during a proof.&lt;br /&gt;
&lt;br /&gt;
In more detail, patterns have the following effect on formulas that are found &lt;br /&gt;
in the logical context or get added to it later while CVC4 is trying to prove &lt;br /&gt;
the validity of some formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If a formula in the current context starts with an existential quantifier, &lt;br /&gt;
CVC4 ''Skolemizes'' it, that is, replaces it in the context with the formula &lt;br /&gt;
obtained by substituting the existentially quantified variables &lt;br /&gt;
by fresh constants and dropping the quantifier. &lt;br /&gt;
Any patterns for the existential quantifier are simply ignored.&lt;br /&gt;
&lt;br /&gt;
If a formula starts with a universal quantifier &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{FORALL}\; (x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt;, &lt;br /&gt;
CVC4 adds to the context a number of instances of the formula, &lt;br /&gt;
with the goal of using them to prove the query &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; valid. &lt;br /&gt;
An instance is obtained by replacing each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; with a ground term&lt;br /&gt;
of the same type occurring in one of the formulas in the context, &lt;br /&gt;
and dropping the universal quantifier. &lt;br /&gt;
If &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; occurs in a pattern &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{PATTERN}\; (t_1, \ldots, t_m)&amp;lt;/math&amp;gt; for the quantifier, &lt;br /&gt;
it will be instantiated only with terms obtained by simultaneously matching &lt;br /&gt;
all the terms in the pattern against ground terms in the current context &lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Specifically, the matching process produces one or more substitutions &lt;br /&gt;
&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; for the variables in &amp;lt;math&amp;gt;(t_1, \ldots, t_m)&amp;lt;/math&amp;gt; &lt;br /&gt;
which satisfy the following invariant: &lt;br /&gt;
for each &amp;lt;math&amp;gt;i = 1, \ldots, m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\sigma(t_i)&amp;lt;/math&amp;gt; is &lt;br /&gt;
a ground term and there is a ground term &amp;lt;math&amp;gt;s_i&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
such that &amp;lt;math&amp;gt;\Gamma \models_T \sigma(t_i) = s_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
The variables of &amp;lt;math&amp;gt;(x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt; that occur &lt;br /&gt;
in the pattern are instantiated only with those substitutions &lt;br /&gt;
(while any remaining variables are instantiated arbitrarily).&lt;br /&gt;
&lt;br /&gt;
The Skolemized version or the added instances of a context formula may themselves &lt;br /&gt;
start with a quantifier. &lt;br /&gt;
The same instantiation process is applied to them too, recursively.&lt;br /&gt;
&lt;br /&gt;
Note that the matching mechanism is not limited to syntactic matching &lt;br /&gt;
but is modulo the equations asserted in the context. &lt;br /&gt;
Because of decidability and/or efficiency limitations, the matching process &lt;br /&gt;
is not exhaustive. &lt;br /&gt;
CVC4 will typically miss some substitutions that satisfy the invariant above. &lt;br /&gt;
As a consequence, it might fail to prove the validity of the query formula &lt;br /&gt;
&amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;, which makes CVC4 incomplete for contexts containing &lt;br /&gt;
quantified formulas. &lt;br /&gt;
It should be noted though that exhaustive matching, which can be achieved &lt;br /&gt;
simply by not specifying any patterns, does not yield completeness anyway &lt;br /&gt;
since the instantiation of universal variables is still restricted &lt;br /&gt;
to just the ground terms in the context,&lt;br /&gt;
whereas in general additional ground terms might be needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 == Subtypes ==&lt;br /&gt;
&lt;br /&gt;
=== Subtype Checking ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Building_CVC4_from_source&amp;diff=3931</id>
		<title>Building CVC4 from source</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Building_CVC4_from_source&amp;diff=3931"/>
				<updated>2012-11-27T18:30:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To compile CVC4 from a source package you must do the following:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
Below are more details instructions about the various dependencies and options. &lt;br /&gt;
&lt;br /&gt;
=Common make Options=&lt;br /&gt;
* &amp;quot;''make install''&amp;quot; will install into the &amp;quot;--prefix&amp;quot; option you gave to&lt;br /&gt;
the configure script (''/usr/local'' by default).&lt;br /&gt;
    ./configure --prefix=~/install_targets/cvc4 ...&lt;br /&gt;
    make install&lt;br /&gt;
* '''You should run &amp;quot;''make check''&amp;quot;''' before installation to ensure that CVC4 has been&lt;br /&gt;
built correctly.  In particular, GCC version 4.5.1 seems to have a&lt;br /&gt;
bug in the optimizer that results in incorrect behavior (and wrong&lt;br /&gt;
results) in many builds.  This is a known problem for Minisat, and&lt;br /&gt;
since Minisat is at the core of CVC4, a problem for CVC4.  &amp;quot;''make check''&amp;quot;&lt;br /&gt;
easily detects this problem (by showing a number of FAILed test cases).&lt;br /&gt;
It is ok if the unit tests aren't run as part of &amp;quot;''make check''&amp;quot;, but all&lt;br /&gt;
system tests and regression tests should pass without incident.&lt;br /&gt;
* To build API documentation, use &amp;quot;''make doc''&amp;quot;.  Documentation is produced&lt;br /&gt;
under ''builds/doc/'' but is not installed by &amp;quot;''make install''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Examples and tutorials are not installed with &amp;quot;''make install''.&amp;quot;  See [[#Examples_and_tutorials_are_not_built_or_installed|below]].&lt;br /&gt;
&lt;br /&gt;
For more information about the build system itself (probably not&lt;br /&gt;
necessary for casual users), see the [[#Appendix:_Build_architecture|Appendix]] at the bottom of this&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
=Common configure Options=&lt;br /&gt;
*'''--prefix=PREFIX''' install architecture-independent files in PREFIX (by default /usr/local)&lt;br /&gt;
*'''--with-build={production,debug,default,competition}''' &lt;br /&gt;
*'''--with-antlr-dir=PATH'''&lt;br /&gt;
*'''--with-cln'''/'''--with-gmp''' selects the numbers package to use by default ([[#Optional requirements]])&lt;br /&gt;
*'''--enable-static-binary''' build a fully statically-linked binary. (This is recommended for Mac OS X users that want to be able to use gdb.)&lt;br /&gt;
*'''ANTLR=PATH''' location of the antlr3 script&lt;br /&gt;
*'''--with-boost=DIR''' installation location of the boost libraries (most users will not need this)&lt;br /&gt;
&lt;br /&gt;
See '''./configure --help''' for more.&lt;br /&gt;
&lt;br /&gt;
=Build dependencies=&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are required to run CVC4. Versions&lt;br /&gt;
given are minimum versions; more recent versions should be compatible.&lt;br /&gt;
&lt;br /&gt;
*'''GNU C and C++''' (gcc and g++), reasonably recent versions&lt;br /&gt;
*'''GNU Make'''&lt;br /&gt;
*'''GNU Bash'''&lt;br /&gt;
*'''GMP v4.2''' (GNU Multi-Precision arithmetic library)&lt;br /&gt;
*'''libantlr3c v3.2 or v3.4''' (ANTLR parser generator C support library)&lt;br /&gt;
*'''The Boost C++ base libraries'''&lt;br /&gt;
*'''MacPorts'''   [highly recommended if on a Mac; see [[#MacPorts]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardest to obtain and install is the libantlr3c requirement, and&lt;br /&gt;
is explained [[#Installing libantlr3c: ANTLR parser generator C support library|next]].&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;make&amp;quot; is non-GNU on your system, make sure to invoke &amp;quot;gmake&amp;quot; (or&lt;br /&gt;
whatever GNU Make is installed as).  If your usual shell is not Bash,&lt;br /&gt;
the configure script should auto-correct this.  If it does not, you'll&lt;br /&gt;
see strange shell syntax errors, and you may need to explicitly set&lt;br /&gt;
SHELL or CONFIG_SHELL to the location of bash on your system.&lt;br /&gt;
&lt;br /&gt;
==Installing libantlr3c: ANTLR parser generator C support library==&lt;br /&gt;
&lt;br /&gt;
For libantlr3c, you can use the convenience script in&lt;br /&gt;
''contrib/get-antlr-3.4'' in the source distribution---this will download, patch, compile and install&lt;br /&gt;
libantlr3c into your cvc4 directory as ''cvc4/antlr-3.4/''.&lt;br /&gt;
  cd contrib&lt;br /&gt;
  ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
CVC4 must be configured with the antlr library installation directory, '''--with-antlr-dir''', and an antlr executable script file, '''ANTLR'''.  If libantlr3c was installed via get-antlr-3.4, the following configure line should suffice for CVC44&lt;br /&gt;
  ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
For 64 bit machines, libantlr3c needs to be configured with 64 bit explicitly&lt;br /&gt;
  ./configure --enable-64bit ...&lt;br /&gt;
The get-antlr-3.4 script makes a guess at whether the machine is 64 bit and adds the appropriate flag.&lt;br /&gt;
To force the script to compile 32 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86&amp;quot; ./get-antlr3.4&lt;br /&gt;
To force the script to compile 64 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86_64&amp;quot; ./get-antlr3.4&lt;br /&gt;
&lt;br /&gt;
For a longer discussion, instructions for manual installation, and more in depth troubleshooting, see [[Developer's Guide#ANTLR3]].&lt;br /&gt;
&lt;br /&gt;
==MacPorts==&lt;br /&gt;
&lt;br /&gt;
On a Mac, it is '''highly''' recommended that you use MacPorts (see&lt;br /&gt;
http://www.macports.org/).  Doing so is easy.  Then, simply run the&lt;br /&gt;
script ''contrib/mac-build'', which installs a few ports from the MacPorts&lt;br /&gt;
repository, then compiles and installs antlr3c using the ''get-antlr-3.4''&lt;br /&gt;
script.  The mac-build script should set you up&lt;br /&gt;
with all requirements, and will tell you how to configure CVC4 when it&lt;br /&gt;
completes successfully.&lt;br /&gt;
&lt;br /&gt;
==Installing the Boost C++ base libraries==&lt;br /&gt;
&lt;br /&gt;
A Boost package is available on most Linux distributions; check yours&lt;br /&gt;
for a package named something like libboost-dev or boost-devel.  There&lt;br /&gt;
are a number of additional Boost packages in some distributions, but&lt;br /&gt;
this &amp;quot;basic&amp;quot; one should be sufficient for building CVC4.&lt;br /&gt;
&lt;br /&gt;
Should you want to install Boost manually, or to learn more about the&lt;br /&gt;
Boost project, please visit http://www.boost.org/.&lt;br /&gt;
&lt;br /&gt;
=Optional requirements=&lt;br /&gt;
&lt;br /&gt;
None of these is required, but can improve CVC4 as described below:&lt;br /&gt;
&lt;br /&gt;
*'''Optional: SWIG 2.0.x''' (Simplified Wrapper and Interface Generator)&lt;br /&gt;
*'''Optional: CLN v1.3 or newer''' (Class Library for Numbers)&lt;br /&gt;
*'''Optional: CUDD v2.4.2 or newer''' (Colorado University Decision Diagram package)&lt;br /&gt;
*'''Optional: GNU Readline library''' (for an improved interactive experience)&lt;br /&gt;
*'''Optional: The Boost C++ threading library''' (libboost_thread)&lt;br /&gt;
*'''Optional: CxxTest unit testing framework'''&lt;br /&gt;
&lt;br /&gt;
SWIG is necessary to build the Java API (and of course a JDK is&lt;br /&gt;
necessary, too).  SWIG 1.x won't work; you'll need 2.0, and the more&lt;br /&gt;
recent the better.  On Mac, we've seen SWIG segfault when generating&lt;br /&gt;
CVC4 language bindings; version 2.0.8 or higher is recommended to&lt;br /&gt;
avoid this.  See [[#Language_bindings|Language bindings]] below for build instructions.&lt;br /&gt;
&lt;br /&gt;
CLN is an alternative multiprecision arithmetic package that can offer&lt;br /&gt;
better performance and memory footprint than GMP.  CLN is covered by&lt;br /&gt;
the GNU General Public License, version 3; so if you choose to use&lt;br /&gt;
CVC4 with CLN support, you are licensing CVC4 under that same license.&lt;br /&gt;
(Usually CVC4's license is more permissive than GPL is; see the file&lt;br /&gt;
COPYING in the CVC4 source distribution for details.)  Please visit&lt;br /&gt;
http://www.ginac.de/CLN/ for more details about CLN.&lt;br /&gt;
&lt;br /&gt;
CUDD is a decision diagram package that changes the behavior of the&lt;br /&gt;
CVC4 arithmetic solver in some cases; it may or may not improve the&lt;br /&gt;
arithmetic solver's performance.  See [[#Building_with_CUDD_(optional)|below]] for instructions on&lt;br /&gt;
obtaining and building CUDD.&lt;br /&gt;
&lt;br /&gt;
The GNU Readline library is optionally used to provide command&lt;br /&gt;
editing, tab completion, and history functionality at the CVC prompt&lt;br /&gt;
(when running in interactive mode).  Check your distribution for a&lt;br /&gt;
package named &amp;quot;libreadline-dev&amp;quot; or &amp;quot;readline-devel&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
The Boost C++ threading library (often packaged independently of the&lt;br /&gt;
Boost base library) is needed to run CVC4 in &amp;quot;portfolio&amp;quot;&lt;br /&gt;
(multithreaded) mode.  Check your distribution for a package named&lt;br /&gt;
&amp;quot;libboost-thread-dev&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
CxxTest is necessary to run CVC4's unit tests (included with the&lt;br /&gt;
distribution).  Running these is not really required for users of&lt;br /&gt;
CVC4; &amp;quot;make check&amp;quot; will skip unit tests if CxxTest isn't available,&lt;br /&gt;
and go on to run the extensive system- and regression-tests in the&lt;br /&gt;
source tree.  However, if you're interested, you can download CxxTest&lt;br /&gt;
at http://cxxtest.com/ .&lt;br /&gt;
&lt;br /&gt;
==Building with CUDD (optional)==&lt;br /&gt;
&lt;br /&gt;
CUDD, if desired, must be installed delicately.  The CVC4 configure&lt;br /&gt;
script attempts to auto-detect the locations and names of CUDD headers&lt;br /&gt;
and libraries the way that the Fedora RPMs install them, the way that&lt;br /&gt;
our NYU-provided Debian packages install them, and the way they exist&lt;br /&gt;
when you download and build the CUDD sources directly.  If you install&lt;br /&gt;
from Fedora RPMs or our Debian packages, the process should be&lt;br /&gt;
completely automatic, since the libraries and headers are installed in&lt;br /&gt;
a standard location.  If you download the sources yourself, you need&lt;br /&gt;
to build them in a special way.  Fortunately, the&lt;br /&gt;
&amp;quot;contrib/build-cudd-2.4.2-with-libtool.sh&amp;quot; script in the CVC4 source&lt;br /&gt;
tree does exactly what you need: it patches the CUDD makefiles to use&lt;br /&gt;
libtool, builds the libtool libraries, then reverses the patch to&lt;br /&gt;
leave the makefiles as they were.  Once you run this script on an&lt;br /&gt;
unpacked CUDD 2.4.2 source distribution, then CVC4's configure script&lt;br /&gt;
should pick up the libraries if you provide&lt;br /&gt;
--with-cudd-dir=/PATH/TO/CUDD/SOURCES.&lt;br /&gt;
&lt;br /&gt;
If you want to force linking to CUDD, provide --with-cudd to the&lt;br /&gt;
configure script; this makes it a hard requirement rather than an&lt;br /&gt;
optional add-on.&lt;br /&gt;
&lt;br /&gt;
The NYU-provided Debian packaging of CUDD 2.4.2 and CUDD 2.5.0 are&lt;br /&gt;
here (along with the CVC4 Debian packages):&lt;br /&gt;
&lt;br /&gt;
  deb http://cvc4.cs.nyu.edu/debian/ unstable/&lt;br /&gt;
&lt;br /&gt;
On Debian (and Debian-derived distributions like Ubuntu), you only&lt;br /&gt;
need to drop that one line in your /etc/apt/sources.list file, then install with your favorite package manager.&lt;br /&gt;
&lt;br /&gt;
The Debian source package &amp;quot;cudd&amp;quot;, available from the same repository,&lt;br /&gt;
includes a diff of all changes made to cudd makefiles.&lt;br /&gt;
&lt;br /&gt;
=Language bindings=&lt;br /&gt;
&lt;br /&gt;
There are several options available for using CVC4 from the API.&lt;br /&gt;
&lt;br /&gt;
First, CVC4 offers a complete and flexible API for manipulating&lt;br /&gt;
expressions, maintaining a stack of assertions, and checking&lt;br /&gt;
satisfiability, and related things.  The C++ libraries (libcvc4.so and&lt;br /&gt;
libcvc4parser.so) and required headers are installed normally via a&lt;br /&gt;
&amp;quot;make install&amp;quot;.  This API is also available from Java (via CVC4.jar&lt;br /&gt;
and libcvc4jni.so) by configuring with --enable-language-bindings=java.&lt;br /&gt;
You'll also need SWIG 2.0 installed (and you might need to help&lt;br /&gt;
configure find it if you installed it in a nonstandard place with&lt;br /&gt;
--with-swig-dir=/path/to/swig/installation).  You may also need to&lt;br /&gt;
give the configure script the path to your Java headers (in&lt;br /&gt;
particular, jni.h).  You might do so with (for example):&lt;br /&gt;
&lt;br /&gt;
  ./configure --enable-language-bindings=java \&lt;br /&gt;
      JAVA_CPPFLAGS=-I/usr/lib/jvm/java-6-openjdk-amd64/include&lt;br /&gt;
&lt;br /&gt;
There is also a &amp;quot;C++ compatibility API&amp;quot; (''#include &amp;lt;cvc4/cvc3_compat.h&amp;gt;''&lt;br /&gt;
and link against libcvc4compat.so) that attempts to maintain&lt;br /&gt;
source-level backwards-compatibility with the CVC3 C++ API.  The&lt;br /&gt;
compatibility library is built by default, and&lt;br /&gt;
''--enable-language-bindings=java'' enables the Java compatibility library&lt;br /&gt;
(CVC4compat.jar and libcvc4compatjni.so).&lt;br /&gt;
''--enable-language-bindings=c'' enables the C compatibility library&lt;br /&gt;
(''#include &amp;lt;cvc4/bindings/compat/c/c_interface.h&amp;gt;'' and link against&lt;br /&gt;
libcvc4bindings_c_compat.so), and if you want both C and Java&lt;br /&gt;
bindings, use ''--enable-language-bindings=c,java''.  These compatibility&lt;br /&gt;
language bindings do NOT require SWIG.&lt;br /&gt;
&lt;br /&gt;
The ''examples/'' directory in the source distribution includes some basic examples (the &amp;quot;simple vc&amp;quot;&lt;br /&gt;
and &amp;quot;simple vc compat&amp;quot; family of examples) of all these interfaces.&lt;br /&gt;
&lt;br /&gt;
In principle, since we use SWIG to generate the native Java API, we&lt;br /&gt;
could support other languages as well.  However, using CVC4 from other&lt;br /&gt;
languages is not supported, nor expected to work, at this time.  If&lt;br /&gt;
you're interested in helping to develop, maintain, and test a language&lt;br /&gt;
binding, please contact us via the users' mailing list at&lt;br /&gt;
cvc-users@cs.nyu.edu.&lt;br /&gt;
&lt;br /&gt;
=Building CVC4 from a repository checkout=&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are additionally required to build&lt;br /&gt;
CVC4 from from a repository checkout rather than from a prepared&lt;br /&gt;
source tarball.&lt;br /&gt;
&lt;br /&gt;
*'''Automake v1.11'''&lt;br /&gt;
*'''Autoconf v2.61'''&lt;br /&gt;
*'''Libtool v2.2'''&lt;br /&gt;
*'''ANTLR3 v3.2 or v3.4'''&lt;br /&gt;
*'''Java Development Kit''' ([http://www.antlr.org/wiki/pages/viewpage.action?pageId=728 required for ANTLR3])&lt;br /&gt;
&lt;br /&gt;
First, use &amp;quot;''./autogen.sh''&amp;quot; to create the configure script.  Then&lt;br /&gt;
proceed as normal for any distribution tarball.  The parsers are&lt;br /&gt;
pre-generated for the tarballs, but don't exist in the repository; hence the extra ANTLR3 and JDK requirements to&lt;br /&gt;
generate the source code for the parsers, when building from the&lt;br /&gt;
repository.&lt;br /&gt;
&lt;br /&gt;
=Examples and tutorials are not built or installed=&lt;br /&gt;
&lt;br /&gt;
Examples are not built by &amp;quot;''make''&amp;quot; or &amp;quot;''make install''&amp;quot;.  See&lt;br /&gt;
''examples/README'' in the source distribution for information on what to find in the ''examples/''&lt;br /&gt;
directory, as well as information about building and installing them.&lt;br /&gt;
&lt;br /&gt;
=Appendix: Build architecture=&lt;br /&gt;
&lt;br /&gt;
The build system is generated by automake, libtool, and autoconf.  It&lt;br /&gt;
is somewhat nonstandard, though, which (for one thing) requires that&lt;br /&gt;
GNU Make be used.  If you ./configure in the top-level source&lt;br /&gt;
directory, the objects will actually all appear in&lt;br /&gt;
builds/${arch}/${build_id}.  This is to allow multiple, separate&lt;br /&gt;
builds in the same place (e.g., an assertions-enabled debugging build&lt;br /&gt;
alongside a production build), without changing directories at the&lt;br /&gt;
shell.  The &amp;quot;current&amp;quot; build is maintained, and you can still use&lt;br /&gt;
(e.g.) &amp;quot;make -C src/main&amp;quot; to rebuild objects in just one subdirectory.&lt;br /&gt;
&lt;br /&gt;
You can also create your own build directory inside or outside of the&lt;br /&gt;
source tree and configure from there.  All objects will then be built&lt;br /&gt;
in that directory, and you'll ultimately find the &amp;quot;cvc4&amp;quot; binary in&lt;br /&gt;
src/main/, and the libraries under src/ and src/parser/.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Building_CVC4_from_source&amp;diff=3930</id>
		<title>Building CVC4 from source</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Building_CVC4_from_source&amp;diff=3930"/>
				<updated>2012-11-27T18:29:50Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To compile CVC4 from a source package you must do the following:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
Below are more details instructions about the dependencies. &lt;br /&gt;
&lt;br /&gt;
=Common make Options=&lt;br /&gt;
* &amp;quot;''make install''&amp;quot; will install into the &amp;quot;--prefix&amp;quot; option you gave to&lt;br /&gt;
the configure script (''/usr/local'' by default).&lt;br /&gt;
    ./configure --prefix=~/install_targets/cvc4 ...&lt;br /&gt;
    make install&lt;br /&gt;
* '''You should run &amp;quot;''make check''&amp;quot;''' before installation to ensure that CVC4 has been&lt;br /&gt;
built correctly.  In particular, GCC version 4.5.1 seems to have a&lt;br /&gt;
bug in the optimizer that results in incorrect behavior (and wrong&lt;br /&gt;
results) in many builds.  This is a known problem for Minisat, and&lt;br /&gt;
since Minisat is at the core of CVC4, a problem for CVC4.  &amp;quot;''make check''&amp;quot;&lt;br /&gt;
easily detects this problem (by showing a number of FAILed test cases).&lt;br /&gt;
It is ok if the unit tests aren't run as part of &amp;quot;''make check''&amp;quot;, but all&lt;br /&gt;
system tests and regression tests should pass without incident.&lt;br /&gt;
* To build API documentation, use &amp;quot;''make doc''&amp;quot;.  Documentation is produced&lt;br /&gt;
under ''builds/doc/'' but is not installed by &amp;quot;''make install''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Examples and tutorials are not installed with &amp;quot;''make install''.&amp;quot;  See [[#Examples_and_tutorials_are_not_built_or_installed|below]].&lt;br /&gt;
&lt;br /&gt;
For more information about the build system itself (probably not&lt;br /&gt;
necessary for casual users), see the [[#Appendix:_Build_architecture|Appendix]] at the bottom of this&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
=Common configure Options=&lt;br /&gt;
*'''--prefix=PREFIX''' install architecture-independent files in PREFIX (by default /usr/local)&lt;br /&gt;
*'''--with-build={production,debug,default,competition}''' &lt;br /&gt;
*'''--with-antlr-dir=PATH'''&lt;br /&gt;
*'''--with-cln'''/'''--with-gmp''' selects the numbers package to use by default ([[#Optional requirements]])&lt;br /&gt;
*'''--enable-static-binary''' build a fully statically-linked binary. (This is recommended for Mac OS X users that want to be able to use gdb.)&lt;br /&gt;
*'''ANTLR=PATH''' location of the antlr3 script&lt;br /&gt;
*'''--with-boost=DIR''' installation location of the boost libraries (most users will not need this)&lt;br /&gt;
&lt;br /&gt;
See '''./configure --help''' for more.&lt;br /&gt;
&lt;br /&gt;
=Build dependencies=&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are required to run CVC4. Versions&lt;br /&gt;
given are minimum versions; more recent versions should be compatible.&lt;br /&gt;
&lt;br /&gt;
*'''GNU C and C++''' (gcc and g++), reasonably recent versions&lt;br /&gt;
*'''GNU Make'''&lt;br /&gt;
*'''GNU Bash'''&lt;br /&gt;
*'''GMP v4.2''' (GNU Multi-Precision arithmetic library)&lt;br /&gt;
*'''libantlr3c v3.2 or v3.4''' (ANTLR parser generator C support library)&lt;br /&gt;
*'''The Boost C++ base libraries'''&lt;br /&gt;
*'''MacPorts'''   [highly recommended if on a Mac; see [[#MacPorts]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardest to obtain and install is the libantlr3c requirement, and&lt;br /&gt;
is explained [[#Installing libantlr3c: ANTLR parser generator C support library|next]].&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;make&amp;quot; is non-GNU on your system, make sure to invoke &amp;quot;gmake&amp;quot; (or&lt;br /&gt;
whatever GNU Make is installed as).  If your usual shell is not Bash,&lt;br /&gt;
the configure script should auto-correct this.  If it does not, you'll&lt;br /&gt;
see strange shell syntax errors, and you may need to explicitly set&lt;br /&gt;
SHELL or CONFIG_SHELL to the location of bash on your system.&lt;br /&gt;
&lt;br /&gt;
==Installing libantlr3c: ANTLR parser generator C support library==&lt;br /&gt;
&lt;br /&gt;
For libantlr3c, you can use the convenience script in&lt;br /&gt;
''contrib/get-antlr-3.4'' in the source distribution---this will download, patch, compile and install&lt;br /&gt;
libantlr3c into your cvc4 directory as ''cvc4/antlr-3.4/''.&lt;br /&gt;
  cd contrib&lt;br /&gt;
  ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
CVC4 must be configured with the antlr library installation directory, '''--with-antlr-dir''', and an antlr executable script file, '''ANTLR'''.  If libantlr3c was installed via get-antlr-3.4, the following configure line should suffice for CVC44&lt;br /&gt;
  ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
For 64 bit machines, libantlr3c needs to be configured with 64 bit explicitly&lt;br /&gt;
  ./configure --enable-64bit ...&lt;br /&gt;
The get-antlr-3.4 script makes a guess at whether the machine is 64 bit and adds the appropriate flag.&lt;br /&gt;
To force the script to compile 32 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86&amp;quot; ./get-antlr3.4&lt;br /&gt;
To force the script to compile 64 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86_64&amp;quot; ./get-antlr3.4&lt;br /&gt;
&lt;br /&gt;
For a longer discussion, instructions for manual installation, and more in depth troubleshooting, see [[Developer's Guide#ANTLR3]].&lt;br /&gt;
&lt;br /&gt;
==MacPorts==&lt;br /&gt;
&lt;br /&gt;
On a Mac, it is '''highly''' recommended that you use MacPorts (see&lt;br /&gt;
http://www.macports.org/).  Doing so is easy.  Then, simply run the&lt;br /&gt;
script ''contrib/mac-build'', which installs a few ports from the MacPorts&lt;br /&gt;
repository, then compiles and installs antlr3c using the ''get-antlr-3.4''&lt;br /&gt;
script.  The mac-build script should set you up&lt;br /&gt;
with all requirements, and will tell you how to configure CVC4 when it&lt;br /&gt;
completes successfully.&lt;br /&gt;
&lt;br /&gt;
==Installing the Boost C++ base libraries==&lt;br /&gt;
&lt;br /&gt;
A Boost package is available on most Linux distributions; check yours&lt;br /&gt;
for a package named something like libboost-dev or boost-devel.  There&lt;br /&gt;
are a number of additional Boost packages in some distributions, but&lt;br /&gt;
this &amp;quot;basic&amp;quot; one should be sufficient for building CVC4.&lt;br /&gt;
&lt;br /&gt;
Should you want to install Boost manually, or to learn more about the&lt;br /&gt;
Boost project, please visit http://www.boost.org/.&lt;br /&gt;
&lt;br /&gt;
=Optional requirements=&lt;br /&gt;
&lt;br /&gt;
None of these is required, but can improve CVC4 as described below:&lt;br /&gt;
&lt;br /&gt;
*'''Optional: SWIG 2.0.x''' (Simplified Wrapper and Interface Generator)&lt;br /&gt;
*'''Optional: CLN v1.3 or newer''' (Class Library for Numbers)&lt;br /&gt;
*'''Optional: CUDD v2.4.2 or newer''' (Colorado University Decision Diagram package)&lt;br /&gt;
*'''Optional: GNU Readline library''' (for an improved interactive experience)&lt;br /&gt;
*'''Optional: The Boost C++ threading library''' (libboost_thread)&lt;br /&gt;
*'''Optional: CxxTest unit testing framework'''&lt;br /&gt;
&lt;br /&gt;
SWIG is necessary to build the Java API (and of course a JDK is&lt;br /&gt;
necessary, too).  SWIG 1.x won't work; you'll need 2.0, and the more&lt;br /&gt;
recent the better.  On Mac, we've seen SWIG segfault when generating&lt;br /&gt;
CVC4 language bindings; version 2.0.8 or higher is recommended to&lt;br /&gt;
avoid this.  See [[#Language_bindings|Language bindings]] below for build instructions.&lt;br /&gt;
&lt;br /&gt;
CLN is an alternative multiprecision arithmetic package that can offer&lt;br /&gt;
better performance and memory footprint than GMP.  CLN is covered by&lt;br /&gt;
the GNU General Public License, version 3; so if you choose to use&lt;br /&gt;
CVC4 with CLN support, you are licensing CVC4 under that same license.&lt;br /&gt;
(Usually CVC4's license is more permissive than GPL is; see the file&lt;br /&gt;
COPYING in the CVC4 source distribution for details.)  Please visit&lt;br /&gt;
http://www.ginac.de/CLN/ for more details about CLN.&lt;br /&gt;
&lt;br /&gt;
CUDD is a decision diagram package that changes the behavior of the&lt;br /&gt;
CVC4 arithmetic solver in some cases; it may or may not improve the&lt;br /&gt;
arithmetic solver's performance.  See [[#Building_with_CUDD_(optional)|below]] for instructions on&lt;br /&gt;
obtaining and building CUDD.&lt;br /&gt;
&lt;br /&gt;
The GNU Readline library is optionally used to provide command&lt;br /&gt;
editing, tab completion, and history functionality at the CVC prompt&lt;br /&gt;
(when running in interactive mode).  Check your distribution for a&lt;br /&gt;
package named &amp;quot;libreadline-dev&amp;quot; or &amp;quot;readline-devel&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
The Boost C++ threading library (often packaged independently of the&lt;br /&gt;
Boost base library) is needed to run CVC4 in &amp;quot;portfolio&amp;quot;&lt;br /&gt;
(multithreaded) mode.  Check your distribution for a package named&lt;br /&gt;
&amp;quot;libboost-thread-dev&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
CxxTest is necessary to run CVC4's unit tests (included with the&lt;br /&gt;
distribution).  Running these is not really required for users of&lt;br /&gt;
CVC4; &amp;quot;make check&amp;quot; will skip unit tests if CxxTest isn't available,&lt;br /&gt;
and go on to run the extensive system- and regression-tests in the&lt;br /&gt;
source tree.  However, if you're interested, you can download CxxTest&lt;br /&gt;
at http://cxxtest.com/ .&lt;br /&gt;
&lt;br /&gt;
==Building with CUDD (optional)==&lt;br /&gt;
&lt;br /&gt;
CUDD, if desired, must be installed delicately.  The CVC4 configure&lt;br /&gt;
script attempts to auto-detect the locations and names of CUDD headers&lt;br /&gt;
and libraries the way that the Fedora RPMs install them, the way that&lt;br /&gt;
our NYU-provided Debian packages install them, and the way they exist&lt;br /&gt;
when you download and build the CUDD sources directly.  If you install&lt;br /&gt;
from Fedora RPMs or our Debian packages, the process should be&lt;br /&gt;
completely automatic, since the libraries and headers are installed in&lt;br /&gt;
a standard location.  If you download the sources yourself, you need&lt;br /&gt;
to build them in a special way.  Fortunately, the&lt;br /&gt;
&amp;quot;contrib/build-cudd-2.4.2-with-libtool.sh&amp;quot; script in the CVC4 source&lt;br /&gt;
tree does exactly what you need: it patches the CUDD makefiles to use&lt;br /&gt;
libtool, builds the libtool libraries, then reverses the patch to&lt;br /&gt;
leave the makefiles as they were.  Once you run this script on an&lt;br /&gt;
unpacked CUDD 2.4.2 source distribution, then CVC4's configure script&lt;br /&gt;
should pick up the libraries if you provide&lt;br /&gt;
--with-cudd-dir=/PATH/TO/CUDD/SOURCES.&lt;br /&gt;
&lt;br /&gt;
If you want to force linking to CUDD, provide --with-cudd to the&lt;br /&gt;
configure script; this makes it a hard requirement rather than an&lt;br /&gt;
optional add-on.&lt;br /&gt;
&lt;br /&gt;
The NYU-provided Debian packaging of CUDD 2.4.2 and CUDD 2.5.0 are&lt;br /&gt;
here (along with the CVC4 Debian packages):&lt;br /&gt;
&lt;br /&gt;
  deb http://cvc4.cs.nyu.edu/debian/ unstable/&lt;br /&gt;
&lt;br /&gt;
On Debian (and Debian-derived distributions like Ubuntu), you only&lt;br /&gt;
need to drop that one line in your /etc/apt/sources.list file, then install with your favorite package manager.&lt;br /&gt;
&lt;br /&gt;
The Debian source package &amp;quot;cudd&amp;quot;, available from the same repository,&lt;br /&gt;
includes a diff of all changes made to cudd makefiles.&lt;br /&gt;
&lt;br /&gt;
=Language bindings=&lt;br /&gt;
&lt;br /&gt;
There are several options available for using CVC4 from the API.&lt;br /&gt;
&lt;br /&gt;
First, CVC4 offers a complete and flexible API for manipulating&lt;br /&gt;
expressions, maintaining a stack of assertions, and checking&lt;br /&gt;
satisfiability, and related things.  The C++ libraries (libcvc4.so and&lt;br /&gt;
libcvc4parser.so) and required headers are installed normally via a&lt;br /&gt;
&amp;quot;make install&amp;quot;.  This API is also available from Java (via CVC4.jar&lt;br /&gt;
and libcvc4jni.so) by configuring with --enable-language-bindings=java.&lt;br /&gt;
You'll also need SWIG 2.0 installed (and you might need to help&lt;br /&gt;
configure find it if you installed it in a nonstandard place with&lt;br /&gt;
--with-swig-dir=/path/to/swig/installation).  You may also need to&lt;br /&gt;
give the configure script the path to your Java headers (in&lt;br /&gt;
particular, jni.h).  You might do so with (for example):&lt;br /&gt;
&lt;br /&gt;
  ./configure --enable-language-bindings=java \&lt;br /&gt;
      JAVA_CPPFLAGS=-I/usr/lib/jvm/java-6-openjdk-amd64/include&lt;br /&gt;
&lt;br /&gt;
There is also a &amp;quot;C++ compatibility API&amp;quot; (''#include &amp;lt;cvc4/cvc3_compat.h&amp;gt;''&lt;br /&gt;
and link against libcvc4compat.so) that attempts to maintain&lt;br /&gt;
source-level backwards-compatibility with the CVC3 C++ API.  The&lt;br /&gt;
compatibility library is built by default, and&lt;br /&gt;
''--enable-language-bindings=java'' enables the Java compatibility library&lt;br /&gt;
(CVC4compat.jar and libcvc4compatjni.so).&lt;br /&gt;
''--enable-language-bindings=c'' enables the C compatibility library&lt;br /&gt;
(''#include &amp;lt;cvc4/bindings/compat/c/c_interface.h&amp;gt;'' and link against&lt;br /&gt;
libcvc4bindings_c_compat.so), and if you want both C and Java&lt;br /&gt;
bindings, use ''--enable-language-bindings=c,java''.  These compatibility&lt;br /&gt;
language bindings do NOT require SWIG.&lt;br /&gt;
&lt;br /&gt;
The ''examples/'' directory in the source distribution includes some basic examples (the &amp;quot;simple vc&amp;quot;&lt;br /&gt;
and &amp;quot;simple vc compat&amp;quot; family of examples) of all these interfaces.&lt;br /&gt;
&lt;br /&gt;
In principle, since we use SWIG to generate the native Java API, we&lt;br /&gt;
could support other languages as well.  However, using CVC4 from other&lt;br /&gt;
languages is not supported, nor expected to work, at this time.  If&lt;br /&gt;
you're interested in helping to develop, maintain, and test a language&lt;br /&gt;
binding, please contact us via the users' mailing list at&lt;br /&gt;
cvc-users@cs.nyu.edu.&lt;br /&gt;
&lt;br /&gt;
=Building CVC4 from a repository checkout=&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are additionally required to build&lt;br /&gt;
CVC4 from from a repository checkout rather than from a prepared&lt;br /&gt;
source tarball.&lt;br /&gt;
&lt;br /&gt;
*'''Automake v1.11'''&lt;br /&gt;
*'''Autoconf v2.61'''&lt;br /&gt;
*'''Libtool v2.2'''&lt;br /&gt;
*'''ANTLR3 v3.2 or v3.4'''&lt;br /&gt;
*'''Java Development Kit''' ([http://www.antlr.org/wiki/pages/viewpage.action?pageId=728 required for ANTLR3])&lt;br /&gt;
&lt;br /&gt;
First, use &amp;quot;''./autogen.sh''&amp;quot; to create the configure script.  Then&lt;br /&gt;
proceed as normal for any distribution tarball.  The parsers are&lt;br /&gt;
pre-generated for the tarballs, but don't exist in the repository; hence the extra ANTLR3 and JDK requirements to&lt;br /&gt;
generate the source code for the parsers, when building from the&lt;br /&gt;
repository.&lt;br /&gt;
&lt;br /&gt;
=Examples and tutorials are not built or installed=&lt;br /&gt;
&lt;br /&gt;
Examples are not built by &amp;quot;''make''&amp;quot; or &amp;quot;''make install''&amp;quot;.  See&lt;br /&gt;
''examples/README'' in the source distribution for information on what to find in the ''examples/''&lt;br /&gt;
directory, as well as information about building and installing them.&lt;br /&gt;
&lt;br /&gt;
=Appendix: Build architecture=&lt;br /&gt;
&lt;br /&gt;
The build system is generated by automake, libtool, and autoconf.  It&lt;br /&gt;
is somewhat nonstandard, though, which (for one thing) requires that&lt;br /&gt;
GNU Make be used.  If you ./configure in the top-level source&lt;br /&gt;
directory, the objects will actually all appear in&lt;br /&gt;
builds/${arch}/${build_id}.  This is to allow multiple, separate&lt;br /&gt;
builds in the same place (e.g., an assertions-enabled debugging build&lt;br /&gt;
alongside a production build), without changing directories at the&lt;br /&gt;
shell.  The &amp;quot;current&amp;quot; build is maintained, and you can still use&lt;br /&gt;
(e.g.) &amp;quot;make -C src/main&amp;quot; to rebuild objects in just one subdirectory.&lt;br /&gt;
&lt;br /&gt;
You can also create your own build directory inside or outside of the&lt;br /&gt;
source tree and configure from there.  All objects will then be built&lt;br /&gt;
in that directory, and you'll ultimately find the &amp;quot;cvc4&amp;quot; binary in&lt;br /&gt;
src/main/, and the libraries under src/ and src/parser/.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3929</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3929"/>
				<updated>2012-11-27T18:27:59Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Source repository */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[Building CVC4 from source #Building_CVC4 from_a_repository_checkout | here]].&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
The CVC4 driver binary (&amp;quot;cvc4&amp;quot;), once installed, can be executed directly to enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's native input language=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The native input language consists of a sequence of symbol declarations and commands, each followed by a semicolon (&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Any text after the first occurrence of a percent character and to the end of the current line is a comment:&lt;br /&gt;
&lt;br /&gt;
 %%% This is a native language comment&lt;br /&gt;
&lt;br /&gt;
== Type System ==&lt;br /&gt;
&lt;br /&gt;
CVC4's type system includes a set of built-in types which can be expanded with additional user-defined types.&lt;br /&gt;
&lt;br /&gt;
The type system consists of ''first-order'' types, ''subtypes'' of first-order types, and ''higher-order'' types,  all of which are interpreted as sets. &lt;br /&gt;
For convenience, we will sometimes identify below the interpretation of a type with the type itself.&lt;br /&gt;
&lt;br /&gt;
First-order types consist of basic types and structured types. The basic types are &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, as well as user-defined basic types (also called uninterpreted types). &lt;br /&gt;
The structured types are array, tuple, record types, and ML-style user-defined (inductive) datatypes.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Currently, subtypes consist only of the built-in subtype &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;!-- and are covered in the [[#Subtypes|Subtypes]] section. --&amp;gt;&lt;br /&gt;
Support for CVC3-style user-defined subtypes will be added in a later release.&lt;br /&gt;
&lt;br /&gt;
Function types are the only higher-order types.&lt;br /&gt;
More precisely, they are just second-order types &lt;br /&gt;
since function symbols in CVC4, both built-in and user-defined, can take as argument or return only values of &lt;br /&gt;
a first-order type.&lt;br /&gt;
&lt;br /&gt;
=== Basic Types ===&lt;br /&gt;
&lt;br /&gt;
==== The BOOLEAN Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; type is interpreted as the two-element set of Boolean values&lt;br /&gt;
&amp;lt;math&amp;gt;\{\mathrm{TRUE},\; \mathrm{FALSE}\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
'''Note:''' CVC4's treatment of this type differs from CVC3's where &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; is used only as the type of formulas, but not as value type. CVC3 follows the two-tiered structure of classical first-order logic &lt;br /&gt;
which distinguishes between formulas and terms, and allows terms to occur in formulas but not vice versa (with the exception of the IF-THEN-ELSE construct).&lt;br /&gt;
CVC4 drops the distinction between terms and formulas and defines the latter just as terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. As such, formulas can occur as subterms of possibly non-Boolean terms.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 [To do]&lt;br /&gt;
&lt;br /&gt;
==== The REAL Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; type is interpreted as the set of real numbers.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical reals,&lt;br /&gt;
not the floating point numbers.&lt;br /&gt;
Support for floating point types is planned for future versions.&lt;br /&gt;
&lt;br /&gt;
 x, y : REAL;&lt;br /&gt;
 QUERY (( x &amp;lt;= y ) AND ( y &amp;lt;= x )) =&amp;gt; ( x = y );&lt;br /&gt;
&lt;br /&gt;
==== The INT Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; type is interpreted as the set of integer numbers&lt;br /&gt;
and is considered as a subtype of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The latter means in particular that it is possible to mix integer and real terms &lt;br /&gt;
in expressions without the need of an explicit ''upcasting'' operator.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical integers,&lt;br /&gt;
not the finite precision machine integers used in most programming languages. &lt;br /&gt;
The latter are models by [[ #Bitvectors | bit vector ]] types.&lt;br /&gt;
&lt;br /&gt;
 x, y : INT;&lt;br /&gt;
 QUERY ((2 * x + 4 * y &amp;lt;= 1) AND ( y &amp;gt;= x)) =&amp;gt; (x &amp;lt;= 0);&lt;br /&gt;
 z : REAL;&lt;br /&gt;
 QUERY (2 * x + z &amp;lt;= 3.5) AND (z &amp;gt;= 1);&lt;br /&gt;
&lt;br /&gt;
==== Bit Vector Types ====&lt;br /&gt;
&lt;br /&gt;
For every positive integer &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, the type &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; is interpreted as the set of all bit vectors of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
A rich set of bit vector operators is supported.&lt;br /&gt;
&lt;br /&gt;
==== User-defined Basic Types ====&lt;br /&gt;
&lt;br /&gt;
Users can define new basic types &lt;br /&gt;
(often referred to as ''uninterpreted'' types in the SMT literature).&lt;br /&gt;
Each such type is interpreted as a set of unspecified cardinality &lt;br /&gt;
but disjoint from any other type. &lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Can we specify cardinalities? &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
User-defined basic types are created by declarations like the following:&lt;br /&gt;
&lt;br /&gt;
 % User declarations of basic types:&lt;br /&gt;
 &lt;br /&gt;
 MyBrandNewType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 Apples, Oranges: TYPE;&lt;br /&gt;
&lt;br /&gt;
=== Structured Types ===&lt;br /&gt;
&lt;br /&gt;
CVC4's structured types are divided in the following families. &lt;br /&gt;
&lt;br /&gt;
==== Array Types ====&lt;br /&gt;
&lt;br /&gt;
Array types are created by the mixfix type constructors &amp;lt;math&amp;gt;\mathrm{ARRAY}\ \_\ \mathrm{OF}\ \_&amp;lt;/math&amp;gt; &lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 I : TYPE;&lt;br /&gt;
 &lt;br /&gt;
 %% Array types:&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with indices from I and values from REAL&lt;br /&gt;
 Array1: TYPE = ARRAY I OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer indices and array values &lt;br /&gt;
 Array2: TYPE = ARRAY INT OF (ARRAY INT OF REAL);&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer pair indices and integer values&lt;br /&gt;
 IntMatrix: TYPE = ARRAY [INT, INT] OF INT;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
An array type of the form &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1\ \mathrm{OF}\ T_2&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the set of all total maps from &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
The main difference with the function type &amp;lt;math&amp;gt;T_1 \to T_2&amp;lt;/math&amp;gt; is that arrays, &lt;br /&gt;
contrary to functions, are first-class objects of the language, that is, values of an array&lt;br /&gt;
type can be arguments or results of functions. &lt;br /&gt;
Furthermore, array types come equipped with an update operation.&lt;br /&gt;
&lt;br /&gt;
==== Tuple Types ====&lt;br /&gt;
&lt;br /&gt;
Tuple types are created by the mixfix type constructors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l} [\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ \ ,\ \_\ ] \\[1ex] \ldots \end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 IntArray: TYPE = ARRAY INT OF INT;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple type declarations&lt;br /&gt;
 &lt;br /&gt;
 RealPair: TYPE = [REAL, REAL]&lt;br /&gt;
 &lt;br /&gt;
 MyTuple: TYPE = [ REAL, IntArray, [INT, INT] ];&lt;br /&gt;
&lt;br /&gt;
A tuple type of the form &amp;lt;math&amp;gt;[T_1, \ldots, T_n]&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Note that while the types &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and &lt;br /&gt;
&amp;lt;math&amp;gt;[T_1 \times \cdots \times T_n] \to T&amp;lt;/math&amp;gt; are semantically equivalent, &lt;br /&gt;
they are operationally different in CVC4. &lt;br /&gt;
The first is the type of functions that take &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; arguments &lt;br /&gt;
of respective type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;T_n&amp;lt;/math&amp;gt;, &lt;br /&gt;
while the second is the type of functions that take one argument of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-tuple type.&lt;br /&gt;
&lt;br /&gt;
==== Record Types ====&lt;br /&gt;
&lt;br /&gt;
Similar to, but more general than tuple types, record types are created by type constructors of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
[\#\ l_1: \_\ ,\ \ldots\ ,\ l_n: \_\ \#]&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;l_1,\ldots, l_n&amp;lt;/math&amp;gt; are field labels, &lt;br /&gt;
and the arguments can be instantiated with any first-order types.&lt;br /&gt;
&lt;br /&gt;
 MyType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 % Record declaration&lt;br /&gt;
 &lt;br /&gt;
 RecordType: TYPE = [# id: REAL, age: INT, info: MyType #];&lt;br /&gt;
&lt;br /&gt;
The order of the fields in a record type is meaningful: &lt;br /&gt;
permuting the field names gives a different type. &lt;br /&gt;
&lt;br /&gt;
Note that record types are non-recursive. &lt;br /&gt;
For instance, it is not possible to declare a record type called &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt; containing &lt;br /&gt;
a field of type &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt;. &lt;br /&gt;
Recursive types are provided in CVC4 by the more general inductive data types.&lt;br /&gt;
(As a matter of fact, both record and tuple types are implemented internally as inductive data types.)&lt;br /&gt;
&lt;br /&gt;
==== Inductive Data Types ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inductive data types in CVC4 are similar to inductive data types of functional languages.&lt;br /&gt;
They can be parametric or not.&lt;br /&gt;
&lt;br /&gt;
===== Non-Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Non-parametric data types are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE} \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1 &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2 &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
Such declarations define the data types &amp;lt;math&amp;gt;A_1, \ldots, A_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
For each data type &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; they introduce:&lt;br /&gt;
&lt;br /&gt;
* constructor symbols &amp;lt;math&amp;gt;cons&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;(T_1, \ldots, T_k) \to \mathit{type\_name}_i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* selector symbols &amp;lt;math&amp;gt;\mathit{sel}_j&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to T_j&amp;lt;/math&amp;gt;, and&lt;br /&gt;
* tester symbols &amp;lt;math&amp;gt;\mathit{is\_cons}&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that permitting more than one data type to be defined in the same declarations allows &lt;br /&gt;
the definition of mutually recursive types.&lt;br /&gt;
&lt;br /&gt;
 % simple enumeration type&lt;br /&gt;
 &lt;br /&gt;
 % implicitly defined are the testers: is_red, is_yellow and is_blue&lt;br /&gt;
 % (similarly for the other data types)&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   PrimaryColor = red | yellow | blue&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % infinite set of pairwise distinct values ..., v(-1), v(0), v(1), ...&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Id = v (id: INT)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % ML-style integer lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   IntList = nil | ins (head: INT, tail: IntList)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % AST for lamba calculus&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Term = var (index: INT)&lt;br /&gt;
        | apply (arg_1: Term, arg_2: Term)&lt;br /&gt;
        | lambda (arg: INT, body: Term)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Trees&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Tree = tree (value: REAL, children: TreeList),&lt;br /&gt;
   TreeList = nil_tl&lt;br /&gt;
            | ins_tl (first_t1: Tree, rest_t1: TreeList)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
Constructor, selector and tester symbols defined for a data type have global scope. &lt;br /&gt;
So, for example, it is not possible for two different data types to use &lt;br /&gt;
the same name for a constructor.&lt;br /&gt;
&lt;br /&gt;
An inductive data type is interpreted as a term algebra constructed by the constructor symbols &lt;br /&gt;
over some sets of generators. &lt;br /&gt;
For example, the type &amp;lt;code&amp;gt;IntList&amp;lt;/code&amp;gt; defined above is interpreted as the set &lt;br /&gt;
of all terms constructed with &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ins&amp;lt;/code&amp;gt; over the integers.&lt;br /&gt;
&lt;br /&gt;
===== Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Parametric data types are infinite families of (non-parametric) data types &lt;br /&gt;
with each family parametrized by one or more type variables.&lt;br /&gt;
They are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE}  \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1[X_{1,1}, \ldots, X_{1,p_1}] &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2[X_{2,1}, \ldots, X_{2,p_2}] &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n[X_{n,1}, \ldots, X_{n,p_n}] &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name parametrized by the type variables &amp;lt;math&amp;gt;X_{i,1}, \ldots, X_{i,p_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, &lt;br /&gt;
possibly parametrized by &amp;lt;math&amp;gt;X_1, \ldots, X_p&amp;lt;/math&amp;gt;, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 % Parametric pairs&lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Pair[X, Y] = pair (first: X, second: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 % Parametric lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Parametric trees using the list type above&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   Tree[X] = node (value: X, children: List[Tree[X]]),&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
The declarations above define infinitely many types of the form &lt;br /&gt;
Pair[S,T], List[T] and Tree[T] where S and T are first-order types.&lt;br /&gt;
Note that the identifier &amp;lt;code&amp;gt;List&amp;lt;/code&amp;gt; above, for example, by itself does not denote a type.&lt;br /&gt;
In contrast, the terms &amp;lt;code&amp;gt;List[Real]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[List[Real]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[Tree[INT]]&amp;lt;/code&amp;gt;,&lt;br /&gt;
and so on do.&lt;br /&gt;
&lt;br /&gt;
===== Restriction to Inductive Types =====&lt;br /&gt;
&lt;br /&gt;
By adopting a term algebra semantics, CVC4 allows only ''inductive'' data types, &lt;br /&gt;
that is, data types whose values are essentially (labeled, ordered) finite trees. &lt;br /&gt;
Infinite structures such as streams or even finite but cyclic ones &lt;br /&gt;
such as circular lists are then excluded. &lt;br /&gt;
For instance, none of the following declarations define inductive data types, &lt;br /&gt;
and are rejected by CVC4:&lt;br /&gt;
&lt;br /&gt;
 DATATYPE&lt;br /&gt;
  IntStream = s (first:INT, rest: IntStream)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
  RationalTree = node1 (child: RationalTree)&lt;br /&gt;
               | node2 (left_child: RationalTree, right_child:RationalTree)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   T1 =  c1 (s1: T2),&lt;br /&gt;
   T2 =  c2 (s2: T1)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
In concrete, a declaration of &amp;lt;math&amp;gt;n \geq 1&amp;lt;/math&amp;gt; datatypes &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; will be rejected if for any one of the types &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;, it is impossible to build a finite term of that type using only the constructors of &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; and free constants of type other than &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Inductive data types are the only types where the user also chooses names for the built-in operations to:&lt;br /&gt;
&lt;br /&gt;
* construct a value of the type (with the constructors),&lt;br /&gt;
* extract components from a value (with the selectors), or&lt;br /&gt;
* check if a value was constructed with a certain constructor or not (with the testers).&lt;br /&gt;
&lt;br /&gt;
For all the other types, CVC4 provides predefined names for the built-in operations on the type.&lt;br /&gt;
&lt;br /&gt;
=== Function Types ===&lt;br /&gt;
&lt;br /&gt;
Function (&amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt;) types are created by the mixfix type constructors&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\_ \to \_ \\[1ex] (\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] (\ \_\ ,\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] \ldots &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
whose arguments can be instantiated by any first-order type.&lt;br /&gt;
&lt;br /&gt;
 % Function type declarations&lt;br /&gt;
 &lt;br /&gt;
 UnaryFunType: TYPE = INT -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 BinaryFunType: TYPE = (REAL, REAL) -&amp;gt; ARRAY REAL OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 TernaryFunType: TYPE = (REAL, BITVECTOR(4), INT) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
A function type of the form &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; is interpreted as the set of all ''total'' functions from the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The example above also shows how to introduce type names. &lt;br /&gt;
A name like &amp;lt;code&amp;gt;UnaryFunType&amp;lt;/code&amp;gt; above is just an abbreviation for the type &amp;lt;math&amp;gt;\mathrm{INT} \to \mathrm{REAL}&amp;lt;/math&amp;gt; and can be used interchangeably with it.&lt;br /&gt;
&lt;br /&gt;
In general, any type defined by a type expression &amp;lt;code&amp;gt;E&amp;lt;/code&amp;gt; can be given a name with the declaration:&lt;br /&gt;
&lt;br /&gt;
 name : TYPE = E;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Type Checking ===&lt;br /&gt;
&lt;br /&gt;
In CVC4, formulas and terms are statically typed at the level of types &lt;br /&gt;
(as opposed to subtypes) according to the usual rules of first-order many-sorted logic,&lt;br /&gt;
with the main difference that formulas are just terms of type &amp;lt;math&amp;gt;BOOLEAN&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* each variable has one associated first-order type,&lt;br /&gt;
* each constant symbol has one or more associated first-order types,&lt;br /&gt;
* each function symbol has one or more associated function types,&lt;br /&gt;
* the type of a term consisting just of a variable is the type associated to that variable,&lt;br /&gt;
* the type of a term consisting just of a constant symbol is the type associated to that constant symbol,&lt;br /&gt;
* the term obtained by applying a function symbol &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; to the terms &amp;lt;math&amp;gt;t_1, \ldots, t_n&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and each &amp;lt;math&amp;gt;t_i&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Attempting to enter an ill-typed term will result in an error.&lt;br /&gt;
&lt;br /&gt;
Another significant difference with standard many-sorted logic is that &lt;br /&gt;
some built-in symbols are parametrically polymorphic. &lt;br /&gt;
For instance, the function symbol for extracting the element of any array has &lt;br /&gt;
type &amp;lt;math&amp;gt;(\mathit{ARRAY}\ T_1\ \mathit{OF}\ T_2,\; T_1) \to T_2&amp;lt;/math&amp;gt; &lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1, T_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Type Ascription ====&lt;br /&gt;
&lt;br /&gt;
By the type inference rules above some terms might have more than one type.&lt;br /&gt;
This can happen with terms built with polymorphic data type constructors&lt;br /&gt;
that have more than one return type for the same input type.&lt;br /&gt;
In that case, a type ascription operator (&amp;lt;code&amp;gt;::&amp;lt;/code&amp;gt;) must be applied &lt;br /&gt;
to the constructor to specify the intended return type.&lt;br /&gt;
&lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = cons(1, nil::List[REAL]);&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Union[X, Y] = left(val_l: X) | right(val_r: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = left::Union[BOOLEAN, REAL](TRUE);&lt;br /&gt;
&lt;br /&gt;
The constant symbol &amp;lt;math&amp;gt;\mathrm{nil}&amp;lt;/math&amp;gt; declared above has infinitely many types &lt;br /&gt;
(&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{REAL}]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{List}[\mathrm{BOOLEAN}]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[[\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;, ...)&lt;br /&gt;
CVC4's type checker requires the user to indicate explicitly the type &lt;br /&gt;
of each occurrence of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; in a term. &lt;br /&gt;
Similarly, &lt;br /&gt;
the injection operator &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; has infinitely many return types &lt;br /&gt;
for the same input type, for instance:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{REAL}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, [\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
and so on.&lt;br /&gt;
Applications of &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; need to specify the intended returned typed, as shown above.&lt;br /&gt;
&lt;br /&gt;
== Terms and Formulas ==&lt;br /&gt;
&lt;br /&gt;
In addition to type expressions, CVC4 has expressions for terms and for formulas &lt;br /&gt;
(i.e., terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;). &lt;br /&gt;
By and large, these are standard first-order terms built out of typed variables, &lt;br /&gt;
predefined theory-specific operators, free (i.e., user-defined) function symbols, &lt;br /&gt;
and quantifiers. &lt;br /&gt;
Extensions include an if-then-else operator, lambda abstractions, and local symbol &lt;br /&gt;
declarations, as illustrated below. &lt;br /&gt;
Note that these extensions still keep CVC4's language first-order. &lt;br /&gt;
In particular, lambda abstractions are restricted to take and return only terms of &lt;br /&gt;
a first-order type. &lt;br /&gt;
Similarly, variables can only be of a first-order type.&lt;br /&gt;
&lt;br /&gt;
A number of built-in function symbols (for instance, the arithmetic ones) are used &lt;br /&gt;
as infix operators. All user-defined symbols are used as prefix ones.&lt;br /&gt;
&lt;br /&gt;
User-defined, i.e., free, function symbols include ''constant symbols'' and &lt;br /&gt;
''predicate symbols'', respectively  nullary function symbols and function symbols &lt;br /&gt;
with a &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; return type. &lt;br /&gt;
These symbols are introduced with global declarations of the form &lt;br /&gt;
&amp;lt;math&amp;gt; f_1, \ldots, f_m: T;&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;f_i&amp;lt;/math&amp;gt; are the names of the symbols and &lt;br /&gt;
&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is their type:&lt;br /&gt;
&lt;br /&gt;
 % integer constants&lt;br /&gt;
 &lt;br /&gt;
 a, b, c: INT;&lt;br /&gt;
 &lt;br /&gt;
 % real constants&lt;br /&gt;
 &lt;br /&gt;
 x, y, z: REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function&lt;br /&gt;
 &lt;br /&gt;
 f1: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % binary function&lt;br /&gt;
 &lt;br /&gt;
 f2: (REAL, INT) -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function with a tuple argument&lt;br /&gt;
 &lt;br /&gt;
 f3: [INT, REAL] -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % binary predicate&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, REAL) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % Propositional &amp;quot;variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 P, Q; BOOLEAN;&lt;br /&gt;
&lt;br /&gt;
Like type declarations, function symbol declarations like the above have global scope &lt;br /&gt;
and must be unique. &lt;br /&gt;
In other words, it is not possible to declare a function symbol globally more than once&lt;br /&gt;
in the same lexical scope. &lt;br /&gt;
This entails among other things that globally-defined free symbols cannot be overloaded &lt;br /&gt;
with different types and that theory symbols cannot be redeclared globally as free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Global symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
As with types, a function symbol can be defined as the name of another term &lt;br /&gt;
of the corresponding type. &lt;br /&gt;
With constant symbols, this is done with a declaration of the form &amp;lt;math&amp;gt;f:T = t;&amp;lt;/math&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
 c: INT;&lt;br /&gt;
 &lt;br /&gt;
 i: INT = 5 + 3*c;  % i is effectively a shorthand for 5 + 3*c&lt;br /&gt;
 &lt;br /&gt;
 j: REAL = 3/4;&lt;br /&gt;
 &lt;br /&gt;
 t: [REAL, INT] = (2/3, -4);&lt;br /&gt;
 &lt;br /&gt;
 r: [# key: INT, value: REAL #] = (# key := 4, value := (c + 1)/2 #);&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN = FORALL (x:INT): x &amp;lt;= 0 OR x &amp;gt; c ;&lt;br /&gt;
&lt;br /&gt;
A restriction on constants of type &amp;lt;math&amp;gt;\mathit{BOOLEAN}&amp;lt;/math&amp;gt; is that their value &lt;br /&gt;
can only be a closed formula, that is, a formula with no free variables.&lt;br /&gt;
&lt;br /&gt;
A term and its name can be used interchangeably in later expressions. &lt;br /&gt;
Named terms are often useful for shared subterms (terms used several times in different places) &lt;br /&gt;
since their use can make the input exponentially more concise. &lt;br /&gt;
Named terms are processed very efficiently by CVC4. &lt;br /&gt;
It is much more efficient to associate a complex term with a name directly rather than &lt;br /&gt;
to declare a constant and later assert that it is equal to the same term. &lt;br /&gt;
This point is explained in more detail later in section [[Commands | Commands]].&lt;br /&gt;
&lt;br /&gt;
More generally, in CVC4 one can associate a term to function symbols of any arity. &lt;br /&gt;
For non-constant function symbols this is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;f:(T_1, \ldots, T_n) \to T = \mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t\;;&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is any term of type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; with free variables &lt;br /&gt;
in &amp;lt;math&amp;gt;\{x_1, \ldots, x_n\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The lambda binder has the usual semantics and conforms to the usual lexical scoping rules: &lt;br /&gt;
within the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; the declaration of the symbols &amp;lt;math&amp;gt;x_1, \ldots, x_n&amp;lt;/math&amp;gt; &lt;br /&gt;
as local variables of respective type &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; hides any previous&lt;br /&gt;
declarations of those symbols that are in scope.&lt;br /&gt;
&lt;br /&gt;
As a general shorthand, when &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; consecutive types &lt;br /&gt;
&amp;lt;math&amp;gt;T_i, \ldots, T_{i+k-1}&amp;lt;/math&amp;gt;  in the lambda expression &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t&amp;lt;/math&amp;gt; are identical, the syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x_i,\ldots, x_{i+k-1}:T_i,\ldots, x:T_n): t&amp;lt;/math&amp;gt;&lt;br /&gt;
can also be used.&lt;br /&gt;
&lt;br /&gt;
 % Global declaration of x as a unary function symbol&lt;br /&gt;
 &lt;br /&gt;
 x: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Local declarations of x as variable (hiding the global one)&lt;br /&gt;
 &lt;br /&gt;
 f: REAL -&amp;gt; REAL = LAMBDA (x: REAL): 2*x + 3;&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, INT) -&amp;gt; BOOLEAN = LAMBDA (x,i: INT): i*x - 1 &amp;gt; 0;&lt;br /&gt;
 &lt;br /&gt;
 g: (REAL, INT) -&amp;gt; [REAL, INT] = LAMBDA (x: REAL, i:INT): (x + 1, i - 3);&lt;br /&gt;
&lt;br /&gt;
Note that lambda definitions are not recursive: &lt;br /&gt;
the symbol being defined cannot occur in the body of the lambda term.&lt;br /&gt;
They should be understood as macros.&lt;br /&gt;
For instance, any occurrence of the term &amp;lt;math&amp;gt;f(t)&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; is as defined above will be treated &lt;br /&gt;
as if it was the term &amp;lt;math&amp;gt;(2*t + 3)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Local symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
Constant and function symbols can also be declared locally anywhere within a term &lt;br /&gt;
by means of a let binder. &lt;br /&gt;
This is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f = t \ \mathrm{IN}\ t' ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is a term with no free variables, possibly a lambda term.&lt;br /&gt;
Let binders can be nested arbitrarily and follow the usual lexical scoping rules.&lt;br /&gt;
The following general form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1, f_2 = t_2, \ldots, f_n = t_m \ \mathrm{IN}\ t ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
can be use above can used as a shorthand for&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1\ \mathrm{IN}\ &lt;br /&gt;
 \mathrm{LET}\ f_2 = t_2\ \mathrm{IN}\ &lt;br /&gt;
 \ldots \ &lt;br /&gt;
 \mathrm{LET}\ f_n = t_m \ \mathrm{IN}\ t ;&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL =&lt;br /&gt;
   LET x1 = 42,&lt;br /&gt;
       g = LAMBDA(x:INT): x + 1,&lt;br /&gt;
       x2 = 2*x1 + 7/2&lt;br /&gt;
   IN&lt;br /&gt;
      (LET x3 = g(x1) IN x3 + x2) / x1;&lt;br /&gt;
&lt;br /&gt;
Note that the same symbol = is used, unambiguously, in the syntax of global declarations, &lt;br /&gt;
let declarations, and as a predicate symbol.&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
A &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; term with a multiple symbols defines them sequentially.&lt;br /&gt;
A parallel version of the &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; construct will be introduced in a later version.&lt;br /&gt;
&lt;br /&gt;
== Built-in theories and their symbols ==&lt;br /&gt;
&lt;br /&gt;
In addition to user-defined symbols, CVC4 terms can use a number of predefined symbols: &lt;br /&gt;
the logical symbols, such as &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, etc., &lt;br /&gt;
as well as theory symbols, function symbols belonging to one of the built-in theories. &lt;br /&gt;
They are described next, with the theory symbols grouped by theory.&lt;br /&gt;
&lt;br /&gt;
=== Logical Symbols ===&lt;br /&gt;
&lt;br /&gt;
The logical symbols in CVC4's language include &lt;br /&gt;
the equality and disequality predicate symbols, respectively written as = and /=, &lt;br /&gt;
the multiarity disequality symbol &amp;lt;math&amp;gt;\mathrm{DISTINCT}&amp;lt;/math&amp;gt;, &lt;br /&gt;
together with the logical constants &amp;lt;math&amp;gt;\mathrm{TRUE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{FALSE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
the connectives &amp;lt;math&amp;gt;\mathrm{NOT}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{XOR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt;, and &lt;br /&gt;
the first-order quantifiers &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt;, &lt;br /&gt;
all with the standard many-sorted logic semantics.&lt;br /&gt;
&lt;br /&gt;
The binary connectives have infix syntax and type &lt;br /&gt;
&amp;lt;math&amp;gt;(\mathrm{BOOLEAN},\mathrm{BOOLEAN}) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The symbols = and /=, which are also infix, are instead parametrically polymorphic, &lt;br /&gt;
having type &amp;lt;math&amp;gt;(T,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
They are interpreted respectively as the identity relation and its complement.&lt;br /&gt;
&lt;br /&gt;
The DISTINCT symbol is both overloaded and polymorphic. &lt;br /&gt;
It has type &amp;lt;math&amp;gt;(T,...,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every sequence &amp;lt;math&amp;gt;(T,...,T)&amp;lt;/math&amp;gt; of length &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; &lt;br /&gt;
and first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
For each &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, it is interpreted as the relation &lt;br /&gt;
that holds exactly for tuples of pairwise distinct elements.&lt;br /&gt;
&lt;br /&gt;
The syntax for quantifiers is similar to that of the lambda binder.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a formula built just of these logical symbols and variables:&lt;br /&gt;
&lt;br /&gt;
 A, B: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 q: BOOLEAN = FORALL (x,y: A, i,j,k: B): &lt;br /&gt;
                i = j AND i /= k =&amp;gt; EXISTS (z: A): x /= z OR z /= y;&lt;br /&gt;
&lt;br /&gt;
Binding and scoping of quantified variables follows the same rules as &lt;br /&gt;
in let expressions. &lt;br /&gt;
In particular, a quantifier will shadow in its scope any constant and function symbols&lt;br /&gt;
with the same name as one of the variables it quantifies:&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 i, j: INT;&lt;br /&gt;
 &lt;br /&gt;
 % The first occurrence of i and of j in f are constant symbols,&lt;br /&gt;
 % the others are variables.&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN =  i = j AND FORALL (i,j: A): i = j OR i /= j;&lt;br /&gt;
&lt;br /&gt;
Optionally, it is also possible to specify instantiation patterns &lt;br /&gt;
for quantified variables. &lt;br /&gt;
The general syntax for a quantified formula &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; with patterns is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Q\;(x_1:T_1, \ldots, x_k:T_k):\; p_1: \ldots\; p_n:\; \varphi&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; is &lt;br /&gt;
either &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\varphi&amp;lt;/math&amp;gt; is a term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &lt;br /&gt;
and each of the &amp;lt;math&amp;gt;p_i&amp;lt;/math&amp;gt;'s, &lt;br /&gt;
a pattern for the quantifier &amp;lt;math&amp;gt;Q\;(x_1:T_1, \ldots, x_k:T_k)&amp;lt;/math&amp;gt;, has the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{PATTERN}\; (t_1, \ldots, t_m)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;t_1, \ldots, t_m&amp;lt;/math&amp;gt; are &lt;br /&gt;
arbitrary binder-free terms (no lets, no quantifiers). &lt;br /&gt;
Those terms can contain (free) variables, typically, but not exclusively, &lt;br /&gt;
drawn from &amp;lt;math&amp;gt;x_1, \ldots, x_k&amp;lt;/math&amp;gt;. &lt;br /&gt;
(Additional variables can occur if &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; occurs in a bigger formula &lt;br /&gt;
binding those variables.)&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 b, c: A;&lt;br /&gt;
 p, q: A -&amp;gt; BOOLEAN;&lt;br /&gt;
 r: (A, A) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x0, x1, x2: A):&lt;br /&gt;
          PATTERN (r(x0, x1), r(x1, x2)): &lt;br /&gt;
          (r(x0, x1) AND r(x1, x2)) =&amp;gt; r(x0, x2) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x: A):&lt;br /&gt;
          PATTERN (r(x, b)): &lt;br /&gt;
          PATTERN (r(x, c)): &lt;br /&gt;
          p(x) =&amp;gt; q(x) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT EXISTS (y: A):&lt;br /&gt;
          FORALL (x: A):&lt;br /&gt;
            PATTERN (r(x, y), p(y)): &lt;br /&gt;
            r(x, y) =&amp;gt; q(x) ;&lt;br /&gt;
&lt;br /&gt;
Patterns have no logical meaning: &lt;br /&gt;
adding them to a formula does not change its semantics. &lt;br /&gt;
Their purpose is purely operational, as explained in &lt;br /&gt;
the [[#Instantiation Patterns | Instantiation Patterns]] section.&lt;br /&gt;
&lt;br /&gt;
In addition to these constructs, CVC4 also has a general mixfix conditional operator &lt;br /&gt;
of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{IF}\ b\ \mathrm{THEN}\ t\ \mathrm{ELSIF}\ b_1\ \mathrm{THEN}\ t_1\ \ldots\ \mathrm{ELSIF}\ b_n\ \mathrm{THEN}\ t_n\ \mathrm{ELSE}\ t_{n+1}\ \mathrm{ENDIF}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt; where &lt;br /&gt;
&amp;lt;math&amp;gt;b, b_1, \ldots, b_n&amp;lt;/math&amp;gt; are terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; and&lt;br /&gt;
&amp;lt;math&amp;gt;t, t_1, \ldots, t_n, t_{n+1}&amp;lt;/math&amp;gt; are terms of the same first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 % Conditional term&lt;br /&gt;
 x, y, z, w: REAL;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL = &lt;br /&gt;
   IF x &amp;gt; 0 THEN y&lt;br /&gt;
   ELSIF x &amp;gt;= 1 THEN z&lt;br /&gt;
   ELSIF x &amp;gt; 2 THEN w&lt;br /&gt;
   ELSE 2/3 ENDIF;&lt;br /&gt;
&lt;br /&gt;
=== User-defined Functions and Types ===&lt;br /&gt;
&lt;br /&gt;
The theory of user-defined functions,also know in the SMT literature as &lt;br /&gt;
the theory ''Equality over Uninterpreted Functions'', or ''EUF'', is in effect &lt;br /&gt;
a family of theories of equality parametrized by the basic types and the free symbols &lt;br /&gt;
a user can define during a run of CVC4.&lt;br /&gt;
&lt;br /&gt;
This theory has no built-in symbols (other than the logical ones).&lt;br /&gt;
Its types consist of ''all and only'' the user-defined types.&lt;br /&gt;
Its function symbols consist of ''all and only'' the user-defined free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
The real arithmetic theory has two types:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{INTEGER}&amp;lt;/math&amp;gt;&lt;br /&gt;
with the latter a subtype of the first.&lt;br /&gt;
Its built-in symbols for the usual arithmetic constants &lt;br /&gt;
and operators over the type &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, each with the expected type: &lt;br /&gt;
all numerals 0, 1, ..., as well as - (both unary and binary), +, *, /, &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=. &lt;br /&gt;
Application of the binary symbols are in infix form.&lt;br /&gt;
Note that + is only binary, and so an expression such as +4 is ill-formed.&lt;br /&gt;
&lt;br /&gt;
Rational values can be expressed in decimal or fractional format,&lt;br /&gt;
e.g., 0.1, 23.243241, 1/2, 3/4, and so on.&lt;br /&gt;
A leading 0 is mandatory for decimal numbers smaller than one &lt;br /&gt;
(e.g., the syntax .3 cannot be used as a shorthand for 0.3).&lt;br /&gt;
However, a trailing 0 is ''not'' required for decimals that are whole numbers&lt;br /&gt;
(e.g., 3. is allowed as a shorthand for 3.0).&lt;br /&gt;
The size of the numerals used in the representation of natural and rational numbers &lt;br /&gt;
is unbounded; more accurately, bounded only by the amount of available memory.&lt;br /&gt;
&lt;br /&gt;
=== Bit vectors ===&lt;br /&gt;
&lt;br /&gt;
=== Arrays ===&lt;br /&gt;
&lt;br /&gt;
The theory of arrays is a parametric theory of (total) unary maps. &lt;br /&gt;
It comes equipped with mixfix polymorphic selection and update operators, respectively&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\_[\_]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_&amp;lt;/math&amp;gt; .&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
The semantics of these operators is the expected one:&lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
if &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1 \mathrm{OF}\ T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, and&lt;br /&gt;
&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a[i]&amp;lt;/math&amp;gt; denotes the value that &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; associates to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a\ \mathrm{WITH}\ [i]\ := v&amp;lt;/math&amp;gt; denotes a map that associates &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and is otherwise identical to &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;.&lt;br /&gt;
Sequential updates can be chained with the shorthand syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_, \ldots, [\_]\ := \_&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 A: TYPE = ARRAY INT OF REAL;&lt;br /&gt;
 a: A;&lt;br /&gt;
 i: INT = 4;&lt;br /&gt;
 &lt;br /&gt;
 % selection:&lt;br /&gt;
 &lt;br /&gt;
 elem: REAL = a[i];&lt;br /&gt;
 &lt;br /&gt;
 % update&lt;br /&gt;
 &lt;br /&gt;
 a1: A = a WITH [10] := 1/2;&lt;br /&gt;
 &lt;br /&gt;
 % sequential update &lt;br /&gt;
 % (syntactic sugar for (a WITH [10] := 2/3) WITH [42] := 3/2)&lt;br /&gt;
 &lt;br /&gt;
 a2: A = a WITH [10] := 2/3, [42] := 3/2;&lt;br /&gt;
&lt;br /&gt;
Since arrays are just maps, equality between them is extensional, that is, &lt;br /&gt;
for two arrays of the same type to be different they have to map at least one&lt;br /&gt;
index to differ values.&lt;br /&gt;
&lt;br /&gt;
=== Data types ===&lt;br /&gt;
&lt;br /&gt;
The theory of inductive data types is in fact a family of theories parametrized &lt;br /&gt;
by a data type declaration specifying constructors and selectors &lt;br /&gt;
for one or more user-defined data types.&lt;br /&gt;
&lt;br /&gt;
No built-in operators other than equality and disequality are provided &lt;br /&gt;
for this family in the native language. &lt;br /&gt;
Each user-provided data type declaration, however, generates constructor, selector and tester operators &lt;br /&gt;
as described in the [[#Inductive Data Types | Inductive Data Types]] section.&lt;br /&gt;
&lt;br /&gt;
=== Tuples and Records ===&lt;br /&gt;
&lt;br /&gt;
Semantically both records and tuples can be seen as special instances &lt;br /&gt;
of inductive data types.&lt;br /&gt;
CVC4 implements them internally indeed as data types.&lt;br /&gt;
In essence, a record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt;&lt;br /&gt;
is encoded as a data type of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
 \mathrm{DATATYPE} \\&lt;br /&gt;
 \ \ \mathrm{Record} = \mathit{rec}(l_0:T_0, \ldots, l_n:T_n) \\&lt;br /&gt;
 \mathrm{END};&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tuples of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; are in turn special cases of records whose field names are &lt;br /&gt;
the numerals from &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Externally, tuples and records have their own syntax for constructor and selector operators.&lt;br /&gt;
* Records of type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; have the associated  record constructor &amp;lt;math&amp;gt;(\#\ l_0 := \_,\; \ldots,\; l_n := \_\ \#)&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Tuples of type &amp;lt;math&amp;gt;[\ T_0, \ldots, T_n\ ]&amp;lt;/math&amp;gt; have the associated tuple constructor &amp;lt;math&amp;gt;(\ \_,\; \ldots,\; \_\ )&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The selector operators on records and tuples follows a dot notation syntax.&lt;br /&gt;
&lt;br /&gt;
 % Record construction and field selection&lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x: Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 k: INT = x.key;&lt;br /&gt;
 v: REAL = x.weight;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple construction and projection&lt;br /&gt;
 y: [REAL, INT, REAL] = ( 4/5, 9, 11/9 );&lt;br /&gt;
 first_elem: REAL = y.0;&lt;br /&gt;
 third_elem: REAL = y.2;&lt;br /&gt;
&lt;br /&gt;
Differently from data types, records and tuples are also provided with built-in update operators similar in syntax and semantics to the update operator for arrays. &lt;br /&gt;
More precisely, for each record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; and&lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\_\ \mathrm{WITH}\ .l_i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator maps a record &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; of that type and a value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; &lt;br /&gt;
of type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; to the record that stores &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in field &amp;lt;math&amp;gt;l_i&amp;lt;/math&amp;gt; &lt;br /&gt;
and is otherwise identical to &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;. &lt;br /&gt;
Analogously, for each tuple type &amp;lt;math&amp;gt;[T_0, \ldots, T_n]&amp;lt;/math&amp;gt; and &lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \_\ \mathrm{WITH}\ .i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with similar semantics.&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = x WITH .weight := 48;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = y WITH .1 := 3; &lt;br /&gt;
 &lt;br /&gt;
 Updates to a nested component can be combined in a single WITH operator:&lt;br /&gt;
 &lt;br /&gt;
 Cache: TYPE = ARRAY [0..100] OF [# addr: INT, data: REAL #];&lt;br /&gt;
 State: TYPE = [# pc: INT, cache: Cache #];&lt;br /&gt;
 &lt;br /&gt;
 s0: State;&lt;br /&gt;
 s1: State = s0 WITH .cache[10].data := 2/3;&lt;br /&gt;
&lt;br /&gt;
Note that, differently from updates on arrays, tuple and record updates are &lt;br /&gt;
just additional syntactic sugar. &lt;br /&gt;
For instance, the record &amp;lt;code&amp;gt;x1&amp;lt;/code&amp;gt; and tuple &amp;lt;code&amp;gt;y1&amp;lt;/code&amp;gt; defined above &lt;br /&gt;
could have been equivalently defined as follows:&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = (# key := x.key,  weight := 48 #);&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = ( y.0, 3, y.1 );&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to declarations of types and function symbols, &lt;br /&gt;
the CVC4 native language contains the following commands:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ASSERT}\ F&amp;lt;/math&amp;gt; -- Add the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; to the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
* [[#CHECKSAT|&amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is satisfiable in the current logical context (&amp;lt;math&amp;gt;\Gamma \not\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{CONTINUE}&amp;lt;/math&amp;gt; -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, search for a counter-example different from the current one.&lt;br /&gt;
* [[#COUNTEREXAMPLE|&amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print the context that is a witness for invalidity/satisfiability.&lt;br /&gt;
* [[#COUNTERMODEL|&amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print a model that makes the formula invalid/satisfiable. The model is provided in terms of concrete values for each free symbol.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{OPTION}\ o\ v&amp;lt;/math&amp;gt; -- Set the command-line option flag &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; to value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The argument &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; is provide as a string literal enclosed in double-quotes and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; as an integer value.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; -- Equivalent to &amp;lt;math&amp;gt;\mathrm{POPTO}\ 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* [[#POPTO|&amp;lt;math&amp;gt;\mathrm{POPTO}\ n&amp;lt;/math&amp;gt;]] -- Restore the system to the state it was in right before the most recent call to &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; made from stack level &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. Note that the current stack level is printed as part of the output of the &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; command.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; -- Save (checkpoint) the current state of the system.&lt;br /&gt;
* [[#QUERY|&amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is valid in the current logical context (&amp;lt;math&amp;gt;\Gamma\models_T F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* [[#RESTART|&amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, repeat the check but with the additional assumption &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; in the context.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PRINT}\ t&amp;lt;/math&amp;gt; -- Parse and print back the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRANSFORM}\ t&amp;lt;/math&amp;gt; -- Simplify the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and print the result.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; -- Print all the formulas in the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The remaining commands take a single argument, given as a string literal enclosed in double-quotes.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ECHO}\ s&amp;lt;/math&amp;gt; -- Print string &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{INCLUDE}\ f&amp;lt;/math&amp;gt; -- Read commands from file &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRACE}\ f&amp;lt;/math&amp;gt; -- Turn on tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{UNTRACE}\ f&amp;lt;/math&amp;gt; -- Turn off tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we explain some of the above commands in more detail.&lt;br /&gt;
&lt;br /&gt;
=== QUERY ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; invokes the core functionality of CVC4 to check &lt;br /&gt;
the validity of the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; with respect to the assertions made thus far,&lt;br /&gt;
which constitute the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;. &lt;br /&gt;
The argument &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; must be well typed term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;,&lt;br /&gt;
as described in [[#Terms and Formulas | Terms and Formulas]].&lt;br /&gt;
&lt;br /&gt;
The execution of this command always terminates and produces one of three possible answers: &lt;br /&gt;
&amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* A &amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;. After a query returning such an answer, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is exactly as it was before the query.&lt;br /&gt;
* An &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \not\models_T F&amp;lt;/math&amp;gt;, that is, there is a model of the background theory &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Gamma \cup \{\mathrm{NOT}\ F\}&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; returns &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is augmented with a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of ground (i.e., variable-free) literals such that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but &amp;lt;math&amp;gt;\Gamma\cup\Delta\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;. In fact, in this case &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; ''propositionally entails'' &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;, in the sense that, every truth assignment to the literals of &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; falsifies &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;. We call the new context &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; a ''counterexample'' for &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
* An &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; answer is similar to an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer in that additional literals are added to the context which propositionally entail &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;. The difference in this case is that CVC4 cannot guarantee that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is actually satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
CVC4 may report &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; when the context or the query contains&lt;br /&gt;
non-linear arithmetic terms or quantifiers.&lt;br /&gt;
In all other cases, it is expected to be sound and complete, &lt;br /&gt;
i.e., to report &amp;lt;code&amp;gt;Valid&amp;lt;/code&amp;gt; if &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;&lt;br /&gt;
and &amp;lt;code&amp;gt;Invalid&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
After an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; (resp. &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;) answer,&lt;br /&gt;
counterexamples (resp. possible counterexamples) can be obtained with &lt;br /&gt;
a &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
or &amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt; command. &lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
WHERE always prints out all of &amp;lt;math&amp;gt;\Gamma\cup C&amp;lt;/math&amp;gt;. COUNTEREXAMPLE may sometimes be more selective, printing a subset of those formulas from the context which are sufficient for a counterexample.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; command may modify &lt;br /&gt;
the current context, if one needs to check several formulas in a row &lt;br /&gt;
in the same context, it is a good idea to surround every &lt;br /&gt;
query by a &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; invocation&lt;br /&gt;
in order to preserve the context:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
&lt;br /&gt;
=== CHECKSAT ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt; behaves identically &lt;br /&gt;
to &amp;lt;math&amp;gt;\mathrm{QUERY}\ \mathrm{NOT}\ F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== RESTART ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt; can only be invoked after an invalid query. &lt;br /&gt;
For example, in an interactive setting:&lt;br /&gt;
&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
 CVC4&amp;gt; invalid&lt;br /&gt;
 &lt;br /&gt;
 RESTART &amp;lt;formula2&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
Functionally, the behavior of the above command sequence is identical to the following:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
 ASSERT &amp;lt;formula2&amp;gt;;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
The advantage of using the &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; command is that &lt;br /&gt;
the first command sequence may be executed much more efficiently that the second.&lt;br /&gt;
The reason is that with &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; CVC4 will re-use&lt;br /&gt;
what it has learned while answering the previous query rather than starting &lt;br /&gt;
over from scratch.&lt;br /&gt;
&lt;br /&gt;
=== COUNTERMODEL ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== COUNTEREXAMPLE ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== POPTO ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
== Instantiation Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVC4 processes each universally quantified formula in the current context &lt;br /&gt;
by adding instances of the formula obtained by replacing its universal variables &lt;br /&gt;
with ground terms. &lt;br /&gt;
Patterns restrict the choice of ground terms for the quantified variables, &lt;br /&gt;
with the goal of controlling the potential explosion of ground instances. &lt;br /&gt;
In essence, adding patterns to a formula is a way for the user to tell CVC4 &lt;br /&gt;
to focus only on certain instances which, in the user's opinion, will be &lt;br /&gt;
most helpful during a proof.&lt;br /&gt;
&lt;br /&gt;
In more detail, patterns have the following effect on formulas that are found &lt;br /&gt;
in the logical context or get added to it later while CVC4 is trying to prove &lt;br /&gt;
the validity of some formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If a formula in the current context starts with an existential quantifier, &lt;br /&gt;
CVC4 ''Skolemizes'' it, that is, replaces it in the context with the formula &lt;br /&gt;
obtained by substituting the existentially quantified variables &lt;br /&gt;
by fresh constants and dropping the quantifier. &lt;br /&gt;
Any patterns for the existential quantifier are simply ignored.&lt;br /&gt;
&lt;br /&gt;
If a formula starts with a universal quantifier &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{FORALL}\; (x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt;, &lt;br /&gt;
CVC4 adds to the context a number of instances of the formula, &lt;br /&gt;
with the goal of using them to prove the query &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; valid. &lt;br /&gt;
An instance is obtained by replacing each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; with a ground term&lt;br /&gt;
of the same type occurring in one of the formulas in the context, &lt;br /&gt;
and dropping the universal quantifier. &lt;br /&gt;
If &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; occurs in a pattern &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{PATTERN}\; (t_1, \ldots, t_m)&amp;lt;/math&amp;gt; for the quantifier, &lt;br /&gt;
it will be instantiated only with terms obtained by simultaneously matching &lt;br /&gt;
all the terms in the pattern against ground terms in the current context &lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Specifically, the matching process produces one or more substitutions &lt;br /&gt;
&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; for the variables in &amp;lt;math&amp;gt;(t_1, \ldots, t_m)&amp;lt;/math&amp;gt; &lt;br /&gt;
which satisfy the following invariant: &lt;br /&gt;
for each &amp;lt;math&amp;gt;i = 1, \ldots, m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\sigma(t_i)&amp;lt;/math&amp;gt; is &lt;br /&gt;
a ground term and there is a ground term &amp;lt;math&amp;gt;s_i&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
such that &amp;lt;math&amp;gt;\Gamma \models_T \sigma(t_i) = s_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
The variables of &amp;lt;math&amp;gt;(x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt; that occur &lt;br /&gt;
in the pattern are instantiated only with those substitutions &lt;br /&gt;
(while any remaining variables are instantiated arbitrarily).&lt;br /&gt;
&lt;br /&gt;
The Skolemized version or the added instances of a context formula may themselves &lt;br /&gt;
start with a quantifier. &lt;br /&gt;
The same instantiation process is applied to them too, recursively.&lt;br /&gt;
&lt;br /&gt;
Note that the matching mechanism is not limited to syntactic matching &lt;br /&gt;
but is modulo the equations asserted in the context. &lt;br /&gt;
Because of decidability and/or efficiency limitations, the matching process &lt;br /&gt;
is not exhaustive. &lt;br /&gt;
CVC4 will typically miss some substitutions that satisfy the invariant above. &lt;br /&gt;
As a consequence, it might fail to prove the validity of the query formula &lt;br /&gt;
&amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;, which makes CVC4 incomplete for contexts containing &lt;br /&gt;
quantified formulas. &lt;br /&gt;
It should be noted though that exhaustive matching, which can be achieved &lt;br /&gt;
simply by not specifying any patterns, does not yield completeness anyway &lt;br /&gt;
since the instantiation of universal variables is still restricted &lt;br /&gt;
to just the ground terms in the context,&lt;br /&gt;
whereas in general additional ground terms might be needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 == Subtypes ==&lt;br /&gt;
&lt;br /&gt;
=== Subtype Checking ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3928</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3928"/>
				<updated>2012-11-27T18:20:37Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Building from source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[#Building_CVC4 from_a_repository_checkout]] here.&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
The CVC4 driver binary (&amp;quot;cvc4&amp;quot;), once installed, can be executed directly to enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's native input language=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The native input language consists of a sequence of symbol declarations and commands, each followed by a semicolon (&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Any text after the first occurrence of a percent character and to the end of the current line is a comment:&lt;br /&gt;
&lt;br /&gt;
 %%% This is a native language comment&lt;br /&gt;
&lt;br /&gt;
== Type System ==&lt;br /&gt;
&lt;br /&gt;
CVC4's type system includes a set of built-in types which can be expanded with additional user-defined types.&lt;br /&gt;
&lt;br /&gt;
The type system consists of ''first-order'' types, ''subtypes'' of first-order types, and ''higher-order'' types,  all of which are interpreted as sets. &lt;br /&gt;
For convenience, we will sometimes identify below the interpretation of a type with the type itself.&lt;br /&gt;
&lt;br /&gt;
First-order types consist of basic types and structured types. The basic types are &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, as well as user-defined basic types (also called uninterpreted types). &lt;br /&gt;
The structured types are array, tuple, record types, and ML-style user-defined (inductive) datatypes.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Currently, subtypes consist only of the built-in subtype &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;!-- and are covered in the [[#Subtypes|Subtypes]] section. --&amp;gt;&lt;br /&gt;
Support for CVC3-style user-defined subtypes will be added in a later release.&lt;br /&gt;
&lt;br /&gt;
Function types are the only higher-order types.&lt;br /&gt;
More precisely, they are just second-order types &lt;br /&gt;
since function symbols in CVC4, both built-in and user-defined, can take as argument or return only values of &lt;br /&gt;
a first-order type.&lt;br /&gt;
&lt;br /&gt;
=== Basic Types ===&lt;br /&gt;
&lt;br /&gt;
==== The BOOLEAN Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; type is interpreted as the two-element set of Boolean values&lt;br /&gt;
&amp;lt;math&amp;gt;\{\mathrm{TRUE},\; \mathrm{FALSE}\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
'''Note:''' CVC4's treatment of this type differs from CVC3's where &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; is used only as the type of formulas, but not as value type. CVC3 follows the two-tiered structure of classical first-order logic &lt;br /&gt;
which distinguishes between formulas and terms, and allows terms to occur in formulas but not vice versa (with the exception of the IF-THEN-ELSE construct).&lt;br /&gt;
CVC4 drops the distinction between terms and formulas and defines the latter just as terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. As such, formulas can occur as subterms of possibly non-Boolean terms.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 [To do]&lt;br /&gt;
&lt;br /&gt;
==== The REAL Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; type is interpreted as the set of real numbers.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical reals,&lt;br /&gt;
not the floating point numbers.&lt;br /&gt;
Support for floating point types is planned for future versions.&lt;br /&gt;
&lt;br /&gt;
 x, y : REAL;&lt;br /&gt;
 QUERY (( x &amp;lt;= y ) AND ( y &amp;lt;= x )) =&amp;gt; ( x = y );&lt;br /&gt;
&lt;br /&gt;
==== The INT Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; type is interpreted as the set of integer numbers&lt;br /&gt;
and is considered as a subtype of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The latter means in particular that it is possible to mix integer and real terms &lt;br /&gt;
in expressions without the need of an explicit ''upcasting'' operator.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical integers,&lt;br /&gt;
not the finite precision machine integers used in most programming languages. &lt;br /&gt;
The latter are models by [[ #Bitvectors | bit vector ]] types.&lt;br /&gt;
&lt;br /&gt;
 x, y : INT;&lt;br /&gt;
 QUERY ((2 * x + 4 * y &amp;lt;= 1) AND ( y &amp;gt;= x)) =&amp;gt; (x &amp;lt;= 0);&lt;br /&gt;
 z : REAL;&lt;br /&gt;
 QUERY (2 * x + z &amp;lt;= 3.5) AND (z &amp;gt;= 1);&lt;br /&gt;
&lt;br /&gt;
==== Bit Vector Types ====&lt;br /&gt;
&lt;br /&gt;
For every positive integer &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, the type &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; is interpreted as the set of all bit vectors of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
A rich set of bit vector operators is supported.&lt;br /&gt;
&lt;br /&gt;
==== User-defined Basic Types ====&lt;br /&gt;
&lt;br /&gt;
Users can define new basic types &lt;br /&gt;
(often referred to as ''uninterpreted'' types in the SMT literature).&lt;br /&gt;
Each such type is interpreted as a set of unspecified cardinality &lt;br /&gt;
but disjoint from any other type. &lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Can we specify cardinalities? &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
User-defined basic types are created by declarations like the following:&lt;br /&gt;
&lt;br /&gt;
 % User declarations of basic types:&lt;br /&gt;
 &lt;br /&gt;
 MyBrandNewType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 Apples, Oranges: TYPE;&lt;br /&gt;
&lt;br /&gt;
=== Structured Types ===&lt;br /&gt;
&lt;br /&gt;
CVC4's structured types are divided in the following families. &lt;br /&gt;
&lt;br /&gt;
==== Array Types ====&lt;br /&gt;
&lt;br /&gt;
Array types are created by the mixfix type constructors &amp;lt;math&amp;gt;\mathrm{ARRAY}\ \_\ \mathrm{OF}\ \_&amp;lt;/math&amp;gt; &lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 I : TYPE;&lt;br /&gt;
 &lt;br /&gt;
 %% Array types:&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with indices from I and values from REAL&lt;br /&gt;
 Array1: TYPE = ARRAY I OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer indices and array values &lt;br /&gt;
 Array2: TYPE = ARRAY INT OF (ARRAY INT OF REAL);&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer pair indices and integer values&lt;br /&gt;
 IntMatrix: TYPE = ARRAY [INT, INT] OF INT;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
An array type of the form &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1\ \mathrm{OF}\ T_2&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the set of all total maps from &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
The main difference with the function type &amp;lt;math&amp;gt;T_1 \to T_2&amp;lt;/math&amp;gt; is that arrays, &lt;br /&gt;
contrary to functions, are first-class objects of the language, that is, values of an array&lt;br /&gt;
type can be arguments or results of functions. &lt;br /&gt;
Furthermore, array types come equipped with an update operation.&lt;br /&gt;
&lt;br /&gt;
==== Tuple Types ====&lt;br /&gt;
&lt;br /&gt;
Tuple types are created by the mixfix type constructors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l} [\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ \ ,\ \_\ ] \\[1ex] \ldots \end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 IntArray: TYPE = ARRAY INT OF INT;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple type declarations&lt;br /&gt;
 &lt;br /&gt;
 RealPair: TYPE = [REAL, REAL]&lt;br /&gt;
 &lt;br /&gt;
 MyTuple: TYPE = [ REAL, IntArray, [INT, INT] ];&lt;br /&gt;
&lt;br /&gt;
A tuple type of the form &amp;lt;math&amp;gt;[T_1, \ldots, T_n]&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Note that while the types &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and &lt;br /&gt;
&amp;lt;math&amp;gt;[T_1 \times \cdots \times T_n] \to T&amp;lt;/math&amp;gt; are semantically equivalent, &lt;br /&gt;
they are operationally different in CVC4. &lt;br /&gt;
The first is the type of functions that take &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; arguments &lt;br /&gt;
of respective type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;T_n&amp;lt;/math&amp;gt;, &lt;br /&gt;
while the second is the type of functions that take one argument of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-tuple type.&lt;br /&gt;
&lt;br /&gt;
==== Record Types ====&lt;br /&gt;
&lt;br /&gt;
Similar to, but more general than tuple types, record types are created by type constructors of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
[\#\ l_1: \_\ ,\ \ldots\ ,\ l_n: \_\ \#]&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;l_1,\ldots, l_n&amp;lt;/math&amp;gt; are field labels, &lt;br /&gt;
and the arguments can be instantiated with any first-order types.&lt;br /&gt;
&lt;br /&gt;
 MyType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 % Record declaration&lt;br /&gt;
 &lt;br /&gt;
 RecordType: TYPE = [# id: REAL, age: INT, info: MyType #];&lt;br /&gt;
&lt;br /&gt;
The order of the fields in a record type is meaningful: &lt;br /&gt;
permuting the field names gives a different type. &lt;br /&gt;
&lt;br /&gt;
Note that record types are non-recursive. &lt;br /&gt;
For instance, it is not possible to declare a record type called &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt; containing &lt;br /&gt;
a field of type &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt;. &lt;br /&gt;
Recursive types are provided in CVC4 by the more general inductive data types.&lt;br /&gt;
(As a matter of fact, both record and tuple types are implemented internally as inductive data types.)&lt;br /&gt;
&lt;br /&gt;
==== Inductive Data Types ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inductive data types in CVC4 are similar to inductive data types of functional languages.&lt;br /&gt;
They can be parametric or not.&lt;br /&gt;
&lt;br /&gt;
===== Non-Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Non-parametric data types are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE} \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1 &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2 &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
Such declarations define the data types &amp;lt;math&amp;gt;A_1, \ldots, A_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
For each data type &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; they introduce:&lt;br /&gt;
&lt;br /&gt;
* constructor symbols &amp;lt;math&amp;gt;cons&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;(T_1, \ldots, T_k) \to \mathit{type\_name}_i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* selector symbols &amp;lt;math&amp;gt;\mathit{sel}_j&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to T_j&amp;lt;/math&amp;gt;, and&lt;br /&gt;
* tester symbols &amp;lt;math&amp;gt;\mathit{is\_cons}&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that permitting more than one data type to be defined in the same declarations allows &lt;br /&gt;
the definition of mutually recursive types.&lt;br /&gt;
&lt;br /&gt;
 % simple enumeration type&lt;br /&gt;
 &lt;br /&gt;
 % implicitly defined are the testers: is_red, is_yellow and is_blue&lt;br /&gt;
 % (similarly for the other data types)&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   PrimaryColor = red | yellow | blue&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % infinite set of pairwise distinct values ..., v(-1), v(0), v(1), ...&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Id = v (id: INT)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % ML-style integer lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   IntList = nil | ins (head: INT, tail: IntList)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % AST for lamba calculus&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Term = var (index: INT)&lt;br /&gt;
        | apply (arg_1: Term, arg_2: Term)&lt;br /&gt;
        | lambda (arg: INT, body: Term)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Trees&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Tree = tree (value: REAL, children: TreeList),&lt;br /&gt;
   TreeList = nil_tl&lt;br /&gt;
            | ins_tl (first_t1: Tree, rest_t1: TreeList)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
Constructor, selector and tester symbols defined for a data type have global scope. &lt;br /&gt;
So, for example, it is not possible for two different data types to use &lt;br /&gt;
the same name for a constructor.&lt;br /&gt;
&lt;br /&gt;
An inductive data type is interpreted as a term algebra constructed by the constructor symbols &lt;br /&gt;
over some sets of generators. &lt;br /&gt;
For example, the type &amp;lt;code&amp;gt;IntList&amp;lt;/code&amp;gt; defined above is interpreted as the set &lt;br /&gt;
of all terms constructed with &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ins&amp;lt;/code&amp;gt; over the integers.&lt;br /&gt;
&lt;br /&gt;
===== Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Parametric data types are infinite families of (non-parametric) data types &lt;br /&gt;
with each family parametrized by one or more type variables.&lt;br /&gt;
They are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE}  \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1[X_{1,1}, \ldots, X_{1,p_1}] &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2[X_{2,1}, \ldots, X_{2,p_2}] &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n[X_{n,1}, \ldots, X_{n,p_n}] &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name parametrized by the type variables &amp;lt;math&amp;gt;X_{i,1}, \ldots, X_{i,p_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, &lt;br /&gt;
possibly parametrized by &amp;lt;math&amp;gt;X_1, \ldots, X_p&amp;lt;/math&amp;gt;, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 % Parametric pairs&lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Pair[X, Y] = pair (first: X, second: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 % Parametric lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Parametric trees using the list type above&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   Tree[X] = node (value: X, children: List[Tree[X]]),&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
The declarations above define infinitely many types of the form &lt;br /&gt;
Pair[S,T], List[T] and Tree[T] where S and T are first-order types.&lt;br /&gt;
Note that the identifier &amp;lt;code&amp;gt;List&amp;lt;/code&amp;gt; above, for example, by itself does not denote a type.&lt;br /&gt;
In contrast, the terms &amp;lt;code&amp;gt;List[Real]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[List[Real]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[Tree[INT]]&amp;lt;/code&amp;gt;,&lt;br /&gt;
and so on do.&lt;br /&gt;
&lt;br /&gt;
===== Restriction to Inductive Types =====&lt;br /&gt;
&lt;br /&gt;
By adopting a term algebra semantics, CVC4 allows only ''inductive'' data types, &lt;br /&gt;
that is, data types whose values are essentially (labeled, ordered) finite trees. &lt;br /&gt;
Infinite structures such as streams or even finite but cyclic ones &lt;br /&gt;
such as circular lists are then excluded. &lt;br /&gt;
For instance, none of the following declarations define inductive data types, &lt;br /&gt;
and are rejected by CVC4:&lt;br /&gt;
&lt;br /&gt;
 DATATYPE&lt;br /&gt;
  IntStream = s (first:INT, rest: IntStream)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
  RationalTree = node1 (child: RationalTree)&lt;br /&gt;
               | node2 (left_child: RationalTree, right_child:RationalTree)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   T1 =  c1 (s1: T2),&lt;br /&gt;
   T2 =  c2 (s2: T1)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
In concrete, a declaration of &amp;lt;math&amp;gt;n \geq 1&amp;lt;/math&amp;gt; datatypes &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; will be rejected if for any one of the types &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;, it is impossible to build a finite term of that type using only the constructors of &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; and free constants of type other than &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Inductive data types are the only types where the user also chooses names for the built-in operations to:&lt;br /&gt;
&lt;br /&gt;
* construct a value of the type (with the constructors),&lt;br /&gt;
* extract components from a value (with the selectors), or&lt;br /&gt;
* check if a value was constructed with a certain constructor or not (with the testers).&lt;br /&gt;
&lt;br /&gt;
For all the other types, CVC4 provides predefined names for the built-in operations on the type.&lt;br /&gt;
&lt;br /&gt;
=== Function Types ===&lt;br /&gt;
&lt;br /&gt;
Function (&amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt;) types are created by the mixfix type constructors&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\_ \to \_ \\[1ex] (\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] (\ \_\ ,\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] \ldots &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
whose arguments can be instantiated by any first-order type.&lt;br /&gt;
&lt;br /&gt;
 % Function type declarations&lt;br /&gt;
 &lt;br /&gt;
 UnaryFunType: TYPE = INT -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 BinaryFunType: TYPE = (REAL, REAL) -&amp;gt; ARRAY REAL OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 TernaryFunType: TYPE = (REAL, BITVECTOR(4), INT) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
A function type of the form &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; is interpreted as the set of all ''total'' functions from the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The example above also shows how to introduce type names. &lt;br /&gt;
A name like &amp;lt;code&amp;gt;UnaryFunType&amp;lt;/code&amp;gt; above is just an abbreviation for the type &amp;lt;math&amp;gt;\mathrm{INT} \to \mathrm{REAL}&amp;lt;/math&amp;gt; and can be used interchangeably with it.&lt;br /&gt;
&lt;br /&gt;
In general, any type defined by a type expression &amp;lt;code&amp;gt;E&amp;lt;/code&amp;gt; can be given a name with the declaration:&lt;br /&gt;
&lt;br /&gt;
 name : TYPE = E;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Type Checking ===&lt;br /&gt;
&lt;br /&gt;
In CVC4, formulas and terms are statically typed at the level of types &lt;br /&gt;
(as opposed to subtypes) according to the usual rules of first-order many-sorted logic,&lt;br /&gt;
with the main difference that formulas are just terms of type &amp;lt;math&amp;gt;BOOLEAN&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* each variable has one associated first-order type,&lt;br /&gt;
* each constant symbol has one or more associated first-order types,&lt;br /&gt;
* each function symbol has one or more associated function types,&lt;br /&gt;
* the type of a term consisting just of a variable is the type associated to that variable,&lt;br /&gt;
* the type of a term consisting just of a constant symbol is the type associated to that constant symbol,&lt;br /&gt;
* the term obtained by applying a function symbol &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; to the terms &amp;lt;math&amp;gt;t_1, \ldots, t_n&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and each &amp;lt;math&amp;gt;t_i&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Attempting to enter an ill-typed term will result in an error.&lt;br /&gt;
&lt;br /&gt;
Another significant difference with standard many-sorted logic is that &lt;br /&gt;
some built-in symbols are parametrically polymorphic. &lt;br /&gt;
For instance, the function symbol for extracting the element of any array has &lt;br /&gt;
type &amp;lt;math&amp;gt;(\mathit{ARRAY}\ T_1\ \mathit{OF}\ T_2,\; T_1) \to T_2&amp;lt;/math&amp;gt; &lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1, T_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Type Ascription ====&lt;br /&gt;
&lt;br /&gt;
By the type inference rules above some terms might have more than one type.&lt;br /&gt;
This can happen with terms built with polymorphic data type constructors&lt;br /&gt;
that have more than one return type for the same input type.&lt;br /&gt;
In that case, a type ascription operator (&amp;lt;code&amp;gt;::&amp;lt;/code&amp;gt;) must be applied &lt;br /&gt;
to the constructor to specify the intended return type.&lt;br /&gt;
&lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = cons(1, nil::List[REAL]);&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Union[X, Y] = left(val_l: X) | right(val_r: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = left::Union[BOOLEAN, REAL](TRUE);&lt;br /&gt;
&lt;br /&gt;
The constant symbol &amp;lt;math&amp;gt;\mathrm{nil}&amp;lt;/math&amp;gt; declared above has infinitely many types &lt;br /&gt;
(&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{REAL}]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{List}[\mathrm{BOOLEAN}]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[[\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;, ...)&lt;br /&gt;
CVC4's type checker requires the user to indicate explicitly the type &lt;br /&gt;
of each occurrence of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; in a term. &lt;br /&gt;
Similarly, &lt;br /&gt;
the injection operator &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; has infinitely many return types &lt;br /&gt;
for the same input type, for instance:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{REAL}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, [\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
and so on.&lt;br /&gt;
Applications of &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; need to specify the intended returned typed, as shown above.&lt;br /&gt;
&lt;br /&gt;
== Terms and Formulas ==&lt;br /&gt;
&lt;br /&gt;
In addition to type expressions, CVC4 has expressions for terms and for formulas &lt;br /&gt;
(i.e., terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;). &lt;br /&gt;
By and large, these are standard first-order terms built out of typed variables, &lt;br /&gt;
predefined theory-specific operators, free (i.e., user-defined) function symbols, &lt;br /&gt;
and quantifiers. &lt;br /&gt;
Extensions include an if-then-else operator, lambda abstractions, and local symbol &lt;br /&gt;
declarations, as illustrated below. &lt;br /&gt;
Note that these extensions still keep CVC4's language first-order. &lt;br /&gt;
In particular, lambda abstractions are restricted to take and return only terms of &lt;br /&gt;
a first-order type. &lt;br /&gt;
Similarly, variables can only be of a first-order type.&lt;br /&gt;
&lt;br /&gt;
A number of built-in function symbols (for instance, the arithmetic ones) are used &lt;br /&gt;
as infix operators. All user-defined symbols are used as prefix ones.&lt;br /&gt;
&lt;br /&gt;
User-defined, i.e., free, function symbols include ''constant symbols'' and &lt;br /&gt;
''predicate symbols'', respectively  nullary function symbols and function symbols &lt;br /&gt;
with a &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; return type. &lt;br /&gt;
These symbols are introduced with global declarations of the form &lt;br /&gt;
&amp;lt;math&amp;gt; f_1, \ldots, f_m: T;&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;f_i&amp;lt;/math&amp;gt; are the names of the symbols and &lt;br /&gt;
&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is their type:&lt;br /&gt;
&lt;br /&gt;
 % integer constants&lt;br /&gt;
 &lt;br /&gt;
 a, b, c: INT;&lt;br /&gt;
 &lt;br /&gt;
 % real constants&lt;br /&gt;
 &lt;br /&gt;
 x, y, z: REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function&lt;br /&gt;
 &lt;br /&gt;
 f1: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % binary function&lt;br /&gt;
 &lt;br /&gt;
 f2: (REAL, INT) -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function with a tuple argument&lt;br /&gt;
 &lt;br /&gt;
 f3: [INT, REAL] -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % binary predicate&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, REAL) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % Propositional &amp;quot;variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 P, Q; BOOLEAN;&lt;br /&gt;
&lt;br /&gt;
Like type declarations, function symbol declarations like the above have global scope &lt;br /&gt;
and must be unique. &lt;br /&gt;
In other words, it is not possible to declare a function symbol globally more than once&lt;br /&gt;
in the same lexical scope. &lt;br /&gt;
This entails among other things that globally-defined free symbols cannot be overloaded &lt;br /&gt;
with different types and that theory symbols cannot be redeclared globally as free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Global symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
As with types, a function symbol can be defined as the name of another term &lt;br /&gt;
of the corresponding type. &lt;br /&gt;
With constant symbols, this is done with a declaration of the form &amp;lt;math&amp;gt;f:T = t;&amp;lt;/math&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
 c: INT;&lt;br /&gt;
 &lt;br /&gt;
 i: INT = 5 + 3*c;  % i is effectively a shorthand for 5 + 3*c&lt;br /&gt;
 &lt;br /&gt;
 j: REAL = 3/4;&lt;br /&gt;
 &lt;br /&gt;
 t: [REAL, INT] = (2/3, -4);&lt;br /&gt;
 &lt;br /&gt;
 r: [# key: INT, value: REAL #] = (# key := 4, value := (c + 1)/2 #);&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN = FORALL (x:INT): x &amp;lt;= 0 OR x &amp;gt; c ;&lt;br /&gt;
&lt;br /&gt;
A restriction on constants of type &amp;lt;math&amp;gt;\mathit{BOOLEAN}&amp;lt;/math&amp;gt; is that their value &lt;br /&gt;
can only be a closed formula, that is, a formula with no free variables.&lt;br /&gt;
&lt;br /&gt;
A term and its name can be used interchangeably in later expressions. &lt;br /&gt;
Named terms are often useful for shared subterms (terms used several times in different places) &lt;br /&gt;
since their use can make the input exponentially more concise. &lt;br /&gt;
Named terms are processed very efficiently by CVC4. &lt;br /&gt;
It is much more efficient to associate a complex term with a name directly rather than &lt;br /&gt;
to declare a constant and later assert that it is equal to the same term. &lt;br /&gt;
This point is explained in more detail later in section [[Commands | Commands]].&lt;br /&gt;
&lt;br /&gt;
More generally, in CVC4 one can associate a term to function symbols of any arity. &lt;br /&gt;
For non-constant function symbols this is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;f:(T_1, \ldots, T_n) \to T = \mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t\;;&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is any term of type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; with free variables &lt;br /&gt;
in &amp;lt;math&amp;gt;\{x_1, \ldots, x_n\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The lambda binder has the usual semantics and conforms to the usual lexical scoping rules: &lt;br /&gt;
within the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; the declaration of the symbols &amp;lt;math&amp;gt;x_1, \ldots, x_n&amp;lt;/math&amp;gt; &lt;br /&gt;
as local variables of respective type &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; hides any previous&lt;br /&gt;
declarations of those symbols that are in scope.&lt;br /&gt;
&lt;br /&gt;
As a general shorthand, when &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; consecutive types &lt;br /&gt;
&amp;lt;math&amp;gt;T_i, \ldots, T_{i+k-1}&amp;lt;/math&amp;gt;  in the lambda expression &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t&amp;lt;/math&amp;gt; are identical, the syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x_i,\ldots, x_{i+k-1}:T_i,\ldots, x:T_n): t&amp;lt;/math&amp;gt;&lt;br /&gt;
can also be used.&lt;br /&gt;
&lt;br /&gt;
 % Global declaration of x as a unary function symbol&lt;br /&gt;
 &lt;br /&gt;
 x: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Local declarations of x as variable (hiding the global one)&lt;br /&gt;
 &lt;br /&gt;
 f: REAL -&amp;gt; REAL = LAMBDA (x: REAL): 2*x + 3;&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, INT) -&amp;gt; BOOLEAN = LAMBDA (x,i: INT): i*x - 1 &amp;gt; 0;&lt;br /&gt;
 &lt;br /&gt;
 g: (REAL, INT) -&amp;gt; [REAL, INT] = LAMBDA (x: REAL, i:INT): (x + 1, i - 3);&lt;br /&gt;
&lt;br /&gt;
Note that lambda definitions are not recursive: &lt;br /&gt;
the symbol being defined cannot occur in the body of the lambda term.&lt;br /&gt;
They should be understood as macros.&lt;br /&gt;
For instance, any occurrence of the term &amp;lt;math&amp;gt;f(t)&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; is as defined above will be treated &lt;br /&gt;
as if it was the term &amp;lt;math&amp;gt;(2*t + 3)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Local symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
Constant and function symbols can also be declared locally anywhere within a term &lt;br /&gt;
by means of a let binder. &lt;br /&gt;
This is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f = t \ \mathrm{IN}\ t' ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is a term with no free variables, possibly a lambda term.&lt;br /&gt;
Let binders can be nested arbitrarily and follow the usual lexical scoping rules.&lt;br /&gt;
The following general form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1, f_2 = t_2, \ldots, f_n = t_m \ \mathrm{IN}\ t ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
can be use above can used as a shorthand for&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1\ \mathrm{IN}\ &lt;br /&gt;
 \mathrm{LET}\ f_2 = t_2\ \mathrm{IN}\ &lt;br /&gt;
 \ldots \ &lt;br /&gt;
 \mathrm{LET}\ f_n = t_m \ \mathrm{IN}\ t ;&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL =&lt;br /&gt;
   LET x1 = 42,&lt;br /&gt;
       g = LAMBDA(x:INT): x + 1,&lt;br /&gt;
       x2 = 2*x1 + 7/2&lt;br /&gt;
   IN&lt;br /&gt;
      (LET x3 = g(x1) IN x3 + x2) / x1;&lt;br /&gt;
&lt;br /&gt;
Note that the same symbol = is used, unambiguously, in the syntax of global declarations, &lt;br /&gt;
let declarations, and as a predicate symbol.&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
A &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; term with a multiple symbols defines them sequentially.&lt;br /&gt;
A parallel version of the &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; construct will be introduced in a later version.&lt;br /&gt;
&lt;br /&gt;
== Built-in theories and their symbols ==&lt;br /&gt;
&lt;br /&gt;
In addition to user-defined symbols, CVC4 terms can use a number of predefined symbols: &lt;br /&gt;
the logical symbols, such as &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, etc., &lt;br /&gt;
as well as theory symbols, function symbols belonging to one of the built-in theories. &lt;br /&gt;
They are described next, with the theory symbols grouped by theory.&lt;br /&gt;
&lt;br /&gt;
=== Logical Symbols ===&lt;br /&gt;
&lt;br /&gt;
The logical symbols in CVC4's language include &lt;br /&gt;
the equality and disequality predicate symbols, respectively written as = and /=, &lt;br /&gt;
the multiarity disequality symbol &amp;lt;math&amp;gt;\mathrm{DISTINCT}&amp;lt;/math&amp;gt;, &lt;br /&gt;
together with the logical constants &amp;lt;math&amp;gt;\mathrm{TRUE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{FALSE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
the connectives &amp;lt;math&amp;gt;\mathrm{NOT}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{XOR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt;, and &lt;br /&gt;
the first-order quantifiers &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt;, &lt;br /&gt;
all with the standard many-sorted logic semantics.&lt;br /&gt;
&lt;br /&gt;
The binary connectives have infix syntax and type &lt;br /&gt;
&amp;lt;math&amp;gt;(\mathrm{BOOLEAN},\mathrm{BOOLEAN}) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The symbols = and /=, which are also infix, are instead parametrically polymorphic, &lt;br /&gt;
having type &amp;lt;math&amp;gt;(T,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
They are interpreted respectively as the identity relation and its complement.&lt;br /&gt;
&lt;br /&gt;
The DISTINCT symbol is both overloaded and polymorphic. &lt;br /&gt;
It has type &amp;lt;math&amp;gt;(T,...,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every sequence &amp;lt;math&amp;gt;(T,...,T)&amp;lt;/math&amp;gt; of length &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; &lt;br /&gt;
and first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
For each &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, it is interpreted as the relation &lt;br /&gt;
that holds exactly for tuples of pairwise distinct elements.&lt;br /&gt;
&lt;br /&gt;
The syntax for quantifiers is similar to that of the lambda binder.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a formula built just of these logical symbols and variables:&lt;br /&gt;
&lt;br /&gt;
 A, B: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 q: BOOLEAN = FORALL (x,y: A, i,j,k: B): &lt;br /&gt;
                i = j AND i /= k =&amp;gt; EXISTS (z: A): x /= z OR z /= y;&lt;br /&gt;
&lt;br /&gt;
Binding and scoping of quantified variables follows the same rules as &lt;br /&gt;
in let expressions. &lt;br /&gt;
In particular, a quantifier will shadow in its scope any constant and function symbols&lt;br /&gt;
with the same name as one of the variables it quantifies:&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 i, j: INT;&lt;br /&gt;
 &lt;br /&gt;
 % The first occurrence of i and of j in f are constant symbols,&lt;br /&gt;
 % the others are variables.&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN =  i = j AND FORALL (i,j: A): i = j OR i /= j;&lt;br /&gt;
&lt;br /&gt;
Optionally, it is also possible to specify instantiation patterns &lt;br /&gt;
for quantified variables. &lt;br /&gt;
The general syntax for a quantified formula &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; with patterns is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Q\;(x_1:T_1, \ldots, x_k:T_k):\; p_1: \ldots\; p_n:\; \varphi&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; is &lt;br /&gt;
either &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\varphi&amp;lt;/math&amp;gt; is a term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &lt;br /&gt;
and each of the &amp;lt;math&amp;gt;p_i&amp;lt;/math&amp;gt;'s, &lt;br /&gt;
a pattern for the quantifier &amp;lt;math&amp;gt;Q\;(x_1:T_1, \ldots, x_k:T_k)&amp;lt;/math&amp;gt;, has the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{PATTERN}\; (t_1, \ldots, t_m)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;t_1, \ldots, t_m&amp;lt;/math&amp;gt; are &lt;br /&gt;
arbitrary binder-free terms (no lets, no quantifiers). &lt;br /&gt;
Those terms can contain (free) variables, typically, but not exclusively, &lt;br /&gt;
drawn from &amp;lt;math&amp;gt;x_1, \ldots, x_k&amp;lt;/math&amp;gt;. &lt;br /&gt;
(Additional variables can occur if &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; occurs in a bigger formula &lt;br /&gt;
binding those variables.)&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 b, c: A;&lt;br /&gt;
 p, q: A -&amp;gt; BOOLEAN;&lt;br /&gt;
 r: (A, A) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x0, x1, x2: A):&lt;br /&gt;
          PATTERN (r(x0, x1), r(x1, x2)): &lt;br /&gt;
          (r(x0, x1) AND r(x1, x2)) =&amp;gt; r(x0, x2) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x: A):&lt;br /&gt;
          PATTERN (r(x, b)): &lt;br /&gt;
          PATTERN (r(x, c)): &lt;br /&gt;
          p(x) =&amp;gt; q(x) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT EXISTS (y: A):&lt;br /&gt;
          FORALL (x: A):&lt;br /&gt;
            PATTERN (r(x, y), p(y)): &lt;br /&gt;
            r(x, y) =&amp;gt; q(x) ;&lt;br /&gt;
&lt;br /&gt;
Patterns have no logical meaning: &lt;br /&gt;
adding them to a formula does not change its semantics. &lt;br /&gt;
Their purpose is purely operational, as explained in &lt;br /&gt;
the [[#Instantiation Patterns | Instantiation Patterns]] section.&lt;br /&gt;
&lt;br /&gt;
In addition to these constructs, CVC4 also has a general mixfix conditional operator &lt;br /&gt;
of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{IF}\ b\ \mathrm{THEN}\ t\ \mathrm{ELSIF}\ b_1\ \mathrm{THEN}\ t_1\ \ldots\ \mathrm{ELSIF}\ b_n\ \mathrm{THEN}\ t_n\ \mathrm{ELSE}\ t_{n+1}\ \mathrm{ENDIF}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt; where &lt;br /&gt;
&amp;lt;math&amp;gt;b, b_1, \ldots, b_n&amp;lt;/math&amp;gt; are terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; and&lt;br /&gt;
&amp;lt;math&amp;gt;t, t_1, \ldots, t_n, t_{n+1}&amp;lt;/math&amp;gt; are terms of the same first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 % Conditional term&lt;br /&gt;
 x, y, z, w: REAL;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL = &lt;br /&gt;
   IF x &amp;gt; 0 THEN y&lt;br /&gt;
   ELSIF x &amp;gt;= 1 THEN z&lt;br /&gt;
   ELSIF x &amp;gt; 2 THEN w&lt;br /&gt;
   ELSE 2/3 ENDIF;&lt;br /&gt;
&lt;br /&gt;
=== User-defined Functions and Types ===&lt;br /&gt;
&lt;br /&gt;
The theory of user-defined functions,also know in the SMT literature as &lt;br /&gt;
the theory ''Equality over Uninterpreted Functions'', or ''EUF'', is in effect &lt;br /&gt;
a family of theories of equality parametrized by the basic types and the free symbols &lt;br /&gt;
a user can define during a run of CVC4.&lt;br /&gt;
&lt;br /&gt;
This theory has no built-in symbols (other than the logical ones).&lt;br /&gt;
Its types consist of ''all and only'' the user-defined types.&lt;br /&gt;
Its function symbols consist of ''all and only'' the user-defined free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
The real arithmetic theory has two types:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{INTEGER}&amp;lt;/math&amp;gt;&lt;br /&gt;
with the latter a subtype of the first.&lt;br /&gt;
Its built-in symbols for the usual arithmetic constants &lt;br /&gt;
and operators over the type &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, each with the expected type: &lt;br /&gt;
all numerals 0, 1, ..., as well as - (both unary and binary), +, *, /, &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=. &lt;br /&gt;
Application of the binary symbols are in infix form.&lt;br /&gt;
Note that + is only binary, and so an expression such as +4 is ill-formed.&lt;br /&gt;
&lt;br /&gt;
Rational values can be expressed in decimal or fractional format,&lt;br /&gt;
e.g., 0.1, 23.243241, 1/2, 3/4, and so on.&lt;br /&gt;
A leading 0 is mandatory for decimal numbers smaller than one &lt;br /&gt;
(e.g., the syntax .3 cannot be used as a shorthand for 0.3).&lt;br /&gt;
However, a trailing 0 is ''not'' required for decimals that are whole numbers&lt;br /&gt;
(e.g., 3. is allowed as a shorthand for 3.0).&lt;br /&gt;
The size of the numerals used in the representation of natural and rational numbers &lt;br /&gt;
is unbounded; more accurately, bounded only by the amount of available memory.&lt;br /&gt;
&lt;br /&gt;
=== Bit vectors ===&lt;br /&gt;
&lt;br /&gt;
=== Arrays ===&lt;br /&gt;
&lt;br /&gt;
The theory of arrays is a parametric theory of (total) unary maps. &lt;br /&gt;
It comes equipped with mixfix polymorphic selection and update operators, respectively&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\_[\_]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_&amp;lt;/math&amp;gt; .&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
The semantics of these operators is the expected one:&lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
if &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1 \mathrm{OF}\ T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, and&lt;br /&gt;
&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a[i]&amp;lt;/math&amp;gt; denotes the value that &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; associates to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a\ \mathrm{WITH}\ [i]\ := v&amp;lt;/math&amp;gt; denotes a map that associates &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and is otherwise identical to &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;.&lt;br /&gt;
Sequential updates can be chained with the shorthand syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_, \ldots, [\_]\ := \_&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 A: TYPE = ARRAY INT OF REAL;&lt;br /&gt;
 a: A;&lt;br /&gt;
 i: INT = 4;&lt;br /&gt;
 &lt;br /&gt;
 % selection:&lt;br /&gt;
 &lt;br /&gt;
 elem: REAL = a[i];&lt;br /&gt;
 &lt;br /&gt;
 % update&lt;br /&gt;
 &lt;br /&gt;
 a1: A = a WITH [10] := 1/2;&lt;br /&gt;
 &lt;br /&gt;
 % sequential update &lt;br /&gt;
 % (syntactic sugar for (a WITH [10] := 2/3) WITH [42] := 3/2)&lt;br /&gt;
 &lt;br /&gt;
 a2: A = a WITH [10] := 2/3, [42] := 3/2;&lt;br /&gt;
&lt;br /&gt;
Since arrays are just maps, equality between them is extensional, that is, &lt;br /&gt;
for two arrays of the same type to be different they have to map at least one&lt;br /&gt;
index to differ values.&lt;br /&gt;
&lt;br /&gt;
=== Data types ===&lt;br /&gt;
&lt;br /&gt;
The theory of inductive data types is in fact a family of theories parametrized &lt;br /&gt;
by a data type declaration specifying constructors and selectors &lt;br /&gt;
for one or more user-defined data types.&lt;br /&gt;
&lt;br /&gt;
No built-in operators other than equality and disequality are provided &lt;br /&gt;
for this family in the native language. &lt;br /&gt;
Each user-provided data type declaration, however, generates constructor, selector and tester operators &lt;br /&gt;
as described in the [[#Inductive Data Types | Inductive Data Types]] section.&lt;br /&gt;
&lt;br /&gt;
=== Tuples and Records ===&lt;br /&gt;
&lt;br /&gt;
Semantically both records and tuples can be seen as special instances &lt;br /&gt;
of inductive data types.&lt;br /&gt;
CVC4 implements them internally indeed as data types.&lt;br /&gt;
In essence, a record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt;&lt;br /&gt;
is encoded as a data type of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
 \mathrm{DATATYPE} \\&lt;br /&gt;
 \ \ \mathrm{Record} = \mathit{rec}(l_0:T_0, \ldots, l_n:T_n) \\&lt;br /&gt;
 \mathrm{END};&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tuples of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; are in turn special cases of records whose field names are &lt;br /&gt;
the numerals from &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Externally, tuples and records have their own syntax for constructor and selector operators.&lt;br /&gt;
* Records of type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; have the associated  record constructor &amp;lt;math&amp;gt;(\#\ l_0 := \_,\; \ldots,\; l_n := \_\ \#)&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Tuples of type &amp;lt;math&amp;gt;[\ T_0, \ldots, T_n\ ]&amp;lt;/math&amp;gt; have the associated tuple constructor &amp;lt;math&amp;gt;(\ \_,\; \ldots,\; \_\ )&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The selector operators on records and tuples follows a dot notation syntax.&lt;br /&gt;
&lt;br /&gt;
 % Record construction and field selection&lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x: Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 k: INT = x.key;&lt;br /&gt;
 v: REAL = x.weight;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple construction and projection&lt;br /&gt;
 y: [REAL, INT, REAL] = ( 4/5, 9, 11/9 );&lt;br /&gt;
 first_elem: REAL = y.0;&lt;br /&gt;
 third_elem: REAL = y.2;&lt;br /&gt;
&lt;br /&gt;
Differently from data types, records and tuples are also provided with built-in update operators similar in syntax and semantics to the update operator for arrays. &lt;br /&gt;
More precisely, for each record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; and&lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\_\ \mathrm{WITH}\ .l_i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator maps a record &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; of that type and a value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; &lt;br /&gt;
of type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; to the record that stores &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in field &amp;lt;math&amp;gt;l_i&amp;lt;/math&amp;gt; &lt;br /&gt;
and is otherwise identical to &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;. &lt;br /&gt;
Analogously, for each tuple type &amp;lt;math&amp;gt;[T_0, \ldots, T_n]&amp;lt;/math&amp;gt; and &lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \_\ \mathrm{WITH}\ .i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with similar semantics.&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = x WITH .weight := 48;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = y WITH .1 := 3; &lt;br /&gt;
 &lt;br /&gt;
 Updates to a nested component can be combined in a single WITH operator:&lt;br /&gt;
 &lt;br /&gt;
 Cache: TYPE = ARRAY [0..100] OF [# addr: INT, data: REAL #];&lt;br /&gt;
 State: TYPE = [# pc: INT, cache: Cache #];&lt;br /&gt;
 &lt;br /&gt;
 s0: State;&lt;br /&gt;
 s1: State = s0 WITH .cache[10].data := 2/3;&lt;br /&gt;
&lt;br /&gt;
Note that, differently from updates on arrays, tuple and record updates are &lt;br /&gt;
just additional syntactic sugar. &lt;br /&gt;
For instance, the record &amp;lt;code&amp;gt;x1&amp;lt;/code&amp;gt; and tuple &amp;lt;code&amp;gt;y1&amp;lt;/code&amp;gt; defined above &lt;br /&gt;
could have been equivalently defined as follows:&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = (# key := x.key,  weight := 48 #);&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = ( y.0, 3, y.1 );&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to declarations of types and function symbols, &lt;br /&gt;
the CVC4 native language contains the following commands:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ASSERT}\ F&amp;lt;/math&amp;gt; -- Add the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; to the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
* [[#CHECKSAT|&amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is satisfiable in the current logical context (&amp;lt;math&amp;gt;\Gamma \not\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{CONTINUE}&amp;lt;/math&amp;gt; -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, search for a counter-example different from the current one.&lt;br /&gt;
* [[#COUNTEREXAMPLE|&amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print the context that is a witness for invalidity/satisfiability.&lt;br /&gt;
* [[#COUNTERMODEL|&amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print a model that makes the formula invalid/satisfiable. The model is provided in terms of concrete values for each free symbol.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{OPTION}\ o\ v&amp;lt;/math&amp;gt; -- Set the command-line option flag &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; to value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The argument &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; is provide as a string literal enclosed in double-quotes and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; as an integer value.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; -- Equivalent to &amp;lt;math&amp;gt;\mathrm{POPTO}\ 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* [[#POPTO|&amp;lt;math&amp;gt;\mathrm{POPTO}\ n&amp;lt;/math&amp;gt;]] -- Restore the system to the state it was in right before the most recent call to &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; made from stack level &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. Note that the current stack level is printed as part of the output of the &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; command.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; -- Save (checkpoint) the current state of the system.&lt;br /&gt;
* [[#QUERY|&amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is valid in the current logical context (&amp;lt;math&amp;gt;\Gamma\models_T F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* [[#RESTART|&amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, repeat the check but with the additional assumption &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; in the context.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PRINT}\ t&amp;lt;/math&amp;gt; -- Parse and print back the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRANSFORM}\ t&amp;lt;/math&amp;gt; -- Simplify the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and print the result.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; -- Print all the formulas in the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The remaining commands take a single argument, given as a string literal enclosed in double-quotes.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ECHO}\ s&amp;lt;/math&amp;gt; -- Print string &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{INCLUDE}\ f&amp;lt;/math&amp;gt; -- Read commands from file &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRACE}\ f&amp;lt;/math&amp;gt; -- Turn on tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{UNTRACE}\ f&amp;lt;/math&amp;gt; -- Turn off tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we explain some of the above commands in more detail.&lt;br /&gt;
&lt;br /&gt;
=== QUERY ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; invokes the core functionality of CVC4 to check &lt;br /&gt;
the validity of the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; with respect to the assertions made thus far,&lt;br /&gt;
which constitute the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;. &lt;br /&gt;
The argument &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; must be well typed term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;,&lt;br /&gt;
as described in [[#Terms and Formulas | Terms and Formulas]].&lt;br /&gt;
&lt;br /&gt;
The execution of this command always terminates and produces one of three possible answers: &lt;br /&gt;
&amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* A &amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;. After a query returning such an answer, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is exactly as it was before the query.&lt;br /&gt;
* An &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \not\models_T F&amp;lt;/math&amp;gt;, that is, there is a model of the background theory &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Gamma \cup \{\mathrm{NOT}\ F\}&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; returns &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is augmented with a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of ground (i.e., variable-free) literals such that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but &amp;lt;math&amp;gt;\Gamma\cup\Delta\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;. In fact, in this case &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; ''propositionally entails'' &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;, in the sense that, every truth assignment to the literals of &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; falsifies &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;. We call the new context &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; a ''counterexample'' for &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
* An &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; answer is similar to an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer in that additional literals are added to the context which propositionally entail &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;. The difference in this case is that CVC4 cannot guarantee that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is actually satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
CVC4 may report &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; when the context or the query contains&lt;br /&gt;
non-linear arithmetic terms or quantifiers.&lt;br /&gt;
In all other cases, it is expected to be sound and complete, &lt;br /&gt;
i.e., to report &amp;lt;code&amp;gt;Valid&amp;lt;/code&amp;gt; if &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;&lt;br /&gt;
and &amp;lt;code&amp;gt;Invalid&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
After an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; (resp. &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;) answer,&lt;br /&gt;
counterexamples (resp. possible counterexamples) can be obtained with &lt;br /&gt;
a &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
or &amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt; command. &lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
WHERE always prints out all of &amp;lt;math&amp;gt;\Gamma\cup C&amp;lt;/math&amp;gt;. COUNTEREXAMPLE may sometimes be more selective, printing a subset of those formulas from the context which are sufficient for a counterexample.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; command may modify &lt;br /&gt;
the current context, if one needs to check several formulas in a row &lt;br /&gt;
in the same context, it is a good idea to surround every &lt;br /&gt;
query by a &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; invocation&lt;br /&gt;
in order to preserve the context:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
&lt;br /&gt;
=== CHECKSAT ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt; behaves identically &lt;br /&gt;
to &amp;lt;math&amp;gt;\mathrm{QUERY}\ \mathrm{NOT}\ F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== RESTART ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt; can only be invoked after an invalid query. &lt;br /&gt;
For example, in an interactive setting:&lt;br /&gt;
&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
 CVC4&amp;gt; invalid&lt;br /&gt;
 &lt;br /&gt;
 RESTART &amp;lt;formula2&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
Functionally, the behavior of the above command sequence is identical to the following:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
 ASSERT &amp;lt;formula2&amp;gt;;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
The advantage of using the &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; command is that &lt;br /&gt;
the first command sequence may be executed much more efficiently that the second.&lt;br /&gt;
The reason is that with &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; CVC4 will re-use&lt;br /&gt;
what it has learned while answering the previous query rather than starting &lt;br /&gt;
over from scratch.&lt;br /&gt;
&lt;br /&gt;
=== COUNTERMODEL ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== COUNTEREXAMPLE ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== POPTO ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
== Instantiation Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVC4 processes each universally quantified formula in the current context &lt;br /&gt;
by adding instances of the formula obtained by replacing its universal variables &lt;br /&gt;
with ground terms. &lt;br /&gt;
Patterns restrict the choice of ground terms for the quantified variables, &lt;br /&gt;
with the goal of controlling the potential explosion of ground instances. &lt;br /&gt;
In essence, adding patterns to a formula is a way for the user to tell CVC4 &lt;br /&gt;
to focus only on certain instances which, in the user's opinion, will be &lt;br /&gt;
most helpful during a proof.&lt;br /&gt;
&lt;br /&gt;
In more detail, patterns have the following effect on formulas that are found &lt;br /&gt;
in the logical context or get added to it later while CVC4 is trying to prove &lt;br /&gt;
the validity of some formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If a formula in the current context starts with an existential quantifier, &lt;br /&gt;
CVC4 ''Skolemizes'' it, that is, replaces it in the context with the formula &lt;br /&gt;
obtained by substituting the existentially quantified variables &lt;br /&gt;
by fresh constants and dropping the quantifier. &lt;br /&gt;
Any patterns for the existential quantifier are simply ignored.&lt;br /&gt;
&lt;br /&gt;
If a formula starts with a universal quantifier &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{FORALL}\; (x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt;, &lt;br /&gt;
CVC4 adds to the context a number of instances of the formula, &lt;br /&gt;
with the goal of using them to prove the query &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; valid. &lt;br /&gt;
An instance is obtained by replacing each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; with a ground term&lt;br /&gt;
of the same type occurring in one of the formulas in the context, &lt;br /&gt;
and dropping the universal quantifier. &lt;br /&gt;
If &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; occurs in a pattern &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{PATTERN}\; (t_1, \ldots, t_m)&amp;lt;/math&amp;gt; for the quantifier, &lt;br /&gt;
it will be instantiated only with terms obtained by simultaneously matching &lt;br /&gt;
all the terms in the pattern against ground terms in the current context &lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Specifically, the matching process produces one or more substitutions &lt;br /&gt;
&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; for the variables in &amp;lt;math&amp;gt;(t_1, \ldots, t_m)&amp;lt;/math&amp;gt; &lt;br /&gt;
which satisfy the following invariant: &lt;br /&gt;
for each &amp;lt;math&amp;gt;i = 1, \ldots, m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\sigma(t_i)&amp;lt;/math&amp;gt; is &lt;br /&gt;
a ground term and there is a ground term &amp;lt;math&amp;gt;s_i&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
such that &amp;lt;math&amp;gt;\Gamma \models_T \sigma(t_i) = s_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
The variables of &amp;lt;math&amp;gt;(x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt; that occur &lt;br /&gt;
in the pattern are instantiated only with those substitutions &lt;br /&gt;
(while any remaining variables are instantiated arbitrarily).&lt;br /&gt;
&lt;br /&gt;
The Skolemized version or the added instances of a context formula may themselves &lt;br /&gt;
start with a quantifier. &lt;br /&gt;
The same instantiation process is applied to them too, recursively.&lt;br /&gt;
&lt;br /&gt;
Note that the matching mechanism is not limited to syntactic matching &lt;br /&gt;
but is modulo the equations asserted in the context. &lt;br /&gt;
Because of decidability and/or efficiency limitations, the matching process &lt;br /&gt;
is not exhaustive. &lt;br /&gt;
CVC4 will typically miss some substitutions that satisfy the invariant above. &lt;br /&gt;
As a consequence, it might fail to prove the validity of the query formula &lt;br /&gt;
&amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;, which makes CVC4 incomplete for contexts containing &lt;br /&gt;
quantified formulas. &lt;br /&gt;
It should be noted though that exhaustive matching, which can be achieved &lt;br /&gt;
simply by not specifying any patterns, does not yield completeness anyway &lt;br /&gt;
since the instantiation of universal variables is still restricted &lt;br /&gt;
to just the ground terms in the context,&lt;br /&gt;
whereas in general additional ground terms might be needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 == Subtypes ==&lt;br /&gt;
&lt;br /&gt;
=== Subtype Checking ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3927</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3927"/>
				<updated>2012-11-27T18:19:05Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Building from source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[#Building_CVC4 from_a_repository_checkout]] here.&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
===Quick-start instructions===&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[Building CVC4 from source #Building_CVC4_from_a_repository_checkout|here]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions and dependencies see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
The CVC4 driver binary (&amp;quot;cvc4&amp;quot;), once installed, can be executed directly to enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's native input language=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The native input language consists of a sequence of symbol declarations and commands, each followed by a semicolon (&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Any text after the first occurrence of a percent character and to the end of the current line is a comment:&lt;br /&gt;
&lt;br /&gt;
 %%% This is a native language comment&lt;br /&gt;
&lt;br /&gt;
== Type System ==&lt;br /&gt;
&lt;br /&gt;
CVC4's type system includes a set of built-in types which can be expanded with additional user-defined types.&lt;br /&gt;
&lt;br /&gt;
The type system consists of ''first-order'' types, ''subtypes'' of first-order types, and ''higher-order'' types,  all of which are interpreted as sets. &lt;br /&gt;
For convenience, we will sometimes identify below the interpretation of a type with the type itself.&lt;br /&gt;
&lt;br /&gt;
First-order types consist of basic types and structured types. The basic types are &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, as well as user-defined basic types (also called uninterpreted types). &lt;br /&gt;
The structured types are array, tuple, record types, and ML-style user-defined (inductive) datatypes.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Currently, subtypes consist only of the built-in subtype &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;!-- and are covered in the [[#Subtypes|Subtypes]] section. --&amp;gt;&lt;br /&gt;
Support for CVC3-style user-defined subtypes will be added in a later release.&lt;br /&gt;
&lt;br /&gt;
Function types are the only higher-order types.&lt;br /&gt;
More precisely, they are just second-order types &lt;br /&gt;
since function symbols in CVC4, both built-in and user-defined, can take as argument or return only values of &lt;br /&gt;
a first-order type.&lt;br /&gt;
&lt;br /&gt;
=== Basic Types ===&lt;br /&gt;
&lt;br /&gt;
==== The BOOLEAN Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; type is interpreted as the two-element set of Boolean values&lt;br /&gt;
&amp;lt;math&amp;gt;\{\mathrm{TRUE},\; \mathrm{FALSE}\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
'''Note:''' CVC4's treatment of this type differs from CVC3's where &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; is used only as the type of formulas, but not as value type. CVC3 follows the two-tiered structure of classical first-order logic &lt;br /&gt;
which distinguishes between formulas and terms, and allows terms to occur in formulas but not vice versa (with the exception of the IF-THEN-ELSE construct).&lt;br /&gt;
CVC4 drops the distinction between terms and formulas and defines the latter just as terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. As such, formulas can occur as subterms of possibly non-Boolean terms.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 [To do]&lt;br /&gt;
&lt;br /&gt;
==== The REAL Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; type is interpreted as the set of real numbers.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical reals,&lt;br /&gt;
not the floating point numbers.&lt;br /&gt;
Support for floating point types is planned for future versions.&lt;br /&gt;
&lt;br /&gt;
 x, y : REAL;&lt;br /&gt;
 QUERY (( x &amp;lt;= y ) AND ( y &amp;lt;= x )) =&amp;gt; ( x = y );&lt;br /&gt;
&lt;br /&gt;
==== The INT Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; type is interpreted as the set of integer numbers&lt;br /&gt;
and is considered as a subtype of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The latter means in particular that it is possible to mix integer and real terms &lt;br /&gt;
in expressions without the need of an explicit ''upcasting'' operator.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical integers,&lt;br /&gt;
not the finite precision machine integers used in most programming languages. &lt;br /&gt;
The latter are models by [[ #Bitvectors | bit vector ]] types.&lt;br /&gt;
&lt;br /&gt;
 x, y : INT;&lt;br /&gt;
 QUERY ((2 * x + 4 * y &amp;lt;= 1) AND ( y &amp;gt;= x)) =&amp;gt; (x &amp;lt;= 0);&lt;br /&gt;
 z : REAL;&lt;br /&gt;
 QUERY (2 * x + z &amp;lt;= 3.5) AND (z &amp;gt;= 1);&lt;br /&gt;
&lt;br /&gt;
==== Bit Vector Types ====&lt;br /&gt;
&lt;br /&gt;
For every positive integer &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, the type &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; is interpreted as the set of all bit vectors of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
A rich set of bit vector operators is supported.&lt;br /&gt;
&lt;br /&gt;
==== User-defined Basic Types ====&lt;br /&gt;
&lt;br /&gt;
Users can define new basic types &lt;br /&gt;
(often referred to as ''uninterpreted'' types in the SMT literature).&lt;br /&gt;
Each such type is interpreted as a set of unspecified cardinality &lt;br /&gt;
but disjoint from any other type. &lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Can we specify cardinalities? &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
User-defined basic types are created by declarations like the following:&lt;br /&gt;
&lt;br /&gt;
 % User declarations of basic types:&lt;br /&gt;
 &lt;br /&gt;
 MyBrandNewType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 Apples, Oranges: TYPE;&lt;br /&gt;
&lt;br /&gt;
=== Structured Types ===&lt;br /&gt;
&lt;br /&gt;
CVC4's structured types are divided in the following families. &lt;br /&gt;
&lt;br /&gt;
==== Array Types ====&lt;br /&gt;
&lt;br /&gt;
Array types are created by the mixfix type constructors &amp;lt;math&amp;gt;\mathrm{ARRAY}\ \_\ \mathrm{OF}\ \_&amp;lt;/math&amp;gt; &lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 I : TYPE;&lt;br /&gt;
 &lt;br /&gt;
 %% Array types:&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with indices from I and values from REAL&lt;br /&gt;
 Array1: TYPE = ARRAY I OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer indices and array values &lt;br /&gt;
 Array2: TYPE = ARRAY INT OF (ARRAY INT OF REAL);&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer pair indices and integer values&lt;br /&gt;
 IntMatrix: TYPE = ARRAY [INT, INT] OF INT;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
An array type of the form &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1\ \mathrm{OF}\ T_2&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the set of all total maps from &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
The main difference with the function type &amp;lt;math&amp;gt;T_1 \to T_2&amp;lt;/math&amp;gt; is that arrays, &lt;br /&gt;
contrary to functions, are first-class objects of the language, that is, values of an array&lt;br /&gt;
type can be arguments or results of functions. &lt;br /&gt;
Furthermore, array types come equipped with an update operation.&lt;br /&gt;
&lt;br /&gt;
==== Tuple Types ====&lt;br /&gt;
&lt;br /&gt;
Tuple types are created by the mixfix type constructors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l} [\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ \ ,\ \_\ ] \\[1ex] \ldots \end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 IntArray: TYPE = ARRAY INT OF INT;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple type declarations&lt;br /&gt;
 &lt;br /&gt;
 RealPair: TYPE = [REAL, REAL]&lt;br /&gt;
 &lt;br /&gt;
 MyTuple: TYPE = [ REAL, IntArray, [INT, INT] ];&lt;br /&gt;
&lt;br /&gt;
A tuple type of the form &amp;lt;math&amp;gt;[T_1, \ldots, T_n]&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Note that while the types &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and &lt;br /&gt;
&amp;lt;math&amp;gt;[T_1 \times \cdots \times T_n] \to T&amp;lt;/math&amp;gt; are semantically equivalent, &lt;br /&gt;
they are operationally different in CVC4. &lt;br /&gt;
The first is the type of functions that take &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; arguments &lt;br /&gt;
of respective type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;T_n&amp;lt;/math&amp;gt;, &lt;br /&gt;
while the second is the type of functions that take one argument of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-tuple type.&lt;br /&gt;
&lt;br /&gt;
==== Record Types ====&lt;br /&gt;
&lt;br /&gt;
Similar to, but more general than tuple types, record types are created by type constructors of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
[\#\ l_1: \_\ ,\ \ldots\ ,\ l_n: \_\ \#]&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;l_1,\ldots, l_n&amp;lt;/math&amp;gt; are field labels, &lt;br /&gt;
and the arguments can be instantiated with any first-order types.&lt;br /&gt;
&lt;br /&gt;
 MyType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 % Record declaration&lt;br /&gt;
 &lt;br /&gt;
 RecordType: TYPE = [# id: REAL, age: INT, info: MyType #];&lt;br /&gt;
&lt;br /&gt;
The order of the fields in a record type is meaningful: &lt;br /&gt;
permuting the field names gives a different type. &lt;br /&gt;
&lt;br /&gt;
Note that record types are non-recursive. &lt;br /&gt;
For instance, it is not possible to declare a record type called &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt; containing &lt;br /&gt;
a field of type &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt;. &lt;br /&gt;
Recursive types are provided in CVC4 by the more general inductive data types.&lt;br /&gt;
(As a matter of fact, both record and tuple types are implemented internally as inductive data types.)&lt;br /&gt;
&lt;br /&gt;
==== Inductive Data Types ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inductive data types in CVC4 are similar to inductive data types of functional languages.&lt;br /&gt;
They can be parametric or not.&lt;br /&gt;
&lt;br /&gt;
===== Non-Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Non-parametric data types are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE} \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1 &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2 &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
Such declarations define the data types &amp;lt;math&amp;gt;A_1, \ldots, A_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
For each data type &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; they introduce:&lt;br /&gt;
&lt;br /&gt;
* constructor symbols &amp;lt;math&amp;gt;cons&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;(T_1, \ldots, T_k) \to \mathit{type\_name}_i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* selector symbols &amp;lt;math&amp;gt;\mathit{sel}_j&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to T_j&amp;lt;/math&amp;gt;, and&lt;br /&gt;
* tester symbols &amp;lt;math&amp;gt;\mathit{is\_cons}&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that permitting more than one data type to be defined in the same declarations allows &lt;br /&gt;
the definition of mutually recursive types.&lt;br /&gt;
&lt;br /&gt;
 % simple enumeration type&lt;br /&gt;
 &lt;br /&gt;
 % implicitly defined are the testers: is_red, is_yellow and is_blue&lt;br /&gt;
 % (similarly for the other data types)&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   PrimaryColor = red | yellow | blue&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % infinite set of pairwise distinct values ..., v(-1), v(0), v(1), ...&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Id = v (id: INT)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % ML-style integer lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   IntList = nil | ins (head: INT, tail: IntList)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % AST for lamba calculus&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Term = var (index: INT)&lt;br /&gt;
        | apply (arg_1: Term, arg_2: Term)&lt;br /&gt;
        | lambda (arg: INT, body: Term)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Trees&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Tree = tree (value: REAL, children: TreeList),&lt;br /&gt;
   TreeList = nil_tl&lt;br /&gt;
            | ins_tl (first_t1: Tree, rest_t1: TreeList)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
Constructor, selector and tester symbols defined for a data type have global scope. &lt;br /&gt;
So, for example, it is not possible for two different data types to use &lt;br /&gt;
the same name for a constructor.&lt;br /&gt;
&lt;br /&gt;
An inductive data type is interpreted as a term algebra constructed by the constructor symbols &lt;br /&gt;
over some sets of generators. &lt;br /&gt;
For example, the type &amp;lt;code&amp;gt;IntList&amp;lt;/code&amp;gt; defined above is interpreted as the set &lt;br /&gt;
of all terms constructed with &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ins&amp;lt;/code&amp;gt; over the integers.&lt;br /&gt;
&lt;br /&gt;
===== Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Parametric data types are infinite families of (non-parametric) data types &lt;br /&gt;
with each family parametrized by one or more type variables.&lt;br /&gt;
They are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE}  \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1[X_{1,1}, \ldots, X_{1,p_1}] &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2[X_{2,1}, \ldots, X_{2,p_2}] &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n[X_{n,1}, \ldots, X_{n,p_n}] &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name parametrized by the type variables &amp;lt;math&amp;gt;X_{i,1}, \ldots, X_{i,p_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, &lt;br /&gt;
possibly parametrized by &amp;lt;math&amp;gt;X_1, \ldots, X_p&amp;lt;/math&amp;gt;, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 % Parametric pairs&lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Pair[X, Y] = pair (first: X, second: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 % Parametric lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Parametric trees using the list type above&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   Tree[X] = node (value: X, children: List[Tree[X]]),&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
The declarations above define infinitely many types of the form &lt;br /&gt;
Pair[S,T], List[T] and Tree[T] where S and T are first-order types.&lt;br /&gt;
Note that the identifier &amp;lt;code&amp;gt;List&amp;lt;/code&amp;gt; above, for example, by itself does not denote a type.&lt;br /&gt;
In contrast, the terms &amp;lt;code&amp;gt;List[Real]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[List[Real]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[Tree[INT]]&amp;lt;/code&amp;gt;,&lt;br /&gt;
and so on do.&lt;br /&gt;
&lt;br /&gt;
===== Restriction to Inductive Types =====&lt;br /&gt;
&lt;br /&gt;
By adopting a term algebra semantics, CVC4 allows only ''inductive'' data types, &lt;br /&gt;
that is, data types whose values are essentially (labeled, ordered) finite trees. &lt;br /&gt;
Infinite structures such as streams or even finite but cyclic ones &lt;br /&gt;
such as circular lists are then excluded. &lt;br /&gt;
For instance, none of the following declarations define inductive data types, &lt;br /&gt;
and are rejected by CVC4:&lt;br /&gt;
&lt;br /&gt;
 DATATYPE&lt;br /&gt;
  IntStream = s (first:INT, rest: IntStream)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
  RationalTree = node1 (child: RationalTree)&lt;br /&gt;
               | node2 (left_child: RationalTree, right_child:RationalTree)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   T1 =  c1 (s1: T2),&lt;br /&gt;
   T2 =  c2 (s2: T1)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
In concrete, a declaration of &amp;lt;math&amp;gt;n \geq 1&amp;lt;/math&amp;gt; datatypes &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; will be rejected if for any one of the types &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;, it is impossible to build a finite term of that type using only the constructors of &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; and free constants of type other than &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Inductive data types are the only types where the user also chooses names for the built-in operations to:&lt;br /&gt;
&lt;br /&gt;
* construct a value of the type (with the constructors),&lt;br /&gt;
* extract components from a value (with the selectors), or&lt;br /&gt;
* check if a value was constructed with a certain constructor or not (with the testers).&lt;br /&gt;
&lt;br /&gt;
For all the other types, CVC4 provides predefined names for the built-in operations on the type.&lt;br /&gt;
&lt;br /&gt;
=== Function Types ===&lt;br /&gt;
&lt;br /&gt;
Function (&amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt;) types are created by the mixfix type constructors&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\_ \to \_ \\[1ex] (\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] (\ \_\ ,\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] \ldots &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
whose arguments can be instantiated by any first-order type.&lt;br /&gt;
&lt;br /&gt;
 % Function type declarations&lt;br /&gt;
 &lt;br /&gt;
 UnaryFunType: TYPE = INT -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 BinaryFunType: TYPE = (REAL, REAL) -&amp;gt; ARRAY REAL OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 TernaryFunType: TYPE = (REAL, BITVECTOR(4), INT) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
A function type of the form &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; is interpreted as the set of all ''total'' functions from the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The example above also shows how to introduce type names. &lt;br /&gt;
A name like &amp;lt;code&amp;gt;UnaryFunType&amp;lt;/code&amp;gt; above is just an abbreviation for the type &amp;lt;math&amp;gt;\mathrm{INT} \to \mathrm{REAL}&amp;lt;/math&amp;gt; and can be used interchangeably with it.&lt;br /&gt;
&lt;br /&gt;
In general, any type defined by a type expression &amp;lt;code&amp;gt;E&amp;lt;/code&amp;gt; can be given a name with the declaration:&lt;br /&gt;
&lt;br /&gt;
 name : TYPE = E;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Type Checking ===&lt;br /&gt;
&lt;br /&gt;
In CVC4, formulas and terms are statically typed at the level of types &lt;br /&gt;
(as opposed to subtypes) according to the usual rules of first-order many-sorted logic,&lt;br /&gt;
with the main difference that formulas are just terms of type &amp;lt;math&amp;gt;BOOLEAN&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* each variable has one associated first-order type,&lt;br /&gt;
* each constant symbol has one or more associated first-order types,&lt;br /&gt;
* each function symbol has one or more associated function types,&lt;br /&gt;
* the type of a term consisting just of a variable is the type associated to that variable,&lt;br /&gt;
* the type of a term consisting just of a constant symbol is the type associated to that constant symbol,&lt;br /&gt;
* the term obtained by applying a function symbol &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; to the terms &amp;lt;math&amp;gt;t_1, \ldots, t_n&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and each &amp;lt;math&amp;gt;t_i&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Attempting to enter an ill-typed term will result in an error.&lt;br /&gt;
&lt;br /&gt;
Another significant difference with standard many-sorted logic is that &lt;br /&gt;
some built-in symbols are parametrically polymorphic. &lt;br /&gt;
For instance, the function symbol for extracting the element of any array has &lt;br /&gt;
type &amp;lt;math&amp;gt;(\mathit{ARRAY}\ T_1\ \mathit{OF}\ T_2,\; T_1) \to T_2&amp;lt;/math&amp;gt; &lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1, T_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Type Ascription ====&lt;br /&gt;
&lt;br /&gt;
By the type inference rules above some terms might have more than one type.&lt;br /&gt;
This can happen with terms built with polymorphic data type constructors&lt;br /&gt;
that have more than one return type for the same input type.&lt;br /&gt;
In that case, a type ascription operator (&amp;lt;code&amp;gt;::&amp;lt;/code&amp;gt;) must be applied &lt;br /&gt;
to the constructor to specify the intended return type.&lt;br /&gt;
&lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = cons(1, nil::List[REAL]);&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Union[X, Y] = left(val_l: X) | right(val_r: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = left::Union[BOOLEAN, REAL](TRUE);&lt;br /&gt;
&lt;br /&gt;
The constant symbol &amp;lt;math&amp;gt;\mathrm{nil}&amp;lt;/math&amp;gt; declared above has infinitely many types &lt;br /&gt;
(&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{REAL}]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{List}[\mathrm{BOOLEAN}]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[[\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;, ...)&lt;br /&gt;
CVC4's type checker requires the user to indicate explicitly the type &lt;br /&gt;
of each occurrence of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; in a term. &lt;br /&gt;
Similarly, &lt;br /&gt;
the injection operator &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; has infinitely many return types &lt;br /&gt;
for the same input type, for instance:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{REAL}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, [\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
and so on.&lt;br /&gt;
Applications of &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; need to specify the intended returned typed, as shown above.&lt;br /&gt;
&lt;br /&gt;
== Terms and Formulas ==&lt;br /&gt;
&lt;br /&gt;
In addition to type expressions, CVC4 has expressions for terms and for formulas &lt;br /&gt;
(i.e., terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;). &lt;br /&gt;
By and large, these are standard first-order terms built out of typed variables, &lt;br /&gt;
predefined theory-specific operators, free (i.e., user-defined) function symbols, &lt;br /&gt;
and quantifiers. &lt;br /&gt;
Extensions include an if-then-else operator, lambda abstractions, and local symbol &lt;br /&gt;
declarations, as illustrated below. &lt;br /&gt;
Note that these extensions still keep CVC4's language first-order. &lt;br /&gt;
In particular, lambda abstractions are restricted to take and return only terms of &lt;br /&gt;
a first-order type. &lt;br /&gt;
Similarly, variables can only be of a first-order type.&lt;br /&gt;
&lt;br /&gt;
A number of built-in function symbols (for instance, the arithmetic ones) are used &lt;br /&gt;
as infix operators. All user-defined symbols are used as prefix ones.&lt;br /&gt;
&lt;br /&gt;
User-defined, i.e., free, function symbols include ''constant symbols'' and &lt;br /&gt;
''predicate symbols'', respectively  nullary function symbols and function symbols &lt;br /&gt;
with a &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; return type. &lt;br /&gt;
These symbols are introduced with global declarations of the form &lt;br /&gt;
&amp;lt;math&amp;gt; f_1, \ldots, f_m: T;&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;f_i&amp;lt;/math&amp;gt; are the names of the symbols and &lt;br /&gt;
&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is their type:&lt;br /&gt;
&lt;br /&gt;
 % integer constants&lt;br /&gt;
 &lt;br /&gt;
 a, b, c: INT;&lt;br /&gt;
 &lt;br /&gt;
 % real constants&lt;br /&gt;
 &lt;br /&gt;
 x, y, z: REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function&lt;br /&gt;
 &lt;br /&gt;
 f1: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % binary function&lt;br /&gt;
 &lt;br /&gt;
 f2: (REAL, INT) -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function with a tuple argument&lt;br /&gt;
 &lt;br /&gt;
 f3: [INT, REAL] -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % binary predicate&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, REAL) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % Propositional &amp;quot;variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 P, Q; BOOLEAN;&lt;br /&gt;
&lt;br /&gt;
Like type declarations, function symbol declarations like the above have global scope &lt;br /&gt;
and must be unique. &lt;br /&gt;
In other words, it is not possible to declare a function symbol globally more than once&lt;br /&gt;
in the same lexical scope. &lt;br /&gt;
This entails among other things that globally-defined free symbols cannot be overloaded &lt;br /&gt;
with different types and that theory symbols cannot be redeclared globally as free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Global symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
As with types, a function symbol can be defined as the name of another term &lt;br /&gt;
of the corresponding type. &lt;br /&gt;
With constant symbols, this is done with a declaration of the form &amp;lt;math&amp;gt;f:T = t;&amp;lt;/math&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
 c: INT;&lt;br /&gt;
 &lt;br /&gt;
 i: INT = 5 + 3*c;  % i is effectively a shorthand for 5 + 3*c&lt;br /&gt;
 &lt;br /&gt;
 j: REAL = 3/4;&lt;br /&gt;
 &lt;br /&gt;
 t: [REAL, INT] = (2/3, -4);&lt;br /&gt;
 &lt;br /&gt;
 r: [# key: INT, value: REAL #] = (# key := 4, value := (c + 1)/2 #);&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN = FORALL (x:INT): x &amp;lt;= 0 OR x &amp;gt; c ;&lt;br /&gt;
&lt;br /&gt;
A restriction on constants of type &amp;lt;math&amp;gt;\mathit{BOOLEAN}&amp;lt;/math&amp;gt; is that their value &lt;br /&gt;
can only be a closed formula, that is, a formula with no free variables.&lt;br /&gt;
&lt;br /&gt;
A term and its name can be used interchangeably in later expressions. &lt;br /&gt;
Named terms are often useful for shared subterms (terms used several times in different places) &lt;br /&gt;
since their use can make the input exponentially more concise. &lt;br /&gt;
Named terms are processed very efficiently by CVC4. &lt;br /&gt;
It is much more efficient to associate a complex term with a name directly rather than &lt;br /&gt;
to declare a constant and later assert that it is equal to the same term. &lt;br /&gt;
This point is explained in more detail later in section [[Commands | Commands]].&lt;br /&gt;
&lt;br /&gt;
More generally, in CVC4 one can associate a term to function symbols of any arity. &lt;br /&gt;
For non-constant function symbols this is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;f:(T_1, \ldots, T_n) \to T = \mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t\;;&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is any term of type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; with free variables &lt;br /&gt;
in &amp;lt;math&amp;gt;\{x_1, \ldots, x_n\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The lambda binder has the usual semantics and conforms to the usual lexical scoping rules: &lt;br /&gt;
within the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; the declaration of the symbols &amp;lt;math&amp;gt;x_1, \ldots, x_n&amp;lt;/math&amp;gt; &lt;br /&gt;
as local variables of respective type &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; hides any previous&lt;br /&gt;
declarations of those symbols that are in scope.&lt;br /&gt;
&lt;br /&gt;
As a general shorthand, when &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; consecutive types &lt;br /&gt;
&amp;lt;math&amp;gt;T_i, \ldots, T_{i+k-1}&amp;lt;/math&amp;gt;  in the lambda expression &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t&amp;lt;/math&amp;gt; are identical, the syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x_i,\ldots, x_{i+k-1}:T_i,\ldots, x:T_n): t&amp;lt;/math&amp;gt;&lt;br /&gt;
can also be used.&lt;br /&gt;
&lt;br /&gt;
 % Global declaration of x as a unary function symbol&lt;br /&gt;
 &lt;br /&gt;
 x: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Local declarations of x as variable (hiding the global one)&lt;br /&gt;
 &lt;br /&gt;
 f: REAL -&amp;gt; REAL = LAMBDA (x: REAL): 2*x + 3;&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, INT) -&amp;gt; BOOLEAN = LAMBDA (x,i: INT): i*x - 1 &amp;gt; 0;&lt;br /&gt;
 &lt;br /&gt;
 g: (REAL, INT) -&amp;gt; [REAL, INT] = LAMBDA (x: REAL, i:INT): (x + 1, i - 3);&lt;br /&gt;
&lt;br /&gt;
Note that lambda definitions are not recursive: &lt;br /&gt;
the symbol being defined cannot occur in the body of the lambda term.&lt;br /&gt;
They should be understood as macros.&lt;br /&gt;
For instance, any occurrence of the term &amp;lt;math&amp;gt;f(t)&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; is as defined above will be treated &lt;br /&gt;
as if it was the term &amp;lt;math&amp;gt;(2*t + 3)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Local symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
Constant and function symbols can also be declared locally anywhere within a term &lt;br /&gt;
by means of a let binder. &lt;br /&gt;
This is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f = t \ \mathrm{IN}\ t' ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is a term with no free variables, possibly a lambda term.&lt;br /&gt;
Let binders can be nested arbitrarily and follow the usual lexical scoping rules.&lt;br /&gt;
The following general form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1, f_2 = t_2, \ldots, f_n = t_m \ \mathrm{IN}\ t ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
can be use above can used as a shorthand for&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1\ \mathrm{IN}\ &lt;br /&gt;
 \mathrm{LET}\ f_2 = t_2\ \mathrm{IN}\ &lt;br /&gt;
 \ldots \ &lt;br /&gt;
 \mathrm{LET}\ f_n = t_m \ \mathrm{IN}\ t ;&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL =&lt;br /&gt;
   LET x1 = 42,&lt;br /&gt;
       g = LAMBDA(x:INT): x + 1,&lt;br /&gt;
       x2 = 2*x1 + 7/2&lt;br /&gt;
   IN&lt;br /&gt;
      (LET x3 = g(x1) IN x3 + x2) / x1;&lt;br /&gt;
&lt;br /&gt;
Note that the same symbol = is used, unambiguously, in the syntax of global declarations, &lt;br /&gt;
let declarations, and as a predicate symbol.&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
A &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; term with a multiple symbols defines them sequentially.&lt;br /&gt;
A parallel version of the &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; construct will be introduced in a later version.&lt;br /&gt;
&lt;br /&gt;
== Built-in theories and their symbols ==&lt;br /&gt;
&lt;br /&gt;
In addition to user-defined symbols, CVC4 terms can use a number of predefined symbols: &lt;br /&gt;
the logical symbols, such as &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, etc., &lt;br /&gt;
as well as theory symbols, function symbols belonging to one of the built-in theories. &lt;br /&gt;
They are described next, with the theory symbols grouped by theory.&lt;br /&gt;
&lt;br /&gt;
=== Logical Symbols ===&lt;br /&gt;
&lt;br /&gt;
The logical symbols in CVC4's language include &lt;br /&gt;
the equality and disequality predicate symbols, respectively written as = and /=, &lt;br /&gt;
the multiarity disequality symbol &amp;lt;math&amp;gt;\mathrm{DISTINCT}&amp;lt;/math&amp;gt;, &lt;br /&gt;
together with the logical constants &amp;lt;math&amp;gt;\mathrm{TRUE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{FALSE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
the connectives &amp;lt;math&amp;gt;\mathrm{NOT}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{XOR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt;, and &lt;br /&gt;
the first-order quantifiers &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt;, &lt;br /&gt;
all with the standard many-sorted logic semantics.&lt;br /&gt;
&lt;br /&gt;
The binary connectives have infix syntax and type &lt;br /&gt;
&amp;lt;math&amp;gt;(\mathrm{BOOLEAN},\mathrm{BOOLEAN}) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The symbols = and /=, which are also infix, are instead parametrically polymorphic, &lt;br /&gt;
having type &amp;lt;math&amp;gt;(T,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
They are interpreted respectively as the identity relation and its complement.&lt;br /&gt;
&lt;br /&gt;
The DISTINCT symbol is both overloaded and polymorphic. &lt;br /&gt;
It has type &amp;lt;math&amp;gt;(T,...,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every sequence &amp;lt;math&amp;gt;(T,...,T)&amp;lt;/math&amp;gt; of length &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; &lt;br /&gt;
and first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
For each &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, it is interpreted as the relation &lt;br /&gt;
that holds exactly for tuples of pairwise distinct elements.&lt;br /&gt;
&lt;br /&gt;
The syntax for quantifiers is similar to that of the lambda binder.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a formula built just of these logical symbols and variables:&lt;br /&gt;
&lt;br /&gt;
 A, B: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 q: BOOLEAN = FORALL (x,y: A, i,j,k: B): &lt;br /&gt;
                i = j AND i /= k =&amp;gt; EXISTS (z: A): x /= z OR z /= y;&lt;br /&gt;
&lt;br /&gt;
Binding and scoping of quantified variables follows the same rules as &lt;br /&gt;
in let expressions. &lt;br /&gt;
In particular, a quantifier will shadow in its scope any constant and function symbols&lt;br /&gt;
with the same name as one of the variables it quantifies:&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 i, j: INT;&lt;br /&gt;
 &lt;br /&gt;
 % The first occurrence of i and of j in f are constant symbols,&lt;br /&gt;
 % the others are variables.&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN =  i = j AND FORALL (i,j: A): i = j OR i /= j;&lt;br /&gt;
&lt;br /&gt;
Optionally, it is also possible to specify instantiation patterns &lt;br /&gt;
for quantified variables. &lt;br /&gt;
The general syntax for a quantified formula &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; with patterns is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Q\;(x_1:T_1, \ldots, x_k:T_k):\; p_1: \ldots\; p_n:\; \varphi&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; is &lt;br /&gt;
either &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\varphi&amp;lt;/math&amp;gt; is a term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &lt;br /&gt;
and each of the &amp;lt;math&amp;gt;p_i&amp;lt;/math&amp;gt;'s, &lt;br /&gt;
a pattern for the quantifier &amp;lt;math&amp;gt;Q\;(x_1:T_1, \ldots, x_k:T_k)&amp;lt;/math&amp;gt;, has the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{PATTERN}\; (t_1, \ldots, t_m)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;t_1, \ldots, t_m&amp;lt;/math&amp;gt; are &lt;br /&gt;
arbitrary binder-free terms (no lets, no quantifiers). &lt;br /&gt;
Those terms can contain (free) variables, typically, but not exclusively, &lt;br /&gt;
drawn from &amp;lt;math&amp;gt;x_1, \ldots, x_k&amp;lt;/math&amp;gt;. &lt;br /&gt;
(Additional variables can occur if &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; occurs in a bigger formula &lt;br /&gt;
binding those variables.)&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 b, c: A;&lt;br /&gt;
 p, q: A -&amp;gt; BOOLEAN;&lt;br /&gt;
 r: (A, A) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x0, x1, x2: A):&lt;br /&gt;
          PATTERN (r(x0, x1), r(x1, x2)): &lt;br /&gt;
          (r(x0, x1) AND r(x1, x2)) =&amp;gt; r(x0, x2) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x: A):&lt;br /&gt;
          PATTERN (r(x, b)): &lt;br /&gt;
          PATTERN (r(x, c)): &lt;br /&gt;
          p(x) =&amp;gt; q(x) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT EXISTS (y: A):&lt;br /&gt;
          FORALL (x: A):&lt;br /&gt;
            PATTERN (r(x, y), p(y)): &lt;br /&gt;
            r(x, y) =&amp;gt; q(x) ;&lt;br /&gt;
&lt;br /&gt;
Patterns have no logical meaning: &lt;br /&gt;
adding them to a formula does not change its semantics. &lt;br /&gt;
Their purpose is purely operational, as explained in &lt;br /&gt;
the [[#Instantiation Patterns | Instantiation Patterns]] section.&lt;br /&gt;
&lt;br /&gt;
In addition to these constructs, CVC4 also has a general mixfix conditional operator &lt;br /&gt;
of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{IF}\ b\ \mathrm{THEN}\ t\ \mathrm{ELSIF}\ b_1\ \mathrm{THEN}\ t_1\ \ldots\ \mathrm{ELSIF}\ b_n\ \mathrm{THEN}\ t_n\ \mathrm{ELSE}\ t_{n+1}\ \mathrm{ENDIF}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt; where &lt;br /&gt;
&amp;lt;math&amp;gt;b, b_1, \ldots, b_n&amp;lt;/math&amp;gt; are terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; and&lt;br /&gt;
&amp;lt;math&amp;gt;t, t_1, \ldots, t_n, t_{n+1}&amp;lt;/math&amp;gt; are terms of the same first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 % Conditional term&lt;br /&gt;
 x, y, z, w: REAL;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL = &lt;br /&gt;
   IF x &amp;gt; 0 THEN y&lt;br /&gt;
   ELSIF x &amp;gt;= 1 THEN z&lt;br /&gt;
   ELSIF x &amp;gt; 2 THEN w&lt;br /&gt;
   ELSE 2/3 ENDIF;&lt;br /&gt;
&lt;br /&gt;
=== User-defined Functions and Types ===&lt;br /&gt;
&lt;br /&gt;
The theory of user-defined functions,also know in the SMT literature as &lt;br /&gt;
the theory ''Equality over Uninterpreted Functions'', or ''EUF'', is in effect &lt;br /&gt;
a family of theories of equality parametrized by the basic types and the free symbols &lt;br /&gt;
a user can define during a run of CVC4.&lt;br /&gt;
&lt;br /&gt;
This theory has no built-in symbols (other than the logical ones).&lt;br /&gt;
Its types consist of ''all and only'' the user-defined types.&lt;br /&gt;
Its function symbols consist of ''all and only'' the user-defined free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
The real arithmetic theory has two types:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{INTEGER}&amp;lt;/math&amp;gt;&lt;br /&gt;
with the latter a subtype of the first.&lt;br /&gt;
Its built-in symbols for the usual arithmetic constants &lt;br /&gt;
and operators over the type &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, each with the expected type: &lt;br /&gt;
all numerals 0, 1, ..., as well as - (both unary and binary), +, *, /, &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=. &lt;br /&gt;
Application of the binary symbols are in infix form.&lt;br /&gt;
Note that + is only binary, and so an expression such as +4 is ill-formed.&lt;br /&gt;
&lt;br /&gt;
Rational values can be expressed in decimal or fractional format,&lt;br /&gt;
e.g., 0.1, 23.243241, 1/2, 3/4, and so on.&lt;br /&gt;
A leading 0 is mandatory for decimal numbers smaller than one &lt;br /&gt;
(e.g., the syntax .3 cannot be used as a shorthand for 0.3).&lt;br /&gt;
However, a trailing 0 is ''not'' required for decimals that are whole numbers&lt;br /&gt;
(e.g., 3. is allowed as a shorthand for 3.0).&lt;br /&gt;
The size of the numerals used in the representation of natural and rational numbers &lt;br /&gt;
is unbounded; more accurately, bounded only by the amount of available memory.&lt;br /&gt;
&lt;br /&gt;
=== Bit vectors ===&lt;br /&gt;
&lt;br /&gt;
=== Arrays ===&lt;br /&gt;
&lt;br /&gt;
The theory of arrays is a parametric theory of (total) unary maps. &lt;br /&gt;
It comes equipped with mixfix polymorphic selection and update operators, respectively&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\_[\_]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_&amp;lt;/math&amp;gt; .&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
The semantics of these operators is the expected one:&lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
if &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1 \mathrm{OF}\ T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, and&lt;br /&gt;
&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a[i]&amp;lt;/math&amp;gt; denotes the value that &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; associates to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a\ \mathrm{WITH}\ [i]\ := v&amp;lt;/math&amp;gt; denotes a map that associates &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and is otherwise identical to &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;.&lt;br /&gt;
Sequential updates can be chained with the shorthand syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_, \ldots, [\_]\ := \_&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 A: TYPE = ARRAY INT OF REAL;&lt;br /&gt;
 a: A;&lt;br /&gt;
 i: INT = 4;&lt;br /&gt;
 &lt;br /&gt;
 % selection:&lt;br /&gt;
 &lt;br /&gt;
 elem: REAL = a[i];&lt;br /&gt;
 &lt;br /&gt;
 % update&lt;br /&gt;
 &lt;br /&gt;
 a1: A = a WITH [10] := 1/2;&lt;br /&gt;
 &lt;br /&gt;
 % sequential update &lt;br /&gt;
 % (syntactic sugar for (a WITH [10] := 2/3) WITH [42] := 3/2)&lt;br /&gt;
 &lt;br /&gt;
 a2: A = a WITH [10] := 2/3, [42] := 3/2;&lt;br /&gt;
&lt;br /&gt;
Since arrays are just maps, equality between them is extensional, that is, &lt;br /&gt;
for two arrays of the same type to be different they have to map at least one&lt;br /&gt;
index to differ values.&lt;br /&gt;
&lt;br /&gt;
=== Data types ===&lt;br /&gt;
&lt;br /&gt;
The theory of inductive data types is in fact a family of theories parametrized &lt;br /&gt;
by a data type declaration specifying constructors and selectors &lt;br /&gt;
for one or more user-defined data types.&lt;br /&gt;
&lt;br /&gt;
No built-in operators other than equality and disequality are provided &lt;br /&gt;
for this family in the native language. &lt;br /&gt;
Each user-provided data type declaration, however, generates constructor, selector and tester operators &lt;br /&gt;
as described in the [[#Inductive Data Types | Inductive Data Types]] section.&lt;br /&gt;
&lt;br /&gt;
=== Tuples and Records ===&lt;br /&gt;
&lt;br /&gt;
Semantically both records and tuples can be seen as special instances &lt;br /&gt;
of inductive data types.&lt;br /&gt;
CVC4 implements them internally indeed as data types.&lt;br /&gt;
In essence, a record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt;&lt;br /&gt;
is encoded as a data type of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
 \mathrm{DATATYPE} \\&lt;br /&gt;
 \ \ \mathrm{Record} = \mathit{rec}(l_0:T_0, \ldots, l_n:T_n) \\&lt;br /&gt;
 \mathrm{END};&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tuples of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; are in turn special cases of records whose field names are &lt;br /&gt;
the numerals from &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Externally, tuples and records have their own syntax for constructor and selector operators.&lt;br /&gt;
* Records of type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; have the associated  record constructor &amp;lt;math&amp;gt;(\#\ l_0 := \_,\; \ldots,\; l_n := \_\ \#)&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Tuples of type &amp;lt;math&amp;gt;[\ T_0, \ldots, T_n\ ]&amp;lt;/math&amp;gt; have the associated tuple constructor &amp;lt;math&amp;gt;(\ \_,\; \ldots,\; \_\ )&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The selector operators on records and tuples follows a dot notation syntax.&lt;br /&gt;
&lt;br /&gt;
 % Record construction and field selection&lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x: Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 k: INT = x.key;&lt;br /&gt;
 v: REAL = x.weight;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple construction and projection&lt;br /&gt;
 y: [REAL, INT, REAL] = ( 4/5, 9, 11/9 );&lt;br /&gt;
 first_elem: REAL = y.0;&lt;br /&gt;
 third_elem: REAL = y.2;&lt;br /&gt;
&lt;br /&gt;
Differently from data types, records and tuples are also provided with built-in update operators similar in syntax and semantics to the update operator for arrays. &lt;br /&gt;
More precisely, for each record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; and&lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\_\ \mathrm{WITH}\ .l_i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator maps a record &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; of that type and a value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; &lt;br /&gt;
of type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; to the record that stores &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in field &amp;lt;math&amp;gt;l_i&amp;lt;/math&amp;gt; &lt;br /&gt;
and is otherwise identical to &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;. &lt;br /&gt;
Analogously, for each tuple type &amp;lt;math&amp;gt;[T_0, \ldots, T_n]&amp;lt;/math&amp;gt; and &lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \_\ \mathrm{WITH}\ .i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with similar semantics.&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = x WITH .weight := 48;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = y WITH .1 := 3; &lt;br /&gt;
 &lt;br /&gt;
 Updates to a nested component can be combined in a single WITH operator:&lt;br /&gt;
 &lt;br /&gt;
 Cache: TYPE = ARRAY [0..100] OF [# addr: INT, data: REAL #];&lt;br /&gt;
 State: TYPE = [# pc: INT, cache: Cache #];&lt;br /&gt;
 &lt;br /&gt;
 s0: State;&lt;br /&gt;
 s1: State = s0 WITH .cache[10].data := 2/3;&lt;br /&gt;
&lt;br /&gt;
Note that, differently from updates on arrays, tuple and record updates are &lt;br /&gt;
just additional syntactic sugar. &lt;br /&gt;
For instance, the record &amp;lt;code&amp;gt;x1&amp;lt;/code&amp;gt; and tuple &amp;lt;code&amp;gt;y1&amp;lt;/code&amp;gt; defined above &lt;br /&gt;
could have been equivalently defined as follows:&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = (# key := x.key,  weight := 48 #);&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = ( y.0, 3, y.1 );&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to declarations of types and function symbols, &lt;br /&gt;
the CVC4 native language contains the following commands:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ASSERT}\ F&amp;lt;/math&amp;gt; -- Add the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; to the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
* [[#CHECKSAT|&amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is satisfiable in the current logical context (&amp;lt;math&amp;gt;\Gamma \not\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{CONTINUE}&amp;lt;/math&amp;gt; -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, search for a counter-example different from the current one.&lt;br /&gt;
* [[#COUNTEREXAMPLE|&amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print the context that is a witness for invalidity/satisfiability.&lt;br /&gt;
* [[#COUNTERMODEL|&amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print a model that makes the formula invalid/satisfiable. The model is provided in terms of concrete values for each free symbol.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{OPTION}\ o\ v&amp;lt;/math&amp;gt; -- Set the command-line option flag &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; to value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The argument &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; is provide as a string literal enclosed in double-quotes and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; as an integer value.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; -- Equivalent to &amp;lt;math&amp;gt;\mathrm{POPTO}\ 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* [[#POPTO|&amp;lt;math&amp;gt;\mathrm{POPTO}\ n&amp;lt;/math&amp;gt;]] -- Restore the system to the state it was in right before the most recent call to &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; made from stack level &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. Note that the current stack level is printed as part of the output of the &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; command.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; -- Save (checkpoint) the current state of the system.&lt;br /&gt;
* [[#QUERY|&amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is valid in the current logical context (&amp;lt;math&amp;gt;\Gamma\models_T F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* [[#RESTART|&amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, repeat the check but with the additional assumption &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; in the context.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PRINT}\ t&amp;lt;/math&amp;gt; -- Parse and print back the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRANSFORM}\ t&amp;lt;/math&amp;gt; -- Simplify the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and print the result.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; -- Print all the formulas in the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The remaining commands take a single argument, given as a string literal enclosed in double-quotes.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ECHO}\ s&amp;lt;/math&amp;gt; -- Print string &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{INCLUDE}\ f&amp;lt;/math&amp;gt; -- Read commands from file &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRACE}\ f&amp;lt;/math&amp;gt; -- Turn on tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{UNTRACE}\ f&amp;lt;/math&amp;gt; -- Turn off tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we explain some of the above commands in more detail.&lt;br /&gt;
&lt;br /&gt;
=== QUERY ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; invokes the core functionality of CVC4 to check &lt;br /&gt;
the validity of the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; with respect to the assertions made thus far,&lt;br /&gt;
which constitute the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;. &lt;br /&gt;
The argument &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; must be well typed term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;,&lt;br /&gt;
as described in [[#Terms and Formulas | Terms and Formulas]].&lt;br /&gt;
&lt;br /&gt;
The execution of this command always terminates and produces one of three possible answers: &lt;br /&gt;
&amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* A &amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;. After a query returning such an answer, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is exactly as it was before the query.&lt;br /&gt;
* An &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \not\models_T F&amp;lt;/math&amp;gt;, that is, there is a model of the background theory &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Gamma \cup \{\mathrm{NOT}\ F\}&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; returns &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is augmented with a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of ground (i.e., variable-free) literals such that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but &amp;lt;math&amp;gt;\Gamma\cup\Delta\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;. In fact, in this case &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; ''propositionally entails'' &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;, in the sense that, every truth assignment to the literals of &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; falsifies &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;. We call the new context &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; a ''counterexample'' for &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
* An &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; answer is similar to an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer in that additional literals are added to the context which propositionally entail &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;. The difference in this case is that CVC4 cannot guarantee that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is actually satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
CVC4 may report &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; when the context or the query contains&lt;br /&gt;
non-linear arithmetic terms or quantifiers.&lt;br /&gt;
In all other cases, it is expected to be sound and complete, &lt;br /&gt;
i.e., to report &amp;lt;code&amp;gt;Valid&amp;lt;/code&amp;gt; if &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;&lt;br /&gt;
and &amp;lt;code&amp;gt;Invalid&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
After an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; (resp. &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;) answer,&lt;br /&gt;
counterexamples (resp. possible counterexamples) can be obtained with &lt;br /&gt;
a &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
or &amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt; command. &lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
WHERE always prints out all of &amp;lt;math&amp;gt;\Gamma\cup C&amp;lt;/math&amp;gt;. COUNTEREXAMPLE may sometimes be more selective, printing a subset of those formulas from the context which are sufficient for a counterexample.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; command may modify &lt;br /&gt;
the current context, if one needs to check several formulas in a row &lt;br /&gt;
in the same context, it is a good idea to surround every &lt;br /&gt;
query by a &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; invocation&lt;br /&gt;
in order to preserve the context:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
&lt;br /&gt;
=== CHECKSAT ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt; behaves identically &lt;br /&gt;
to &amp;lt;math&amp;gt;\mathrm{QUERY}\ \mathrm{NOT}\ F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== RESTART ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt; can only be invoked after an invalid query. &lt;br /&gt;
For example, in an interactive setting:&lt;br /&gt;
&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
 CVC4&amp;gt; invalid&lt;br /&gt;
 &lt;br /&gt;
 RESTART &amp;lt;formula2&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
Functionally, the behavior of the above command sequence is identical to the following:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
 ASSERT &amp;lt;formula2&amp;gt;;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
The advantage of using the &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; command is that &lt;br /&gt;
the first command sequence may be executed much more efficiently that the second.&lt;br /&gt;
The reason is that with &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; CVC4 will re-use&lt;br /&gt;
what it has learned while answering the previous query rather than starting &lt;br /&gt;
over from scratch.&lt;br /&gt;
&lt;br /&gt;
=== COUNTERMODEL ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== COUNTEREXAMPLE ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== POPTO ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
== Instantiation Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVC4 processes each universally quantified formula in the current context &lt;br /&gt;
by adding instances of the formula obtained by replacing its universal variables &lt;br /&gt;
with ground terms. &lt;br /&gt;
Patterns restrict the choice of ground terms for the quantified variables, &lt;br /&gt;
with the goal of controlling the potential explosion of ground instances. &lt;br /&gt;
In essence, adding patterns to a formula is a way for the user to tell CVC4 &lt;br /&gt;
to focus only on certain instances which, in the user's opinion, will be &lt;br /&gt;
most helpful during a proof.&lt;br /&gt;
&lt;br /&gt;
In more detail, patterns have the following effect on formulas that are found &lt;br /&gt;
in the logical context or get added to it later while CVC4 is trying to prove &lt;br /&gt;
the validity of some formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If a formula in the current context starts with an existential quantifier, &lt;br /&gt;
CVC4 ''Skolemizes'' it, that is, replaces it in the context with the formula &lt;br /&gt;
obtained by substituting the existentially quantified variables &lt;br /&gt;
by fresh constants and dropping the quantifier. &lt;br /&gt;
Any patterns for the existential quantifier are simply ignored.&lt;br /&gt;
&lt;br /&gt;
If a formula starts with a universal quantifier &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{FORALL}\; (x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt;, &lt;br /&gt;
CVC4 adds to the context a number of instances of the formula, &lt;br /&gt;
with the goal of using them to prove the query &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; valid. &lt;br /&gt;
An instance is obtained by replacing each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; with a ground term&lt;br /&gt;
of the same type occurring in one of the formulas in the context, &lt;br /&gt;
and dropping the universal quantifier. &lt;br /&gt;
If &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; occurs in a pattern &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{PATTERN}\; (t_1, \ldots, t_m)&amp;lt;/math&amp;gt; for the quantifier, &lt;br /&gt;
it will be instantiated only with terms obtained by simultaneously matching &lt;br /&gt;
all the terms in the pattern against ground terms in the current context &lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Specifically, the matching process produces one or more substitutions &lt;br /&gt;
&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; for the variables in &amp;lt;math&amp;gt;(t_1, \ldots, t_m)&amp;lt;/math&amp;gt; &lt;br /&gt;
which satisfy the following invariant: &lt;br /&gt;
for each &amp;lt;math&amp;gt;i = 1, \ldots, m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\sigma(t_i)&amp;lt;/math&amp;gt; is &lt;br /&gt;
a ground term and there is a ground term &amp;lt;math&amp;gt;s_i&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
such that &amp;lt;math&amp;gt;\Gamma \models_T \sigma(t_i) = s_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
The variables of &amp;lt;math&amp;gt;(x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt; that occur &lt;br /&gt;
in the pattern are instantiated only with those substitutions &lt;br /&gt;
(while any remaining variables are instantiated arbitrarily).&lt;br /&gt;
&lt;br /&gt;
The Skolemized version or the added instances of a context formula may themselves &lt;br /&gt;
start with a quantifier. &lt;br /&gt;
The same instantiation process is applied to them too, recursively.&lt;br /&gt;
&lt;br /&gt;
Note that the matching mechanism is not limited to syntactic matching &lt;br /&gt;
but is modulo the equations asserted in the context. &lt;br /&gt;
Because of decidability and/or efficiency limitations, the matching process &lt;br /&gt;
is not exhaustive. &lt;br /&gt;
CVC4 will typically miss some substitutions that satisfy the invariant above. &lt;br /&gt;
As a consequence, it might fail to prove the validity of the query formula &lt;br /&gt;
&amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;, which makes CVC4 incomplete for contexts containing &lt;br /&gt;
quantified formulas. &lt;br /&gt;
It should be noted though that exhaustive matching, which can be achieved &lt;br /&gt;
simply by not specifying any patterns, does not yield completeness anyway &lt;br /&gt;
since the instantiation of universal variables is still restricted &lt;br /&gt;
to just the ground terms in the context,&lt;br /&gt;
whereas in general additional ground terms might be needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 == Subtypes ==&lt;br /&gt;
&lt;br /&gt;
=== Subtype Checking ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Building_CVC4_from_source&amp;diff=3926</id>
		<title>Building CVC4 from source</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Building_CVC4_from_source&amp;diff=3926"/>
				<updated>2012-11-27T18:10:55Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: Created page with &amp;quot;=Common make Options= * &amp;quot;''make install''&amp;quot; will install into the &amp;quot;--prefix&amp;quot; option you gave to the configure script (''/usr/local'' by default).     ./configure --prefix=~/instal…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Common make Options=&lt;br /&gt;
* &amp;quot;''make install''&amp;quot; will install into the &amp;quot;--prefix&amp;quot; option you gave to&lt;br /&gt;
the configure script (''/usr/local'' by default).&lt;br /&gt;
    ./configure --prefix=~/install_targets/cvc4 ...&lt;br /&gt;
    make install&lt;br /&gt;
* '''You should run &amp;quot;''make check''&amp;quot;''' before installation to ensure that CVC4 has been&lt;br /&gt;
built correctly.  In particular, GCC version 4.5.1 seems to have a&lt;br /&gt;
bug in the optimizer that results in incorrect behavior (and wrong&lt;br /&gt;
results) in many builds.  This is a known problem for Minisat, and&lt;br /&gt;
since Minisat is at the core of CVC4, a problem for CVC4.  &amp;quot;''make check''&amp;quot;&lt;br /&gt;
easily detects this problem (by showing a number of FAILed test cases).&lt;br /&gt;
It is ok if the unit tests aren't run as part of &amp;quot;''make check''&amp;quot;, but all&lt;br /&gt;
system tests and regression tests should pass without incident.&lt;br /&gt;
* To build API documentation, use &amp;quot;''make doc''&amp;quot;.  Documentation is produced&lt;br /&gt;
under ''builds/doc/'' but is not installed by &amp;quot;''make install''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Examples and tutorials are not installed with &amp;quot;''make install''.&amp;quot;  See [[#Examples_and_tutorials_are_not_built_or_installed|below]].&lt;br /&gt;
&lt;br /&gt;
For more information about the build system itself (probably not&lt;br /&gt;
necessary for casual users), see the [[#Appendix:_Build_architecture|Appendix]] at the bottom of this&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
=Common configure Options=&lt;br /&gt;
*'''--prefix=PREFIX''' install architecture-independent files in PREFIX (by default /usr/local)&lt;br /&gt;
*'''--with-build={production,debug,default,competition}''' &lt;br /&gt;
*'''--with-antlr-dir=PATH'''&lt;br /&gt;
*'''--with-cln'''/'''--with-gmp''' selects the numbers package to use by default ([[#Optional requirements]])&lt;br /&gt;
*'''--enable-static-binary''' build a fully statically-linked binary. (This is recommended for Mac OS X users that want to be able to use gdb.)&lt;br /&gt;
*'''ANTLR=PATH''' location of the antlr3 script&lt;br /&gt;
*'''--with-boost=DIR''' installation location of the boost libraries (most users will not need this)&lt;br /&gt;
&lt;br /&gt;
See '''./configure --help''' for more.&lt;br /&gt;
&lt;br /&gt;
=Build dependencies=&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are required to run CVC4. Versions&lt;br /&gt;
given are minimum versions; more recent versions should be compatible.&lt;br /&gt;
&lt;br /&gt;
*'''GNU C and C++''' (gcc and g++), reasonably recent versions&lt;br /&gt;
*'''GNU Make'''&lt;br /&gt;
*'''GNU Bash'''&lt;br /&gt;
*'''GMP v4.2''' (GNU Multi-Precision arithmetic library)&lt;br /&gt;
*'''libantlr3c v3.2 or v3.4''' (ANTLR parser generator C support library)&lt;br /&gt;
*'''The Boost C++ base libraries'''&lt;br /&gt;
*'''MacPorts'''   [highly recommended if on a Mac; see [[#MacPorts]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardest to obtain and install is the libantlr3c requirement, and&lt;br /&gt;
is explained [[#Installing libantlr3c: ANTLR parser generator C support library|next]].&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;make&amp;quot; is non-GNU on your system, make sure to invoke &amp;quot;gmake&amp;quot; (or&lt;br /&gt;
whatever GNU Make is installed as).  If your usual shell is not Bash,&lt;br /&gt;
the configure script should auto-correct this.  If it does not, you'll&lt;br /&gt;
see strange shell syntax errors, and you may need to explicitly set&lt;br /&gt;
SHELL or CONFIG_SHELL to the location of bash on your system.&lt;br /&gt;
&lt;br /&gt;
==Installing libantlr3c: ANTLR parser generator C support library==&lt;br /&gt;
&lt;br /&gt;
For libantlr3c, you can use the convenience script in&lt;br /&gt;
''contrib/get-antlr-3.4'' in the source distribution---this will download, patch, compile and install&lt;br /&gt;
libantlr3c into your cvc4 directory as ''cvc4/antlr-3.4/''.&lt;br /&gt;
  cd contrib&lt;br /&gt;
  ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
CVC4 must be configured with the antlr library installation directory, '''--with-antlr-dir''', and an antlr executable script file, '''ANTLR'''.  If libantlr3c was installed via get-antlr-3.4, the following configure line should suffice for CVC44&lt;br /&gt;
  ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
For 64 bit machines, libantlr3c needs to be configured with 64 bit explicitly&lt;br /&gt;
  ./configure --enable-64bit ...&lt;br /&gt;
The get-antlr-3.4 script makes a guess at whether the machine is 64 bit and adds the appropriate flag.&lt;br /&gt;
To force the script to compile 32 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86&amp;quot; ./get-antlr3.4&lt;br /&gt;
To force the script to compile 64 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86_64&amp;quot; ./get-antlr3.4&lt;br /&gt;
&lt;br /&gt;
For a longer discussion, instructions for manual installation, and more in depth troubleshooting, see [[Developer's Guide#ANTLR3]].&lt;br /&gt;
&lt;br /&gt;
==MacPorts==&lt;br /&gt;
&lt;br /&gt;
On a Mac, it is '''highly''' recommended that you use MacPorts (see&lt;br /&gt;
http://www.macports.org/).  Doing so is easy.  Then, simply run the&lt;br /&gt;
script ''contrib/mac-build'', which installs a few ports from the MacPorts&lt;br /&gt;
repository, then compiles and installs antlr3c using the ''get-antlr-3.4''&lt;br /&gt;
script.  The mac-build script should set you up&lt;br /&gt;
with all requirements, and will tell you how to configure CVC4 when it&lt;br /&gt;
completes successfully.&lt;br /&gt;
&lt;br /&gt;
==Installing the Boost C++ base libraries==&lt;br /&gt;
&lt;br /&gt;
A Boost package is available on most Linux distributions; check yours&lt;br /&gt;
for a package named something like libboost-dev or boost-devel.  There&lt;br /&gt;
are a number of additional Boost packages in some distributions, but&lt;br /&gt;
this &amp;quot;basic&amp;quot; one should be sufficient for building CVC4.&lt;br /&gt;
&lt;br /&gt;
Should you want to install Boost manually, or to learn more about the&lt;br /&gt;
Boost project, please visit http://www.boost.org/.&lt;br /&gt;
&lt;br /&gt;
=Optional requirements=&lt;br /&gt;
&lt;br /&gt;
None of these is required, but can improve CVC4 as described below:&lt;br /&gt;
&lt;br /&gt;
*'''Optional: SWIG 2.0.x''' (Simplified Wrapper and Interface Generator)&lt;br /&gt;
*'''Optional: CLN v1.3 or newer''' (Class Library for Numbers)&lt;br /&gt;
*'''Optional: CUDD v2.4.2 or newer''' (Colorado University Decision Diagram package)&lt;br /&gt;
*'''Optional: GNU Readline library''' (for an improved interactive experience)&lt;br /&gt;
*'''Optional: The Boost C++ threading library''' (libboost_thread)&lt;br /&gt;
*'''Optional: CxxTest unit testing framework'''&lt;br /&gt;
&lt;br /&gt;
SWIG is necessary to build the Java API (and of course a JDK is&lt;br /&gt;
necessary, too).  SWIG 1.x won't work; you'll need 2.0, and the more&lt;br /&gt;
recent the better.  On Mac, we've seen SWIG segfault when generating&lt;br /&gt;
CVC4 language bindings; version 2.0.8 or higher is recommended to&lt;br /&gt;
avoid this.  See [[#Language_bindings|Language bindings]] below for build instructions.&lt;br /&gt;
&lt;br /&gt;
CLN is an alternative multiprecision arithmetic package that can offer&lt;br /&gt;
better performance and memory footprint than GMP.  CLN is covered by&lt;br /&gt;
the GNU General Public License, version 3; so if you choose to use&lt;br /&gt;
CVC4 with CLN support, you are licensing CVC4 under that same license.&lt;br /&gt;
(Usually CVC4's license is more permissive than GPL is; see the file&lt;br /&gt;
COPYING in the CVC4 source distribution for details.)  Please visit&lt;br /&gt;
http://www.ginac.de/CLN/ for more details about CLN.&lt;br /&gt;
&lt;br /&gt;
CUDD is a decision diagram package that changes the behavior of the&lt;br /&gt;
CVC4 arithmetic solver in some cases; it may or may not improve the&lt;br /&gt;
arithmetic solver's performance.  See [[#Building_with_CUDD_(optional)|below]] for instructions on&lt;br /&gt;
obtaining and building CUDD.&lt;br /&gt;
&lt;br /&gt;
The GNU Readline library is optionally used to provide command&lt;br /&gt;
editing, tab completion, and history functionality at the CVC prompt&lt;br /&gt;
(when running in interactive mode).  Check your distribution for a&lt;br /&gt;
package named &amp;quot;libreadline-dev&amp;quot; or &amp;quot;readline-devel&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
The Boost C++ threading library (often packaged independently of the&lt;br /&gt;
Boost base library) is needed to run CVC4 in &amp;quot;portfolio&amp;quot;&lt;br /&gt;
(multithreaded) mode.  Check your distribution for a package named&lt;br /&gt;
&amp;quot;libboost-thread-dev&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
CxxTest is necessary to run CVC4's unit tests (included with the&lt;br /&gt;
distribution).  Running these is not really required for users of&lt;br /&gt;
CVC4; &amp;quot;make check&amp;quot; will skip unit tests if CxxTest isn't available,&lt;br /&gt;
and go on to run the extensive system- and regression-tests in the&lt;br /&gt;
source tree.  However, if you're interested, you can download CxxTest&lt;br /&gt;
at http://cxxtest.com/ .&lt;br /&gt;
&lt;br /&gt;
==Building with CUDD (optional)==&lt;br /&gt;
&lt;br /&gt;
CUDD, if desired, must be installed delicately.  The CVC4 configure&lt;br /&gt;
script attempts to auto-detect the locations and names of CUDD headers&lt;br /&gt;
and libraries the way that the Fedora RPMs install them, the way that&lt;br /&gt;
our NYU-provided Debian packages install them, and the way they exist&lt;br /&gt;
when you download and build the CUDD sources directly.  If you install&lt;br /&gt;
from Fedora RPMs or our Debian packages, the process should be&lt;br /&gt;
completely automatic, since the libraries and headers are installed in&lt;br /&gt;
a standard location.  If you download the sources yourself, you need&lt;br /&gt;
to build them in a special way.  Fortunately, the&lt;br /&gt;
&amp;quot;contrib/build-cudd-2.4.2-with-libtool.sh&amp;quot; script in the CVC4 source&lt;br /&gt;
tree does exactly what you need: it patches the CUDD makefiles to use&lt;br /&gt;
libtool, builds the libtool libraries, then reverses the patch to&lt;br /&gt;
leave the makefiles as they were.  Once you run this script on an&lt;br /&gt;
unpacked CUDD 2.4.2 source distribution, then CVC4's configure script&lt;br /&gt;
should pick up the libraries if you provide&lt;br /&gt;
--with-cudd-dir=/PATH/TO/CUDD/SOURCES.&lt;br /&gt;
&lt;br /&gt;
If you want to force linking to CUDD, provide --with-cudd to the&lt;br /&gt;
configure script; this makes it a hard requirement rather than an&lt;br /&gt;
optional add-on.&lt;br /&gt;
&lt;br /&gt;
The NYU-provided Debian packaging of CUDD 2.4.2 and CUDD 2.5.0 are&lt;br /&gt;
here (along with the CVC4 Debian packages):&lt;br /&gt;
&lt;br /&gt;
  deb http://cvc4.cs.nyu.edu/debian/ unstable/&lt;br /&gt;
&lt;br /&gt;
On Debian (and Debian-derived distributions like Ubuntu), you only&lt;br /&gt;
need to drop that one line in your /etc/apt/sources.list file, then install with your favorite package manager.&lt;br /&gt;
&lt;br /&gt;
The Debian source package &amp;quot;cudd&amp;quot;, available from the same repository,&lt;br /&gt;
includes a diff of all changes made to cudd makefiles.&lt;br /&gt;
&lt;br /&gt;
=Language bindings=&lt;br /&gt;
&lt;br /&gt;
There are several options available for using CVC4 from the API.&lt;br /&gt;
&lt;br /&gt;
First, CVC4 offers a complete and flexible API for manipulating&lt;br /&gt;
expressions, maintaining a stack of assertions, and checking&lt;br /&gt;
satisfiability, and related things.  The C++ libraries (libcvc4.so and&lt;br /&gt;
libcvc4parser.so) and required headers are installed normally via a&lt;br /&gt;
&amp;quot;make install&amp;quot;.  This API is also available from Java (via CVC4.jar&lt;br /&gt;
and libcvc4jni.so) by configuring with --enable-language-bindings=java.&lt;br /&gt;
You'll also need SWIG 2.0 installed (and you might need to help&lt;br /&gt;
configure find it if you installed it in a nonstandard place with&lt;br /&gt;
--with-swig-dir=/path/to/swig/installation).  You may also need to&lt;br /&gt;
give the configure script the path to your Java headers (in&lt;br /&gt;
particular, jni.h).  You might do so with (for example):&lt;br /&gt;
&lt;br /&gt;
  ./configure --enable-language-bindings=java \&lt;br /&gt;
      JAVA_CPPFLAGS=-I/usr/lib/jvm/java-6-openjdk-amd64/include&lt;br /&gt;
&lt;br /&gt;
There is also a &amp;quot;C++ compatibility API&amp;quot; (''#include &amp;lt;cvc4/cvc3_compat.h&amp;gt;''&lt;br /&gt;
and link against libcvc4compat.so) that attempts to maintain&lt;br /&gt;
source-level backwards-compatibility with the CVC3 C++ API.  The&lt;br /&gt;
compatibility library is built by default, and&lt;br /&gt;
''--enable-language-bindings=java'' enables the Java compatibility library&lt;br /&gt;
(CVC4compat.jar and libcvc4compatjni.so).&lt;br /&gt;
''--enable-language-bindings=c'' enables the C compatibility library&lt;br /&gt;
(''#include &amp;lt;cvc4/bindings/compat/c/c_interface.h&amp;gt;'' and link against&lt;br /&gt;
libcvc4bindings_c_compat.so), and if you want both C and Java&lt;br /&gt;
bindings, use ''--enable-language-bindings=c,java''.  These compatibility&lt;br /&gt;
language bindings do NOT require SWIG.&lt;br /&gt;
&lt;br /&gt;
The ''examples/'' directory in the source distribution includes some basic examples (the &amp;quot;simple vc&amp;quot;&lt;br /&gt;
and &amp;quot;simple vc compat&amp;quot; family of examples) of all these interfaces.&lt;br /&gt;
&lt;br /&gt;
In principle, since we use SWIG to generate the native Java API, we&lt;br /&gt;
could support other languages as well.  However, using CVC4 from other&lt;br /&gt;
languages is not supported, nor expected to work, at this time.  If&lt;br /&gt;
you're interested in helping to develop, maintain, and test a language&lt;br /&gt;
binding, please contact us via the users' mailing list at&lt;br /&gt;
cvc-users@cs.nyu.edu.&lt;br /&gt;
&lt;br /&gt;
=Building CVC4 from a repository checkout=&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are additionally required to build&lt;br /&gt;
CVC4 from from a repository checkout rather than from a prepared&lt;br /&gt;
source tarball.&lt;br /&gt;
&lt;br /&gt;
*'''Automake v1.11'''&lt;br /&gt;
*'''Autoconf v2.61'''&lt;br /&gt;
*'''Libtool v2.2'''&lt;br /&gt;
*'''ANTLR3 v3.2 or v3.4'''&lt;br /&gt;
*'''Java Development Kit''' ([http://www.antlr.org/wiki/pages/viewpage.action?pageId=728 required for ANTLR3])&lt;br /&gt;
&lt;br /&gt;
First, use &amp;quot;''./autogen.sh''&amp;quot; to create the configure script.  Then&lt;br /&gt;
proceed as normal for any distribution tarball.  The parsers are&lt;br /&gt;
pre-generated for the tarballs, but don't exist in the repository; hence the extra ANTLR3 and JDK requirements to&lt;br /&gt;
generate the source code for the parsers, when building from the&lt;br /&gt;
repository.&lt;br /&gt;
&lt;br /&gt;
=Examples and tutorials are not built or installed=&lt;br /&gt;
&lt;br /&gt;
Examples are not built by &amp;quot;''make''&amp;quot; or &amp;quot;''make install''&amp;quot;.  See&lt;br /&gt;
''examples/README'' in the source distribution for information on what to find in the ''examples/''&lt;br /&gt;
directory, as well as information about building and installing them.&lt;br /&gt;
&lt;br /&gt;
=Appendix: Build architecture=&lt;br /&gt;
&lt;br /&gt;
The build system is generated by automake, libtool, and autoconf.  It&lt;br /&gt;
is somewhat nonstandard, though, which (for one thing) requires that&lt;br /&gt;
GNU Make be used.  If you ./configure in the top-level source&lt;br /&gt;
directory, the objects will actually all appear in&lt;br /&gt;
builds/${arch}/${build_id}.  This is to allow multiple, separate&lt;br /&gt;
builds in the same place (e.g., an assertions-enabled debugging build&lt;br /&gt;
alongside a production build), without changing directories at the&lt;br /&gt;
shell.  The &amp;quot;current&amp;quot; build is maintained, and you can still use&lt;br /&gt;
(e.g.) &amp;quot;make -C src/main&amp;quot; to rebuild objects in just one subdirectory.&lt;br /&gt;
&lt;br /&gt;
You can also create your own build directory inside or outside of the&lt;br /&gt;
source tree and configure from there.  All objects will then be built&lt;br /&gt;
in that directory, and you'll ultimately find the &amp;quot;cvc4&amp;quot; binary in&lt;br /&gt;
src/main/, and the libraries under src/ and src/parser/.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3925</id>
		<title>User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=User_Manual&amp;diff=3925"/>
				<updated>2012-11-27T18:06:24Z</updated>
		
		<summary type="html">&lt;p&gt;Lianah: /* Building from source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This manual includes lots of information about how to use CVC4.&lt;br /&gt;
&lt;br /&gt;
It is a work in-progress.&lt;br /&gt;
&lt;br /&gt;
= What is CVC4? =&lt;br /&gt;
&lt;br /&gt;
CVC4 is the last of a long line of SMT solvers that started with SVC and includes CVC, CVC-Lite and CVC3.&lt;br /&gt;
Technically, it is an automated validity checker for a many-sorted (i.e., typed) first-order logic with built-in theories. &lt;br /&gt;
The current built-in theories are the theories of:&lt;br /&gt;
&lt;br /&gt;
* equality over free (aka uninterpreted) function and predicate symbols,&lt;br /&gt;
* real and integer linear arithmetic (with some support for non-linear arithmetic),&lt;br /&gt;
* bit vectors,&lt;br /&gt;
* arrays,&lt;br /&gt;
* tuples,&lt;br /&gt;
* records,&lt;br /&gt;
* user-defined inductive data types.&lt;br /&gt;
&lt;br /&gt;
CVC4 checks whether a given formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is valid in the built-in theories under a given set &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; of assumptions, a ''context''. &lt;br /&gt;
More precisely, it checks whether&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma\models_T \phi&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that is, whether &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a logical consequence in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; of the set of formulas &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is the union of CVC4's built-in theories.&lt;br /&gt;
&lt;br /&gt;
Roughly speaking, when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; is a universal formula and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is a set of existential formulas (i.e., when &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; contain at most universal, respectively existential, quantifiers), CVC4 is a decision procedure: &lt;br /&gt;
it is guaranteed (modulo bugs and memory limits) to return a correct &amp;quot;valid&amp;quot; or &amp;quot;invalid&amp;quot; answer eventually. &lt;br /&gt;
In all other cases, CVC4 is deductively sound but incomplete: &lt;br /&gt;
it will never say that an invalid formula is valid,&lt;br /&gt;
but it may either never return or give up and return &amp;quot;unknown&amp;quot; for some formulas.&lt;br /&gt;
&lt;br /&gt;
Currently, when CVC4 returns &amp;quot;valid&amp;quot; for a query formula &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; under a context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;&lt;br /&gt;
it provides no evidence to back its claim.&lt;br /&gt;
Future versions will also return a ''proof certificate'', &lt;br /&gt;
a formal proof that &amp;lt;math&amp;gt;\Gamma'\models_T \phi&amp;lt;/math&amp;gt; for some subset &amp;lt;math&amp;gt;\Gamma'&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When CVC4 returns &amp;quot;invalid&amp;quot; it can return &lt;br /&gt;
both a ''counter-example'' to &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;'s validity under the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and a ''counter-model''. &lt;br /&gt;
Both a counter-example and a counter-model are a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of additional formulas consistent with &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but entailing the negation of &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
Formally:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \not\models_T \mathit{false}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma \cup \Delta \models_T \lnot \phi&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference is that a counter-model is given as a set of equations providing a concrete assignment of values for the free symbols in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\phi&amp;lt;/math&amp;gt; &lt;br /&gt;
(see the section on [[#CVC4's native input language|CVC4's native input language]] for more details).&lt;br /&gt;
&lt;br /&gt;
=Obtaining and compiling CVC4=&lt;br /&gt;
&lt;br /&gt;
CVC4 is distributed in the following ways:&lt;br /&gt;
* [[#Obtaining_binary_packages|Binary packages]]&lt;br /&gt;
* [[#Obtaining_source_packages|Source packages]]&lt;br /&gt;
* [[#Source_repository|Source repository checkout]]&lt;br /&gt;
&lt;br /&gt;
==Obtaining binary packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/ Binary packages are available] for CVC4.&lt;br /&gt;
Nightly builds:&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/debian/unstable Debian] packages&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-opt/ Optimized] binaries (statically linked)&lt;br /&gt;
* [http://cvc4.cs.nyu.edu/builds/x86_64-linux-dbg/ Debug] binaries (statically linked)&lt;br /&gt;
&lt;br /&gt;
==Obtaining source packages==&lt;br /&gt;
&lt;br /&gt;
[http://cvc4.cs.nyu.edu/builds/src/ Sources are available] from the same site as the binaries.&lt;br /&gt;
&lt;br /&gt;
==Source repository==&lt;br /&gt;
The [http://cvc4.cs.nyu.edu/builds/src/ CVC4 source repository] is currently hosted by [http://cims.nyu.edu/ CIMS] and requires a CIMS account. Please contact a member of the development team for access. Please see the additional instructions for [[#Building_CVC4 from_a_repository_checkout]] here.&lt;br /&gt;
&lt;br /&gt;
==Building from source==&lt;br /&gt;
&lt;br /&gt;
===Quick-start instructions===&lt;br /&gt;
To compile from a source package:&lt;br /&gt;
# Install antlr&lt;br /&gt;
# Configure cvc4&lt;br /&gt;
# Compile cvc4&lt;br /&gt;
# Install cvc4 [optional]&lt;br /&gt;
    cd contrib&lt;br /&gt;
    ./get-antlr-3.4&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
    make&lt;br /&gt;
    make check   [recommended]&lt;br /&gt;
    make install [optional]&lt;br /&gt;
&lt;br /&gt;
(To build from a repository checkout, see [[#Building_CVC4_from_a_repository_checkout|below]].)&lt;br /&gt;
&lt;br /&gt;
For more detailed build instructions for various architectures see [[Building CVC4 from source]]&lt;br /&gt;
&lt;br /&gt;
===Common make Options===&lt;br /&gt;
* &amp;quot;''make install''&amp;quot; will install into the &amp;quot;--prefix&amp;quot; option you gave to&lt;br /&gt;
the configure script (''/usr/local'' by default).&lt;br /&gt;
    ./configure --prefix=~/install_targets/cvc4 ...&lt;br /&gt;
    make install&lt;br /&gt;
* '''You should run &amp;quot;''make check''&amp;quot;''' before installation to ensure that CVC4 has been&lt;br /&gt;
built correctly.  In particular, GCC version 4.5.1 seems to have a&lt;br /&gt;
bug in the optimizer that results in incorrect behavior (and wrong&lt;br /&gt;
results) in many builds.  This is a known problem for Minisat, and&lt;br /&gt;
since Minisat is at the core of CVC4, a problem for CVC4.  &amp;quot;''make check''&amp;quot;&lt;br /&gt;
easily detects this problem (by showing a number of FAILed test cases).&lt;br /&gt;
It is ok if the unit tests aren't run as part of &amp;quot;''make check''&amp;quot;, but all&lt;br /&gt;
system tests and regression tests should pass without incident.&lt;br /&gt;
* To build API documentation, use &amp;quot;''make doc''&amp;quot;.  Documentation is produced&lt;br /&gt;
under ''builds/doc/'' but is not installed by &amp;quot;''make install''&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Examples and tutorials are not installed with &amp;quot;''make install''.&amp;quot;  See [[#Examples_and_tutorials_are_not_built_or_installed|below]].&lt;br /&gt;
&lt;br /&gt;
For more information about the build system itself (probably not&lt;br /&gt;
necessary for casual users), see the [[#Appendix:_Build_architecture|Appendix]] at the bottom of this&lt;br /&gt;
file.&lt;br /&gt;
&lt;br /&gt;
===Common configure Options===&lt;br /&gt;
*'''--prefix=PREFIX''' install architecture-independent files in PREFIX (by default /usr/local)&lt;br /&gt;
*'''--with-build={production,debug,default,competition}''' &lt;br /&gt;
*'''--with-antlr-dir=PATH'''&lt;br /&gt;
*'''--with-cln'''/'''--with-gmp''' selects the numbers package to use by default ([[#Optional requirements]])&lt;br /&gt;
*'''--enable-static-binary''' build a fully statically-linked binary. (This is recommended for Mac OS X users that want to be able to use gdb.)&lt;br /&gt;
*'''ANTLR=PATH''' location of the antlr3 script&lt;br /&gt;
*'''--with-boost=DIR''' installation location of the boost libraries (most users will not need this)&lt;br /&gt;
&lt;br /&gt;
See '''./configure --help''' for more.&lt;br /&gt;
&lt;br /&gt;
===Build dependencies===&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are required to run CVC4. Versions&lt;br /&gt;
given are minimum versions; more recent versions should be compatible.&lt;br /&gt;
&lt;br /&gt;
*'''GNU C and C++''' (gcc and g++), reasonably recent versions&lt;br /&gt;
*'''GNU Make'''&lt;br /&gt;
*'''GNU Bash'''&lt;br /&gt;
*'''GMP v4.2''' (GNU Multi-Precision arithmetic library)&lt;br /&gt;
*'''libantlr3c v3.2 or v3.4''' (ANTLR parser generator C support library)&lt;br /&gt;
*'''The Boost C++ base libraries'''&lt;br /&gt;
*'''MacPorts'''   [highly recommended if on a Mac; see [[#MacPorts]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hardest to obtain and install is the libantlr3c requirement, and&lt;br /&gt;
is explained [[#Installing libantlr3c: ANTLR parser generator C support library|next]].&lt;br /&gt;
&lt;br /&gt;
If &amp;quot;make&amp;quot; is non-GNU on your system, make sure to invoke &amp;quot;gmake&amp;quot; (or&lt;br /&gt;
whatever GNU Make is installed as).  If your usual shell is not Bash,&lt;br /&gt;
the configure script should auto-correct this.  If it does not, you'll&lt;br /&gt;
see strange shell syntax errors, and you may need to explicitly set&lt;br /&gt;
SHELL or CONFIG_SHELL to the location of bash on your system.&lt;br /&gt;
&lt;br /&gt;
====Installing libantlr3c: ANTLR parser generator C support library====&lt;br /&gt;
&lt;br /&gt;
For libantlr3c, you can use the convenience script in&lt;br /&gt;
''contrib/get-antlr-3.4'' in the source distribution---this will download, patch, compile and install&lt;br /&gt;
libantlr3c into your cvc4 directory as ''cvc4/antlr-3.4/''.&lt;br /&gt;
  cd contrib&lt;br /&gt;
  ./get-antlr-3.4&lt;br /&gt;
&lt;br /&gt;
CVC4 must be configured with the antlr library installation directory, '''--with-antlr-dir''', and an antlr executable script file, '''ANTLR'''.  If libantlr3c was installed via get-antlr-3.4, the following configure line should suffice for CVC44&lt;br /&gt;
  ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3&lt;br /&gt;
&lt;br /&gt;
For 64 bit machines, libantlr3c needs to be configured with 64 bit explicitly&lt;br /&gt;
  ./configure --enable-64bit ...&lt;br /&gt;
The get-antlr-3.4 script makes a guess at whether the machine is 64 bit and adds the appropriate flag.&lt;br /&gt;
To force the script to compile 32 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86&amp;quot; ./get-antlr3.4&lt;br /&gt;
To force the script to compile 64 bit:&lt;br /&gt;
  MACHINE_TYPE=&amp;quot;x86_64&amp;quot; ./get-antlr3.4&lt;br /&gt;
&lt;br /&gt;
For a longer discussion, instructions for manual installation, and more in depth troubleshooting, see [[Developer's Guide#ANTLR3]].&lt;br /&gt;
&lt;br /&gt;
====MacPorts====&lt;br /&gt;
&lt;br /&gt;
On a Mac, it is '''highly''' recommended that you use MacPorts (see&lt;br /&gt;
http://www.macports.org/).  Doing so is easy.  Then, simply run the&lt;br /&gt;
script ''contrib/mac-build'', which installs a few ports from the MacPorts&lt;br /&gt;
repository, then compiles and installs antlr3c using the ''get-antlr-3.4''&lt;br /&gt;
script.  The mac-build script should set you up&lt;br /&gt;
with all requirements, and will tell you how to configure CVC4 when it&lt;br /&gt;
completes successfully.&lt;br /&gt;
&lt;br /&gt;
====Installing the Boost C++ base libraries====&lt;br /&gt;
&lt;br /&gt;
A Boost package is available on most Linux distributions; check yours&lt;br /&gt;
for a package named something like libboost-dev or boost-devel.  There&lt;br /&gt;
are a number of additional Boost packages in some distributions, but&lt;br /&gt;
this &amp;quot;basic&amp;quot; one should be sufficient for building CVC4.&lt;br /&gt;
&lt;br /&gt;
Should you want to install Boost manually, or to learn more about the&lt;br /&gt;
Boost project, please visit http://www.boost.org/.&lt;br /&gt;
&lt;br /&gt;
===Optional requirements===&lt;br /&gt;
&lt;br /&gt;
None of these is required, but can improve CVC4 as described below:&lt;br /&gt;
&lt;br /&gt;
*'''Optional: SWIG 2.0.x''' (Simplified Wrapper and Interface Generator)&lt;br /&gt;
*'''Optional: CLN v1.3 or newer''' (Class Library for Numbers)&lt;br /&gt;
*'''Optional: CUDD v2.4.2 or newer''' (Colorado University Decision Diagram package)&lt;br /&gt;
*'''Optional: GNU Readline library''' (for an improved interactive experience)&lt;br /&gt;
*'''Optional: The Boost C++ threading library''' (libboost_thread)&lt;br /&gt;
*'''Optional: CxxTest unit testing framework'''&lt;br /&gt;
&lt;br /&gt;
SWIG is necessary to build the Java API (and of course a JDK is&lt;br /&gt;
necessary, too).  SWIG 1.x won't work; you'll need 2.0, and the more&lt;br /&gt;
recent the better.  On Mac, we've seen SWIG segfault when generating&lt;br /&gt;
CVC4 language bindings; version 2.0.8 or higher is recommended to&lt;br /&gt;
avoid this.  See [[#Language_bindings|Language bindings]] below for build instructions.&lt;br /&gt;
&lt;br /&gt;
CLN is an alternative multiprecision arithmetic package that can offer&lt;br /&gt;
better performance and memory footprint than GMP.  CLN is covered by&lt;br /&gt;
the GNU General Public License, version 3; so if you choose to use&lt;br /&gt;
CVC4 with CLN support, you are licensing CVC4 under that same license.&lt;br /&gt;
(Usually CVC4's license is more permissive than GPL is; see the file&lt;br /&gt;
COPYING in the CVC4 source distribution for details.)  Please visit&lt;br /&gt;
http://www.ginac.de/CLN/ for more details about CLN.&lt;br /&gt;
&lt;br /&gt;
CUDD is a decision diagram package that changes the behavior of the&lt;br /&gt;
CVC4 arithmetic solver in some cases; it may or may not improve the&lt;br /&gt;
arithmetic solver's performance.  See [[#Building_with_CUDD_(optional)|below]] for instructions on&lt;br /&gt;
obtaining and building CUDD.&lt;br /&gt;
&lt;br /&gt;
The GNU Readline library is optionally used to provide command&lt;br /&gt;
editing, tab completion, and history functionality at the CVC prompt&lt;br /&gt;
(when running in interactive mode).  Check your distribution for a&lt;br /&gt;
package named &amp;quot;libreadline-dev&amp;quot; or &amp;quot;readline-devel&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
The Boost C++ threading library (often packaged independently of the&lt;br /&gt;
Boost base library) is needed to run CVC4 in &amp;quot;portfolio&amp;quot;&lt;br /&gt;
(multithreaded) mode.  Check your distribution for a package named&lt;br /&gt;
&amp;quot;libboost-thread-dev&amp;quot; or similar.&lt;br /&gt;
&lt;br /&gt;
CxxTest is necessary to run CVC4's unit tests (included with the&lt;br /&gt;
distribution).  Running these is not really required for users of&lt;br /&gt;
CVC4; &amp;quot;make check&amp;quot; will skip unit tests if CxxTest isn't available,&lt;br /&gt;
and go on to run the extensive system- and regression-tests in the&lt;br /&gt;
source tree.  However, if you're interested, you can download CxxTest&lt;br /&gt;
at http://cxxtest.com/ .&lt;br /&gt;
&lt;br /&gt;
====Building with CUDD (optional)====&lt;br /&gt;
&lt;br /&gt;
CUDD, if desired, must be installed delicately.  The CVC4 configure&lt;br /&gt;
script attempts to auto-detect the locations and names of CUDD headers&lt;br /&gt;
and libraries the way that the Fedora RPMs install them, the way that&lt;br /&gt;
our NYU-provided Debian packages install them, and the way they exist&lt;br /&gt;
when you download and build the CUDD sources directly.  If you install&lt;br /&gt;
from Fedora RPMs or our Debian packages, the process should be&lt;br /&gt;
completely automatic, since the libraries and headers are installed in&lt;br /&gt;
a standard location.  If you download the sources yourself, you need&lt;br /&gt;
to build them in a special way.  Fortunately, the&lt;br /&gt;
&amp;quot;contrib/build-cudd-2.4.2-with-libtool.sh&amp;quot; script in the CVC4 source&lt;br /&gt;
tree does exactly what you need: it patches the CUDD makefiles to use&lt;br /&gt;
libtool, builds the libtool libraries, then reverses the patch to&lt;br /&gt;
leave the makefiles as they were.  Once you run this script on an&lt;br /&gt;
unpacked CUDD 2.4.2 source distribution, then CVC4's configure script&lt;br /&gt;
should pick up the libraries if you provide&lt;br /&gt;
--with-cudd-dir=/PATH/TO/CUDD/SOURCES.&lt;br /&gt;
&lt;br /&gt;
If you want to force linking to CUDD, provide --with-cudd to the&lt;br /&gt;
configure script; this makes it a hard requirement rather than an&lt;br /&gt;
optional add-on.&lt;br /&gt;
&lt;br /&gt;
The NYU-provided Debian packaging of CUDD 2.4.2 and CUDD 2.5.0 are&lt;br /&gt;
here (along with the CVC4 Debian packages):&lt;br /&gt;
&lt;br /&gt;
  deb http://cvc4.cs.nyu.edu/debian/ unstable/&lt;br /&gt;
&lt;br /&gt;
On Debian (and Debian-derived distributions like Ubuntu), you only&lt;br /&gt;
need to drop that one line in your /etc/apt/sources.list file, then install with your favorite package manager.&lt;br /&gt;
&lt;br /&gt;
The Debian source package &amp;quot;cudd&amp;quot;, available from the same repository,&lt;br /&gt;
includes a diff of all changes made to cudd makefiles.&lt;br /&gt;
&lt;br /&gt;
===Language bindings===&lt;br /&gt;
&lt;br /&gt;
There are several options available for using CVC4 from the API.&lt;br /&gt;
&lt;br /&gt;
First, CVC4 offers a complete and flexible API for manipulating&lt;br /&gt;
expressions, maintaining a stack of assertions, and checking&lt;br /&gt;
satisfiability, and related things.  The C++ libraries (libcvc4.so and&lt;br /&gt;
libcvc4parser.so) and required headers are installed normally via a&lt;br /&gt;
&amp;quot;make install&amp;quot;.  This API is also available from Java (via CVC4.jar&lt;br /&gt;
and libcvc4jni.so) by configuring with --enable-language-bindings=java.&lt;br /&gt;
You'll also need SWIG 2.0 installed (and you might need to help&lt;br /&gt;
configure find it if you installed it in a nonstandard place with&lt;br /&gt;
--with-swig-dir=/path/to/swig/installation).  You may also need to&lt;br /&gt;
give the configure script the path to your Java headers (in&lt;br /&gt;
particular, jni.h).  You might do so with (for example):&lt;br /&gt;
&lt;br /&gt;
  ./configure --enable-language-bindings=java \&lt;br /&gt;
      JAVA_CPPFLAGS=-I/usr/lib/jvm/java-6-openjdk-amd64/include&lt;br /&gt;
&lt;br /&gt;
There is also a &amp;quot;C++ compatibility API&amp;quot; (''#include &amp;lt;cvc4/cvc3_compat.h&amp;gt;''&lt;br /&gt;
and link against libcvc4compat.so) that attempts to maintain&lt;br /&gt;
source-level backwards-compatibility with the CVC3 C++ API.  The&lt;br /&gt;
compatibility library is built by default, and&lt;br /&gt;
''--enable-language-bindings=java'' enables the Java compatibility library&lt;br /&gt;
(CVC4compat.jar and libcvc4compatjni.so).&lt;br /&gt;
''--enable-language-bindings=c'' enables the C compatibility library&lt;br /&gt;
(''#include &amp;lt;cvc4/bindings/compat/c/c_interface.h&amp;gt;'' and link against&lt;br /&gt;
libcvc4bindings_c_compat.so), and if you want both C and Java&lt;br /&gt;
bindings, use ''--enable-language-bindings=c,java''.  These compatibility&lt;br /&gt;
language bindings do NOT require SWIG.&lt;br /&gt;
&lt;br /&gt;
The ''examples/'' directory in the source distribution includes some basic examples (the &amp;quot;simple vc&amp;quot;&lt;br /&gt;
and &amp;quot;simple vc compat&amp;quot; family of examples) of all these interfaces.&lt;br /&gt;
&lt;br /&gt;
In principle, since we use SWIG to generate the native Java API, we&lt;br /&gt;
could support other languages as well.  However, using CVC4 from other&lt;br /&gt;
languages is not supported, nor expected to work, at this time.  If&lt;br /&gt;
you're interested in helping to develop, maintain, and test a language&lt;br /&gt;
binding, please contact us via the users' mailing list at&lt;br /&gt;
cvc-users@cs.nyu.edu.&lt;br /&gt;
&lt;br /&gt;
===Building CVC4 from a repository checkout===&lt;br /&gt;
&lt;br /&gt;
The following tools and libraries are additionally required to build&lt;br /&gt;
CVC4 from from a repository checkout rather than from a prepared&lt;br /&gt;
source tarball.&lt;br /&gt;
&lt;br /&gt;
*'''Automake v1.11'''&lt;br /&gt;
*'''Autoconf v2.61'''&lt;br /&gt;
*'''Libtool v2.2'''&lt;br /&gt;
*'''ANTLR3 v3.2 or v3.4'''&lt;br /&gt;
*'''Java Development Kit''' ([http://www.antlr.org/wiki/pages/viewpage.action?pageId=728 required for ANTLR3])&lt;br /&gt;
&lt;br /&gt;
First, use &amp;quot;''./autogen.sh''&amp;quot; to create the configure script.  Then&lt;br /&gt;
proceed as normal for any distribution tarball.  The parsers are&lt;br /&gt;
pre-generated for the tarballs, but don't exist in the repository; hence the extra ANTLR3 and JDK requirements to&lt;br /&gt;
generate the source code for the parsers, when building from the&lt;br /&gt;
repository.&lt;br /&gt;
&lt;br /&gt;
===Examples and tutorials are not built or installed===&lt;br /&gt;
&lt;br /&gt;
Examples are not built by &amp;quot;''make''&amp;quot; or &amp;quot;''make install''&amp;quot;.  See&lt;br /&gt;
''examples/README'' in the source distribution for information on what to find in the ''examples/''&lt;br /&gt;
directory, as well as information about building and installing them.&lt;br /&gt;
&lt;br /&gt;
===Appendix: Build architecture===&lt;br /&gt;
&lt;br /&gt;
The build system is generated by automake, libtool, and autoconf.  It&lt;br /&gt;
is somewhat nonstandard, though, which (for one thing) requires that&lt;br /&gt;
GNU Make be used.  If you ./configure in the top-level source&lt;br /&gt;
directory, the objects will actually all appear in&lt;br /&gt;
builds/${arch}/${build_id}.  This is to allow multiple, separate&lt;br /&gt;
builds in the same place (e.g., an assertions-enabled debugging build&lt;br /&gt;
alongside a production build), without changing directories at the&lt;br /&gt;
shell.  The &amp;quot;current&amp;quot; build is maintained, and you can still use&lt;br /&gt;
(e.g.) &amp;quot;make -C src/main&amp;quot; to rebuild objects in just one subdirectory.&lt;br /&gt;
&lt;br /&gt;
You can also create your own build directory inside or outside of the&lt;br /&gt;
source tree and configure from there.  All objects will then be built&lt;br /&gt;
in that directory, and you'll ultimately find the &amp;quot;cvc4&amp;quot; binary in&lt;br /&gt;
src/main/, and the libraries under src/ and src/parser/.&lt;br /&gt;
&lt;br /&gt;
=Using the CVC4 binary=&lt;br /&gt;
&lt;br /&gt;
The CVC4 driver binary (&amp;quot;cvc4&amp;quot;), once installed, can be executed directly to enter into interactive mode:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then enter commands into CVC4 interactively:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;incremental&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;produce-models&amp;quot;;&lt;br /&gt;
 CVC4&amp;gt; TRANSFORM 25*25;&lt;br /&gt;
 625&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above example shows two useful options, ''incremental'' and ''produce-models.''&lt;br /&gt;
&lt;br /&gt;
* The ''incremental'' option allows you to issue multiple QUERY (or CHECKSAT) commands, and allows the use of the PUSH and POP commands.  Without this option, CVC4 optimizes itself for a single QUERY or CHECKSAT command (though you may issue any number of ASSERT commands).  The ''incremental'' option may also be given by passing the ''-i'' command line option to CVC4.&lt;br /&gt;
* The ''produce-models'' option allows you to query the model (here, with the COUNTERMODEL command) after an &amp;quot;invalid&amp;quot; QUERY (or &amp;quot;satisfiable&amp;quot; CHECK-SAT).  Without it, CVC4 doesn't do the bookkeeping necessary to support model generation.  The ''produce-models'' option may also be given by passing the ''-m'' command line option to CVC4.&lt;br /&gt;
&lt;br /&gt;
So, if you invoke CVC4 with ''-im'', you don't need to pass those options at all:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -im&lt;br /&gt;
 cvc4 1.0 assertions:off&lt;br /&gt;
 CVC4&amp;gt; x, y : INT;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = -1;&lt;br /&gt;
 y : INT = 0;&lt;br /&gt;
 CVC4&amp;gt; ASSERT x &amp;gt;= 0;&lt;br /&gt;
 CVC4&amp;gt; QUERY x = y;&lt;br /&gt;
 invalid&lt;br /&gt;
 CVC4&amp;gt; COUNTERMODEL;&lt;br /&gt;
 x : INT = 0;&lt;br /&gt;
 y : INT = 1;&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, CVC4 operates in [[#CVC4's native input language|CVC-language mode]].  If you enter something that looks like SMT-LIB, it will suggest that you use the &amp;quot;''--lang smt''&amp;quot; command-line option for SMT-LIB mode:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (declare-fun x () Int)&lt;br /&gt;
 Parse Error: &amp;lt;shell&amp;gt;:1.7: In CVC4 presentation language mode, but SMT-LIB format detected.  Use --lang smt for SMT-LIB support.&lt;br /&gt;
 CVC4&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Verbosity==&lt;br /&gt;
&lt;br /&gt;
CVC4 has various levels of verbosity.  By default, CVC4 is pretty quiet, only reporting serious warnings and notices.  If you're curious about what it's doing, you can pass CVC4 the ''-v'' option:&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -v file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
For even more verbosity, you can pass CVC4 an ''additional'' ''-v'':&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 -vv file.smt2&lt;br /&gt;
 Invoking: (set-logic AUFLIRA)&lt;br /&gt;
 Invoking: (set-info :smt-lib-version 2.000000)&lt;br /&gt;
 Invoking: (set-info :category &amp;quot;crafted&amp;quot;)&lt;br /&gt;
 Invoking: (set-info :status unsat)&lt;br /&gt;
 Invoking: (declare-fun x () Real)&lt;br /&gt;
 ''etc...''&lt;br /&gt;
 expanding definitions...&lt;br /&gt;
 constraining subtypes...&lt;br /&gt;
 applying substitutions...&lt;br /&gt;
 simplifying assertions...&lt;br /&gt;
 doing static learning...&lt;br /&gt;
 ''etc...''&lt;br /&gt;
&lt;br /&gt;
Internally, verbosity is just an integer value.  It starts at 0, and with every ''-v'' on the command line it is incremented; with every ''-q'', decremented.  It can also be set directly.  From CVC language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; OPTION &amp;quot;verbosity&amp;quot; 2;&lt;br /&gt;
&lt;br /&gt;
Or from SMT-LIB language:&lt;br /&gt;
&lt;br /&gt;
 CVC4&amp;gt; (set-option :verbosity 2)&lt;br /&gt;
&lt;br /&gt;
==Getting statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with the ''--statistics'' command line option.&lt;br /&gt;
&lt;br /&gt;
 $ cvc4 --statistics foo.smt2&lt;br /&gt;
 sat&lt;br /&gt;
 sat::decisions, 0&lt;br /&gt;
 sat::propagations, 3&lt;br /&gt;
 sat::starts, 1&lt;br /&gt;
 theory::uf::TheoryUF::functionTermsCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::mergesCount, 2&lt;br /&gt;
 theory::uf::TheoryUF::termsCount, 6&lt;br /&gt;
 theory&amp;lt;THEORY_UF&amp;gt;::propagations, 1 &lt;br /&gt;
 driver::filename, foo.smt2&lt;br /&gt;
 driver::sat/unsat, sat&lt;br /&gt;
 driver::totalTime, 0.02015373&lt;br /&gt;
 ''[many others]''&lt;br /&gt;
&lt;br /&gt;
Many statistics name-value pairs follow, one comma-separated pair per line.&lt;br /&gt;
&lt;br /&gt;
==Exit status==&lt;br /&gt;
&lt;br /&gt;
The exit status of CVC4 depends on the ''last'' QUERY or CHECK-SAT.  If you wish to call CVC4 from a program (e.g., a shell script) and care only about the satisfiability or validity of a single formula, you can pass the ''-q'' option (as described [[#Verbosity|above, under verbosity]]) and check the exit code.  With ''-q'', CVC4 should not produce any output unless it encounters a fatal error.&lt;br /&gt;
&lt;br /&gt;
QUERY asks a validity question, and CHECK-SAT a satisfiability question, and these are dual problems; hence the terminology is different, but really &amp;quot;sat&amp;quot; and &amp;quot;invalid&amp;quot; are the same internally, as are &amp;quot;unsat&amp;quot; and &amp;quot;valid&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Solver's last result&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Exit code&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Notes&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''sat''' or '''invalid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;10&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unsat''' or '''valid'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;20&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;'''unknown'''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;could be for any reason: time limit exceeded, no memory, incompleteness..&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;''no result''&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;no query or check-sat command issued&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;parse errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;0 (in interactive mode)&amp;lt;br/&amp;gt;1 (otherwise)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;other errors&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;1 (usually)&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;see below&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most &amp;quot;normal errors&amp;quot; return a 1 as the exit code, but out of memory conditions, and others, can produce different exit codes.  In interactive mode, parse errors are ignored and the next line read; so in interactive mode, you may see an exit code of 0 even in the presence of such an error.&lt;br /&gt;
&lt;br /&gt;
In SMT-LIB mode, an SMT-LIB command script that sets its status via &amp;quot;set-info :status&amp;quot; also affects the exit code.  So, for instance, the following SMT-LIB script returns an exit code of 10 even though it contains no &amp;quot;check-sat&amp;quot; command:&lt;br /&gt;
&lt;br /&gt;
 (set-logic QF_UF)&lt;br /&gt;
 (set-info :status sat)&lt;br /&gt;
 (exit)&lt;br /&gt;
&lt;br /&gt;
Without the &amp;quot;set-info,&amp;quot; it would have returned an exit code of 0.&lt;br /&gt;
&lt;br /&gt;
=CVC4's native input language=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The native input language consists of a sequence of symbol declarations and commands, each followed by a semicolon (&amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Any text after the first occurrence of a percent character and to the end of the current line is a comment:&lt;br /&gt;
&lt;br /&gt;
 %%% This is a native language comment&lt;br /&gt;
&lt;br /&gt;
== Type System ==&lt;br /&gt;
&lt;br /&gt;
CVC4's type system includes a set of built-in types which can be expanded with additional user-defined types.&lt;br /&gt;
&lt;br /&gt;
The type system consists of ''first-order'' types, ''subtypes'' of first-order types, and ''higher-order'' types,  all of which are interpreted as sets. &lt;br /&gt;
For convenience, we will sometimes identify below the interpretation of a type with the type itself.&lt;br /&gt;
&lt;br /&gt;
First-order types consist of basic types and structured types. The basic types are &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; for all &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, as well as user-defined basic types (also called uninterpreted types). &lt;br /&gt;
The structured types are array, tuple, record types, and ML-style user-defined (inductive) datatypes.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Currently, subtypes consist only of the built-in subtype &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&amp;lt;!-- and are covered in the [[#Subtypes|Subtypes]] section. --&amp;gt;&lt;br /&gt;
Support for CVC3-style user-defined subtypes will be added in a later release.&lt;br /&gt;
&lt;br /&gt;
Function types are the only higher-order types.&lt;br /&gt;
More precisely, they are just second-order types &lt;br /&gt;
since function symbols in CVC4, both built-in and user-defined, can take as argument or return only values of &lt;br /&gt;
a first-order type.&lt;br /&gt;
&lt;br /&gt;
=== Basic Types ===&lt;br /&gt;
&lt;br /&gt;
==== The BOOLEAN Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; type is interpreted as the two-element set of Boolean values&lt;br /&gt;
&amp;lt;math&amp;gt;\{\mathrm{TRUE},\; \mathrm{FALSE}\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
'''Note:''' CVC4's treatment of this type differs from CVC3's where &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; is used only as the type of formulas, but not as value type. CVC3 follows the two-tiered structure of classical first-order logic &lt;br /&gt;
which distinguishes between formulas and terms, and allows terms to occur in formulas but not vice versa (with the exception of the IF-THEN-ELSE construct).&lt;br /&gt;
CVC4 drops the distinction between terms and formulas and defines the latter just as terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. As such, formulas can occur as subterms of possibly non-Boolean terms.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
 [To do]&lt;br /&gt;
&lt;br /&gt;
==== The REAL Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; type is interpreted as the set of real numbers.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical reals,&lt;br /&gt;
not the floating point numbers.&lt;br /&gt;
Support for floating point types is planned for future versions.&lt;br /&gt;
&lt;br /&gt;
 x, y : REAL;&lt;br /&gt;
 QUERY (( x &amp;lt;= y ) AND ( y &amp;lt;= x )) =&amp;gt; ( x = y );&lt;br /&gt;
&lt;br /&gt;
==== The INT Type ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math&amp;gt;\mathrm{INT}&amp;lt;/math&amp;gt; type is interpreted as the set of integer numbers&lt;br /&gt;
and is considered as a subtype of &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;.&lt;br /&gt;
The latter means in particular that it is possible to mix integer and real terms &lt;br /&gt;
in expressions without the need of an explicit ''upcasting'' operator.&lt;br /&gt;
&lt;br /&gt;
Note that these are the (infinite precision) mathematical integers,&lt;br /&gt;
not the finite precision machine integers used in most programming languages. &lt;br /&gt;
The latter are models by [[ #Bitvectors | bit vector ]] types.&lt;br /&gt;
&lt;br /&gt;
 x, y : INT;&lt;br /&gt;
 QUERY ((2 * x + 4 * y &amp;lt;= 1) AND ( y &amp;gt;= x)) =&amp;gt; (x &amp;lt;= 0);&lt;br /&gt;
 z : REAL;&lt;br /&gt;
 QUERY (2 * x + z &amp;lt;= 3.5) AND (z &amp;gt;= 1);&lt;br /&gt;
&lt;br /&gt;
==== Bit Vector Types ====&lt;br /&gt;
&lt;br /&gt;
For every positive integer &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;, the type &amp;lt;math&amp;gt;\mathrm{BITVECTOR}(n)&amp;lt;/math&amp;gt; is interpreted as the set of all bit vectors of size &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
A rich set of bit vector operators is supported.&lt;br /&gt;
&lt;br /&gt;
==== User-defined Basic Types ====&lt;br /&gt;
&lt;br /&gt;
Users can define new basic types &lt;br /&gt;
(often referred to as ''uninterpreted'' types in the SMT literature).&lt;br /&gt;
Each such type is interpreted as a set of unspecified cardinality &lt;br /&gt;
but disjoint from any other type. &lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
 Can we specify cardinalities? &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
User-defined basic types are created by declarations like the following:&lt;br /&gt;
&lt;br /&gt;
 % User declarations of basic types:&lt;br /&gt;
 &lt;br /&gt;
 MyBrandNewType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 Apples, Oranges: TYPE;&lt;br /&gt;
&lt;br /&gt;
=== Structured Types ===&lt;br /&gt;
&lt;br /&gt;
CVC4's structured types are divided in the following families. &lt;br /&gt;
&lt;br /&gt;
==== Array Types ====&lt;br /&gt;
&lt;br /&gt;
Array types are created by the mixfix type constructors &amp;lt;math&amp;gt;\mathrm{ARRAY}\ \_\ \mathrm{OF}\ \_&amp;lt;/math&amp;gt; &lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 I : TYPE;&lt;br /&gt;
 &lt;br /&gt;
 %% Array types:&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with indices from I and values from REAL&lt;br /&gt;
 Array1: TYPE = ARRAY I OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer indices and array values &lt;br /&gt;
 Array2: TYPE = ARRAY INT OF (ARRAY INT OF REAL);&lt;br /&gt;
 &lt;br /&gt;
 % Arrays with integer pair indices and integer values&lt;br /&gt;
 IntMatrix: TYPE = ARRAY [INT, INT] OF INT;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
An array type of the form &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1\ \mathrm{OF}\ T_2&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the set of all total maps from &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;. &lt;br /&gt;
The main difference with the function type &amp;lt;math&amp;gt;T_1 \to T_2&amp;lt;/math&amp;gt; is that arrays, &lt;br /&gt;
contrary to functions, are first-class objects of the language, that is, values of an array&lt;br /&gt;
type can be arguments or results of functions. &lt;br /&gt;
Furthermore, array types come equipped with an update operation.&lt;br /&gt;
&lt;br /&gt;
==== Tuple Types ====&lt;br /&gt;
&lt;br /&gt;
Tuple types are created by the mixfix type constructors&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l} [\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ ] \\[1ex] [\ \_\ ,\ \_\ \ ,\ \_\ ] \\[1ex] \ldots \end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
whose arguments can be instantiated by any value type.&lt;br /&gt;
&lt;br /&gt;
 IntArray: TYPE = ARRAY INT OF INT;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple type declarations&lt;br /&gt;
 &lt;br /&gt;
 RealPair: TYPE = [REAL, REAL]&lt;br /&gt;
 &lt;br /&gt;
 MyTuple: TYPE = [ REAL, IntArray, [INT, INT] ];&lt;br /&gt;
&lt;br /&gt;
A tuple type of the form &amp;lt;math&amp;gt;[T_1, \ldots, T_n]&amp;lt;/math&amp;gt; is interpreted &lt;br /&gt;
as the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Note that while the types &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and &lt;br /&gt;
&amp;lt;math&amp;gt;[T_1 \times \cdots \times T_n] \to T&amp;lt;/math&amp;gt; are semantically equivalent, &lt;br /&gt;
they are operationally different in CVC4. &lt;br /&gt;
The first is the type of functions that take &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; arguments &lt;br /&gt;
of respective type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\ldots&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;T_n&amp;lt;/math&amp;gt;, &lt;br /&gt;
while the second is the type of functions that take one argument of an &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;-tuple type.&lt;br /&gt;
&lt;br /&gt;
==== Record Types ====&lt;br /&gt;
&lt;br /&gt;
Similar to, but more general than tuple types, record types are created by type constructors of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
[\#\ l_1: \_\ ,\ \ldots\ ,\ l_n: \_\ \#]&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;l_1,\ldots, l_n&amp;lt;/math&amp;gt; are field labels, &lt;br /&gt;
and the arguments can be instantiated with any first-order types.&lt;br /&gt;
&lt;br /&gt;
 MyType: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 % Record declaration&lt;br /&gt;
 &lt;br /&gt;
 RecordType: TYPE = [# id: REAL, age: INT, info: MyType #];&lt;br /&gt;
&lt;br /&gt;
The order of the fields in a record type is meaningful: &lt;br /&gt;
permuting the field names gives a different type. &lt;br /&gt;
&lt;br /&gt;
Note that record types are non-recursive. &lt;br /&gt;
For instance, it is not possible to declare a record type called &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt; containing &lt;br /&gt;
a field of type &amp;lt;code&amp;gt;Person&amp;lt;/code&amp;gt;. &lt;br /&gt;
Recursive types are provided in CVC4 by the more general inductive data types.&lt;br /&gt;
(As a matter of fact, both record and tuple types are implemented internally as inductive data types.)&lt;br /&gt;
&lt;br /&gt;
==== Inductive Data Types ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Inductive data types in CVC4 are similar to inductive data types of functional languages.&lt;br /&gt;
They can be parametric or not.&lt;br /&gt;
&lt;br /&gt;
===== Non-Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Non-parametric data types are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE} \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1 &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2 &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
Such declarations define the data types &amp;lt;math&amp;gt;A_1, \ldots, A_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
For each data type &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; they introduce:&lt;br /&gt;
&lt;br /&gt;
* constructor symbols &amp;lt;math&amp;gt;cons&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;(T_1, \ldots, T_k) \to \mathit{type\_name}_i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* selector symbols &amp;lt;math&amp;gt;\mathit{sel}_j&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to T_j&amp;lt;/math&amp;gt;, and&lt;br /&gt;
* tester symbols &amp;lt;math&amp;gt;\mathit{is\_cons}&amp;lt;/math&amp;gt; of type &amp;lt;math&amp;gt;\mathit{type\_name}_i \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that permitting more than one data type to be defined in the same declarations allows &lt;br /&gt;
the definition of mutually recursive types.&lt;br /&gt;
&lt;br /&gt;
 % simple enumeration type&lt;br /&gt;
 &lt;br /&gt;
 % implicitly defined are the testers: is_red, is_yellow and is_blue&lt;br /&gt;
 % (similarly for the other data types)&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   PrimaryColor = red | yellow | blue&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % infinite set of pairwise distinct values ..., v(-1), v(0), v(1), ...&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Id = v (id: INT)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % ML-style integer lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   IntList = nil | ins (head: INT, tail: IntList)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % AST for lamba calculus&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Term = var (index: INT)&lt;br /&gt;
        | apply (arg_1: Term, arg_2: Term)&lt;br /&gt;
        | lambda (arg: INT, body: Term)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Trees&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   Tree = tree (value: REAL, children: TreeList),&lt;br /&gt;
   TreeList = nil_tl&lt;br /&gt;
            | ins_tl (first_t1: Tree, rest_t1: TreeList)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
Constructor, selector and tester symbols defined for a data type have global scope. &lt;br /&gt;
So, for example, it is not possible for two different data types to use &lt;br /&gt;
the same name for a constructor.&lt;br /&gt;
&lt;br /&gt;
An inductive data type is interpreted as a term algebra constructed by the constructor symbols &lt;br /&gt;
over some sets of generators. &lt;br /&gt;
For example, the type &amp;lt;code&amp;gt;IntList&amp;lt;/code&amp;gt; defined above is interpreted as the set &lt;br /&gt;
of all terms constructed with &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ins&amp;lt;/code&amp;gt; over the integers.&lt;br /&gt;
&lt;br /&gt;
===== Parametric Data Types =====&lt;br /&gt;
&lt;br /&gt;
Parametric data types are infinite families of (non-parametric) data types &lt;br /&gt;
with each family parametrized by one or more type variables.&lt;br /&gt;
They are created by declarations of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\mathrm{DATATYPE}  \\&lt;br /&gt;
\begin{array}{ccc} &lt;br /&gt;
 \ \ A_1[X_{1,1}, \ldots, X_{1,p_1}] &amp;amp; = &amp;amp; C_{1,1} \mid C_{1,2} \mid \cdots \mid C_{1,m_1}, \\&lt;br /&gt;
 \ \ A_2[X_{2,1}, \ldots, X_{2,p_2}] &amp;amp; = &amp;amp; C_{2,1} \mid C_{2,2} \mid \cdots \mid C_{2,m_2}, \\&lt;br /&gt;
 \ \ \vdots &amp;amp; = &amp;amp; \vdots \\&lt;br /&gt;
 \ \ A_n[X_{n,1}, \ldots, X_{n,p_n}] &amp;amp; = &amp;amp; C_{n,1} \mid C_{n,2} \mid \cdots \mid C_{n,m_n} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\\&lt;br /&gt;
\mathrm{END}; &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
each &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt; is a type name parametrized by the type variables &amp;lt;math&amp;gt;X_{i,1}, \ldots, X_{i,p_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
each &amp;lt;math&amp;gt;C_{ij}&amp;lt;/math&amp;gt; is either a constant symbol or an expression of the form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\mathit{cons}(\ \mathit{sel}_1: T_1,\ \ldots,\ \mathit{sel}_k: T_k\ )&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;T_1, \ldots, T_k&amp;lt;/math&amp;gt; are any first-order types, &lt;br /&gt;
possibly parametrized by &amp;lt;math&amp;gt;X_1, \ldots, X_p&amp;lt;/math&amp;gt;, including any &amp;lt;math&amp;gt;A_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 % Parametric pairs&lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Pair[X, Y] = pair (first: X, second: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 % Parametric lists&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 % Parametric trees using the list type above&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   Tree[X] = node (value: X, children: List[Tree[X]]),&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
The declarations above define infinitely many types of the form &lt;br /&gt;
Pair[S,T], List[T] and Tree[T] where S and T are first-order types.&lt;br /&gt;
Note that the identifier &amp;lt;code&amp;gt;List&amp;lt;/code&amp;gt; above, for example, by itself does not denote a type.&lt;br /&gt;
In contrast, the terms &amp;lt;code&amp;gt;List[Real]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[List[Real]]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;List[Tree[INT]]&amp;lt;/code&amp;gt;,&lt;br /&gt;
and so on do.&lt;br /&gt;
&lt;br /&gt;
===== Restriction to Inductive Types =====&lt;br /&gt;
&lt;br /&gt;
By adopting a term algebra semantics, CVC4 allows only ''inductive'' data types, &lt;br /&gt;
that is, data types whose values are essentially (labeled, ordered) finite trees. &lt;br /&gt;
Infinite structures such as streams or even finite but cyclic ones &lt;br /&gt;
such as circular lists are then excluded. &lt;br /&gt;
For instance, none of the following declarations define inductive data types, &lt;br /&gt;
and are rejected by CVC4:&lt;br /&gt;
&lt;br /&gt;
 DATATYPE&lt;br /&gt;
  IntStream = s (first:INT, rest: IntStream)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
  RationalTree = node1 (child: RationalTree)&lt;br /&gt;
               | node2 (left_child: RationalTree, right_child:RationalTree)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE&lt;br /&gt;
   T1 =  c1 (s1: T2),&lt;br /&gt;
   T2 =  c2 (s2: T1)&lt;br /&gt;
 END;&lt;br /&gt;
&lt;br /&gt;
In concrete, a declaration of &amp;lt;math&amp;gt;n \geq 1&amp;lt;/math&amp;gt; datatypes &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; will be rejected if for any one of the types &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;, it is impossible to build a finite term of that type using only the constructors of &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; and free constants of type other than &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Inductive data types are the only types where the user also chooses names for the built-in operations to:&lt;br /&gt;
&lt;br /&gt;
* construct a value of the type (with the constructors),&lt;br /&gt;
* extract components from a value (with the selectors), or&lt;br /&gt;
* check if a value was constructed with a certain constructor or not (with the testers).&lt;br /&gt;
&lt;br /&gt;
For all the other types, CVC4 provides predefined names for the built-in operations on the type.&lt;br /&gt;
&lt;br /&gt;
=== Function Types ===&lt;br /&gt;
&lt;br /&gt;
Function (&amp;lt;math&amp;gt;\to&amp;lt;/math&amp;gt;) types are created by the mixfix type constructors&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
\_ \to \_ \\[1ex] (\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] (\ \_\ ,\ \_\ ,\ \_\ ) \to \_ &lt;br /&gt;
\\[1ex] \ldots &lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
whose arguments can be instantiated by any first-order type.&lt;br /&gt;
&lt;br /&gt;
 % Function type declarations&lt;br /&gt;
 &lt;br /&gt;
 UnaryFunType: TYPE = INT -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 BinaryFunType: TYPE = (REAL, REAL) -&amp;gt; ARRAY REAL OF REAL;&lt;br /&gt;
 &lt;br /&gt;
 TernaryFunType: TYPE = (REAL, BITVECTOR(4), INT) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
A function type of the form &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; is interpreted as the set of all ''total'' functions from the Cartesian product &amp;lt;math&amp;gt;T_1 \times \cdots \times T_n&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The example above also shows how to introduce type names. &lt;br /&gt;
A name like &amp;lt;code&amp;gt;UnaryFunType&amp;lt;/code&amp;gt; above is just an abbreviation for the type &amp;lt;math&amp;gt;\mathrm{INT} \to \mathrm{REAL}&amp;lt;/math&amp;gt; and can be used interchangeably with it.&lt;br /&gt;
&lt;br /&gt;
In general, any type defined by a type expression &amp;lt;code&amp;gt;E&amp;lt;/code&amp;gt; can be given a name with the declaration:&lt;br /&gt;
&lt;br /&gt;
 name : TYPE = E;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Type Checking ===&lt;br /&gt;
&lt;br /&gt;
In CVC4, formulas and terms are statically typed at the level of types &lt;br /&gt;
(as opposed to subtypes) according to the usual rules of first-order many-sorted logic,&lt;br /&gt;
with the main difference that formulas are just terms of type &amp;lt;math&amp;gt;BOOLEAN&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* each variable has one associated first-order type,&lt;br /&gt;
* each constant symbol has one or more associated first-order types,&lt;br /&gt;
* each function symbol has one or more associated function types,&lt;br /&gt;
* the type of a term consisting just of a variable is the type associated to that variable,&lt;br /&gt;
* the type of a term consisting just of a constant symbol is the type associated to that constant symbol,&lt;br /&gt;
* the term obtained by applying a function symbol &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; to the terms &amp;lt;math&amp;gt;t_1, \ldots, t_n&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; if &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;(T_1, \ldots, T_n) \to T&amp;lt;/math&amp;gt; and each &amp;lt;math&amp;gt;t_i&amp;lt;/math&amp;gt; has type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Attempting to enter an ill-typed term will result in an error.&lt;br /&gt;
&lt;br /&gt;
Another significant difference with standard many-sorted logic is that &lt;br /&gt;
some built-in symbols are parametrically polymorphic. &lt;br /&gt;
For instance, the function symbol for extracting the element of any array has &lt;br /&gt;
type &amp;lt;math&amp;gt;(\mathit{ARRAY}\ T_1\ \mathit{OF}\ T_2,\; T_1) \to T_2&amp;lt;/math&amp;gt; &lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1, T_2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Type Ascription ====&lt;br /&gt;
&lt;br /&gt;
By the type inference rules above some terms might have more than one type.&lt;br /&gt;
This can happen with terms built with polymorphic data type constructors&lt;br /&gt;
that have more than one return type for the same input type.&lt;br /&gt;
In that case, a type ascription operator (&amp;lt;code&amp;gt;::&amp;lt;/code&amp;gt;) must be applied &lt;br /&gt;
to the constructor to specify the intended return type.&lt;br /&gt;
&lt;br /&gt;
 DATATYPE [X]&lt;br /&gt;
   List[X] = nil | cons (head: X, tail: List[X])&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = cons(1, nil::List[REAL]);&lt;br /&gt;
 &lt;br /&gt;
 DATATYPE [X, Y]&lt;br /&gt;
   Union[X, Y] = left(val_l: X) | right(val_r: Y)&lt;br /&gt;
 END;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT y = left::Union[BOOLEAN, REAL](TRUE);&lt;br /&gt;
&lt;br /&gt;
The constant symbol &amp;lt;math&amp;gt;\mathrm{nil}&amp;lt;/math&amp;gt; declared above has infinitely many types &lt;br /&gt;
(&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{REAL}]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{List}[\mathrm{BOOLEAN}]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[[\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{List}[\mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;, ...)&lt;br /&gt;
CVC4's type checker requires the user to indicate explicitly the type &lt;br /&gt;
of each occurrence of &amp;lt;code&amp;gt;nil&amp;lt;/code&amp;gt; in a term. &lt;br /&gt;
Similarly, &lt;br /&gt;
the injection operator &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; has infinitely many return types &lt;br /&gt;
for the same input type, for instance:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{REAL}]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, [\mathrm{REAL}, \mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{BOOLEAN} \to \mathrm{Union}[\mathrm{BOOLEAN}, \mathrm{List}[\mathrm{REAL}]]&amp;lt;/math&amp;gt;,&lt;br /&gt;
and so on.&lt;br /&gt;
Applications of &amp;lt;code&amp;gt;left&amp;lt;/code&amp;gt; need to specify the intended returned typed, as shown above.&lt;br /&gt;
&lt;br /&gt;
== Terms and Formulas ==&lt;br /&gt;
&lt;br /&gt;
In addition to type expressions, CVC4 has expressions for terms and for formulas &lt;br /&gt;
(i.e., terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;). &lt;br /&gt;
By and large, these are standard first-order terms built out of typed variables, &lt;br /&gt;
predefined theory-specific operators, free (i.e., user-defined) function symbols, &lt;br /&gt;
and quantifiers. &lt;br /&gt;
Extensions include an if-then-else operator, lambda abstractions, and local symbol &lt;br /&gt;
declarations, as illustrated below. &lt;br /&gt;
Note that these extensions still keep CVC4's language first-order. &lt;br /&gt;
In particular, lambda abstractions are restricted to take and return only terms of &lt;br /&gt;
a first-order type. &lt;br /&gt;
Similarly, variables can only be of a first-order type.&lt;br /&gt;
&lt;br /&gt;
A number of built-in function symbols (for instance, the arithmetic ones) are used &lt;br /&gt;
as infix operators. All user-defined symbols are used as prefix ones.&lt;br /&gt;
&lt;br /&gt;
User-defined, i.e., free, function symbols include ''constant symbols'' and &lt;br /&gt;
''predicate symbols'', respectively  nullary function symbols and function symbols &lt;br /&gt;
with a &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; return type. &lt;br /&gt;
These symbols are introduced with global declarations of the form &lt;br /&gt;
&amp;lt;math&amp;gt; f_1, \ldots, f_m: T;&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;f_i&amp;lt;/math&amp;gt; are the names of the symbols and &lt;br /&gt;
&amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; is their type:&lt;br /&gt;
&lt;br /&gt;
 % integer constants&lt;br /&gt;
 &lt;br /&gt;
 a, b, c: INT;&lt;br /&gt;
 &lt;br /&gt;
 % real constants&lt;br /&gt;
 &lt;br /&gt;
 x, y, z: REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function&lt;br /&gt;
 &lt;br /&gt;
 f1: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % binary function&lt;br /&gt;
 &lt;br /&gt;
 f2: (REAL, INT) -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % unary function with a tuple argument&lt;br /&gt;
 &lt;br /&gt;
 f3: [INT, REAL] -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % binary predicate&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, REAL) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 % Propositional &amp;quot;variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 P, Q; BOOLEAN;&lt;br /&gt;
&lt;br /&gt;
Like type declarations, function symbol declarations like the above have global scope &lt;br /&gt;
and must be unique. &lt;br /&gt;
In other words, it is not possible to declare a function symbol globally more than once&lt;br /&gt;
in the same lexical scope. &lt;br /&gt;
This entails among other things that globally-defined free symbols cannot be overloaded &lt;br /&gt;
with different types and that theory symbols cannot be redeclared globally as free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Global symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
As with types, a function symbol can be defined as the name of another term &lt;br /&gt;
of the corresponding type. &lt;br /&gt;
With constant symbols, this is done with a declaration of the form &amp;lt;math&amp;gt;f:T = t;&amp;lt;/math&amp;gt; :&lt;br /&gt;
&lt;br /&gt;
 c: INT;&lt;br /&gt;
 &lt;br /&gt;
 i: INT = 5 + 3*c;  % i is effectively a shorthand for 5 + 3*c&lt;br /&gt;
 &lt;br /&gt;
 j: REAL = 3/4;&lt;br /&gt;
 &lt;br /&gt;
 t: [REAL, INT] = (2/3, -4);&lt;br /&gt;
 &lt;br /&gt;
 r: [# key: INT, value: REAL #] = (# key := 4, value := (c + 1)/2 #);&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN = FORALL (x:INT): x &amp;lt;= 0 OR x &amp;gt; c ;&lt;br /&gt;
&lt;br /&gt;
A restriction on constants of type &amp;lt;math&amp;gt;\mathit{BOOLEAN}&amp;lt;/math&amp;gt; is that their value &lt;br /&gt;
can only be a closed formula, that is, a formula with no free variables.&lt;br /&gt;
&lt;br /&gt;
A term and its name can be used interchangeably in later expressions. &lt;br /&gt;
Named terms are often useful for shared subterms (terms used several times in different places) &lt;br /&gt;
since their use can make the input exponentially more concise. &lt;br /&gt;
Named terms are processed very efficiently by CVC4. &lt;br /&gt;
It is much more efficient to associate a complex term with a name directly rather than &lt;br /&gt;
to declare a constant and later assert that it is equal to the same term. &lt;br /&gt;
This point is explained in more detail later in section [[Commands | Commands]].&lt;br /&gt;
&lt;br /&gt;
More generally, in CVC4 one can associate a term to function symbols of any arity. &lt;br /&gt;
For non-constant function symbols this is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;f:(T_1, \ldots, T_n) \to T = \mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t\;;&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is any term of type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; with free variables &lt;br /&gt;
in &amp;lt;math&amp;gt;\{x_1, \ldots, x_n\}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The lambda binder has the usual semantics and conforms to the usual lexical scoping rules: &lt;br /&gt;
within the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; the declaration of the symbols &amp;lt;math&amp;gt;x_1, \ldots, x_n&amp;lt;/math&amp;gt; &lt;br /&gt;
as local variables of respective type &amp;lt;math&amp;gt;T_1, \ldots, T_n&amp;lt;/math&amp;gt; hides any previous&lt;br /&gt;
declarations of those symbols that are in scope.&lt;br /&gt;
&lt;br /&gt;
As a general shorthand, when &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; consecutive types &lt;br /&gt;
&amp;lt;math&amp;gt;T_i, \ldots, T_{i+k-1}&amp;lt;/math&amp;gt;  in the lambda expression &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x:T_n): t&amp;lt;/math&amp;gt; are identical, the syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{LAMBDA}(x_1:T_1, \ldots, x_i,\ldots, x_{i+k-1}:T_i,\ldots, x:T_n): t&amp;lt;/math&amp;gt;&lt;br /&gt;
can also be used.&lt;br /&gt;
&lt;br /&gt;
 % Global declaration of x as a unary function symbol&lt;br /&gt;
 &lt;br /&gt;
 x: REAL -&amp;gt; REAL;&lt;br /&gt;
 &lt;br /&gt;
 % Local declarations of x as variable (hiding the global one)&lt;br /&gt;
 &lt;br /&gt;
 f: REAL -&amp;gt; REAL = LAMBDA (x: REAL): 2*x + 3;&lt;br /&gt;
 &lt;br /&gt;
 p: (INT, INT) -&amp;gt; BOOLEAN = LAMBDA (x,i: INT): i*x - 1 &amp;gt; 0;&lt;br /&gt;
 &lt;br /&gt;
 g: (REAL, INT) -&amp;gt; [REAL, INT] = LAMBDA (x: REAL, i:INT): (x + 1, i - 3);&lt;br /&gt;
&lt;br /&gt;
Note that lambda definitions are not recursive: &lt;br /&gt;
the symbol being defined cannot occur in the body of the lambda term.&lt;br /&gt;
They should be understood as macros.&lt;br /&gt;
For instance, any occurrence of the term &amp;lt;math&amp;gt;f(t)&amp;lt;/math&amp;gt; &lt;br /&gt;
where &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt; is as defined above will be treated &lt;br /&gt;
as if it was the term &amp;lt;math&amp;gt;(2*t + 3)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Local symbol definitions ===&lt;br /&gt;
&lt;br /&gt;
Constant and function symbols can also be declared locally anywhere within a term &lt;br /&gt;
by means of a let binder. &lt;br /&gt;
This is done with a declaration of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f = t \ \mathrm{IN}\ t' ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; is a term with no free variables, possibly a lambda term.&lt;br /&gt;
Let binders can be nested arbitrarily and follow the usual lexical scoping rules.&lt;br /&gt;
The following general form&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1, f_2 = t_2, \ldots, f_n = t_m \ \mathrm{IN}\ t ; &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
can be use above can used as a shorthand for&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \mathrm{LET}\ f_1 = t_1\ \mathrm{IN}\ &lt;br /&gt;
 \mathrm{LET}\ f_2 = t_2\ \mathrm{IN}\ &lt;br /&gt;
 \ldots \ &lt;br /&gt;
 \mathrm{LET}\ f_n = t_m \ \mathrm{IN}\ t ;&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL =&lt;br /&gt;
   LET x1 = 42,&lt;br /&gt;
       g = LAMBDA(x:INT): x + 1,&lt;br /&gt;
       x2 = 2*x1 + 7/2&lt;br /&gt;
   IN&lt;br /&gt;
      (LET x3 = g(x1) IN x3 + x2) / x1;&lt;br /&gt;
&lt;br /&gt;
Note that the same symbol = is used, unambiguously, in the syntax of global declarations, &lt;br /&gt;
let declarations, and as a predicate symbol.&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
A &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; term with a multiple symbols defines them sequentially.&lt;br /&gt;
A parallel version of the &amp;lt;math&amp;gt;\mathrm{LET}&amp;lt;/math&amp;gt; construct will be introduced in a later version.&lt;br /&gt;
&lt;br /&gt;
== Built-in theories and their symbols ==&lt;br /&gt;
&lt;br /&gt;
In addition to user-defined symbols, CVC4 terms can use a number of predefined symbols: &lt;br /&gt;
the logical symbols, such as &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, etc., &lt;br /&gt;
as well as theory symbols, function symbols belonging to one of the built-in theories. &lt;br /&gt;
They are described next, with the theory symbols grouped by theory.&lt;br /&gt;
&lt;br /&gt;
=== Logical Symbols ===&lt;br /&gt;
&lt;br /&gt;
The logical symbols in CVC4's language include &lt;br /&gt;
the equality and disequality predicate symbols, respectively written as = and /=, &lt;br /&gt;
the multiarity disequality symbol &amp;lt;math&amp;gt;\mathrm{DISTINCT}&amp;lt;/math&amp;gt;, &lt;br /&gt;
together with the logical constants &amp;lt;math&amp;gt;\mathrm{TRUE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{FALSE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
the connectives &amp;lt;math&amp;gt;\mathrm{NOT}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{AND}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{OR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{XOR}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt;, and &lt;br /&gt;
the first-order quantifiers &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt;, &lt;br /&gt;
all with the standard many-sorted logic semantics.&lt;br /&gt;
&lt;br /&gt;
The binary connectives have infix syntax and type &lt;br /&gt;
&amp;lt;math&amp;gt;(\mathrm{BOOLEAN},\mathrm{BOOLEAN}) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt;. &lt;br /&gt;
The symbols = and /=, which are also infix, are instead parametrically polymorphic, &lt;br /&gt;
having type &amp;lt;math&amp;gt;(T,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
They are interpreted respectively as the identity relation and its complement.&lt;br /&gt;
&lt;br /&gt;
The DISTINCT symbol is both overloaded and polymorphic. &lt;br /&gt;
It has type &amp;lt;math&amp;gt;(T,...,T) \to \mathrm{BOOLEAN}&amp;lt;/math&amp;gt; &lt;br /&gt;
for every sequence &amp;lt;math&amp;gt;(T,...,T)&amp;lt;/math&amp;gt; of length &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt; &lt;br /&gt;
and first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
For each &amp;lt;math&amp;gt;n &amp;gt; 0&amp;lt;/math&amp;gt;, it is interpreted as the relation &lt;br /&gt;
that holds exactly for tuples of pairwise distinct elements.&lt;br /&gt;
&lt;br /&gt;
The syntax for quantifiers is similar to that of the lambda binder.&lt;br /&gt;
&lt;br /&gt;
Here is an example of a formula built just of these logical symbols and variables:&lt;br /&gt;
&lt;br /&gt;
 A, B: TYPE;&lt;br /&gt;
 &lt;br /&gt;
 q: BOOLEAN = FORALL (x,y: A, i,j,k: B): &lt;br /&gt;
                i = j AND i /= k =&amp;gt; EXISTS (z: A): x /= z OR z /= y;&lt;br /&gt;
&lt;br /&gt;
Binding and scoping of quantified variables follows the same rules as &lt;br /&gt;
in let expressions. &lt;br /&gt;
In particular, a quantifier will shadow in its scope any constant and function symbols&lt;br /&gt;
with the same name as one of the variables it quantifies:&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 i, j: INT;&lt;br /&gt;
 &lt;br /&gt;
 % The first occurrence of i and of j in f are constant symbols,&lt;br /&gt;
 % the others are variables.&lt;br /&gt;
 &lt;br /&gt;
 f: BOOLEAN =  i = j AND FORALL (i,j: A): i = j OR i /= j;&lt;br /&gt;
&lt;br /&gt;
Optionally, it is also possible to specify instantiation patterns &lt;br /&gt;
for quantified variables. &lt;br /&gt;
The general syntax for a quantified formula &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; with patterns is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
Q\;(x_1:T_1, \ldots, x_k:T_k):\; p_1: \ldots\; p_n:\; \varphi&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; is &lt;br /&gt;
either &amp;lt;math&amp;gt;\mathrm{FORALL}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\mathrm{EXISTS}&amp;lt;/math&amp;gt;, &lt;br /&gt;
&amp;lt;math&amp;gt;\varphi&amp;lt;/math&amp;gt; is a term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;, &lt;br /&gt;
and each of the &amp;lt;math&amp;gt;p_i&amp;lt;/math&amp;gt;'s, &lt;br /&gt;
a pattern for the quantifier &amp;lt;math&amp;gt;Q\;(x_1:T_1, \ldots, x_k:T_k)&amp;lt;/math&amp;gt;, has the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{PATTERN}\; (t_1, \ldots, t_m)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;m &amp;gt; 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;t_1, \ldots, t_m&amp;lt;/math&amp;gt; are &lt;br /&gt;
arbitrary binder-free terms (no lets, no quantifiers). &lt;br /&gt;
Those terms can contain (free) variables, typically, but not exclusively, &lt;br /&gt;
drawn from &amp;lt;math&amp;gt;x_1, \ldots, x_k&amp;lt;/math&amp;gt;. &lt;br /&gt;
(Additional variables can occur if &amp;lt;math&amp;gt;\psi&amp;lt;/math&amp;gt; occurs in a bigger formula &lt;br /&gt;
binding those variables.)&lt;br /&gt;
&lt;br /&gt;
 A: TYPE;&lt;br /&gt;
 b, c: A;&lt;br /&gt;
 p, q: A -&amp;gt; BOOLEAN;&lt;br /&gt;
 r: (A, A) -&amp;gt; BOOLEAN;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x0, x1, x2: A):&lt;br /&gt;
          PATTERN (r(x0, x1), r(x1, x2)): &lt;br /&gt;
          (r(x0, x1) AND r(x1, x2)) =&amp;gt; r(x0, x2) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT FORALL (x: A):&lt;br /&gt;
          PATTERN (r(x, b)): &lt;br /&gt;
          PATTERN (r(x, c)): &lt;br /&gt;
          p(x) =&amp;gt; q(x) ;&lt;br /&gt;
 &lt;br /&gt;
 ASSERT EXISTS (y: A):&lt;br /&gt;
          FORALL (x: A):&lt;br /&gt;
            PATTERN (r(x, y), p(y)): &lt;br /&gt;
            r(x, y) =&amp;gt; q(x) ;&lt;br /&gt;
&lt;br /&gt;
Patterns have no logical meaning: &lt;br /&gt;
adding them to a formula does not change its semantics. &lt;br /&gt;
Their purpose is purely operational, as explained in &lt;br /&gt;
the [[#Instantiation Patterns | Instantiation Patterns]] section.&lt;br /&gt;
&lt;br /&gt;
In addition to these constructs, CVC4 also has a general mixfix conditional operator &lt;br /&gt;
of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathrm{IF}\ b\ \mathrm{THEN}\ t\ \mathrm{ELSIF}\ b_1\ \mathrm{THEN}\ t_1\ \ldots\ \mathrm{ELSIF}\ b_n\ \mathrm{THEN}\ t_n\ \mathrm{ELSE}\ t_{n+1}\ \mathrm{ENDIF}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with &amp;lt;math&amp;gt;n \geq 0&amp;lt;/math&amp;gt; where &lt;br /&gt;
&amp;lt;math&amp;gt;b, b_1, \ldots, b_n&amp;lt;/math&amp;gt; are terms of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt; and&lt;br /&gt;
&amp;lt;math&amp;gt;t, t_1, \ldots, t_n, t_{n+1}&amp;lt;/math&amp;gt; are terms of the same first-order type &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 % Conditional term&lt;br /&gt;
 x, y, z, w: REAL;&lt;br /&gt;
 &lt;br /&gt;
 t: REAL = &lt;br /&gt;
   IF x &amp;gt; 0 THEN y&lt;br /&gt;
   ELSIF x &amp;gt;= 1 THEN z&lt;br /&gt;
   ELSIF x &amp;gt; 2 THEN w&lt;br /&gt;
   ELSE 2/3 ENDIF;&lt;br /&gt;
&lt;br /&gt;
=== User-defined Functions and Types ===&lt;br /&gt;
&lt;br /&gt;
The theory of user-defined functions,also know in the SMT literature as &lt;br /&gt;
the theory ''Equality over Uninterpreted Functions'', or ''EUF'', is in effect &lt;br /&gt;
a family of theories of equality parametrized by the basic types and the free symbols &lt;br /&gt;
a user can define during a run of CVC4.&lt;br /&gt;
&lt;br /&gt;
This theory has no built-in symbols (other than the logical ones).&lt;br /&gt;
Its types consist of ''all and only'' the user-defined types.&lt;br /&gt;
Its function symbols consist of ''all and only'' the user-defined free symbols.&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
The real arithmetic theory has two types:&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{INTEGER}&amp;lt;/math&amp;gt;&lt;br /&gt;
with the latter a subtype of the first.&lt;br /&gt;
Its built-in symbols for the usual arithmetic constants &lt;br /&gt;
and operators over the type &amp;lt;math&amp;gt;\mathrm{REAL}&amp;lt;/math&amp;gt;, each with the expected type: &lt;br /&gt;
all numerals 0, 1, ..., as well as - (both unary and binary), +, *, /, &amp;lt;, &amp;gt;, &amp;lt;=, &amp;gt;=. &lt;br /&gt;
Application of the binary symbols are in infix form.&lt;br /&gt;
Note that + is only binary, and so an expression such as +4 is ill-formed.&lt;br /&gt;
&lt;br /&gt;
Rational values can be expressed in decimal or fractional format,&lt;br /&gt;
e.g., 0.1, 23.243241, 1/2, 3/4, and so on.&lt;br /&gt;
A leading 0 is mandatory for decimal numbers smaller than one &lt;br /&gt;
(e.g., the syntax .3 cannot be used as a shorthand for 0.3).&lt;br /&gt;
However, a trailing 0 is ''not'' required for decimals that are whole numbers&lt;br /&gt;
(e.g., 3. is allowed as a shorthand for 3.0).&lt;br /&gt;
The size of the numerals used in the representation of natural and rational numbers &lt;br /&gt;
is unbounded; more accurately, bounded only by the amount of available memory.&lt;br /&gt;
&lt;br /&gt;
=== Bit vectors ===&lt;br /&gt;
&lt;br /&gt;
=== Arrays ===&lt;br /&gt;
&lt;br /&gt;
The theory of arrays is a parametric theory of (total) unary maps. &lt;br /&gt;
It comes equipped with mixfix polymorphic selection and update operators, respectively&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;\_[\_]&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_&amp;lt;/math&amp;gt; .&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
The semantics of these operators is the expected one:&lt;br /&gt;
for all first-order types &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
if &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;\mathrm{ARRAY}\ T_1 \mathrm{OF}\ T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
&amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_1&amp;lt;/math&amp;gt;, and&lt;br /&gt;
&amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; is of type &amp;lt;math&amp;gt;T_2&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a[i]&amp;lt;/math&amp;gt; denotes the value that &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt; associates to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math&amp;gt;a\ \mathrm{WITH}\ [i]\ := v&amp;lt;/math&amp;gt; denotes a map that associates &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to index &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and is otherwise identical to &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;.&lt;br /&gt;
Sequential updates can be chained with the shorthand syntax &lt;br /&gt;
&amp;lt;math&amp;gt;\_\ \mathrm{WITH}\ [\_]\ := \_, \ldots, [\_]\ := \_&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 A: TYPE = ARRAY INT OF REAL;&lt;br /&gt;
 a: A;&lt;br /&gt;
 i: INT = 4;&lt;br /&gt;
 &lt;br /&gt;
 % selection:&lt;br /&gt;
 &lt;br /&gt;
 elem: REAL = a[i];&lt;br /&gt;
 &lt;br /&gt;
 % update&lt;br /&gt;
 &lt;br /&gt;
 a1: A = a WITH [10] := 1/2;&lt;br /&gt;
 &lt;br /&gt;
 % sequential update &lt;br /&gt;
 % (syntactic sugar for (a WITH [10] := 2/3) WITH [42] := 3/2)&lt;br /&gt;
 &lt;br /&gt;
 a2: A = a WITH [10] := 2/3, [42] := 3/2;&lt;br /&gt;
&lt;br /&gt;
Since arrays are just maps, equality between them is extensional, that is, &lt;br /&gt;
for two arrays of the same type to be different they have to map at least one&lt;br /&gt;
index to differ values.&lt;br /&gt;
&lt;br /&gt;
=== Data types ===&lt;br /&gt;
&lt;br /&gt;
The theory of inductive data types is in fact a family of theories parametrized &lt;br /&gt;
by a data type declaration specifying constructors and selectors &lt;br /&gt;
for one or more user-defined data types.&lt;br /&gt;
&lt;br /&gt;
No built-in operators other than equality and disequality are provided &lt;br /&gt;
for this family in the native language. &lt;br /&gt;
Each user-provided data type declaration, however, generates constructor, selector and tester operators &lt;br /&gt;
as described in the [[#Inductive Data Types | Inductive Data Types]] section.&lt;br /&gt;
&lt;br /&gt;
=== Tuples and Records ===&lt;br /&gt;
&lt;br /&gt;
Semantically both records and tuples can be seen as special instances &lt;br /&gt;
of inductive data types.&lt;br /&gt;
CVC4 implements them internally indeed as data types.&lt;br /&gt;
In essence, a record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt;&lt;br /&gt;
is encoded as a data type of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
 \mathrm{DATATYPE} \\&lt;br /&gt;
 \ \ \mathrm{Record} = \mathit{rec}(l_0:T_0, \ldots, l_n:T_n) \\&lt;br /&gt;
 \mathrm{END};&lt;br /&gt;
\end{array}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Tuples of length &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; are in turn special cases of records whose field names are &lt;br /&gt;
the numerals from &amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;n-1&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Externally, tuples and records have their own syntax for constructor and selector operators.&lt;br /&gt;
* Records of type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; have the associated  record constructor &amp;lt;math&amp;gt;(\#\ l_0 := \_,\; \ldots,\; l_n := \_\ \#)&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Tuples of type &amp;lt;math&amp;gt;[\ T_0, \ldots, T_n\ ]&amp;lt;/math&amp;gt; have the associated tuple constructor &amp;lt;math&amp;gt;(\ \_,\; \ldots,\; \_\ )&amp;lt;/math&amp;gt; whose arguments must be terms of type &amp;lt;math&amp;gt;T_0, \ldots, T_n&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The selector operators on records and tuples follows a dot notation syntax.&lt;br /&gt;
&lt;br /&gt;
 % Record construction and field selection&lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x: Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 k: INT = x.key;&lt;br /&gt;
 v: REAL = x.weight;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple construction and projection&lt;br /&gt;
 y: [REAL, INT, REAL] = ( 4/5, 9, 11/9 );&lt;br /&gt;
 first_elem: REAL = y.0;&lt;br /&gt;
 third_elem: REAL = y.2;&lt;br /&gt;
&lt;br /&gt;
Differently from data types, records and tuples are also provided with built-in update operators similar in syntax and semantics to the update operator for arrays. &lt;br /&gt;
More precisely, for each record type &amp;lt;math&amp;gt;[\#\ l_0:T_0, \ldots, l_n:T_n\ \#]&amp;lt;/math&amp;gt; and&lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\_\ \mathrm{WITH}\ .l_i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator maps a record &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; of that type and a value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; &lt;br /&gt;
of type &amp;lt;math&amp;gt;T_i&amp;lt;/math&amp;gt; to the record that stores &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; in field &amp;lt;math&amp;gt;l_i&amp;lt;/math&amp;gt; &lt;br /&gt;
and is otherwise identical to &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt;. &lt;br /&gt;
Analogously, for each tuple type &amp;lt;math&amp;gt;[T_0, \ldots, T_n]&amp;lt;/math&amp;gt; and &lt;br /&gt;
each &amp;lt;math&amp;gt;i=0, \ldots, n&amp;lt;/math&amp;gt;, CVC4 provides the operator&lt;br /&gt;
&lt;br /&gt;
&amp;lt;center&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \_\ \mathrm{WITH}\ .i\ := \_&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
with similar semantics.&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = x WITH .weight := 48;&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = y WITH .1 := 3; &lt;br /&gt;
 &lt;br /&gt;
 Updates to a nested component can be combined in a single WITH operator:&lt;br /&gt;
 &lt;br /&gt;
 Cache: TYPE = ARRAY [0..100] OF [# addr: INT, data: REAL #];&lt;br /&gt;
 State: TYPE = [# pc: INT, cache: Cache #];&lt;br /&gt;
 &lt;br /&gt;
 s0: State;&lt;br /&gt;
 s1: State = s0 WITH .cache[10].data := 2/3;&lt;br /&gt;
&lt;br /&gt;
Note that, differently from updates on arrays, tuple and record updates are &lt;br /&gt;
just additional syntactic sugar. &lt;br /&gt;
For instance, the record &amp;lt;code&amp;gt;x1&amp;lt;/code&amp;gt; and tuple &amp;lt;code&amp;gt;y1&amp;lt;/code&amp;gt; defined above &lt;br /&gt;
could have been equivalently defined as follows:&lt;br /&gt;
&lt;br /&gt;
 % Record updates&lt;br /&gt;
 &lt;br /&gt;
 Item: TYPE = [# key: INT, weight: REAL #];&lt;br /&gt;
 &lt;br /&gt;
 x:  Item = (# key := 23, weight := 43/10 #);&lt;br /&gt;
 &lt;br /&gt;
 x1: Item = (# key := x.key,  weight := 48 #);&lt;br /&gt;
 &lt;br /&gt;
 % Tuple updates&lt;br /&gt;
 &lt;br /&gt;
 Tup: TYPE = [REAL,INT,REAL];&lt;br /&gt;
 y:  Tup = ( 4/5, 9, 11/9 );&lt;br /&gt;
 y1: Tup = ( y.0, 3, y.1 );&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
In addition to declarations of types and function symbols, &lt;br /&gt;
the CVC4 native language contains the following commands:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ASSERT}\ F&amp;lt;/math&amp;gt; -- Add the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; to the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
* [[#CHECKSAT|&amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is satisfiable in the current logical context (&amp;lt;math&amp;gt;\Gamma \not\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{CONTINUE}&amp;lt;/math&amp;gt; -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, search for a counter-example different from the current one.&lt;br /&gt;
* [[#COUNTEREXAMPLE|&amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print the context that is a witness for invalidity/satisfiability.&lt;br /&gt;
* [[#COUNTERMODEL|&amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, print a model that makes the formula invalid/satisfiable. The model is provided in terms of concrete values for each free symbol.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{OPTION}\ o\ v&amp;lt;/math&amp;gt; -- Set the command-line option flag &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; to value &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. The argument &amp;lt;math&amp;gt;o&amp;lt;/math&amp;gt; is provide as a string literal enclosed in double-quotes and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; as an integer value.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; -- Equivalent to &amp;lt;math&amp;gt;\mathrm{POPTO}\ 1&amp;lt;/math&amp;gt;&lt;br /&gt;
* [[#POPTO|&amp;lt;math&amp;gt;\mathrm{POPTO}\ n&amp;lt;/math&amp;gt;]] -- Restore the system to the state it was in right before the most recent call to &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; made from stack level &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. Note that the current stack level is printed as part of the output of the &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; command.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; -- Save (checkpoint) the current state of the system.&lt;br /&gt;
* [[#QUERY|&amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt;]] -- Check if the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; is valid in the current logical context (&amp;lt;math&amp;gt;\Gamma\models_T F&amp;lt;/math&amp;gt;).&lt;br /&gt;
* [[#RESTART|&amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt;]] -- After an invalid &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; or satisfiable &amp;lt;math&amp;gt;\mathrm{CHECKSAT}&amp;lt;/math&amp;gt;, repeat the check but with the additional assumption &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; in the context.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{PRINT}\ t&amp;lt;/math&amp;gt; -- Parse and print back the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRANSFORM}\ t&amp;lt;/math&amp;gt; -- Simplify the term &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; and print the result.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt; -- Print all the formulas in the current logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The remaining commands take a single argument, given as a string literal enclosed in double-quotes.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{ECHO}\ s&amp;lt;/math&amp;gt; -- Print string &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{INCLUDE}\ f&amp;lt;/math&amp;gt; -- Read commands from file &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{TRACE}\ f&amp;lt;/math&amp;gt; -- Turn on tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;\mathrm{UNTRACE}\ f&amp;lt;/math&amp;gt; -- Turn off tracing for the debug flag &amp;lt;math&amp;gt;f&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, we explain some of the above commands in more detail.&lt;br /&gt;
&lt;br /&gt;
=== QUERY ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; invokes the core functionality of CVC4 to check &lt;br /&gt;
the validity of the formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; with respect to the assertions made thus far,&lt;br /&gt;
which constitute the context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;. &lt;br /&gt;
The argument &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; must be well typed term of type &amp;lt;math&amp;gt;\mathrm{BOOLEAN}&amp;lt;/math&amp;gt;,&lt;br /&gt;
as described in [[#Terms and Formulas | Terms and Formulas]].&lt;br /&gt;
&lt;br /&gt;
The execution of this command always terminates and produces one of three possible answers: &lt;br /&gt;
&amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* A &amp;lt;code&amp;gt;valid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;. After a query returning such an answer, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is exactly as it was before the query.&lt;br /&gt;
* An &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer indicates that &amp;lt;math&amp;gt;\Gamma \not\models_T F&amp;lt;/math&amp;gt;, that is, there is a model of the background theory &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Gamma \cup \{\mathrm{NOT}\ F\}&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;\mathrm{QUERY}\ F&amp;lt;/math&amp;gt; returns &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt;, the logical context &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; is augmented with a set &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; of ground (i.e., variable-free) literals such that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;, but &amp;lt;math&amp;gt;\Gamma\cup\Delta\models_T \mathrm{NOT}\ F&amp;lt;/math&amp;gt;. In fact, in this case &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; ''propositionally entails'' &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;, in the sense that, every truth assignment to the literals of &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; that satisfies &amp;lt;math&amp;gt;\Delta&amp;lt;/math&amp;gt; falsifies &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;. We call the new context &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; a ''counterexample'' for &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
* An &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; answer is similar to an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; answer in that additional literals are added to the context which propositionally entail &amp;lt;math&amp;gt;\mathrm{NOT}\ F&amp;lt;/math&amp;gt;. The difference in this case is that CVC4 cannot guarantee that &amp;lt;math&amp;gt;\Gamma\cup\Delta&amp;lt;/math&amp;gt; is actually satisfiable in &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
CVC4 may report &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt; when the context or the query contains&lt;br /&gt;
non-linear arithmetic terms or quantifiers.&lt;br /&gt;
In all other cases, it is expected to be sound and complete, &lt;br /&gt;
i.e., to report &amp;lt;code&amp;gt;Valid&amp;lt;/code&amp;gt; if &amp;lt;math&amp;gt;\Gamma \models_T F&amp;lt;/math&amp;gt;&lt;br /&gt;
and &amp;lt;code&amp;gt;Invalid&amp;lt;/code&amp;gt; otherwise.&lt;br /&gt;
&lt;br /&gt;
After an &amp;lt;code&amp;gt;invalid&amp;lt;/code&amp;gt; (resp. &amp;lt;code&amp;gt;unknown&amp;lt;/code&amp;gt;) answer,&lt;br /&gt;
counterexamples (resp. possible counterexamples) can be obtained with &lt;br /&gt;
a &amp;lt;math&amp;gt;\mathrm{WHERE}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathrm{COUNTEREXAMPLE}&amp;lt;/math&amp;gt;, &lt;br /&gt;
or &amp;lt;math&amp;gt;\mathrm{COUNTERMODEL}&amp;lt;/math&amp;gt; command. &lt;br /&gt;
&amp;lt;!---&lt;br /&gt;
WHERE always prints out all of &amp;lt;math&amp;gt;\Gamma\cup C&amp;lt;/math&amp;gt;. COUNTEREXAMPLE may sometimes be more selective, printing a subset of those formulas from the context which are sufficient for a counterexample.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the &amp;lt;math&amp;gt;\mathrm{QUERY}&amp;lt;/math&amp;gt; command may modify &lt;br /&gt;
the current context, if one needs to check several formulas in a row &lt;br /&gt;
in the same context, it is a good idea to surround every &lt;br /&gt;
query by a &amp;lt;math&amp;gt;\mathrm{PUSH}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathrm{POP}&amp;lt;/math&amp;gt; invocation&lt;br /&gt;
in order to preserve the context:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
&lt;br /&gt;
=== CHECKSAT ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{CHECKSAT}\ F&amp;lt;/math&amp;gt; behaves identically &lt;br /&gt;
to &amp;lt;math&amp;gt;\mathrm{QUERY}\ \mathrm{NOT}\ F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== RESTART ===&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;math&amp;gt;\mathrm{RESTART}\ F&amp;lt;/math&amp;gt; can only be invoked after an invalid query. &lt;br /&gt;
For example, in an interactive setting:&lt;br /&gt;
&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 &lt;br /&gt;
 CVC4&amp;gt; invalid&lt;br /&gt;
 &lt;br /&gt;
 RESTART &amp;lt;formula2&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
Functionally, the behavior of the above command sequence is identical to the following:&lt;br /&gt;
&lt;br /&gt;
 PUSH;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
 POP;&lt;br /&gt;
 ASSERT &amp;lt;formula2&amp;gt;;&lt;br /&gt;
 QUERY &amp;lt;formula&amp;gt;;&lt;br /&gt;
&lt;br /&gt;
The advantage of using the &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; command is that &lt;br /&gt;
the first command sequence may be executed much more efficiently that the second.&lt;br /&gt;
The reason is that with &amp;lt;math&amp;gt;\mathrm{RESTART}&amp;lt;/math&amp;gt; CVC4 will re-use&lt;br /&gt;
what it has learned while answering the previous query rather than starting &lt;br /&gt;
over from scratch.&lt;br /&gt;
&lt;br /&gt;
=== COUNTERMODEL ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== COUNTEREXAMPLE ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
=== POPTO ===&lt;br /&gt;
&lt;br /&gt;
[More]&lt;br /&gt;
&lt;br /&gt;
== Instantiation Patterns ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CVC4 processes each universally quantified formula in the current context &lt;br /&gt;
by adding instances of the formula obtained by replacing its universal variables &lt;br /&gt;
with ground terms. &lt;br /&gt;
Patterns restrict the choice of ground terms for the quantified variables, &lt;br /&gt;
with the goal of controlling the potential explosion of ground instances. &lt;br /&gt;
In essence, adding patterns to a formula is a way for the user to tell CVC4 &lt;br /&gt;
to focus only on certain instances which, in the user's opinion, will be &lt;br /&gt;
most helpful during a proof.&lt;br /&gt;
&lt;br /&gt;
In more detail, patterns have the following effect on formulas that are found &lt;br /&gt;
in the logical context or get added to it later while CVC4 is trying to prove &lt;br /&gt;
the validity of some formula &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If a formula in the current context starts with an existential quantifier, &lt;br /&gt;
CVC4 ''Skolemizes'' it, that is, replaces it in the context with the formula &lt;br /&gt;
obtained by substituting the existentially quantified variables &lt;br /&gt;
by fresh constants and dropping the quantifier. &lt;br /&gt;
Any patterns for the existential quantifier are simply ignored.&lt;br /&gt;
&lt;br /&gt;
If a formula starts with a universal quantifier &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{FORALL}\; (x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt;, &lt;br /&gt;
CVC4 adds to the context a number of instances of the formula, &lt;br /&gt;
with the goal of using them to prove the query &amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt; valid. &lt;br /&gt;
An instance is obtained by replacing each &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; with a ground term&lt;br /&gt;
of the same type occurring in one of the formulas in the context, &lt;br /&gt;
and dropping the universal quantifier. &lt;br /&gt;
If &amp;lt;math&amp;gt;x_i&amp;lt;/math&amp;gt; occurs in a pattern &lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{PATTERN}\; (t_1, \ldots, t_m)&amp;lt;/math&amp;gt; for the quantifier, &lt;br /&gt;
it will be instantiated only with terms obtained by simultaneously matching &lt;br /&gt;
all the terms in the pattern against ground terms in the current context &lt;br /&gt;
&amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Specifically, the matching process produces one or more substitutions &lt;br /&gt;
&amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; for the variables in &amp;lt;math&amp;gt;(t_1, \ldots, t_m)&amp;lt;/math&amp;gt; &lt;br /&gt;
which satisfy the following invariant: &lt;br /&gt;
for each &amp;lt;math&amp;gt;i = 1, \ldots, m&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\sigma(t_i)&amp;lt;/math&amp;gt; is &lt;br /&gt;
a ground term and there is a ground term &amp;lt;math&amp;gt;s_i&amp;lt;/math&amp;gt; in &amp;lt;math&amp;gt;\Gamma&amp;lt;/math&amp;gt; &lt;br /&gt;
such that &amp;lt;math&amp;gt;\Gamma \models_T \sigma(t_i) = s_i&amp;lt;/math&amp;gt;. &lt;br /&gt;
The variables of &amp;lt;math&amp;gt;(x_1:T_1, \ldots, x_n:T_n)&amp;lt;/math&amp;gt; that occur &lt;br /&gt;
in the pattern are instantiated only with those substitutions &lt;br /&gt;
(while any remaining variables are instantiated arbitrarily).&lt;br /&gt;
&lt;br /&gt;
The Skolemized version or the added instances of a context formula may themselves &lt;br /&gt;
start with a quantifier. &lt;br /&gt;
The same instantiation process is applied to them too, recursively.&lt;br /&gt;
&lt;br /&gt;
Note that the matching mechanism is not limited to syntactic matching &lt;br /&gt;
but is modulo the equations asserted in the context. &lt;br /&gt;
Because of decidability and/or efficiency limitations, the matching process &lt;br /&gt;
is not exhaustive. &lt;br /&gt;
CVC4 will typically miss some substitutions that satisfy the invariant above. &lt;br /&gt;
As a consequence, it might fail to prove the validity of the query formula &lt;br /&gt;
&amp;lt;math&amp;gt;F&amp;lt;/math&amp;gt;, which makes CVC4 incomplete for contexts containing &lt;br /&gt;
quantified formulas. &lt;br /&gt;
It should be noted though that exhaustive matching, which can be achieved &lt;br /&gt;
simply by not specifying any patterns, does not yield completeness anyway &lt;br /&gt;
since the instantiation of universal variables is still restricted &lt;br /&gt;
to just the ground terms in the context,&lt;br /&gt;
whereas in general additional ground terms might be needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 == Subtypes ==&lt;br /&gt;
&lt;br /&gt;
=== Subtype Checking ===&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=CVC4's support for the SMT-LIB language=&lt;br /&gt;
&lt;br /&gt;
==SMT-LIB compliance==&lt;br /&gt;
&lt;br /&gt;
Every effort has been made to make CVC4 compliant with the SMT-LIB 2.0&lt;br /&gt;
standard (http://smtlib.org/).  However, when parsing SMT-LIB input,&lt;br /&gt;
certain default settings don't match what is stated in the official&lt;br /&gt;
standard.  To make CVC4 adhere more strictly to the standard, use the&lt;br /&gt;
&amp;quot;--smtlib&amp;quot; command-line option.  Even with this setting, CVC4 is&lt;br /&gt;
somewhat lenient; some non-conforming input may still be parsed and&lt;br /&gt;
processed.&lt;br /&gt;
&lt;br /&gt;
=The CVC4 library interface (API)=&lt;br /&gt;
==Using CVC4 in a C++ project==&lt;br /&gt;
==Using CVC4 from Java==&lt;br /&gt;
==The compatibility interface==&lt;br /&gt;
&lt;br /&gt;
=Upgrading from CVC3 to CVC4=&lt;br /&gt;
&lt;br /&gt;
==Features not supported by CVC4 (yet)==&lt;br /&gt;
&lt;br /&gt;
===Type Correctness Conditions (TCCs)===&lt;br /&gt;
&lt;br /&gt;
Type Correctness Conditions (TCCs), and the checking of such, are not&lt;br /&gt;
supported by CVC4 1.0.  Thus, a function defined only on integers can be&lt;br /&gt;
applied to REAL (as INT is a subtype of REAL), and CVC4 will not complain,&lt;br /&gt;
but may produce strange results.  For example:&lt;br /&gt;
&lt;br /&gt;
  f : INT -&amp;gt; INT;&lt;br /&gt;
  ASSERT f(1/3) = 0;&lt;br /&gt;
  ASSERT f(2/3) = 1;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  COUNTEREXAMPLE;&lt;br /&gt;
  % f : (INT) -&amp;gt; INT = LAMBDA(x1:INT) : 0;&lt;br /&gt;
&lt;br /&gt;
CVC3 can be used to produce TCCs for this input (with the +dump-tcc option).&lt;br /&gt;
The TCC can be checked by CVC3 or another solver.  (CVC3 can also check&lt;br /&gt;
TCCs while solving with +tcc.)&lt;br /&gt;
&lt;br /&gt;
==If you were using the text interfaces of CVC3==&lt;br /&gt;
&lt;br /&gt;
The native language of all solvers in the CVC family, referred to as the&lt;br /&gt;
&amp;quot;presentation language,&amp;quot; has undergone some revisions for CVC4.  The&lt;br /&gt;
most notable is that CVC4 does _not_ add counterexample assertions to&lt;br /&gt;
the current assertion set after a SAT/INVALID result.  For example:&lt;br /&gt;
&lt;br /&gt;
  x, y : INT;&lt;br /&gt;
  ASSERT x = 1 OR x = 2;&lt;br /&gt;
  ASSERT y = 1 OR y = 2;&lt;br /&gt;
  ASSERT x /= y;&lt;br /&gt;
  CHECKSAT;&lt;br /&gt;
  % sat&lt;br /&gt;
  QUERY x = 1;&lt;br /&gt;
  % invalid&lt;br /&gt;
  QUERY x = 2;&lt;br /&gt;
  % invalid&lt;br /&gt;
&lt;br /&gt;
Here, CVC4 responds &amp;quot;invalid&amp;quot; to the second and third queries, because&lt;br /&gt;
each has a counterexample (x=2 is a counterexample to the first, and&lt;br /&gt;
x=1 is a counterexample to the second).  However, CVC3 will respond&lt;br /&gt;
with &amp;quot;valid&amp;quot; to one of these two, as the first query (the CHECKSAT)&lt;br /&gt;
had the side-effect of locking CVC3 into one of the two cases; the&lt;br /&gt;
later queries are effectively querying the counterexample that was&lt;br /&gt;
found by the first.  CVC4 removes this side-effect of the CHECKSAT and&lt;br /&gt;
QUERY commands.&lt;br /&gt;
&lt;br /&gt;
CVC4 supports rational literals (of type REAL) in decimal; CVC3 did not&lt;br /&gt;
support decimals.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not have support for the IS_INTEGER predicate.&lt;br /&gt;
&lt;br /&gt;
==If you were using the library (&amp;quot;in-memory&amp;quot;) interface of CVC3==&lt;br /&gt;
===If you were using CVC3 from C===&lt;br /&gt;
===If you were using CVC3 from Java===&lt;br /&gt;
&lt;br /&gt;
=Useful command-line options=&lt;br /&gt;
&lt;br /&gt;
==Statistics==&lt;br /&gt;
&lt;br /&gt;
Statistics can be dumped on exit (both normal and abnormal exits) with&lt;br /&gt;
the --statistics command line option.&lt;br /&gt;
&lt;br /&gt;
==Time and resource limits==&lt;br /&gt;
&lt;br /&gt;
CVC4 can be made to self-timeout after a given number of milliseconds.&lt;br /&gt;
Use the --tlimit command line option to limit the entire run of&lt;br /&gt;
CVC4, or use --tlimit-per to limit each individual query separately.&lt;br /&gt;
Preprocessing time is not counted by the time limit, so for some large&lt;br /&gt;
inputs which require aggressive preprocessing, you may notice that&lt;br /&gt;
--tlimit does not work very well.  If you suspect this might be the&lt;br /&gt;
case, you can use &amp;quot;-vv&amp;quot; (double verbosity) to see what CVC4 is doing.&lt;br /&gt;
&lt;br /&gt;
Time-limited runs are not deterministic; two consecutive runs with the&lt;br /&gt;
same time limit might produce different results (i.e., one may time out&lt;br /&gt;
and responds with &amp;quot;unknown&amp;quot;, while the other completes and provides an&lt;br /&gt;
answer).  To ensure that results are reproducible, use --rlimit or&lt;br /&gt;
--rlimit-per.  These options take a &amp;quot;resource count&amp;quot; (presently, based on&lt;br /&gt;
the number of SAT conflicts) that limits the search time.  A word of&lt;br /&gt;
caution, though: there is no guarantee that runs of different versions of&lt;br /&gt;
CVC4 or of different builds of CVC4 (e.g., two CVC4 binaries with different&lt;br /&gt;
features enabled, or for different architectures) will interpret the resource&lt;br /&gt;
count in the same manner.&lt;br /&gt;
&lt;br /&gt;
CVC4 does not presently have a way to limit its memory use; you may opt&lt;br /&gt;
to run it from a shell after using &amp;quot;ulimit&amp;quot; to limit the size of the&lt;br /&gt;
heap.&lt;br /&gt;
&lt;br /&gt;
=Dumping API calls or preprocessed output=&lt;br /&gt;
&lt;br /&gt;
=Changing the output language=&lt;br /&gt;
&lt;br /&gt;
=Proof support=&lt;br /&gt;
&lt;br /&gt;
CVC4 1.0 has limited support for proofs, and they are disabled by default.&lt;br /&gt;
(Run the configure script with --enable-proof to enable proofs).  Proofs&lt;br /&gt;
are exported in LFSC format and are limited to the propositional backbone&lt;br /&gt;
of the discovered proof (theory lemmas are stated without proof in this&lt;br /&gt;
release).&lt;br /&gt;
&lt;br /&gt;
=Portfolio solving=&lt;br /&gt;
&lt;br /&gt;
If enabled at configure-time (./configure --with-portfolio), a second&lt;br /&gt;
CVC4 binary will be produced (&amp;quot;pcvc4&amp;quot;).  This binary has support for&lt;br /&gt;
running multiple instances of CVC4 in different threads.  Use --threads=N&lt;br /&gt;
to specify the number of threads, and use --thread0=&amp;quot;options for thread 0&amp;quot;&lt;br /&gt;
--thread1=&amp;quot;options for thread 1&amp;quot;, etc., to specify a configuration for the&lt;br /&gt;
threads.  Lemmas are *not* shared between the threads by default; to adjust&lt;br /&gt;
this, use the --filter-lemma-length=N option to share lemmas of N literals&lt;br /&gt;
(or smaller).  (Some lemmas are ineligible for sharing because they include&lt;br /&gt;
literals that are &amp;quot;local&amp;quot; to one thread.)&lt;br /&gt;
&lt;br /&gt;
Currently, the portfolio **does not work** with quantifiers or with&lt;br /&gt;
the theory of inductive datatypes.  These limitations will be addressed&lt;br /&gt;
in a future release.&lt;br /&gt;
&lt;br /&gt;
=Emacs support=&lt;br /&gt;
&lt;br /&gt;
For a suggestion of editing CVC4 source code with emacs, see the file&lt;br /&gt;
contrib/editing-with-emacs.  For a CVC language mode (the native input&lt;br /&gt;
language for CVC4), see contrib/cvc-mode.el.&lt;/div&gt;</summary>
		<author><name>Lianah</name></author>	</entry>

	</feed>