<?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=Wwang</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=Wwang"/>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/wiki/Special:Contributions/Wwang"/>
		<updated>2026-04-05T16:27:42Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.4</generator>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=~/.m2/settings.xml&amp;diff=4437</id>
		<title>~/.m2/settings.xml</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=~/.m2/settings.xml&amp;diff=4437"/>
				<updated>2012-12-20T04:06:32Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;  &amp;lt;settings&amp;gt;&lt;br /&gt;
    &amp;lt;profiles&amp;gt;&lt;br /&gt;
      &amp;lt;profile&amp;gt;&lt;br /&gt;
        &amp;lt;id&amp;gt;tools-builds-cvc4&amp;lt;/id&amp;gt;&lt;br /&gt;
        &amp;lt;activation&amp;gt;&lt;br /&gt;
          &amp;lt;activeByDefault&amp;gt;true&amp;lt;/activeByDefault&amp;gt;&lt;br /&gt;
        &amp;lt;/activation&amp;gt;&lt;br /&gt;
        &amp;lt;properties&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.version&amp;gt;4.0.0&amp;lt;/cvc4.version&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.basedir&amp;gt;/Users/Wei/Workspace/target/cvc4/&amp;lt;/cvc4.basedir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.libdir&amp;gt;/Users/Wei/Workspace/target/cvc4/lib/&amp;lt;/cvc4.libdir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.jni.libdir&amp;gt;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;lt;/cvc4.jni.libdir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.jar&amp;gt;/Users/Wei/Workspace/target/cvc4/share/java/CVC4.jar&amp;lt;/cvc4.jar&amp;gt;&lt;br /&gt;
        &amp;lt;/properties&amp;gt;&lt;br /&gt;
      &amp;lt;/profile&amp;gt;&lt;br /&gt;
    &amp;lt;/profiles&amp;gt;&lt;br /&gt;
  &amp;lt;/settings&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=~/.m2/settings.xml&amp;diff=4436</id>
		<title>~/.m2/settings.xml</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=~/.m2/settings.xml&amp;diff=4436"/>
				<updated>2012-12-20T04:06:17Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{{  &lt;br /&gt;
  &amp;lt;settings&amp;gt;&lt;br /&gt;
    &amp;lt;profiles&amp;gt;&lt;br /&gt;
      &amp;lt;profile&amp;gt;&lt;br /&gt;
        &amp;lt;id&amp;gt;tools-builds-cvc4&amp;lt;/id&amp;gt;&lt;br /&gt;
        &amp;lt;activation&amp;gt;&lt;br /&gt;
          &amp;lt;activeByDefault&amp;gt;true&amp;lt;/activeByDefault&amp;gt;&lt;br /&gt;
        &amp;lt;/activation&amp;gt;&lt;br /&gt;
        &amp;lt;properties&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.version&amp;gt;4.0.0&amp;lt;/cvc4.version&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.basedir&amp;gt;/Users/Wei/Workspace/target/cvc4/&amp;lt;/cvc4.basedir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.libdir&amp;gt;/Users/Wei/Workspace/target/cvc4/lib/&amp;lt;/cvc4.libdir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.jni.libdir&amp;gt;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;lt;/cvc4.jni.libdir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.jar&amp;gt;/Users/Wei/Workspace/target/cvc4/share/java/CVC4.jar&amp;lt;/cvc4.jar&amp;gt;&lt;br /&gt;
        &amp;lt;/properties&amp;gt;&lt;br /&gt;
      &amp;lt;/profile&amp;gt;&lt;br /&gt;
    &amp;lt;/profiles&amp;gt;&lt;br /&gt;
  &amp;lt;/settings&amp;gt;&lt;br /&gt;
}}}&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4435</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4435"/>
				<updated>2012-12-20T01:17:30Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Command line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/branches/wwang1109/cvc4_branch svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and here we only introduces those often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly linked acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It is used to assume that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly linked cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;br /&gt;
&lt;br /&gt;
Another sample control file [[list_contains.ctrl]] is for the function contains(). Note that, the predicate '''_create_acyclic_list(f, root, length)''' is used to assume the function parameter list with root as start node is created with length 2 and field ''next''.&lt;br /&gt;
  __create_acyclic_list(next, root, 2)&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4434</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4434"/>
				<updated>2012-12-19T20:49:57Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Build and Install Cascade */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/branches/wwang1109/cvc4_branch svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and here we only introduces those often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly linked acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It is used to assume that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly linked cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;br /&gt;
&lt;br /&gt;
Another sample control file [[list_contains.ctrl]] is for the function contains(). Note that, the predicate '''_create_acyclic_list(f, root, length)''' is used to assume the function parameter list with root as start node is created with length 2 and field ''next''.&lt;br /&gt;
  __create_acyclic_list(next, root, 2)&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4433</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4433"/>
				<updated>2012-12-19T19:52:50Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* People */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;br /&gt;
* [http://www.cs.wustl.edu/~mdeters/ Morgan Deters]&lt;br /&gt;
* [http://www.cs.nyu.edu/pnueli Amir Pnueli]&lt;br /&gt;
* [http://www.cs.nyu.edu/~nsethi Nikhil Sethi]&lt;br /&gt;
* [http://www.cs.nyu.edu/~wwang1109/ Wei Wang]&lt;br /&gt;
&lt;br /&gt;
== Publications ==&lt;br /&gt;
* Christopher L. Conway and Clark Barrett. [http://www.cs.nyu.edu/~cconway/papers/conway-2010-datatypes.pdf Verifying Low-Level Implementations of High-Level Datatypes]. In Tayssir Touili, Byron Cook, and Paul Jackson, editors, Proceedings of the Twenty-Second International Conference on Computer Aided Verification (CAV '10), volume 6174 of Lecture Notes in Computer Science, pages 306-320. Springer, July 2010. Edinburgh, Scotland.&lt;br /&gt;
&lt;br /&gt;
* Nikhil Sethi and Clark Barrett. [http://cs.nyu.edu/~barrett/pubs/SB06.ps CASCADE: C Assertion Checker and Deductive Engine.] In Thomas Ball and Robert B. Jones, editors, Proceedings of the 18th International Conference on Computer Aided Verification (CAV '06), volume 4144 of Lecture Notes in Computer Science, pages 166-169. Springer-Verlag, August 2006. Seattle, Washington.&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Cascade development is supported by the National Science Foundation, grant number 0644299.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4432</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4432"/>
				<updated>2012-12-19T19:51:11Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Publications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;br /&gt;
* [http://www.cs.nyu.edu/~wwang1109/ Wei Wang]&lt;br /&gt;
&lt;br /&gt;
== Publications ==&lt;br /&gt;
* Christopher L. Conway and Clark Barrett. [http://www.cs.nyu.edu/~cconway/papers/conway-2010-datatypes.pdf Verifying Low-Level Implementations of High-Level Datatypes]. In Tayssir Touili, Byron Cook, and Paul Jackson, editors, Proceedings of the Twenty-Second International Conference on Computer Aided Verification (CAV '10), volume 6174 of Lecture Notes in Computer Science, pages 306-320. Springer, July 2010. Edinburgh, Scotland.&lt;br /&gt;
&lt;br /&gt;
* Nikhil Sethi and Clark Barrett. [http://cs.nyu.edu/~barrett/pubs/SB06.ps CASCADE: C Assertion Checker and Deductive Engine.] In Thomas Ball and Robert B. Jones, editors, Proceedings of the 18th International Conference on Computer Aided Verification (CAV '06), volume 4144 of Lecture Notes in Computer Science, pages 166-169. Springer-Verlag, August 2006. Seattle, Washington.&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Cascade development is supported by the National Science Foundation, grant number 0644299.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4431</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4431"/>
				<updated>2012-12-19T19:50:46Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Publications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;br /&gt;
* [http://www.cs.nyu.edu/~wwang1109/ Wei Wang]&lt;br /&gt;
&lt;br /&gt;
== Publications ==&lt;br /&gt;
* Christopher L. Conway and Clark Barrett. [https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDcQFjAA&amp;amp;url=http%3A%2F%2Fwww.cs.nyu.edu%2F~cconway%2Fpapers%2Fconway-2010-datatypes.pdf&amp;amp;ei=ihrSULiSJa-70QHKo4GgCw&amp;amp;usg=AFQjCNGMR4KKLfP4NPx0liddH4ChtZXkbQ&amp;amp;sig2=D37AJMBY2rPGU-LrcDcrug&amp;amp;bvm=bv.1355534169,d.dmQ Verifying Low-Level Implementations of High-Level Datatypes]. In Tayssir Touili, Byron Cook, and Paul Jackson, editors, Proceedings of the Twenty-Second International Conference on Computer Aided Verification (CAV '10), volume 6174 of Lecture Notes in Computer Science, pages 306-320. Springer, July 2010. Edinburgh, Scotland.&lt;br /&gt;
&lt;br /&gt;
* Nikhil Sethi and Clark Barrett. [http://cs.nyu.edu/~barrett/pubs/SB06.ps CASCADE: C Assertion Checker and Deductive Engine.] In Thomas Ball and Robert B. Jones, editors, Proceedings of the 18th International Conference on Computer Aided Verification (CAV '06), volume 4144 of Lecture Notes in Computer Science, pages 166-169. Springer-Verlag, August 2006. Seattle, Washington.&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Cascade development is supported by the National Science Foundation, grant number 0644299.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4430</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4430"/>
				<updated>2012-12-19T19:49:32Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Publications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;br /&gt;
* [http://www.cs.nyu.edu/~wwang1109/ Wei Wang]&lt;br /&gt;
&lt;br /&gt;
== Publications ==&lt;br /&gt;
Nikhil Sethi and Clark Barrett. [http://cs.nyu.edu/~barrett/pubs/SB06.ps CASCADE: C Assertion Checker and Deductive Engine.] In Thomas Ball and Robert B. Jones, editors, Proceedings of the 18th International Conference on Computer Aided Verification (CAV '06), volume 4144 of Lecture Notes in Computer Science, pages 166-169. Springer-Verlag, August 2006. Seattle, Washington.&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Cascade development is supported by the National Science Foundation, grant number 0644299.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4429</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4429"/>
				<updated>2012-12-19T19:48:39Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;br /&gt;
* [http://www.cs.nyu.edu/~wwang1109/ Wei Wang]&lt;br /&gt;
&lt;br /&gt;
== Publications ==&lt;br /&gt;
Nikhil Sethi and Clark Barrett. CASCADE: C Assertion Checker and Deductive Engine. In Thomas Ball and Robert B. Jones, editors, Proceedings of the 18th International Conference on Computer Aided Verification (CAV '06), volume 4144 of Lecture Notes in Computer Science, pages 166-169. Springer-Verlag, August 2006. Seattle, Washington.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Cascade development is supported by the National Science Foundation, grant number 0644299.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4428</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4428"/>
				<updated>2012-12-19T19:46:44Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* People */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;br /&gt;
* [http://www.cs.nyu.edu/~wwang1109/ Wei Wang]&lt;br /&gt;
&lt;br /&gt;
== Support ==&lt;br /&gt;
Cascade development is supported by the National Science Foundation, grant number 0644299.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4426</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4426"/>
				<updated>2012-12-18T03:28:15Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and here we only introduces those often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly linked acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It is used to assume that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly linked cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;br /&gt;
&lt;br /&gt;
Another sample control file [[list_contains.ctrl]] is for the function contains(). Note that, the predicate '''_create_acyclic_list(f, root, length)''' is used to assume the function parameter list with root as start node is created with length 2 and field ''next''.&lt;br /&gt;
  __create_acyclic_list(next, root, 2)&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4424</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4424"/>
				<updated>2012-12-18T03:26:55Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Reachability */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly linked acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It is used to assume that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly linked cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;br /&gt;
&lt;br /&gt;
Another sample control file [[list_contains.ctrl]] is for the function contains(). Note that, the predicate '''_create_acyclic_list(f, root, length)''' is used to assume the function parameter list with root as start node is created with length 2 and field ''next''.&lt;br /&gt;
  __create_acyclic_list(next, root, 2)&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4419</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4419"/>
				<updated>2012-12-17T23:36:31Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Reachability */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly linked acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It is used to assume that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly linked cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;br /&gt;
&lt;br /&gt;
Another sample control file [[list_contains.ctrl]] is for the function contains(). Note that, the predicate '''_create_acyclic_list(f, root, length)''' is used to assume a list linked by field ''next'', with length 2 and starts with node root.&lt;br /&gt;
  __allocated_list(next, root, 2)&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4418</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4418"/>
				<updated>2012-12-17T23:35:19Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Reachability */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly linked acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It is used to assume that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly linked cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;br /&gt;
&lt;br /&gt;
Another sample control file [[list_contains.ctrl]] is for the function contains(). Note that, the predicate '''_create_acyclic_list(f, root, length)''' is used here.&lt;br /&gt;
  __allocated_list(next, root, 2)&lt;br /&gt;
It means a list with length 2 and starts with root has been created.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4417</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4417"/>
				<updated>2012-12-17T22:51:21Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Logic Operators and Predicates */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly linked acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It is used to assume that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly linked cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4416</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4416"/>
				<updated>2012-12-17T22:50:45Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Logic Operators and Predicates */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly linked acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It means that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly linked cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4415</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4415"/>
				<updated>2012-12-17T22:50:02Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Logic Operators and Predicates */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It means that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly cyclic list creation predicate: '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4414</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4414"/>
				<updated>2012-12-17T22:49:47Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Logic Operators and Predicates */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* Singly acyclic list creation predicate: '''_create_acyclic_list(f, root, length)'''. It means that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. &lt;br /&gt;
    _create_acyclic_list(f, l1, 3)&lt;br /&gt;
* Singly cyclic list creation predicate '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4413</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4413"/>
				<updated>2012-12-17T22:43:51Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Logic Operators and Predicates */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* List allocation predicate: '''_create_acyclic_list(f, root, length)'''. It means that a singly acyclic list with particular length and root has been created. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. For cyclic list creation, we have '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_acyclic_list(f, l1, 3) &amp;amp;&amp;amp; _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4412</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4412"/>
				<updated>2012-12-17T22:43:28Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Logic Operators and Predicates */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
* List allocation predicate: '''_create_acyclic_list(f, root, length)'''. It means that a singly acyclic list with particular length and root has been allocated. This predicate is very helpful for modular verification of linked data structure manipulation functions, which takes linked lists as parameters. For cyclic list creation, we have '''_create_cyclic_list(f, root, length)'''.&lt;br /&gt;
    _create_acyclic_list(f, l1, 3) &amp;amp;&amp;amp; _create_cyclic_list(f, l2, 4)&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4411</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4411"/>
				<updated>2012-12-17T22:34:36Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Cascade Command */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logic Operators and Predicates ==&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4410</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4410"/>
				<updated>2012-12-17T05:42:18Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* People */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;br /&gt;
* [http://www.cs.nyu.edu/~wwang1109/ Wei Wang]&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4409</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4409"/>
				<updated>2012-12-17T05:41:41Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* People */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;br /&gt;
* [http://www.cs.nyu.edu/pnueli/ Amir Pnueli]&lt;br /&gt;
* [http://www.cs.nyu.edu/~nsethi Nikhil Sethi]&lt;br /&gt;
* [http://www.cs.nyu.edu/~wwang1109/ Wei Wang]&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4408</id>
		<title>About Cascade</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=About_Cascade&amp;diff=4408"/>
				<updated>2012-12-17T05:38:10Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cascade is a tool to check assertions in C programs as part of multi-stage verification strategy. There are a number of static analysis tools which can analyse large programs and find potential bugs. To scale, these tools must abstract the programs with the result that some of the errors reported are often false. Having to check these false alarms is often a time consuming task.&lt;br /&gt;
&lt;br /&gt;
In two stage verification, a light-weight analysis capable of scaling to large codes is first run to detect potential bugs. Then a more detailed analysis is used to rule out false errors. Cascade provides a generic back-end for two stage verification of C programs which can be easily integrated with any initial stage. Cascade can handle most C constructs like loops, functions (including recursive functions), structs, pointers, and dynamic memory allocation.&lt;br /&gt;
&lt;br /&gt;
Cascade uses a control file to interface with the first stage tool. The control file specifies the assertion(s) to be checked. In addition, the control file can be used to constrain the search for a violating trace by restricting the program paths to be explored or giving constraints on program variables.&lt;br /&gt;
&lt;br /&gt;
== People ==&lt;br /&gt;
* [http://www.cs.nyu.edu/~barrett/ Clark Barrett]&lt;br /&gt;
* [http://www.cs.nyu.edu/~cconway/ Chris Conway]&lt;br /&gt;
* [http://www.cs.nyu.edu/~dejan/ Dejan Jovanović]&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4407</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4407"/>
				<updated>2012-12-17T05:35:26Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Build and Install Cascade */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse or svn to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4406</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4406"/>
				<updated>2012-12-17T05:34:48Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Miscellaneous setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jdk]&lt;br /&gt;
** [http://www.oracle.com/technetwork/java/javase/downloads/index.html sun-java6-jre]&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4405</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4405"/>
				<updated>2012-12-17T05:32:56Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Miscellaneous setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** [http://maven.apache.org/download.html maven]&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4404</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4404"/>
				<updated>2012-12-17T05:32:43Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Configure mvn */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure maven ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4403</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4403"/>
				<updated>2012-12-17T05:31:47Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Miscellaneous setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** [http://eclipse.org/m2e/download/ eclipse maven plugin]&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse plugin]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4402</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4402"/>
				<updated>2012-12-17T05:30:38Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Miscellaneous setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** eclipse maven plugin&lt;br /&gt;
** [http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA subclipse]&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4401</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4401"/>
				<updated>2012-12-17T05:29:37Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Miscellaneous setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** [http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]&lt;br /&gt;
** eclipse maven plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4400</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4400"/>
				<updated>2012-12-17T05:29:25Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Miscellaneous setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** [[http://www.eclipse.org/downloads/packages/release/indigo/sr2 eclipse]]&lt;br /&gt;
** eclipse maven plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4399</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4399"/>
				<updated>2012-12-17T05:27:18Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Miscellaneous setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse maven plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4398</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4398"/>
				<updated>2012-12-17T03:51:05Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Build and Install Cascade */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc4-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc4-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc4-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4397</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4397"/>
				<updated>2012-12-17T03:50:46Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Command line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc3-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc3-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc3-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4396</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4396"/>
				<updated>2012-12-17T03:48:46Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Build and Install Cascade */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc3-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc3-plugin&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/cvc3-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd /Users/Wei/Workspace/cascade-cvc4/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/home/taking/phony_install_targets/cvc3/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4395</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4395"/>
				<updated>2012-12-17T03:46:55Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Eclipse */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc3-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc3-plugin&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/cvc3-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/home/taking/phony_install_targets/cvc3/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/Users/Wei/Workspace/cascade-cvc4/c/src/test/resources/c/test/minicase_bug/funcCall_test.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4394</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4394"/>
				<updated>2012-12-17T03:45:26Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Eclipse */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc3-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc3-plugin&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/cvc3-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/home/taking/phony_install_targets/cvc3/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; (DYLD_LIBRARY_PATH for Mac) and Value: &amp;quot;/home/taking/phony_install_targets/cvc3/lib&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/home/taking/ws/eclipse/c/target/test-classes/META-INF/syntax/swap.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4393</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4393"/>
				<updated>2012-12-17T03:44:43Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Command line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc3-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc3-plugin&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/cvc3-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc4jni library and the cvc4 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/home/taking/phony_install_targets/cvc3/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282-jar-with-dependencies.jar: \&lt;br /&gt;
  /Users/Wei/Workspace/cascade-cvc4/c/target/cascade-c-0.0.2-SNAPSHOT-r1282.jar edu.nyu.cascade.c.Main /Users/Wei/Workspace/cascade-\&lt;br /&gt;
  cvc4/c/src/test/resources/c/test/minicase_bug/minus_test.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc4-plugin/target&lt;br /&gt;
  Can't read plugins directory: /Users/Wei/Workspace/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; and Value: &amp;quot;/home/taking/phony_install_targets/cvc3/lib&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/home/taking/ws/eclipse/c/target/test-classes/META-INF/syntax/swap.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4392</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4392"/>
				<updated>2012-12-17T03:34:32Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Build and Install CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc3-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc3-plugin&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/cvc3-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc3jni library and the cvc3 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/home/taking/phony_install_targets/cvc3/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /home/taking/ws/eclipse/c/target/cascade-c-0.0.2-SNAPSHOT-r594-jar-with-dependencies.jar:/home/taking/phony_install_targets/cvc3/java/libcvc3-3.0.0.jar edu.nyu.cascade.c.Main /home/taking/ws/eclipse/c/target/test-classes/META-INF/syntax/swap.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc3-plugin/target&lt;br /&gt;
  Can't read plugins directory: /home/taking/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; and Value: &amp;quot;/home/taking/phony_install_targets/cvc3/lib&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/home/taking/ws/eclipse/c/target/test-classes/META-INF/syntax/swap.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4391</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4391"/>
				<updated>2012-12-17T03:31:24Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Using Cascade */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* For Mac, add library to the DYLD_LIBRARY_PATH in ~/.bashrc (or profile).&lt;br /&gt;
     export DYLD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$DYLD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc3-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc3-plugin&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/cvc3-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
These instructions assume you have followed the installation instructions.&lt;br /&gt;
&lt;br /&gt;
== Command line ==&lt;br /&gt;
&lt;br /&gt;
* Make sure LD_LIBRARY_PATH (DYLD_LIBRARY_PATH for Mac) includes the directory the cvc3jni library and the cvc3 library are installed&lt;br /&gt;
    export LD_LIBRARY_PATH=/home/taking/phony_install_targets/cvc3/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* If you are For the cascade &lt;br /&gt;
* The cascade tool can be run using &amp;quot;c/target/cascade.sh&amp;quot;.  Use &amp;quot;--help&amp;quot; to determine options.  This file is generated during the mvn package/install process.&lt;br /&gt;
* The cascade.sh tool does the following:&lt;br /&gt;
** Defines variables for library locations using the settings from ~/.m2/settings.xml (at the time of mvn install).&lt;br /&gt;
** Attempts to set the LD_LIBRARY_PATH variable. Note: I need to set LD_LIBRARY_PATH before cascade.sh.  The part of the shell that is intended to set this does not seem to accomplish its task.&lt;br /&gt;
** Passes the appropriate arguments to java for the correct classpath and runs the &amp;quot;edu.nyu.cascade.c.Main&amp;quot; class.&lt;br /&gt;
* As an alternative to cascade.sh, you can run java directly. An example is below.&lt;br /&gt;
  java -ea -cp /home/taking/ws/eclipse/c/target/cascade-c-0.0.2-SNAPSHOT-r594-jar-with-dependencies.jar:/home/taking/phony_install_targets/cvc3/java/libcvc3-3.0.0.jar edu.nyu.cascade.c.Main /home/taking/ws/eclipse/c/target/test-classes/META-INF/syntax/swap.ctrl&lt;br /&gt;
* If you are not in the c/ directory when you run this, you may see the warning messages:&lt;br /&gt;
  Can't read plugins directory: ../cvc3-plugin/target&lt;br /&gt;
  Can't read plugins directory: /home/taking/.cascade/plugins&lt;br /&gt;
&lt;br /&gt;
== Eclipse ==&lt;br /&gt;
&lt;br /&gt;
* In the Package Explorer, Select c &amp;gt; src/main/java &amp;gt; edu.nyu.cascade.c &amp;gt; Main.java .&lt;br /&gt;
* Right-click Main.java. Select Run As &amp;gt; Run Configurations...&lt;br /&gt;
* Select the Environment tab&lt;br /&gt;
* Click New&lt;br /&gt;
* Enter Name: &amp;quot;LD_LIBRARY_PATH&amp;quot; and Value: &amp;quot;/home/taking/phony_install_targets/cvc3/lib&amp;quot;&lt;br /&gt;
* Select the Arguments tab&lt;br /&gt;
* Add &amp;quot;-ea&amp;quot; to the VM arguments&lt;br /&gt;
* Set the Program arguments tab as you would the arguments to cascade.sh. For example: &amp;quot;--help&amp;quot; or &amp;quot;/home/taking/ws/eclipse/c/target/test-classes/META-INF/syntax/swap.ctrl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4390</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4390"/>
				<updated>2012-12-17T03:28:27Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Build and Install Cascade */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* For Mac, add library to the DYLD_LIBRARY_PATH in ~/.bashrc (or profile).&lt;br /&gt;
     export DYLD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$DYLD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
* Use eclipse to check out each of these as top level projects from the [https://subversive.cims.nyu.edu/cascade/trunk/ svn repository].&lt;br /&gt;
** c&lt;br /&gt;
** core&lt;br /&gt;
** cvc3-plugin&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;core&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/core&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
* Build &amp;quot;cvc3-plugin&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/cvc3-plugin&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
*Build &amp;quot;c&amp;quot;&lt;br /&gt;
     cd ~/ws/eclipse/c&lt;br /&gt;
     mvn package&lt;br /&gt;
     mvn install&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=~/.m2/settings.xml&amp;diff=4389</id>
		<title>~/.m2/settings.xml</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=~/.m2/settings.xml&amp;diff=4389"/>
				<updated>2012-12-17T03:26:22Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: Created page with &amp;quot;  &amp;lt;settings&amp;gt;     &amp;lt;profiles&amp;gt;       &amp;lt;profile&amp;gt;         &amp;lt;id&amp;gt;tools-builds-cvc4&amp;lt;/id&amp;gt;         &amp;lt;activation&amp;gt;           &amp;lt;activeByDefault&amp;gt;true&amp;lt;/activeByDefault&amp;gt;         &amp;lt;/activation&amp;gt;       …&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;  &amp;lt;settings&amp;gt;&lt;br /&gt;
    &amp;lt;profiles&amp;gt;&lt;br /&gt;
      &amp;lt;profile&amp;gt;&lt;br /&gt;
        &amp;lt;id&amp;gt;tools-builds-cvc4&amp;lt;/id&amp;gt;&lt;br /&gt;
        &amp;lt;activation&amp;gt;&lt;br /&gt;
          &amp;lt;activeByDefault&amp;gt;true&amp;lt;/activeByDefault&amp;gt;&lt;br /&gt;
        &amp;lt;/activation&amp;gt;&lt;br /&gt;
        &amp;lt;properties&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.version&amp;gt;4.0.0&amp;lt;/cvc4.version&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.basedir&amp;gt;/Users/Wei/Workspace/target/cvc4/&amp;lt;/cvc4.basedir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.libdir&amp;gt;/Users/Wei/Workspace/target/cvc4/lib/&amp;lt;/cvc4.libdir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.jni.libdir&amp;gt;/Users/Wei/Workspace/target/cvc4/lib/jni&amp;lt;/cvc4.jni.libdir&amp;gt;&lt;br /&gt;
          &amp;lt;cvc4.jar&amp;gt;/Users/Wei/Workspace/target/cvc4/share/java/CVC4.jar&amp;lt;/cvc4.jar&amp;gt;&lt;br /&gt;
        &amp;lt;/properties&amp;gt;&lt;br /&gt;
      &amp;lt;/profile&amp;gt;&lt;br /&gt;
    &amp;lt;/profiles&amp;gt;&lt;br /&gt;
  &amp;lt;/settings&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4388</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4388"/>
				<updated>2012-12-17T03:25:40Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Configure mvn */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* For Mac, add library to the DYLD_LIBRARY_PATH in ~/.bashrc (or profile).&lt;br /&gt;
     export DYLD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$DYLD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my [[~/.m2/settings.xml]].&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	<entry>
		<id>http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4387</id>
		<title>Cascade User Manual</title>
		<link rel="alternate" type="text/html" href="http://cvc4.stanford.edu/w/index.php?title=Cascade_User_Manual&amp;diff=4387"/>
				<updated>2012-12-17T03:24:56Z</updated>
		
		<summary type="html">&lt;p&gt;Wwang: /* Build and Install CVC4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Cascade =&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous setup ==&lt;br /&gt;
&lt;br /&gt;
* Packages that may need to be installed:&lt;br /&gt;
** sun-java6-jdk&lt;br /&gt;
** sun-java6-jre&lt;br /&gt;
** maven2&lt;br /&gt;
** eclipse 3.6.2&lt;br /&gt;
** eclipse mvn plugin&lt;br /&gt;
** subclipse plugin&lt;br /&gt;
* Until the bug is fixed!&lt;br /&gt;
** You may need to disable gnome_keyring in ~/.subversion/config. &lt;br /&gt;
** To do this set &amp;quot;password-stores = &amp;quot; .&lt;br /&gt;
&lt;br /&gt;
== Build and Install CVC4 ==&lt;br /&gt;
&lt;br /&gt;
* Please check the instructions on visit the [http://cvc4.cs.nyu.edu/wiki/User_Manual#Getting_CVC4 Getting CVC4]. Note that, the directory I used to install CVC4 is &amp;quot;/Users/Wei/Workspace/target/cvc4&amp;quot;.&lt;br /&gt;
* For Linux, add library to the LD_LIBRARY_PATH in ~/.bashrc (or profile). &lt;br /&gt;
     export LD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$LD_LIBRARY_PATH&lt;br /&gt;
* For Mac, add library to the DYLD_LIBRARY_PATH in ~/.bashrc (or profile).&lt;br /&gt;
     export DYLD_LIBRARY_PATH=/Users/Wei/Workspace/target/cvc4/lib:$DYLD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
== Configure mvn ==&lt;br /&gt;
&lt;br /&gt;
Here is a copy of my ~/.m2/settings.xml. Note that /&lt;br /&gt;
&lt;br /&gt;
== Build and Install Cascade ==&lt;br /&gt;
&lt;br /&gt;
= Using Cascade =&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
Cascade provides a number of options, and we introduce the ones often be used. The complete list of them are attached in [[cascade_options]].&lt;br /&gt;
* ''' -D, --debug''': run in debug mode.&lt;br /&gt;
* '''--counter-example''': enable counter example generation when Cascade failed to prove.&lt;br /&gt;
* '''--feasibility''': check path feasibility for runs.&lt;br /&gt;
* '''--order-alloc''': use an ordered allocation model (unsound). It assumes that there's no aliasing, overlapping between regions in the memory in an unsound way that keeps an arbitrary order of memory cells. It is enabled in the running of all the following examples.&lt;br /&gt;
* '''--sound-alloc''': use a sound allocation model (may be slow). It assumes that there's no aliasing, overlapping between regions in the memory in a sound way. However, it generates a very large formula involves many case-splitting, and thus the verification in the theorem prover maybe slow.&lt;br /&gt;
* '''--resource-limit &amp;lt;N&amp;gt;''': set resource limit for the theorem prover to N level.&lt;br /&gt;
* '''--time-limit &amp;lt;N&amp;gt;''': set time limit for the theorem prover to N sec.&lt;br /&gt;
* '''--cvc4-stats''': show statistics of the theorem prover.&lt;br /&gt;
* '''--iter-times &amp;lt;N&amp;gt;''': default iteration times of loop unrolling.&lt;br /&gt;
&lt;br /&gt;
= Control Flow Annotation =&lt;br /&gt;
&lt;br /&gt;
Instead of inserting annotations in the source code, Cascade keeps them in a control file in order to leaves the source code clean. The control file is in the simple XML format, which serves as the guidance of verification. In this section, we will introduce the elements included control files by showing how to verify some sample codes in Cascade.&lt;br /&gt;
&lt;br /&gt;
== Basic Structure ==&lt;br /&gt;
&lt;br /&gt;
Every control file starts with ''sourceFile'' sections that specify the files to be analyzed. Each source file has two attributes: ''name'' contains the path to the file, and ''fileId'' attaches a unique id to it. After ''sourceFile'', one or more ''run'' sections are specified, which describe the runs to be checked. Each run starts with a single ''startPosition'' and ''endPosition'' to give the start point and the end point respectively, and in between, one or more ''wayPoint''s may be inserted optionally to indicate the positions should be passed through.&lt;br /&gt;
&lt;br /&gt;
Let's discuss it more with a simple example [[abs.c]]. This program returns the absolute value of parameter x. &lt;br /&gt;
&lt;br /&gt;
[[abs1.ctrl]] is the control file for it, in which the ''sourceFile'' indicates the path to abs.c and assigns an id 1 for it. For the execution path to check, we simply use the start and end line number of [[abs.c]] as ''startPosition'' and ''endPosition''. Since there's a conditional statement if-else, we use a ''wayPoint'' to select one to check. Normally, a ''wayPoint'' is often the first line of the chosen code. Note that the ''fileId'' is all assigned to 1 in the ''startPosition'', ''endPosition'' and ''wayPoint'', which means these positions are all in [[abs.c]] (whose id is 1).&lt;br /&gt;
&lt;br /&gt;
As mentioned above, multiple paths can be specified in one control file. In [[abs2.ctrl]], two possible alternative runs of [[abs.c]] are considered together.&lt;br /&gt;
&lt;br /&gt;
== Function Call ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports functions by inlining. The locality of the parameters and the non-static local variables are preserved by attaching them with their scopes. Cascade can perform inlining and and thus parameters passing automatically. We'll see it in the example [[pow2.c]] and [[pow2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
If the function contains branches and loops and we need to check a specific execution path in it, the annotation ''function'' will be helpful, as shown in example [[absext.c]] and [[absext.ctrl]]. The ''function'' section is nested under the ''wayPoint'' where it is called. It has an attribute ''funcName'', whose value is name of the function, and the ''wayPoint''s of the path in that function is nested under it.&lt;br /&gt;
&lt;br /&gt;
If multiple functions are called at the same line of code, we could nested multiple ''function''s under the ''wayPoint'', and differentiate them with the attribute ''funcId'' if the ''funcName'' are same, as in [[absext2.c]] and [[absext2.ctrl]].&lt;br /&gt;
&lt;br /&gt;
== Loop ==&lt;br /&gt;
&lt;br /&gt;
Cascade supports loop unwinding, which is unrolling the loops by finite number of times. It means the user must specify a bound by the attribute ''iterTimes'' in the anotation ''loop''. Cascade will then unwind the loops up to that bound, and we can check if the number is correct or not by using option --feasibility (which is used to check the specific path is feasible or not). As an example, consider [[log2.c]] and [[log2.ctrl]] (note that the ''loop'' is nested in the ''function'').&lt;br /&gt;
&lt;br /&gt;
If there's a conditional statement inside the ''loop'', we also can specify ''wayPoint''s in it. In addition, if different rounds of iteration have different execution paths, which means we need to specify them separately, we would nested multiple ''loop''s under one ''wayPoint''. We will be clear about it with an example [[gcd.c]] and [[gcd.ctrl]].&lt;br /&gt;
&lt;br /&gt;
= Cascade Command =&lt;br /&gt;
&lt;br /&gt;
In addition to execution path, we could specify some commands in control files, which involves adding assertions, assumptions and memory allocations. These commands are in the following format:&lt;br /&gt;
  &amp;lt;command&amp;gt;&lt;br /&gt;
    &amp;lt;cascadeFunction&amp;gt; cascade_cmd &amp;lt;/cascadeFunction&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt; arg_expr1 &amp;lt;/argument&amp;gt;&lt;br /&gt;
      &amp;lt;argument&amp;gt;&amp;lt;![CDATA[&lt;br /&gt;
      arg_expr2&lt;br /&gt;
      ]]&amp;gt;&lt;br /&gt;
      &amp;lt;/argument&amp;gt;&lt;br /&gt;
  &amp;lt;/command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before we go further into specific commands, let's talk a little about the argument expressions. They are valid C expressions, and a CDATA section can be used to allow regular C syntax within the XML format document. All variables referenced in the argument expression should be in scope at this position. Besides, Cascade provides a number of C extension that can be used within argument expressions to enable more expressive reasoning.&lt;br /&gt;
* Logic implication: '''_implies(P, Q)'''. It formally means ((!P) || Q).&lt;br /&gt;
* Universal quantification: '''_forall(v, u, E)'''. It means for every value v and u, E is true. For example, the assertion&lt;br /&gt;
    x &amp;gt; 1 &amp;amp;&amp;amp; _forall(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; x, x % i != 0))&lt;br /&gt;
* Existential quantification: '''_exists(v, u, E)'''. It means for some value v and u, E is true. For example, the assertion&lt;br /&gt;
    _exists(i, _implies(1 &amp;lt; i &amp;amp;&amp;amp; i &amp;lt; N, b[i] == 0))&lt;br /&gt;
* Valid address predicate: '''_valid(p)'''. It means that p is a valid address in the memory, which has been allocated and not been freed yet.&lt;br /&gt;
    _forall(i, _implies(0 &amp;lt;= i &amp;amp;&amp;amp; i &amp;lt; N, _valid(&amp;amp;b[i])))&lt;br /&gt;
* Reachability predicate: '''_reach(f, a, b)'''. It means that ''a'' can reach ''b'' via ''f''-path. This predicate captures the unbounded number of dynamically allocated cells present in a linked list. For a given cell ''a'', it characterizes the set of cells {''a'', ''a.f'', ''a.f.f'', ...} reachable from ''u'' via ''f''-path using the transitive closure (will be discussed later in details).&lt;br /&gt;
    _implies(_reach(f, a, b) &amp;amp;&amp;amp; _reach(f, b, c), _reach(f, a, c))&lt;br /&gt;
* Heap allocation predicate: '''_allocated(p, size)'''. It is used to assume that a region with size 4 has been allocated at p. This predicate is very helpful for modular verification, particularly of a function with pointers, arrays or structures as input arguments. As an example, consider [[strlen.c]] and [[strlen.ctrl]].&lt;br /&gt;
    _allocated(str, 4*sizeof(char))&lt;br /&gt;
&lt;br /&gt;
Now, let's go through those Cascade commands. They could be added at each position in the specific run, such as start point, end point and way point. The effect of them would be same as modifying the C source file to insert the statement at the exact position.&lt;br /&gt;
&lt;br /&gt;
== Cascade_check ==&lt;br /&gt;
&lt;br /&gt;
The effect of this command is the same as the assert statement. Cascade would check if the argument expression is true at the particular position. Let's go back to the example of [[abs.c]] to see how to use it. Clearly, one desired property expected to hold at the end point of this program is&lt;br /&gt;
    result &amp;gt;= 0&lt;br /&gt;
In [[abs3.ctrl]], such expression is an argument of command ''cascade_check''. Run Cascade, it is proved to be &amp;quot;valid&amp;quot; in both runs, which means it is guaranteed to hold in both branches.&lt;br /&gt;
&lt;br /&gt;
== Cascade_assume ==&lt;br /&gt;
&lt;br /&gt;
Sometimes, we want Cascade to ignore certain cases that would otherwise lead to invalid proof, in order to narrow down the check to more specific senario. We can do it by inserting assume statement at specific points of the run in the control file, as shown in the example [[div.c]]. This program computes the quotient and remainder from the division of numerator by denominator, returning the result in a structure of type &amp;quot;div_t&amp;quot;. In the corresponding control file [[div.ctrl]], an assumption &lt;br /&gt;
    denom != 0&lt;br /&gt;
is inserted at the start point, which excludes the possiblity of division by zero. Without this assumption, Cascade would fail to prove the asserted formula. The reason behind this is that division by zero is undefined in mathematics, and thus &amp;quot;result.quote&amp;quot; is an arbitrary value. &lt;br /&gt;
    num == div_result.quot * denom + div_result.rem&lt;br /&gt;
In fact, every statement along the execution path of the program is also an assumption, and the backend theorem prover is to prove if all assumptions hold, all assertions will also hold.&lt;br /&gt;
&lt;br /&gt;
= Reachability =&lt;br /&gt;
&lt;br /&gt;
In this section, we will discuss how to use Cascade to reason about reachability of linked data structure in details. Currently, we only support reason about linked list with single field. As discussed above, the predicate '''_reach(f, a, b)''' is used to indicate that b is reachable from a by repeatedly visiting the field f, and it is the key of our reasoning. [[list.c]] contains a number of functions of singly linked list, and we give a sample control file [[list_create.ctrl]] for the first function create(). A new section ''theory'' is created after ''sourceFile'', and it defines the theory used in the reasoning. The attribute ''qname'' gives the name of the theory. In the assertion&lt;br /&gt;
  _reach(next, root, 0)&lt;br /&gt;
indicates that root can reach NULL (which defines as 0 in [[list.c]]) finally, which means that the created list is an acyclic list.&lt;/div&gt;</summary>
		<author><name>Wwang</name></author>	</entry>

	</feed>