diff --git a/README b/README
index 82bfd839952b096ba0e9e18b94f41f4e30182bf8..c77e299e970e0adeed931f3b8d92afc00275321c 100644
--- a/README
+++ b/README
@@ -1,176 +1 @@
-Yay! We moved to Git!
-
-To clean and compile everything:
-
-> sbt clean package all
-
-
-
-
-
-This README file is outdated.
-
-Don't read it unless you're looking for an excuse to procrastinate.
-
-PS
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-================================================================================
-===                             FUNCHECK PLUGIN                              ===       
-================================================================================
-
-
-COMPILE
-======================
-
-
-1 - Funcheck Plugin
-----------------------
-
-To compile the FunCheck project just type 'ant'. This will compile the 
-scala.collection.immutable.Multiset library extension created as part of this 
-project (Note: This should become a module in the future and then just have a 
-jar file with the extended multiset collection). Furthermore, it will compile 
-the internal funcheck.lib.Specs library used for declaring forAll properties 
-in the examples. Finally, it will compile the plugin, create a distribution jar 
-and also create a script 'scalac-funcheck' that should be used instead of 
-the usual 'scalac' script for compiling examples of this project.  
-
-2 - Funcheck Examples
-----------------------
-
-Examples that shows the functionality of the plugin are in the folder 'examples/plugin'
-and also (for the static verification part) in 'examples/contracts'. To compile 
-the former you should use the 'forall-tests' script, which will compile the examples
-in the 'examples/plugin' directory and will also execute them. On the other hand, if you want 
-to compile all the other examples you can simply type 'ant compile-examples'. 
-
-XXX: We should really integrate the compilation of the examples in 'examples/plugin' 
-into the 'forall-tests' script. However, this is not working right now (getting to 
-crash the plugin extension when compile inside ant, while compilation outside ant works 
-just fine. 
-
-3 - Running Funcheck
-----------------------
-
-When the 'forall-tests' is launched, it will first compiles the examples in 'examples/plugin' 
-and then it will execute them one after the other. You should see a similar output when the test
-succeed:
-
-+ OK, passed 100 tests.     //Nice!! This means the property was ok!
-
-and this when it fails:
-
-! Falsified after 1 passed tests.     //Ops, the property has been falsified                                        
-> ARG_0: "1"
-java.lang.ExceptionInInitializerError
-	[...]
-	
-
-4 - Tests
-----------------------
-
-the 'tests' directory contains some unit tests for the examples and, most interestingly, 
-an extensive test of the multiset collection library created as part of this project.  
-
-
-================================================================================
-
-OLD README:
-
-Use:
-    ant
-
-...to compile the project.
-
-Use:
-    ant dist
-
-...to generate the plugin jar file and a script to run scalac with the plugin.
-
-Then, try for instance:
-    ./scalac-funcheck -Xshow-phases
-
-...and notice that funcheck runs right after refchecks. Note that
-./scalac-funcheck is generated and contains the full path to the jar file, so
-you can use it from any location and it will find what it needs. You may want
-to symbolically link to it from ~/bin, for instance.
-
-You can also try:
-    ./scalac-funcheck -Xplugin-list
-
-Try:
-    ./scalac-funcheck Test.scala
-
-...and notice that the plugin does something (in particular, the compilation
-stops right after the plugin).
-
-Try:
-    ./scalac-funcheck -P:funcheck:with-code Test.scala
-
-...to achieve the same result but with letting the compiler continue its work.
-
-To clean up:
-    ant clean
-
-Useful for showing Scala AST
------------------------------
-
-Try:
-   ./scalac-funcheck -Yshow-trees -Xprint:funcheck Test.scala
-
-...to print the program's AST on the standard output
-
-Try:
-   ./scalac-funcheck -Ybrowse:funcheck Test.scala
-
-...to print a Swing-based GUI for browsing the program's AST
-
-
-
-ForAll Transformation: How does it work
------------------------------
-
-First, look at Test4.scala to get an idea of how we can declare properties using "our" Spec library (which has a forAll combinator)
-
-Second, compile the whole project if you didn't yet (simply type: ant)
-
-Third, compile the Test4.scala using scalac extended with the funcheck plugin. You can do this by typing:
-    ./scalac-funcheck -cp bin:lib/ScalaCheck-1.5.jar  Test4.scala 
-
-Now run the compiled program using standard the scala environment as follow:
-    scala -cp lib/ScalaCheck-1.5.jar:. HeapTest
-
-And you should see a similar output:
-
-+ OK, passed 100 tests.     //Nice!! This means the property was ok!
-                                                  
-! Falsified after 1 passed tests.     //Good, The property was indeed wrong                                        
-> ARG_0: "1"
-java.lang.ExceptionInInitializerError
-	[...]
-
-
-Note: The ScalaCheck-1.5.jar library needs to be in the classpath for both compilation and execution because the FunCheck 
-plugin rely on it for transforming every Spec.forAll (internal to our library) call to a scalacheck Prop.forAll call. 
+Trying to clean the slate.
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 6835610fb5a53210c30e3382b46d2f351cb8fb98..0000000000000000000000000000000000000000
--- a/build.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<project name="FunCheck" default="deprecationwarning" basedir=".">
-    <description>
-        Build file for the compiler plugin of the FunCheck project.
-    </description>
-
-    <!-- The settings can be overridden in local.properties. -->
-    <property environment="env" />
-    <property name="scala.home" value="${env.SCALA_HOME}" />
-    <property name="scala-library.jar" value="${scala.home}/lib/scala-library.jar" />
-    <property name="scala-compiler.jar" value="${scala.home}/lib/scala-compiler.jar" />
-
-    <!-- paths -->
-    <property name="base.dir" value="${basedir}" /> 
-    <property name="sources.dir" value="${base.dir}/src" />
-    <property name="examples.dir" value="${base.dir}/examples" />
-    <!-- <property name="tests.dir" value="${base.dir}/tests" /> -->
-    <property name="dist.dir" value="${base.dir}/dist" />
-    <property name="lib.dir" value="${basedir}/lib" /> 
-    <property name="lib-bin.dir" value="${basedir}/lib-bin" />
-    <property name="build.dir" value="${base.dir}/bin" />
-
-    <property name="build.plugin.funcheck.dir" value="${build.dir}/plugin" />
-    <property name="build.funcheck.lib.dir" value="${build.dir}/lib" />
-    <!-- <property name="build.scala.lib.extension.dir" value="${build.dir}/scala" /> -->
-    <!-- <property name="build.examples.dir" value="${build.dir}/examples" /> -->
-    <!-- <property name="build.tests.dir" value="${build.dir}/tests" /> -->
-
-
-    <!-- other properties -->
-    <property name="dist.jar" value="${dist.dir}/funcheck-plugin.jar" />
-    <property name="main.class" value="funcheck.DefaultMain" />
-    <property name="script.file" value="${base.dir}/scalac-funcheck" />
-    <property name="scalac.default.params" value="-deprecation -unchecked" />
-    <property name="scalac.funcheck.plugin" value="-Xplugin:${dist.jar} ${scalac.default.params}"/> 
-
-    <!-- required to use the tasks scalac, fsc and scaladoc -->
-    <taskdef resource="scala/tools/ant/antlib.xml">
-        <classpath>
-            <pathelement location="${scala-compiler.jar}"  />
-            <pathelement location="${scala-library.jar}"  />
-        </classpath>
-    </taskdef>
-
-    <!-- classpath definitions -->
-    <path id="scalac.class.path">
-        <pathelement location="${scala-library.jar}"  />
-        <pathelement location="${scala-compiler.jar}"  />
-    </path>
-
-    <path id="funcheck.lib.path">
-        <pathelement location="${build.funcheck.lib.dir}"/>
-    </path>
-
-    <!--
-    <path id="scala.lib.extension.path">
-        <pathelement location="${build.scala.lib.extension.dir}"/>
-    </path>
-    -->
-
-    <path id="build.path">
-        <path refid="scalac.class.path"/>
-        <!-- <path refid="funcheck.lib.path"/> -->
-        <pathelement location="${lib.dir}/z3.jar"/>
-        <!-- <pathelement location="${build.plugin.funcheck.dir}"  /> -->
-    </path>
-
-    <!--
-    <path id="scalacheck.lib.path">
-        <pathelement location="${lib.dir}/ScalaCheck-1.5.jar"/>
-    </path>
-    -->
-
-    <!--
-    <path id="test.lib.path">
-        <path refid="scalacheck.lib.path"/>
-        <pathelement location="${lib.dir}/scalatest-0.9.5.jar" />
-        <pathelement location="${lib.dir}/specs-1.5.0.jar" />
-    </path>
-    -->
-
-    <!-- phases definitions -->
-    <!-- <target name="compile-funcheck-lib" description="compile the FunCheck library (used for specification)">
-        <mkdir dir="${build.funcheck.lib.dir}"  />
-        <scalac srcdir="${sources.dir}" destdir="${build.funcheck.lib.dir}" force="changed" addparams="${scalac.default.params}">
-            <classpath>
-                <path refid="scalac.class.path" />
-            </classpath>
-            <include name="funcheck/lib/**/*.scala"  />
-        </scalac>
-    </target>
-    -->
-
-    <!--
-    <target name="compile-scalac-lib-extension" description="compile Scala library extension for immutable Multiset">
-        <mkdir dir="${build.scala.lib.extension.dir}"  />
-        <scalac srcdir="${sources.dir}" destdir="${build.scala.lib.extension.dir}" force="changed" addparams="${scalac.default.params}">
-            <classpath refid="scalac.class.path" />
-            <include name="scala/collection/**/*.scala"  />
-        </scalac>
-    </target>
-    -->
-
-    <!-- <target name="compile" depends="compile-funcheck-lib" description="compile the FunCheck plugin"> -->
-    <target name="compile" description="compile the FunCheck plugin" depends="deprecationwarning">
-        <echo message="I refuse to work. Use sbt." />
-        <!--
-        <mkdir dir="${build.plugin.funcheck.dir}"  />
-        <scalac srcdir="${sources.dir}" destdir="${build.plugin.funcheck.dir}" force="changed" addparams="${scalac.default.params}">
-            <classpath>
-                <path refid="build.path" />
-            </classpath>
-            <exclude name="scala/collection/**/*"/>
-            <exclude name="funcheck/lib/**/*"/>
-            <exclude name="funcheck/scalacheck/**/*" />
-        </scalac>
-        -->
-    </target>
-
-    <target name="deprecationwarning" description="a warning everyone should get">
-        <echo message="WARNING: YOU SHOULD NOT USE ant TO COMPILE THIS PROJECT ANYMORE. USE sbt INSTEAD AND RUN FOR INSTANCE sbt package all." />
-    </target>
-
-    <target name="dist" depends="compile,deprecationwarning" description="build the FunCheck jar file and create the script file used to run scalac with FunCheck plugged-in">
-        <echo message="I refuse to work. Use sbt." />
-        <!--
-        <mkdir dir="${dist.dir}" />
-
-        <manifest file="${dist.dir}/MANIFEST.MF">
-            <attribute name="Built-By" value="lara.epfl.ch" />
-            <attribute name="Main-Class" value="${main.class}" />
-        </manifest>
-
-        <jar destfile="${dist.jar}" manifest="${dist.dir}/MANIFEST.MF">
-            <fileset dir="${build.plugin.funcheck.dir}" />
-            <fileset file="./scalac-plugin.xml" />
-        </jar>
-
-        <echo file="${script.file}" message="#!/bin/sh${line.separator}LD_LIBRARY_PATH=${lib-bin.dir} java -Dscala.home=${scala.home} -classpath ${scala-library.jar}:${scala-compiler.jar}:${distjar}:${lib.dir}/z3.jar scala.tools.nsc.Main -Xplugin:${dist.jar} $@${line.separator}" />
-        <chmod file="${script.file}" perm="u+x" />
-        -->
-    </target>
-
-    <!--
-    <target name="compile-examples" depends="dist" description="compile the examples">
-        <mkdir dir="${build.examples.dir}" />    	
-        <scalac srcdir="${examples.dir}" destdir="${build.examples.dir}" force="changed" 
-            addparams="${scalac.default.params}">
-            < ! - - addparams="${scalac.funcheck.plugin}" crashes for some unknown reason - - >
-            <classpath>
-                <path refid="scalac.class.path" />
-                <path refid="scala.lib.extension.path" />
-                <path refid="funcheck.lib.path" />
-                <path refid="scalacheck.lib.path" />
-            </classpath>
-        </scalac>
-    </target>
-
-    <target name="compile-all" depends="compile-tests" description="compile FunCheck, create a distribution file, compile examples and tests" />
-
-    <target name="compile-tests" depends="compile-examples" description="compile the tests suite">
-        <mkdir dir="${build.tests.dir}"  />
-        <scalac srcdir="${tests.dir}" destdir="${build.tests.dir}" force="changed" addparams="${scalac.default.params}">
-            <classpath>
-                <path refid="scala.lib.extension.path" />
-                <path refid="test.lib.path" />
-                <path refid="build.path" />
-                <pathelement location="${build.examples.dir}"/>
-            </classpath>
-        </scalac>
-    </target>
-
-    <target name="run-test" depends="compile-tests"
-        description="run a test (test name is provided by the user)">
-        <input message="Please enter the name of the test you want to run
-            (e.g., package_name.ClassName)"
-            addproperty="test.name"
-            />
-
-        <echo message="- - running test ${test.name}."/>
-        <java classname="scala.tools.nsc.MainGenericRunner" fork="true">
-            <classpath>
-                <path refid="scala.lib.extension.path" />
-                <path refid="test.lib.path" />
-                <path refid="build.path" />
-                <pathelement location="${build.examples.dir}"/>
-                <pathelement location="${build.tests.dir}"/>
-            </classpath>
-            <arg line="${test.name}" />
-        </java>
-    </target>
-    -->
-
-    <target name="clean" description="clean the project space" depends="deprecationwarning">
-        <echo message="I refuse to work. Use sbt." />
-        <!--
-        <delete file="${script.file}" quiet="yes" failonerror="no" />
-        <delete dir="${build.dir}" includeemptydirs="yes" quiet="yes" failonerror="no" />
-        <delete dir="${dist.dir}" includeemptydirs="yes" quiet="yes" failonerror="no" />
-        <delete>
-            <fileset dir="${basedir}" includes="**/*.class" />
-        </delete>
-        -->
-    </target>
-
-    <target name="new" description="clean and rebuilds" depends="clean, dist, deprecationwarning" />
-</project>
diff --git a/cav2011-testcases/Debug.scala b/cav2011-testcases/Debug.scala
deleted file mode 100644
index 4fc8c01f5be24d6932a781482e9e80177e395525..0000000000000000000000000000000000000000
--- a/cav2011-testcases/Debug.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-import funcheck.Utils._
-import funcheck.Annotations._
-import scala.annotation.tailrec
-
-object Debug {
-  sealed abstract class List
-  case class Nil() extends List
-  case class Cons(head: Int, tail: List) extends List
-
-  def size1(list: List) : Int = {
-    list match {
-      case Nil() => 0
-      case Cons(_, xs) => 1 + size1(xs)
-    }
-  } ensuring(_ >= 0)
-
-  def size2(list: List) : Int = {
-    sizeTailRec(list, 0)
-  }
-
-  def identity(list: List) : List = list
-  
-  def zero() : Int = 0
-
-  def sizeTailRec(list: List, acc: Int) : Int = {
-    require(acc >= 0)
-    list match {
-      case Nil() => acc
-      case Cons(_, xs) => sizeTailRec(xs, acc + 1)
-    }
-  } ensuring(_ == acc + size1(list))
-
-  def sizesAreTheSame(list: List) : Boolean = {
-    size1(list) == size2(list)
-  } holds
-
-  def bug(list: List) : Boolean = {
-    list match {
-      case Nil() => true
-      case Cons(_,_) => size1(list) == size2(list) + 1
-    }
-  } holds
-}
diff --git a/cav2011-testcases/RedBlackTree.scala b/cav2011-testcases/RedBlackTree.scala
deleted file mode 100644
index d6d447e65ab07fc97e3fa73ef791a166a6ce9c6f..0000000000000000000000000000000000000000
--- a/cav2011-testcases/RedBlackTree.scala
+++ /dev/null
@@ -1,112 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Annotations._
-
-object RedBlackTree { 
-  sealed abstract class Color
-  case class Red() extends Color
-  case class Black() extends Color
- 
-  sealed abstract class Tree
-  case class Empty() extends Tree
-  case class Node(color: Color, left: Tree, value: Int, right: Tree) extends Tree
-
-  def content(t: Tree) : Set[Int] = t match {
-    case Empty() => Set.empty
-    case Node(_, l, v, r) => content(l) ++ Set(v) ++ content(r)
-  }
-
-  def size(t: Tree) : Int = t match {
-    case Empty() => 0
-    case Node(_, l, v, r) => size(l) + 1 + size(r)
-  }
-
-  /* We consider leaves to be black by definition */
-  def isBlack(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(),_,_,_) => true
-    case _ => false
-  }
-
-  def redNodesHaveBlackChildren(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(), l, _, r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-    case Node(Red(), l, _, r) => isBlack(l) && isBlack(r) && redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-  }
-
-  def redDescHaveBlackChildren(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(_,l,_,r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-  }
-
-  def ins(x: Int, t: Tree): Tree = {
-    require(redNodesHaveBlackChildren(t))
-    t match {
-      case Empty() => Node(Red(),Empty(),x,Empty())
-      case Node(c,a,y,b) =>
-        if      (x < y)  balance(c, ins(x, a), y, b)
-        else if (x == y) Node(c,a,y,b)
-        else             balance(c,a,y,ins(x, b))
-    }
-  } ensuring (res => content(res) == content(t) ++ Set(x) 
-                   && size(t) <= size(res) && size(res) <= size(t) + 1
-                   && redDescHaveBlackChildren(res)
-                   )
-
-  def makeBlack(n: Tree): Tree = {
-    require(redDescHaveBlackChildren(n))
-    n match {
-      case Node(Red(),l,v,r) => Node(Black(),l,v,r)
-      case _ => n
-    }
-  } ensuring(redNodesHaveBlackChildren(_))
-
-  def add(x: Int, t: Tree): Tree = {
-    require(redNodesHaveBlackChildren(t))
-    makeBlack(ins(x, t))
-  } ensuring (res => content(res) == content(t) ++ Set(x) && redNodesHaveBlackChildren(res))
-  
-  def buggyAdd(x: Int, t: Tree): Tree = {
-    require(redNodesHaveBlackChildren(t))
-    //makeBlack(ins(x, t))
-    ins(x, t)
-  } ensuring (res => content(res) == content(t) ++ Set(x) && redNodesHaveBlackChildren(res))
-  
-  def balance(c: Color, a: Tree, x: Int, b: Tree): Tree = {
-    //require(
-    //  Node(c,a,x,b) match {
-    //    case Node(Black(),Node(Red(),Node(Red(),a,_,b),_,c),_,d) =>
-    //      redNodesHaveBlackChildren(a) &&
-    //      redNodesHaveBlackChildren(b) &&
-    //      redNodesHaveBlackChildren(c) &&
-    //      redNodesHaveBlackChildren(d)
-    //    case Node(Black(),Node(Red(),a,_,Node(Red(),b,_,c)),_,d) =>
-    //      redNodesHaveBlackChildren(a) &&
-    //      redNodesHaveBlackChildren(b) &&
-    //      redNodesHaveBlackChildren(c) &&
-    //      redNodesHaveBlackChildren(d)
-    //    case Node(Black(),a,_,Node(Red(),Node(Red(),b,_,c),_,d)) => 
-    //      redNodesHaveBlackChildren(a) &&
-    //      redNodesHaveBlackChildren(b) &&
-    //      redNodesHaveBlackChildren(c) &&
-    //      redNodesHaveBlackChildren(d)
-    //    case Node(Black(),a,_,Node(Red(),b,_,Node(Red(),c,_,d))) => 
-    //      redNodesHaveBlackChildren(a) &&
-    //      redNodesHaveBlackChildren(b) &&
-    //      redNodesHaveBlackChildren(c) &&
-    //      redNodesHaveBlackChildren(d)
-    //    case t => redDescHaveBlackChildren(t)
-    //  }
-    //)
-    Node(c,a,x,b) match {
-      case Node(Black(),Node(Red(),Node(Red(),a,xV,b),yV,c),zV,d) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),Node(Red(),a,xV,Node(Red(),b,yV,c)),zV,d) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),a,xV,Node(Red(),Node(Red(),b,yV,c),zV,d)) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),a,xV,Node(Red(),b,yV,Node(Red(),c,zV,d))) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(c,a,xV,b) => Node(c,a,xV,b)
-    }
-  } ensuring (res => content(res) == content(Node(c,a,x,b)) )//&& redDescHaveBlackChildren(res))
-}
diff --git a/clp/Demo.scala b/clp/Demo.scala
deleted file mode 100644
index 497aec80cdfba7b760623db7a10efa6817baa011..0000000000000000000000000000000000000000
--- a/clp/Demo.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-object Demo {
-  sealed abstract class List
-  case class Cons(head: Int, tail: List) extends List
-  case class Nil() extends List
-
-  def size(l: List) : Int = (l match {
-    case Nil() => 0
-    case Cons(x, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def sz(l: List) : Boolean = {
-    size(l) == 0
-  } ensuring(_ == true)
-
-  def f(x: Int) : Boolean = {
-    x > 4
-  } ensuring(x => x)
-}
diff --git a/clp/IntSynth.scala b/clp/IntSynth.scala
deleted file mode 100644
index 6113da1ef67cc27198e09b3e3755fbbee915a9c7..0000000000000000000000000000000000000000
--- a/clp/IntSynth.scala
+++ /dev/null
@@ -1,52 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Annotations._
-import funcheck.Utils._
-
-object IntSynth {
-
-  // What could this be?
-
-  def specT(time : Int, h : Int, m : Int, s : Int) : Boolean = {
-    require(0 <= time)
-    time == 3600 * h + 60 * m + s &&
-    0 <= h && 
-    0 <= m && m < 60 &&
-    0 <= s && s < 60
-  }
-  def f200(h : Int, m : Int, s : Int) : Boolean = {
-    !specT(10000, h, m, s)
-  } holds
-
-  // Square root
-
-  def specSqr(x : Int, y : Int) : Boolean = {
-    require (0 <= y)
-    x*x <= y && (x+1)*(x+1) > y
-  }
-  def sqrt100(x : Int) : Boolean = {
-    !specSqr(x, 1000)
-  } holds
-
-  // Sketching
-
-  def mySquare(x : Int, q1 : Int, q2 : Int, q3 : Int) : Int = {
-    require (x >= 0)
-    if (x <= 1) x + q1
-    else q2*x + mySquare(x - 2, q1,q2,q3) + q3
-  }
-
-  def shouldSquare(q1 : Int, q2 : Int, q3 : Int) : Boolean = {
-    !(mySquare(3,q1,q2,q3)==9 &&
-      mySquare(4,q1,q2,q3)==16 &&
-      mySquare(5,q1,q2,q3)==25)
-  } holds
-
-  def mySquareSketched(x : Int) : Int = {
-    require (x >= 0)
-    if (x <= 1) x
-    else 4 * x + mySquareSketched(x - 2) - 4
-  } ensuring(res => specSqr(x, res))
-
-  //def gotThis(x : Int) = mySquare(x, 0, 4, -4)
-  //println(gotThis(10)) --> 100
-}
diff --git a/cp-compile b/cp-compile
deleted file mode 100755
index e0edd3db6a4a5c5935d6a913cbe6608a7abdb837..0000000000000000000000000000000000000000
--- a/cp-compile
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-runner="./scalac-cp"
-newargs=""
-
-for arg in $@
-do
-    if [ -e ${arg} ]
-    then
-        newargs="${newargs} ${arg}"
-    else
-        newargs="${newargs} -P:constraint-programming:${arg}"
-    fi
-done
-
-if [ -e ${runner} ]
-then
-    ${runner} ${newargs}
-else
-    echo "${runner} not found. Have you run 'sbt all' ?"
-    exit 1
-fi
diff --git a/cp-demo/ACMDLExamples.scala b/cp-demo/ACMDLExamples.scala
deleted file mode 100644
index 1a095275d4cc6e10bc8492e20e0f99550c434e88..0000000000000000000000000000000000000000
--- a/cp-demo/ACMDLExamples.scala
+++ /dev/null
@@ -1,293 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-import cp.LTrees._
-
-// This file contains examples from the paper:
-//     A.S. Köksal, V. Kuncak, P. Suter, "Constraints as Control", POPL 2012
-//   as well as some more.
-// The file should be compiled and run with Scala 2.9+ along with the Kaplan
-// plugin.
-
-object ACMDLExamples extends App {
-  def p(str : String, a : =>Any) : Unit = {
-    println(str + " : " + a.toString)
-  }
-
-  trait Demo {
-    val name : String
-    def action : Unit
-    def run : Unit = {
-      println("*** Running " + name + " ***")
-      action
-    }
-  }
-
-  object Initial extends Demo {
-    val name = "first examples"
-    val c1 : Constraint2[Int,Int] = ((x : Int, y : Int) => 2 * x + 3 * y == 10 && x >= 0 && y >= 0)
-    def action : Unit = {
-      p("c1(2,1)", c1(2,1))
-      p("c1(5,0)", c1(5,0))
-      p("c1.solve", c1.solve)
-      p("c1.findAll.toList", c1.findAll.toList)
-      p("bounded(3).findAll.toList", bounded(3).findAll.toList)
-    }
-  }
-  Initial.run
-
-  def bounded(m : Int) : Constraint1[Int] = ((x : Int) => x >= 0 && x <= m)
-
-  object Matrices extends Demo {
-    val name = "unimodular matrices"
-    def boundedQ(m : Int) : Constraint4[Int,Int,Int,Int] = {
-      ((x : Int, y : Int, z : Int, u : Int) =>
-        x >= 0 && x <= m &&
-        y >= 0 && y <= m &&
-        z >= 0 && z <= m &&
-        u >= 0 && u <= m)
-    }
-  
-    @spec def det(a : Int, b : Int, c : Int, d : Int) : Int = a*d - b*c
-    @spec def isUnimodular(a : Int, b : Int, c : Int, d : Int) : Boolean = {
-      val dt = det(a,b,c,d)
-      dt == 1 || dt == -1
-    }
-  
-    def inverse(a : Int, b : Int, c : Int, d : Int) : Option[(Int,Int,Int,Int)] = 
-      ((x: Int, y: Int, z: Int, u: Int) =>
-        a*x+b*z == 1 && 
-        a*y+b*u == 0 &&
-        c*x+d*z == 0 &&
-        c*y+d*u == 1).find
-  
-    def boundedUnimodular(m : Int) = {
-      boundedQ(m) && (isUnimodular _)
-    }
-  
-    def action : Unit = {
-      p("Unimodular count", (0 to 5).map(boundedUnimodular(_).findAll.size).toList)
-      p("boundedUnimodular(2).findAll.take(5).foreach.println(_))", boundedUnimodular(2).findAll.take(5).toList.map(_.toString))
-      p("inverse of(4,5,3,4): ", inverse(4,5,3,4))
-      p("inverse of(4,5,3,0): ", inverse(4,5,3,0))
-    }
-  }
-  Matrices.run
-
-  object SatSolving extends Demo {
-    val name = "sat solving"
-    def satSolve(problem : Seq[Seq[Int]]) = {
-      problem.map(l => l.map(i => {
-        val id = scala.math.abs(i)
-        val isPos = i > 0
-        val c : Constraint1[Map[Int,Boolean]] = ((m : Map[Int,Boolean]) => m(id) == isPos)
-        c
-      }).reduceLeft(_ || _)).reduceLeft(_ && _).find
-    }
-
-    def action : Unit = {
-      println("satSolve(p)", satSolve(Seq(Seq(1,-2,-3), Seq(2,3,4), Seq(-1,-4))))
-      println("satSolve(Seq(Seq(1,2), Seq(-1), Seq(-2)))", satSolve(Seq(Seq(1,2), Seq(-1), Seq(-2))))
-    }
-  }
-  SatSolving.run
-
-  object Knapsack extends Demo {
-    val name = "knapsack"
-
-    def action : Unit = {
-      val values  : List[Int] = List(4, 2, 2, 1, 10)
-      val weights : List[Int] = List(12, 1, 2, 1, 4)
-      val maxWeight : Int = 15
-
-      def conditionalSumTerm(values : List[Int]) : IntTerm1[Map[Int,Boolean]] = {
-        values.zipWithIndex.map(pair => {
-          val (value,index) = pair
-          ((m : Map[Int,Boolean]) => (if(m(index)) value else 0)).i
-        }).reduceLeft(_ + _)
-      }
-      val valueFunction = conditionalSumTerm(values.map(x => -x))
-      val weightFunction = conditionalSumTerm(weights)
-      val answer = ((x : Int) => x <= maxWeight)
-        .compose0(weightFunction)
-        .minimizing(valueFunction)
-        .find
-
-      p("Knapsack map", answer)
-    }
-  }
-  Knapsack.run
-
-  object Primes extends Demo {
-    val name = "prime numbers"
-
-    @spec def divides(i : Int, j : Int) : Boolean = i * (j / i) == j
-    @spec def noneDivides(from : Int, j : Int) : Boolean = {
-      if(from == j) {
-        true
-      } else {
-        !divides(from, j) && noneDivides(from+1, j)
-      }
-    }
-    @spec def isPrime(i : Int) : Boolean = (i >= 2 && noneDivides(2, i))
-  
-    val primes = (isPrime(_:Int)) minimizing((x:Int) => x) findAll
-  
-    def action : Unit = {
-      println("Primes")
-      primes.take(10).foreach(println(_))
-    }
-  }
-  Primes.run
-
-  object RedBlackTrees extends Demo {
-    val name = "red-black trees"
-
-    @spec sealed abstract class Color
-    @spec case class Red() extends Color
-    @spec case class Black() extends Color
-    
-    @spec sealed abstract class Tree
-    @spec case class Node(c : Color, l : Tree, v : Int, r : Tree) extends Tree
-    @spec case class Leaf() extends Tree
-
-    @spec sealed abstract class OptionInt
-    @spec case class SomeInt(v : Int) extends OptionInt
-    @spec case class NoneInt() extends OptionInt
-
-    @spec def size(t : Tree) : Int = (t match {
-      case Leaf() => 0
-      case Node(_, l, _, r) => 1 + size(l) + size(r)
-    }) ensuring(_ >= 0)
-
-    @spec def blackBalanced(t : Tree) : Boolean = t match {
-      case Node(_,l,_,r) => blackBalanced(l) && blackBalanced(r) && blackHeight(l) == blackHeight(r)
-      case Leaf() => true
-    }
-
-    @spec def isBlack(t: Tree) : Boolean = t match {
-      case Leaf() => true
-      case Node(Black(),_,_,_) => true
-      case _ => false
-    }
-  
-    @spec def redNodesHaveBlackChildren(t: Tree) : Boolean = t match {
-      case Leaf() => true
-      case Node(Black(), l, _, r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-      case Node(Red(), l, _, r) => isBlack(l) && isBlack(r) && redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-    }
-
-    @spec def blackHeight(t : Tree) : Int = t match {
-      case Leaf() => 0
-      case Node(Black(), l, _, _) => blackHeight(l) + 1
-      case Node(Red(), l, _, _) => blackHeight(l)
-    }
-
-    @spec def validColoring(t : Tree) : Boolean = {
-      isBlack(t) && redNodesHaveBlackChildren(t) && blackBalanced(t) 
-    }
-
-    @spec def valuesWithin(t : Tree, bound : Int) : Boolean = t match {
-      case Leaf() => true
-      case Node(_,l,v,r) => 0 < v && v <= bound && valuesWithin(l,bound) && valuesWithin(r,bound)
-    }
-
-    @spec def orderedKeys(t : Tree) : Boolean = orderedKeys(t, NoneInt(), NoneInt())
-
-    @spec def orderedKeys(t : Tree, min : OptionInt, max : OptionInt) : Boolean = t match {
-      case Leaf() => true
-      case Node(c,a,v,b) =>
-        val minOK = 
-          min match {
-            case SomeInt(minVal) =>
-              v > minVal
-            case NoneInt() => true
-          }
-        val maxOK =
-          max match {
-            case SomeInt(maxVal) =>
-              v < maxVal
-            case NoneInt() => true
-          }
-        minOK && maxOK && orderedKeys(a, min, SomeInt(v)) && orderedKeys(b, SomeInt(v), max)
-    }
-
-    @spec def validTree(t : Tree) : Boolean = {
-      validColoring(t) && orderedKeys(t) 
-    }
-
-    def action : Unit = {
-      (1 to 3).foreach(i => {
-        val num = ((t : Tree) => validTree(t) && valuesWithin(t,i) && size(t) == i).findAll.size
-        p("# of RBTs with " + i + " distinct els", num)
-      })
-    }
-  }
-  RedBlackTrees.run
-
-  object SendMoreMoney extends Demo {
-    val name = "SEND+MORE=MONEY"
-
-    def asserting(c : Constraint0) : Unit = {
-      var entered = false
-      for(i <- c.lazyFindAll) {
-        entered = true
-      }
-      if(!entered) { throw new Exception("Asserting failed.") }
-    }
-
-    def action : Unit = {
-      val anyInt : Constraint1[Int] = ((n : Int) => true)
-
-      val letters @ Seq(s,e,n,d,m,o,r,y) = Seq.fill(8)(anyInt.lazySolve)
-
-      for(l <- letters) {
-        asserting(l >= 0 && l <= 9) 
-      }
-
-      asserting(s >= 1)
-      asserting(m >= 1) 
-
-      when(distinct[Int](s,e,n,d,m,o,r,y)) {
-        println("Letters now have distinct values.")
-      } otherwise {
-        println("Letters can't have distinct values.")
-      }
-
-      val fstLine = anyInt.lazySolve
-      val sndLine = anyInt.lazySolve
-      val total = anyInt.lazySolve
-
-      asserting(fstLine == 1000*s + 100*e + 10*n + d)
-      asserting(sndLine == 1000*m + 100*o + 10*r + e)
-      asserting(total   == 10000*m + 1000*o + 100*n + 10*e + y)
-      when(total == fstLine + sndLine) {
-        println("The puzzle has a solution : " + letters.map(_.value) + " (" + fstLine.value + " + " + sndLine.value + " = " + total.value + ")")
-      } otherwise {
-        println("The puzzle has no solution.")
-      }
-    }
-  }
-  SendMoreMoney.run
-
-  object Calendar extends Demo {
-    // Declaratively computes a year and extra number of days since January first 1980.
-    // A piece of (imperative) code performing the same computation was responsible
-    // for a bug in a popular Mp3 player.
-  
-    val name = "Date computation"
-
-    final val totalDays = 10593
-    final val originYear = 1980
-  
-    @spec def leapDaysUntil(y: Int) = (y - 1) / 4 - (y - 1) / 100 + (y - 1) / 400
-  
-    val (year, day) = ((year: Int, day: Int) => 
-      totalDays == (year - originYear) * 365 + leapDaysUntil(year) - leapDaysUntil(originYear) + day &&
-      day > 0 && day <= 366).solve
-  
-    def action : Unit = {
-      println("Year : %d, day : %d" format (year, day))
-    }
-  }
-  Calendar.run
-}
diff --git a/cp-demo/Assuming.scala b/cp-demo/Assuming.scala
deleted file mode 100644
index 6180393d7e7c057bc744aa011064ad360ffe2ebb..0000000000000000000000000000000000000000
--- a/cp-demo/Assuming.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object Assuming {
-  def main(args: Array[String]): Unit = {
-    for (x <- ((x: Int) => x >= 0 && x < 4).lazyFindAll) {
-      when (x < 3) {
-        println("I'm assuming x is less than three")
-      }
-
-      println(when(x < 2) {
-        "furthermore, less than two"
-      } otherwise {
-        "ok, not less than two"
-      })
-
-      val anInt: Int = when (x < 1) { 42 }
-
-      // cif (x <= 1) {
-      //   println(x)
-      //   println("hi")
-      // } celse {
-      //   println(x)
-      //   println("hola")
-      // }
-
-      // assuming(x == 0) {
-      //   println(x)
-      //   println("I assume this was zero!")
-      // }
-    }
-  }
-}
diff --git a/cp-demo/BinarySortedLists.scala b/cp-demo/BinarySortedLists.scala
deleted file mode 100644
index 17d8862109810c520db79af9734923b30479cc2f..0000000000000000000000000000000000000000
--- a/cp-demo/BinarySortedLists.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object BinarySortedLists {
-  def main(args : Array[String]) : Unit = {
-    val inRange : Constraint1[Int] = ((x : Int) => x >= 0 && x <= 1)
-  
-    val sortedLists =
-      for(x <- inRange.lazyFindAll;
-        y <- inRange.lazyFindAll if y >= x;
-        z <- inRange.lazyFindAll if z >= y)
-      yield {
-        x.value; y.value; z.value;  
-        List(x, y, z)
-      }
-  
-    sortedLists.foreach(println(_))
-  }
-}
diff --git a/cp-demo/BuildingListConstraints.scala b/cp-demo/BuildingListConstraints.scala
deleted file mode 100644
index 31d91a5bda20f54c990dc2dd1c5f949e53173165..0000000000000000000000000000000000000000
--- a/cp-demo/BuildingListConstraints.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-@spec object Specs {
-  abstract class List
-  case class Cons(head : Int, tail : List) extends List
-  case class Nil() extends List
-
-  def size(l: List) : Int = (l match {
-      case Nil() => 0
-      case Cons(_, t) => 1 + size(t)
-  }) ensuring(res => res >= 0)
-}
-
-object FirstClassConstraints {
-  import Specs._
-
-  def oneOf(lst : Seq[Int]) : Constraint1[Int] = lst match {
-   case Seq() => (x : Int) => false
-   case Seq(c, cs @ _*) => ((x : Int) => x == c) || oneOf(cs)
-  }
-
-  
-  def hasSize(size : Int) : Constraint1[List] = {
-    if (size <= 0)
-      (l : List) => l == Nil()
-    else {
-      ((l : List) => l != Nil()) && hasSize(size - 1).compose0((l : List) => l match { case Cons(_,xs) => xs ; case x => x } )
-    }
-  }
-
-  def main(args: Array[String]) : Unit = {
-    val l = Seq(1, 3, 5, 7)
-
-    for (x <- oneOf(l).findAll)
-      println("A solution to `oneOf': " + x)
-
-    val nilHasSize3 = hasSize(3)(Nil())
-    println("Does Nil() have size 3? : " + nilHasSize3)
- 
-    val aList = hasSize(5).solve
-    println("A list of size 5: " + aList)
-  }
-}
diff --git a/cp-demo/CEGIS.scala b/cp-demo/CEGIS.scala
deleted file mode 100644
index b943da185d114e74dd73eb7a90db1fe787a1ef34..0000000000000000000000000000000000000000
--- a/cp-demo/CEGIS.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object CEGIS {
-  def main(args: Array[String]): Unit = {
-    var continue = true
-
-    val initialX = ((x: Int) => true).solve
-    println("Initial x: " + initialX)
-
-    def cnstrGivenX(x0: Int)              : Constraint2[Int,Int] = ((a: Int, b: Int) => a * (x0 - 1) < b * x0)
-    def cnstrGivenParams(a0: Int, b0: Int): Constraint1[Int] = ((x: Int) => a0 * (x - 1) < b0 * x)
-
-    var currentCnstr = cnstrGivenX(initialX)
-
-    while (continue) {
-      currentCnstr.find match {
-        case Some((a, b)) => {
-          println("found candidate parameters a = " + a + ", b = " + b)
-          (! cnstrGivenParams(a, b)).find match {
-            case None => 
-              println("proved!")
-              continue = false
-            case Some(counterex) => 
-              println("found a counterexample for x: " + counterex)
-              currentCnstr = currentCnstr && cnstrGivenX(counterex)
-          }
-        }
-        case None => 
-          println("cannot prove property!")
-          continue = false
-      }
-    }
-  }
-}
diff --git a/cp-demo/CEGISsqr.scala b/cp-demo/CEGISsqr.scala
deleted file mode 100644
index 766c2aad8a76aad15768dcea42bc3a6b34bb3dbb..0000000000000000000000000000000000000000
--- a/cp-demo/CEGISsqr.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object CEGISsqr {
-  @spec def sqr(x: Int, y: Int): Boolean = {
-    x*x <= y && (x+1)*(x+1) > y
-  }
-
-  @spec def sqr_sk(x: Int, q1: Int, q2: Int, q3: Int): Int = {
-    if (x <= 1) x + q1
-    else q2*x + sqr_sk(x - 2, q1, q2, q3) + q3
-  }
-
-  def main(args: Array[String]): Unit = {
-    var continue = true
-
-    val initialX = ((x: Int) => x >= 0).solve
-    println("Initial x: " + initialX)
-
-    // constraint is sqr(x, sqr_sk(x, q1, q2, q3))
-    def cnstrGivenX(x0: Int): Constraint3[Int,Int,Int] = 
-      ((q1: Int, q2: Int, q3: Int) => sqr(x0, sqr_sk(x0, q1, q2, q3)))
-
-    def cnstrGivenParams(q1: Int, q2: Int, q3: Int): Constraint1[Int] =
-      ((x: Int) => sqr(x, sqr_sk(x, q1, q2, q3)))
-
-    var currentCnstr = cnstrGivenX(initialX)
-
-    while (continue) {
-      currentCnstr.find match {
-        case Some((q1, q2, q3)) => {
-          println("found candidate parameters q1 = " + q1 + ", q2 = " + q2 + ", q3 = " + q3)
-          (((x: Int) => x >= 0) && (! cnstrGivenParams(q1, q2, q3))).find match {
-            case None =>
-              println("proved!")
-              continue = false
-            case Some(counterex) =>
-              println("found a counterexample for x: " + counterex)
-              currentCnstr = currentCnstr && cnstrGivenX(counterex)
-          }
-        }
-        case None =>
-          println("cannot prove property!")
-          continue = false
-      }
-    }
-  }
-}
diff --git a/cp-demo/Distinct.scala b/cp-demo/Distinct.scala
deleted file mode 100644
index d4c9008a60009c03b075362a6a6b53c34f84b26f..0000000000000000000000000000000000000000
--- a/cp-demo/Distinct.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-import cp.Definitions._
-
-object Distinct {
-  def main(args: Array[String]) : Unit = {
-    val (a, b, c) = ((i: Int, j: Int, k: Int) => distinct(i, j, k) && 0 < i && 0 < j && 0 < k && i < 3 && j < 3 && k < 5).solve
-    println((a, b, c))
-  }
-}
diff --git a/cp-demo/IntegerProgramming.scala b/cp-demo/IntegerProgramming.scala
deleted file mode 100644
index 80973e9f0511669fcf22db62c0ae5f73e126bf4e..0000000000000000000000000000000000000000
--- a/cp-demo/IntegerProgramming.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-import cp.Definitions._
-
-object ChooseCalls {
-
-  def main(args: Array[String]) : Unit = {
-
-    println(
-      (((x : Int, y : Int) => 
-        2*x + y >= 6 && 
-        x + y >= 4 &&
-        x >= 0 &&
-        y >= 0) minimizing ((x : Int, y : Int) => 3*x + 2*y)
-      ).solve
-    )
-  }
-}
diff --git a/cp-demo/LazyNQueens.scala b/cp-demo/LazyNQueens.scala
deleted file mode 100644
index e187c6bb50ee9f78b7b68e6814d348c82635cdf5..0000000000000000000000000000000000000000
--- a/cp-demo/LazyNQueens.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-import cp.LTrees._
-
-object LazyNQueens {
-  def main(args: Array[String]): Unit = {
-    val numCols = 8
-
-    val cols = new Array[L[Int]](numCols)
-
-    for (i <- 0 until numCols) {
-      // bounds
-      var c: Constraint1[Int] = ((x: Int) => x >= 0 && x < numCols)
-
-      // different from previous
-      for (j <- 0 until i) {
-        c = c && ((x: Int) => x != cols(j))
-      }
-
-      // not on a same diagonal as previous
-      for (j <- 0 until i) {
-        c = c && ((x: Int) => x - cols(j) != i - j && x - cols(j) != j - i)
-      }
-
-      cols(i) = c.lazySolve
-    }
-
-    for (c <- cols)
-      println(c.value)
-  }
-}
diff --git a/cp-demo/LazyVars.scala b/cp-demo/LazyVars.scala
deleted file mode 100644
index cc9714fa7412dadfac46b0052214828a07652dbf..0000000000000000000000000000000000000000
--- a/cp-demo/LazyVars.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-import cp.Terms._
-import cp.Definitions._
-import cp.LTrees._
-
-object LazyVars {
-  def NonnegativeInt = ((x: Int) => x >= 0).lazyFindAll
-  def chooseInt(lower: Int, upper: Int) = ((x: Int) => x >= lower && x <= upper).lazyFindAll
-
-  def main(args: Array[String]): Unit = {
-    f1()
-    f2()
-    f3()
-  }
-
-  def f1() {
-    for {
-      x <- chooseInt(0, 5)
-      y <- chooseInt(1, 3)
-      if x > y
-    } {
-      val a: Int = x
-      val b: Int = y
-      println(a, b)
-    }
-  }
-
-  def f2() {
-    // will loop forever if Scala Stream.from(0) is used instead.
-    for {
-      x <- NonnegativeInt
-      if x < 3
-      y <- NonnegativeInt
-      if x > y
-    } {
-      val i: Int = x
-      val j: Int = y
-      println(i, j)
-    }
-  }
-
-  def f3() {
-    for {
-      i <- chooseInt(0, 3)
-      pair <- ((x: Int, y: Int) => x > 0 && y == 2 * x && x <= i).lazyFindAll
-    } {
-      println("i, (a, b):" + i.value + ", " + pair.value)
-    }
-  }
-
-  def f4() {
-    val (x, y) = ((x: Int, y: Int) => x > 0 && y == 2 * x && x <= 5).lazySolve
-    val other = ((z: Int) => z == x + y).lazySolve
-    println("x + y: " + other.value)
-    println("x: " + x.value)
-    println("y: " + y.value)
-  }
-
-  def f5() {
-    val p = ((x: Int, y: Int) => x > 0 && y == 2 * x && x <= 5).lazySolve
-    val scalaPair = p.value
-    println("scala pair: " + scalaPair)
-  }
-
-  def f6() {
-    val s = ((s: Int) => s > 0 && s < 42).lazySolve
-    println(s.value)
-  }
-}
diff --git a/cp-demo/NQueens.scala b/cp-demo/NQueens.scala
deleted file mode 100644
index 3fd8c50ab01cdfeaf93c4e7b4c2025071fddfd7f..0000000000000000000000000000000000000000
--- a/cp-demo/NQueens.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object NQueens {
-  def conjoin[T](cs: Constraint1[T]*): Constraint1[T] = {
-    cs.reduceLeft[Constraint1[T]]{ case (acc, c) => acc && c }
-  }
-
-  def main(args: Array[String]): Unit = {
-    val numCols = 8
-
-    var cnstr: Constraint1[Map[Int,Int]] = ((cols: Map[Int,Int]) => true)
-
-    /* All queens are on different columns */
-    for (i <- 0 until numCols; j <- (i + 1) until numCols) {
-      cnstr &&= ((cols: Map[Int,Int]) => cols(i) != cols(j))
-    }
-
-    /* Columns are within the bounds */
-    for (i <- 0 until numCols) {
-      cnstr &&= ((cols: Map[Int,Int]) => cols(i) >= 0 && cols(i) < numCols)
-    }
-
-    /* No two queens are on same diagonal */
-    for (i <- 0 until numCols; j <- 0 until i) {
-      cnstr &&= ((cols: Map[Int,Int]) => cols(i) - cols(j) != i - j && cols(i) - cols(j) != j - i)
-    }
-
-    println(cnstr.solve.map{ case (k, v) => "Place queen " + k + " on column " + v }.mkString("\n"))
-  }
-}
diff --git a/cp-demo/PaperExamples.scala b/cp-demo/PaperExamples.scala
deleted file mode 100644
index 06dd23a9f35b107ff1cc856218168ccc724acff7..0000000000000000000000000000000000000000
--- a/cp-demo/PaperExamples.scala
+++ /dev/null
@@ -1,266 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-import cp.LTrees._
-
-object PaperExamples extends App {
-  def p(str : String, a : =>Any) : Unit = {
-    println(str + " : " + a.toString)
-  }
-
-  trait Demo {
-    val name : String
-    def action : Unit
-    def run : Unit = {
-      println("*** Running " + name + " ***")
-      action
-    }
-  }
-
-  object Initial extends Demo {
-    val name = "first examples"
-    val c1 : Constraint2[Int,Int] = ((x : Int, y : Int) => 2 * x + 3 * y == 10 && x >= 0 && y >= 0)
-    def action : Unit = {
-      p("c1(2,1)", c1(2,1))
-      p("c1(5,0)", c1(5,0))
-      p("c1.solve", c1.solve)
-      p("c1.findAll.toList", c1.findAll.toList)
-      p("bounded(3).findAll.toList", bounded(3).findAll.toList)
-    }
-  }
-  Initial.run
-
-  def bounded(m : Int) : Constraint1[Int] = ((x : Int) => x >= 0 && x <= m)
-
-  object Matrices extends Demo {
-    val name = "unimodular matrices"
-    def boundedQ(m : Int) : Constraint4[Int,Int,Int,Int] = {
-      ((x : Int, y : Int, z : Int, u : Int) =>
-        x >= 0 && x <= m &&
-        y >= 0 && y <= m &&
-        z >= 0 && z <= m &&
-        u >= 0 && u <= m)
-    }
-  
-    @spec def det(a : Int, b : Int, c : Int, d : Int) : Int = a*d - b*c
-    @spec def isUnimodular(a : Int, b : Int, c : Int, d : Int) : Boolean = {
-      val dt = det(a,b,c,d)
-      dt == 1 || dt == -1
-    }
-  
-    def inverse(a : Int, b : Int, c : Int, d : Int) : Option[(Int,Int,Int,Int)] = 
-      ((x: Int, y: Int, z: Int, u: Int) =>
-        a*x+b*z == 1 && 
-        a*y+b*u == 0 &&
-        c*x+d*z == 0 &&
-        c*y+d*u == 1).find
-  
-    def boundedUnimodular(m : Int) = {
-      boundedQ(m) && (isUnimodular _)
-      // ((a : Int, b : Int, c : Int, d : Int) => isUnimodular(a,b,c,d)) // TODO would be great if we could write this as isUnimodular _ :)
-    }
-  
-    def action : Unit = {
-      p("Unimodular count", (0 to 5).map(boundedUnimodular(_).findAll.size).toList)
-      p("boundedUnimodular(2).findAll.take(5).foreach.println(_))", boundedUnimodular(2).findAll.take(5).toList.map(_.toString))
-      p("inverse of(4,5,3,4): ", inverse(4,5,3,4))
-      p("inverse of(4,5,3,0): ", inverse(4,5,3,0))
-    }
-  }
-  Matrices.run
-
-  object SatSolving extends Demo {
-    val name = "sat solving"
-    def satSolve(problem : Seq[Seq[Int]]) = {
-      problem.map(l => l.map(i => {
-        val id = scala.math.abs(i)
-        val isPos = i > 0
-        val c : Constraint1[Map[Int,Boolean]] = ((m : Map[Int,Boolean]) => m(id) == isPos)
-        c
-      }).reduceLeft(_ || _)).reduceLeft(_ && _).find
-    }
-
-    def action : Unit = {
-      println("satSolve(p)", satSolve(Seq(Seq(1,-2,-3), Seq(2,3,4), Seq(-1,-4))))
-      println("satSolve(Seq(Seq(1,2), Seq(-1), Seq(-2)))", satSolve(Seq(Seq(1,2), Seq(-1), Seq(-2))))
-    }
-  }
-  SatSolving.run
-
-  object Knapsack extends Demo {
-    val name = "knapsack"
-
-    def action : Unit = {
-      val values  : List[Int] = List(4, 2, 2, 1, 10)
-      val weights : List[Int] = List(12, 1, 2, 1, 4)
-      val maxWeight : Int = 15
-
-      def conditionalSumTerm(values : List[Int]) : IntTerm1[Map[Int,Boolean]] = {
-        values.zipWithIndex.map(pair => {
-          val (value,index) = pair
-          ((m : Map[Int,Boolean]) => (if(m(index)) value else 0)).i
-        }).reduceLeft(_ + _)
-      }
-      val valueFunction = conditionalSumTerm(values.map(x => -x))
-      val weightFunction = conditionalSumTerm(weights)
-      val answer = ((x : Int) => x <= maxWeight)
-        .compose0(weightFunction)
-        .minimizing(valueFunction)
-        .find
-
-      p("Knapsack map", answer)
-    }
-  }
-  Knapsack.run
-
-  object Primes extends Demo {
-    val name = "prime numbers"
-
-    @spec def divides(i : Int, j : Int) : Boolean = i * (j / i) == j
-    @spec def noneDivides(from : Int, j : Int) : Boolean = {
-      if(from == j) {
-        true
-      } else {
-        !divides(from, j) && noneDivides(from+1, j)
-      }
-    }
-    @spec def isPrime(i : Int) : Boolean = (i >= 2 && noneDivides(2, i))
-  
-    val primes = (isPrime(_:Int)) minimizing((x:Int) => x) findAll
-  
-    def action : Unit = {
-      println("Primes")
-      primes.take(10).foreach(println(_))
-    }
-  }
-  Primes.run
-
-  object RedBlackTrees extends Demo {
-    val name = "red-black trees"
-
-    @spec sealed abstract class Color
-    @spec case class Red() extends Color
-    @spec case class Black() extends Color
-    
-    @spec sealed abstract class Tree
-    @spec case class Node(c : Color, l : Tree, v : Int, r : Tree) extends Tree
-    @spec case class Leaf() extends Tree
-
-    @spec sealed abstract class OptionInt
-    @spec case class SomeInt(v : Int) extends OptionInt
-    @spec case class NoneInt() extends OptionInt
-
-    @spec def size(t : Tree) : Int = (t match {
-      case Leaf() => 0
-      case Node(_, l, _, r) => 1 + size(l) + size(r)
-    }) ensuring(_ >= 0)
-
-    @spec def blackBalanced(t : Tree) : Boolean = t match {
-      case Node(_,l,_,r) => blackBalanced(l) && blackBalanced(r) && blackHeight(l) == blackHeight(r)
-      case Leaf() => true
-    }
-
-    @spec def isBlack(t: Tree) : Boolean = t match {
-      case Leaf() => true
-      case Node(Black(),_,_,_) => true
-      case _ => false
-    }
-  
-    @spec def redNodesHaveBlackChildren(t: Tree) : Boolean = t match {
-      case Leaf() => true
-      case Node(Black(), l, _, r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-      case Node(Red(), l, _, r) => isBlack(l) && isBlack(r) && redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-    }
-
-    @spec def blackHeight(t : Tree) : Int = t match {
-      case Leaf() => 0
-      case Node(Black(), l, _, _) => blackHeight(l) + 1
-      case Node(Red(), l, _, _) => blackHeight(l)
-    }
-
-    @spec def validColoring(t : Tree) : Boolean = {
-      isBlack(t) && redNodesHaveBlackChildren(t) && blackBalanced(t) 
-    }
-
-    @spec def valuesWithin(t : Tree, bound : Int) : Boolean = t match {
-      case Leaf() => true
-      case Node(_,l,v,r) => 0 < v && v <= bound && valuesWithin(l,bound) && valuesWithin(r,bound)
-    }
-
-    @spec def orderedKeys(t : Tree) : Boolean = orderedKeys(t, NoneInt(), NoneInt())
-
-    @spec def orderedKeys(t : Tree, min : OptionInt, max : OptionInt) : Boolean = t match {
-      case Leaf() => true
-      case Node(c,a,v,b) =>
-        val minOK = 
-          min match {
-            case SomeInt(minVal) =>
-              v > minVal
-            case NoneInt() => true
-          }
-        val maxOK =
-          max match {
-            case SomeInt(maxVal) =>
-              v < maxVal
-            case NoneInt() => true
-          }
-        minOK && maxOK && orderedKeys(a, min, SomeInt(v)) && orderedKeys(b, SomeInt(v), max)
-    }
-
-    @spec def validTree(t : Tree) : Boolean = {
-      validColoring(t) && orderedKeys(t) 
-    }
-
-    def action : Unit = {
-      (1 to 3).foreach(i => {
-        val num = ((t : Tree) => validTree(t) && valuesWithin(t,i) && size(t) == i).findAll.size
-        p("# of RBTs with " + i + " distinct els", num)
-      })
-    }
-  }
-  RedBlackTrees.run
-
-  object SendMoreMoney extends Demo {
-    val name = "SEND+MORE=MONEY"
-
-    def asserting(c : Constraint0) : Unit = {
-      var entered = false
-      for(i <- c.lazyFindAll) {
-        entered = true
-      }
-      if(!entered) { throw new Exception("Asserting failed.") }
-    }
-
-    def action : Unit = {
-      val anyInt : Constraint1[Int] = ((n : Int) => true)
-
-      val letters @ Seq(s,e,n,d,m,o,r,y) = Seq.fill(8)(anyInt.lazySolve)
-
-      for(l <- letters) {
-        asserting(l >= 0 && l <= 9) 
-      }
-
-      asserting(s >= 1)
-      asserting(m >= 1) 
-
-      when(distinct[Int](s,e,n,d,m,o,r,y)) {
-        println("Letters now have distinct values.")
-      } otherwise {
-        println("Letters can't have distinct values.")
-      }
-
-      val fstLine = anyInt.lazySolve
-      val sndLine = anyInt.lazySolve
-      val total = anyInt.lazySolve
-
-      asserting(fstLine == 1000*s + 100*e + 10*n + d)
-      asserting(sndLine == 1000*m + 100*o + 10*r + e)
-      asserting(total   == 10000*m + 1000*o + 100*n + 10*e + y)
-      when(total == fstLine + sndLine) {
-        println("The puzzle has a solution : " + letters.map(_.value) + " (" + fstLine.value + " + " + sndLine.value + " = " + total.value + ")")
-      } otherwise {
-        println("The puzzle has no solution.")
-      }
-    }
-  }
-  SendMoreMoney.run
-}
diff --git a/cp-demo/Primes.scala b/cp-demo/Primes.scala
deleted file mode 100644
index 2890635cd9150d491444df483238257222c517e1..0000000000000000000000000000000000000000
--- a/cp-demo/Primes.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-@spec object Specs {
-  def isPrime(i : Int) : Boolean = {
-    (i >= 2 && noneDivides(2, i))
-  }
-
-  def noneDivides(start : Int, number : Int) : Boolean = {
-    if(start == number) {
-      true
-    } else {
-      !divides(start, number) && noneDivides(start + 1, number)
-    }
-  }
-
-  def divides(i : Int, j : Int) : Boolean = (i == j || (i < j && ((j / i) * i == j)))
-}
-
-object Primes {
-  import Specs.isPrime
-
-  // Three different ways of getting the results of the example in the CADE tool demo.
-  def main(args : Array[String]) : Unit = {
-    val seq1 = (
-      for(
-        x <- 1 to 40;
-        y <- (x+1) to ((40 - 2*x)/3);
-        if(isPrime(y) && ((3 * y * y) % x) == 0)) yield(x, y, (3*y*y)/x)
-      ).toList
-
-    println(seq1)
-
-    val seq2 = (
-      for(
-        (x,y) <- ((x:Int, y:Int) => x > 0 && y > x && 2*x + 3*y <= 40).findAll;
-        if(isPrime(y));
-        z <- ((z:Int) => z * x == 3 * y * y).findAll) yield(x, y, z)
-      ).toList
-
-    println(seq2)
-
-    val seq3 = (
-      for(
-        (x,y,z) <- ((x:Int, y:Int, z:Int) => x > 0 && y > x && 2*x + 3*y <= 40 && isPrime(y) && z * x == 3 * y * y).findAll) yield(x, y, z)
-      ).toList
-
-    println(seq3)
-    
-  }
-}
diff --git a/cp-demo/Product.scala b/cp-demo/Product.scala
deleted file mode 100644
index 024fdd7b7b7d29aec1a84f0ebfb8fc66c73e6e13..0000000000000000000000000000000000000000
--- a/cp-demo/Product.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object Product {
-  def main(args: Array[String]): Unit = {
-    val c1 = ((x: Int) => x > 5).c
-    val c2 = ((x: Int) => x > 41).c
-    val c22 = ((x: Int, y: Int, z: Int) => x > y).c
-
-    val c3 = c1 product c2
-    val c32 = c1 product c22
-
-    val c4 = ((a: Boolean, b: Int) => a == b > 0).c
-    val c5 = ((i: Int, j: Int) => i > j).c
-
-    val c6 = c4 product c5
-
-    println(c3.solve)
-    println(c32.solve)
-    println(c6.solve)
-  }
-}
diff --git a/cp-demo/SatSolver.scala b/cp-demo/SatSolver.scala
deleted file mode 100644
index 6f1d6710a4e8491bebbe129a367b1ce925de0887..0000000000000000000000000000000000000000
--- a/cp-demo/SatSolver.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-import scala.io.Source
-
-object SatSolver {
-  val defaultProblem : List[List[Int]] = List(
-    List(-1, 2, 3),
-    List(1, -2),
-    List(4)
-  )
-
-  def satSolve(problem : Seq[Seq[Int]]) = {
-    problem.map(l => l.map(i => {
-      val id = scala.math.abs(i)
-      val isPos = i > 0
-      val c : Constraint1[Map[Int,Boolean]] = ((m : Map[Int,Boolean]) => m(id) == isPos)
-      c
-    }).reduceLeft(_ || _)).reduceLeft(_ && _).find
-  }
-
-  def main(args: Array[String]): Unit = {
-
-    val problem: List[List[Int]] = if (args.length > 0 ) (for (line <- Source.fromFile(args(0)).getLines if (!line.startsWith("c") && !line.startsWith("p"))) yield {
-        line.split(" ").toList.map(_.toInt)
-    }).toList else defaultProblem
-
-    // type CM = Constraint1[Map[Int,Boolean]]
-    // val solution : CM =
-    //   problem.foldLeft[CM]((m:Map[Int,Boolean]) => true)((cons:CM,clause:List[Int]) => cons && clause.foldLeft[CM]((m:Map[Int,Boolean]) => false)((cons:CM,lit:Int) => {
-    //         val isPos = lit > 0
-    //         val abs = scala.math.abs(lit)
-    //         cons || ((m:Map[Int,Boolean]) => m(abs) == isPos)
-    //       }))
-
-    // val answer = solution.solve
-    // println("Solution map : " + answer)
-    // (1 to 4).foreach(i => println("i : " + answer(i)))
-    println("satSolve(p)", satSolve(problem))
-  }
-}
diff --git a/cp-demo/UserDefinedSolver.scala b/cp-demo/UserDefinedSolver.scala
deleted file mode 100644
index 89dc7240fdebc02665157855eeee836e7cd7f97d..0000000000000000000000000000000000000000
--- a/cp-demo/UserDefinedSolver.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-import org.scalacheck._
-import Gen._
-import Arbitrary.arbitrary
-
-@spec object Specs {
-  sealed abstract class Tree
-  case class Node(left: Tree, right: Tree, v: Int) extends Tree
-  case class Leaf() extends Tree
-}
-object UserDefinedSolver {
-  import Specs._
-
-  val genLeaf = value(Leaf())
-
-  val genNode = for {
-    v <- Gen.choose(1, 10)
-    left <- genTree
-    right <- genTree
-  } yield Node(left, right, v)
-
-  def genTree: Gen[Tree] = oneOf(genLeaf, genNode)
-
-  def main(args: Array[String]): Unit = {
-    val generator = ((t: Tree) => t != Leaf()).customize(new Iterator[Tree] {
-      private var counter = 0
-      def hasNext : Boolean = counter < 10
-      def next : Tree = { counter += 1; genTree.sample.get }
-    })
-
-    for (t <- generator.findAll) {
-      println("Here is a tree : " + t)
-    }
-  }
-}
diff --git a/cp-demo/When.scala b/cp-demo/When.scala
deleted file mode 100644
index def9e813aaaa087cde0936be83cf0b17231a94a4..0000000000000000000000000000000000000000
--- a/cp-demo/When.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object When {
-  def main(args: Array[String]): Unit = {
-    for (x <- ((x: Int) => x >= 0 && x < 4).lazyFindAll) {
-      when (x < 3) {
-        println("I'm assuming x is less than three")
-      }
-
-      println(when(x < 2) {
-        "furthermore, less than two"
-      } otherwise {
-        "ok, it is not less than two"
-      })
-
-      val anInt: Int = when (x < 1) { 42 } // will throw an exception if x cannot be less than 1
-    }
-  }
-}
diff --git a/cp-demo/acl2/AbstractMemory.scala b/cp-demo/acl2/AbstractMemory.scala
deleted file mode 100644
index 923e2a450c044922616658831b771136b6848ab0..0000000000000000000000000000000000000000
--- a/cp-demo/acl2/AbstractMemory.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-import funcheck.Utils._
-import funcheck.Annotations._
-
-import cp.Definitions._
-
-@spec object AbstractMemory {
-  // - our maps are already ``canonicalized''
-
-  def init(): Map[Int,Int] = {
-    Map.empty[Int,Int]
-  }
-
-  def write(memory: Map[Int,Int], address: Int, data: Int): Map[Int,Int] = {
-    memory.updated(address, data)
-  }
-
-  def read(memory: Map[Int,Int], address: Int): Int = {
-    require(memory.isDefinedAt(address))
-    memory(address)
-  }
-
-  def writeRead(m: Map[Int,Int], a: Int, d: Int): Boolean = {
-    (m.updated(a, d))(a) == d
-  } holds
-
-  def writeIdempotent(m: Map[Int,Int], a: Int, d: Int): Boolean = {
-    val m2 = m.updated(a, d)
-    val m3 = m2.updated(a, d)
-    m2 == m3
-  } holds
-}
diff --git a/cp-demo/comfusy-examples/ComplicatedScaleWeights.scala b/cp-demo/comfusy-examples/ComplicatedScaleWeights.scala
deleted file mode 100644
index 1aa8442b736f5594dca85d264e3a7df09d818fcf..0000000000000000000000000000000000000000
--- a/cp-demo/comfusy-examples/ComplicatedScaleWeights.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import cp.Definitions._
-
-object ComplicatedScaleWeights {
-  def main(args: Array[String]): Unit = {
-    println("Give me the total and the three limits K P Q to find a, b, c and d")
-    println("such that a + 17b + 295c + 5124d == total and a, b, c are bounded by K, P, Q on the right respectively")
-    val total: Int = Console.readInt
-    val limit1: Int = Console.readInt
-    val limit2: Int = Console.readInt
-    val limit3: Int = Console.readInt
-
-    try {
-      val (a, b, c, d) = ((a:Int,b:Int,c:Int,d:Int) => (
-           a + 17 * b + 295 * c + 5124 * d == total
-        && 0 <= a && a <= limit1
-        && 0 <= b && b <= limit2
-        && 0 <= c && c <= limit3
-      )).solve
-      println(a+" + 17*"+b+" + 295*"+c+" + 5124*"+d+" = "+total)
-    } catch {
-      case e: UnsatisfiableConstraintException => println("Sorry, there are no such decomposition with the imposed upper bounds. Try higher upper bounds ?")
-    }
-  }
-}
diff --git a/cp-demo/comfusy-examples/Coordinates.scala b/cp-demo/comfusy-examples/Coordinates.scala
deleted file mode 100644
index 23e28f00024ceef64355f7871e12e75cae4fd981..0000000000000000000000000000000000000000
--- a/cp-demo/comfusy-examples/Coordinates.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import cp.Definitions._
-
-object Coordinates {
-  def main(args : Array[String]) : Unit = {
-    println("Size X ?")
-    val x = Console.readInt
-    println("Size Y ?")
-    val y = Console.readInt
-    println("Size Z ?")
-    val z = Console.readInt
-
-    println("Index ?")
-    val i = Console.readInt
-
-    val (j, k, l) = ((j: Int, k: Int, l: Int) => ( 
-         i == l * (x * y) + k * x + j )
-      && 0 <= j && j < x
-      && 0 <= k && k < y
-      && 0 <= l && l < z
-    ).solve
-
-    println("Index " + i + " corresponds to coordinate (" + j + ", " + k + ", " + l + ") in the space.")
-  }
-}
diff --git a/cp-demo/comfusy-examples/Divides5And7.scala b/cp-demo/comfusy-examples/Divides5And7.scala
deleted file mode 100644
index b2665cb812b89f2df99c9bcb0027f7c8e8929deb..0000000000000000000000000000000000000000
--- a/cp-demo/comfusy-examples/Divides5And7.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-import cp.Definitions._
-
-object Divides5And7 {
-  def main(args : Array[String]) : Unit = {
-    println("Give me a number.")
-    val y = Console.readInt
-
-    val (b, c, _, _) = ((b:Int,c:Int,a1:Int,a2:Int) => {
-        y + b == 5 * a1 && y + c == 7 * a2 && a1 != 0 && a2 != 0 && b > 0 && c > 0
-    }).solve
-
-    println(y + " + " + b + " = " + (y+b) + " ...and that's a multiple of 5.")
-    println(y + " + " + c + " = " + (y+c) + " ...and that's a multiple of 7.")
-  }
-}
diff --git a/cp-demo/comfusy-examples/GoBezoutGo.scala b/cp-demo/comfusy-examples/GoBezoutGo.scala
deleted file mode 100644
index e79686103e9ac8d3af258331fd650393d9178c1d..0000000000000000000000000000000000000000
--- a/cp-demo/comfusy-examples/GoBezoutGo.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-import cp.Definitions._
-
-object GoBezoutGo {
-  def main(args : Array[String]) : Unit = {
-    Console.println("i + a*x + b*y + c*z == 0")
-    Console.println("i?")
-    val i = Console.readInt
-    Console.println("a?")
-    val a = Console.readInt
-    Console.println("b?")
-    val b = Console.readInt
-    Console.println("c?")
-    val c = Console.readInt
-
-    val (x,y,z) = ((x:Int, y:Int, z:Int) => (i + a*x + b*y + c*z == 0)).solve
-
-    println("x : " + x)
-    println("y : " + y)
-    println("z : " + z)
-  }
-}
diff --git a/cp-demo/comfusy-examples/IntegerRatio.scala b/cp-demo/comfusy-examples/IntegerRatio.scala
deleted file mode 100644
index ffd6b06e859de1d40631e91a6d837f23049377cd..0000000000000000000000000000000000000000
--- a/cp-demo/comfusy-examples/IntegerRatio.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-import cp.Definitions._
-
-object IntegerRatio {
-    def main(args : Array[String]) : Unit = {
-        println("a ? ")
-        val a = Console.readInt
-        println("b ? ")
-        val b = Console.readInt
-        try {
-          val x = ((x: Int) => a * x == b || b * x == a).solve
-          println("Ratio is " + x)
-        } catch {
-          case e: UnsatisfiableConstraintException => println("Couldn't find an integer ratio between 'a' and 'b'.")
-        }
-    }
-}
diff --git a/cp-demo/comfusy-examples/ScaleWeights.scala b/cp-demo/comfusy-examples/ScaleWeights.scala
deleted file mode 100644
index 7df5433dca3d902b5f5ed8bec92f2ab0eeb0bbed..0000000000000000000000000000000000000000
--- a/cp-demo/comfusy-examples/ScaleWeights.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-import cp.Definitions._
-
-object ScaleWeights {
-  def main(args: Array[String]): Unit = {
-    println("Give me a weight: ")
-    val weight: Int = Console.readInt
-
-    try {
-      val (w1,w2,w3,w4) = ((w1:Int,w2:Int,w3:Int,w4:Int) => (
-           w1 + 3 * w2 + 9 * w3 + 27 * w4 == weight
-        && -1 <= w1 && w1 <= 1
-        && -1 <= w2 && w2 <= 1
-        && -1 <= w3 && w3 <= 1
-        && -1 <= w4 && w4 <= 1
-      )).solve
-      println("Put what you think weights " + weight + " to the left, then")
-      println("Put 1         : " + numToPlace(w1))
-      println("Put 3         : " + numToPlace(w2))
-      println("Put 9         : " + numToPlace(w3))
-      println("Put 27        : " + numToPlace(w4))
-    } catch {
-      case e: UnsatisfiableConstraintException => println("Sorry, cannot measure " + weight + " with weights 1,3,9 and 27.")
-    }
-  }
-
-  def numToPlace(i: Int): String = i match {
-    case -1 => "to the left"
-    case  0 => "nowhere"
-    case  1 => "to the right"
-    case  _ => "??? " + i
-  }
-}
diff --git a/cp-demo/comfusy-examples/SecondsToTime.scala b/cp-demo/comfusy-examples/SecondsToTime.scala
deleted file mode 100644
index 736c817d617d47a16d9f1437b73c497fa94b53da..0000000000000000000000000000000000000000
--- a/cp-demo/comfusy-examples/SecondsToTime.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import cp.Definitions._
-
-object SecondsToTime {
-  def main(args: Array[String]): Unit = {
-    println("Please enter a number of seconds: ")
-    val secnum: Int = Console.readInt
-
-    val (hours, minutes, seconds) = ((h: Int, m: Int, s: Int) => (
-           h * 3600 + m * 60 + s == secnum
-        && 0 <= m && m < 60
-        && 0 <= s && s < 60
-      )).solve
-
-    println(secnum + "s = " + hours + "h, " + minutes + "m and " + seconds + "s.")
-  }
-}
-
diff --git a/cp-demo/enumerating/RedBlackTree.scala b/cp-demo/enumerating/RedBlackTree.scala
deleted file mode 100644
index e94c26b95a62e2911409409f31a603e6f838a8a6..0000000000000000000000000000000000000000
--- a/cp-demo/enumerating/RedBlackTree.scala
+++ /dev/null
@@ -1,158 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-import purescala.Stopwatch
-
-@spec object Specs { 
-  sealed abstract class Color
-  case class Red() extends Color
-  case class Black() extends Color
- 
-  sealed abstract class Tree
-  case class Empty() extends Tree
-  case class Node(color: Color, left: Tree, value: Int, right: Tree) extends Tree
-
-  sealed abstract class OptionInt
-  case class SomeInt(v : Int) extends OptionInt
-  case class NoneInt() extends OptionInt
-
-  def max(a: Int, b: Int) : Int = {
-    if (a >= b) a else b
-  } ensuring (res => res >= a && res >= b)
-
-  def size(t: Tree) : Int = (t match {
-    case Empty() => 0
-    case Node(_, l, v, r) => size(l) + 1 + size(r)
-  }) ensuring (_ >= 0)
-
-  def height(t: Tree) : Int = (t match {
-    case Empty() => 0
-    case Node(_,l,_,r) => max(height(l), height(r)) + 1
-  }) ensuring (_ >= 0)
-
-  def isBlack(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(),_,_,_) => true
-    case _ => false
-  }
-
-  def redNodesHaveBlackChildren(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(), l, _, r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-    case Node(Red(), l, _, r) => isBlack(l) && isBlack(r) && redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-  }
-
-  def blackBalanced(t : Tree) : Boolean = t match {
-    case Node(_,l,_,r) => blackBalanced(l) && blackBalanced(r) && blackHeight(l) == blackHeight(r)
-    case Empty() => true
-  }
-
-  def blackHeight(t : Tree) : Int = t match {
-    case Empty() => 0
-    case Node(Black(), l, _, _) => blackHeight(l) + 1
-    case Node(Red(), l, _, _) => blackHeight(l)
-  }
-
-  def valuesWithin(t : Tree, bound : Int) : Boolean = t match {
-    case Empty() => true
-    case Node(_,l,v,r) => 0 <= v && v <= bound && valuesWithin(l,bound) && valuesWithin(r,bound)
-  }
-
-  def orderedKeys(t : Tree) : Boolean = orderedKeys(t, NoneInt(), NoneInt())
-
-  def orderedKeys(t : Tree, min : OptionInt, max : OptionInt) : Boolean = t match {
-    case Empty() => true
-    case Node(c,a,v,b) =>
-      val minOK = 
-        min match {
-          case SomeInt(minVal) =>
-            v > minVal
-          case NoneInt() => true
-        }
-      val maxOK =
-        max match {
-          case SomeInt(maxVal) =>
-            v < maxVal
-          case NoneInt() => true
-        }
-      minOK && maxOK && orderedKeys(a, min, SomeInt(v)) && orderedKeys(b, SomeInt(v), max)
-  }
-
-  def isRedBlackTree(t : Tree) : Boolean = {
-    blackBalanced(t) && redNodesHaveBlackChildren(t) && orderedKeys(t) // && isBlack(t)
-  }
-}
-
-object RedBlackTree {
-  import Specs._
-
-  def main(args: Array[String]) : Unit = {
-    val defaultBound = 3
-    val bound = if (args.isEmpty) defaultBound else args(0).toInt
-
-    val isBoundedRBT : Constraint1[Tree] = (t : Tree) => isRedBlackTree(t) && valuesWithin(t, bound - 1)
-
-    println("Minimizing size:")
-    for ((tree, index) <- (isBoundedRBT minimizing ((t: Tree) => size(t))).findAll.zipWithIndex) {
-      println("Tree " + index + ":")
-      println(print(tree))
-      println("----")
-    }
-
-    println("Without minimization:")
-    for (tree <- isBoundedRBT.findAll) {
-      println(print(tree))
-      println("----")
-    }
-
-    println("Fixing size of trees to " + (bound))
-    for (tree <- (isBoundedRBT && ((t : Tree) => size(t) == bound)).findAll) {
-      println(print(tree))
-      println("----")
-    }
-  }
-
-  /** Printing trees */
-  def indent(s: String) = ("  "+s).split('\n').mkString("\n  ")
-
-  def print(tree: Tree): String = tree match {
-    case Node(c,l,v,r) =>
-      indent(print(r)) + "\n" + (if (c == Black()) "B" else "R") + " " + v.toString + "\n" + indent(print(l))
-    case Empty() => "E"
-  }
-
-  def enumerateAllUpTo(bound : Int) : Unit = {
-    println("Bound is " + bound)
-
-    val set1 = scala.collection.mutable.Set[Tree]()
-    val set2 = scala.collection.mutable.Set[Tree]()
-    val set3 = scala.collection.mutable.Set[Tree]()
-    val set4 = scala.collection.mutable.Set[Tree]()
-
-    println("Minimizing size:")
-    for (tree <- (((t : Tree) => isRedBlackTree(t) && valuesWithin(t, bound)) minimizing ((t: Tree) => size(t))).findAll) {
-      println(print(tree))
-    }
-    
-    /*
-    println("Minimizing height:")
-    for (tree <- findAll((t : Tree) => isRedBlackTree(t) && valuesWithin(t, bound) minimizing height(t))) {
-      set2 += tree
-    }
-
-    println("Minimizing bound:")
-    for ((tree, bb) <- findAll((t : Tree, b: Int) => isRedBlackTree(t) && valuesWithin(t, b) && b >= 0 && b <= bound minimizing b)) {
-      set3 += tree
-    }
-    
-    println("No minimization:")
-    for (tree <- findAll((t : Tree) => isRedBlackTree(t) && valuesWithin(t, bound))) {
-      set4 += tree
-    }
-
-    assert(set1 == set2)
-    assert(set1 == set3)
-    assert(set1 == set4)
-    */
-    println("Solution set size: " + set1.size)
-  }
-}
diff --git a/cp-demo/enumerating/SortedList.scala b/cp-demo/enumerating/SortedList.scala
deleted file mode 100644
index 15ef1d1962d71d2cb3fcf82c97c808df43dd87d1..0000000000000000000000000000000000000000
--- a/cp-demo/enumerating/SortedList.scala
+++ /dev/null
@@ -1,88 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-@spec object Lists {
-  sealed abstract class List
-  case class Cons(head: Int, tail: List) extends List
-  case class Nil() extends List
-
-  def size(l: List) : Int = (l match {
-      case Nil() => 0
-      case Cons(_, t) => 1 + size(t)
-  }) ensuring(res => res >= 0)
-
-  def content(l: List): Set[Int] = l match {
-    case Nil() => Set.empty[Int]
-    case Cons(x, xs) => Set(x) ++ content(xs)
-  }
-  def isSorted(l : List) : Boolean = l match {
-    case Nil() => true
-    case Cons(x, xs) => xs match {
-      case Nil() => true
-      case Cons(y, _) => x <= y && isSorted(xs)
-    }
-  }
-
-  def listEq(l1: List, l2: List): Boolean = l1 == l2
-
-  def valuesWithin(l: List, lower: Int, upper: Int) : Boolean = l match {
-    case Nil() => true
-    case Cons(x, xs) => x >= lower && x <= upper && valuesWithin(xs, lower, upper)
-  }
-
-  def isAppend(head1: List, tail1: List, head2: List, tail2: List, head3 : List, tail3 : List): Boolean = {
-    head3 == head1 && tail3 == tail2 && tail1 == head2
-  }
-}
-
-object SortedList {
-  import Lists._
-
-  def anyList = ((l: List) => true).lazyFindAll
-  def hasSize(i: Int) = ((l: List) => size(l) == i).lazyFindAll
-
-  def main(args : Array[String]) : Unit = {
-    val len = if (args.isEmpty) 3 else args(0).toInt
-
-    f1(len)
-    // f2(len)
-    // f3(len)
-    // f4()
-  }
-
-  def f1(len: Int) {
-    val set = scala.collection.mutable.Set[List]()
-
-    for (list <- ((l : List) => isSorted(l) && valuesWithin(l, 0, len) && size(l) == len).findAll)
-      set += list
-      
-    println("size : " + set.size)
-    purescala.Stopwatch.printSummary
-  }
-
-  def f2(len: Int) {
-    for {
-      l1 <- hasSize(len)
-      l2 <- hasSize(len)
-      if isSorted(l1) && isSorted(l2) && content(l1) == content(l2) && !listEq(l1, l2)
-    } {
-      println(l1.force(), l2.force())
-    }
-  }
-
-  def f3(len: Int) {
-    for ((l1, l2) <- ((l1:List, l2: List) => size(l1) == len && size(l2) == len && isSorted(l1) && isSorted(l2) && content(l1) == content(l2) && !listEq(l1, l2)).findAll)
-      println(l1, l2)
-  }
-
-  def f4() {
-    println(((l1: List, l2: List, h1: List, h2: List) =>  
-      l1 == Cons(1, Cons(2, Cons(3, h1))) &&
-      l2 == Cons(4, Cons(5, Cons(6, h2))) &&
-      h1 == l2).solve)
-  }
-
-  def f5() {
-    
-  }
-}
diff --git a/cp-demo/executing-specs/Calendar.scala b/cp-demo/executing-specs/Calendar.scala
deleted file mode 100644
index fae76a4ebb45c5e514e01b772c0d74efc089447a..0000000000000000000000000000000000000000
--- a/cp-demo/executing-specs/Calendar.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object Calendar extends App {
-  // Declaratively computes a year and extra number of days since January first 1980.
-  // A piece of (imperative) code performing the same computation was responsible
-  // for a bug in a popular Mp3 player.
-
-  final val totalDays = 10593
-  final val originYear = 1980
-
-  @spec def leapDaysUntil(y: Int) = (y - 1) / 4 - (y - 1) / 100 + (y - 1) / 400
-
-  val (year, day) = ((year: Int, day: Int) => 
-    totalDays == (year - originYear) * 365 + leapDaysUntil(year) - leapDaysUntil(originYear) + day &&
-    day > 0 && day <= 366).solve
-
-  println("Year : %d, day : %d" format (year, day))
-}
diff --git a/cp-demo/executing-specs/IntSqrt.scala b/cp-demo/executing-specs/IntSqrt.scala
deleted file mode 100644
index a4da12fb67da7ed2bf44aa223168827bbbe390b8..0000000000000000000000000000000000000000
--- a/cp-demo/executing-specs/IntSqrt.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import cp.Definitions._
-import cp.Terms._
-
-object IntSqrt {
-  def sqrt(i : Int) : Int = {
-    ((res: Int) => res > 0 && 
-                   res * res <= i  &&
-                   (res + 1) * (res + 1) > i).solve
-  }
-
-  def main(args: Array[String]): Unit = {
-    println("Please provide a positive integer!")
-    val i = Console.readInt
-    println(sqrt(i))
-  }
- 
-}
diff --git a/cp-demo/executing-specs/ListMethods.scala b/cp-demo/executing-specs/ListMethods.scala
deleted file mode 100644
index b810b5a78e3dedcb5054e8cb175b813700742ca6..0000000000000000000000000000000000000000
--- a/cp-demo/executing-specs/ListMethods.scala
+++ /dev/null
@@ -1,111 +0,0 @@
-import funcheck.Annotations._
-import funcheck.Utils._
-import cp.Definitions._
-import cp.Terms._
-
-@spec object Specs {
-  abstract class List
-  case class Cons(head : Int, tail : List) extends List
-  case class Nil() extends List
-
-  def concat(l1 : List, l2 : List) : List = (l1 match {
-    case Nil() => l2
-    case Cons(x,xs) => Cons(x, concat(xs, l2))
-  })
-
-  def isSorted(l : List) : Boolean = l match {
-    case Nil() => true
-    case Cons(_, Nil()) => true
-    case Cons(x, Cons(y, xs)) => x <= y && isSorted(Cons(y, xs))
-  }
-
-  def content(l : List) : Set[Int] = l match {
-    case Nil() => Set.empty[Int]
-    case Cons(x, xs) => Set(x) ++ content(xs)
-  }
-
-  def size(l : List) : Int = (l match {
-    case Nil() => 0
-    case Cons(_, xs) => 1 + size(xs)
-  }) ensuring (_ >= 0)
-
-  def valuesWithin(l : List, lower : Int, upper : Int) : Boolean = l match {
-    case Nil() => true
-    case Cons(x, xs) => x >= lower && x <= upper && valuesWithin(xs, lower, upper)
-  }
-
-  def occurrences(l : List, i : Int) : Int = (l match {
-    case Nil() => 0
-    case Cons(x, xs) => (if (x == i) 1 else 0) + occurrences(xs, i)
-  }) ensuring (_ >= 0)
-
-  def isPermutedSublistOf(l1 : List, l2 : List) : Boolean = l1 match {
-    case Nil() => true
-    case Cons(x, xs) => occurrences(l1, x) <= occurrences(l2, x) && isPermutedSublistOf(xs, l2)
-  }
-
-  def isPermutationOf(l1 : List, l2 : List) : Boolean =
-    isPermutedSublistOf(l1, l2) && isPermutedSublistOf(l2, l1)
-}
-
-object ListMethods {
-  import Specs._
-
-  def last(list : List) : Int = {
-    val (elem, _) = ((e : Int, zs : List) => concat(zs, Cons(e, Nil())) == list).solve
-    elem
-  }
-
-  def appendElem(list : List, elem : Int) : List =
-    ((l : List) => concat(list, Cons(elem, Nil())) == l).solve
-
-  def sort(list : List) : List =
-    ((l : List) => isPermutationOf(l, list) && isSorted(l)).solve
-
-  def main(args: Array[String]) : Unit = {
-    val bound = if (args.isEmpty) 3 else args(0).toInt
-    val nbLists = if (args.size == 2) args(1).toInt else 3
-
-    // val l = ((l : List) => size(l) == bound).solve
-    // val lists = for (i <- 1 to nbLists) yield ((l : List) => size(l) == bound).solve
-    // val lists = ((l : List) => size(l) == bound && valuesWithin(l, 0, bound - 1)).findAll.toList
-    
-    val random = new scala.util.Random()
-    def randomList(s: Int): List = if (s <= 0) Nil() else Cons(random.nextInt(10), randomList(s - 1))
-
-    val lists = (1 to nbLists) map (i => randomList(bound))
-    println("Here are lists:")
-    println(lists.mkString("\n"))
-
-    // println("Here is its last element: " + last(l))
-    Timer.go
-    val lastElems = lists.map(l => last(l))
-    val measured = Timer.stop
-    println("last elements:")
-    println(lastElems)
-    println("measured:" + measured)
-    println("average :" + (measured / nbLists))
-
-    // val added = lists.map(appendElem(_, 42))
-    // println("Here are those lists with 42 added to them:")
-    // println(added.mkString("\n"))
-
-    // val sorted = sort(added)
-    // println("Here is the previous list, this time sorted: " + sorted)
-  }
-}
-
-object Timer {
-  var start: Long = 0L
-  var end: Long = 0L
-  def go = {
-    start = System.currentTimeMillis
-  }
-  def stop = {
-    end = System.currentTimeMillis
-    val measured = (end - start) / 1000.0
-    println("Measured time: " + measured + " s")
-    measured
-  }
-}
-
diff --git a/cp-demo/executing-specs/RedBlackTreeMethods.scala b/cp-demo/executing-specs/RedBlackTreeMethods.scala
deleted file mode 100644
index eca814f23968c72a550e02f7d9dd07cea266af70..0000000000000000000000000000000000000000
--- a/cp-demo/executing-specs/RedBlackTreeMethods.scala
+++ /dev/null
@@ -1,197 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Annotations._
-import funcheck.Utils._
-
-import cp.Definitions._
-import cp.Terms._
-import purescala.Stopwatch
-
-@spec object Specs { 
-  sealed abstract class Color
-  case class Red() extends Color
-  case class Black() extends Color
- 
-  sealed abstract class Tree
-  case class Empty() extends Tree
-  case class Node(color: Color, left: Tree, value: Int, right: Tree) extends Tree
-
-  sealed abstract class OptionInt
-  case class SomeInt(v : Int) extends OptionInt
-  case class NoneInt() extends OptionInt
-
-  def content(t: Tree) : Set[Int] = t match {
-    case Empty() => Set.empty
-    case Node(_, l, v, r) => content(l) ++ Set(v) ++ content(r)
-  }
-
-  def max(a: Int, b: Int) : Int = {
-    if (a >= b) a else b
-  } ensuring (res => res >= a && res >= b)
-
-  def size(t: Tree) : Int = (t match {
-    case Empty() => 0
-    case Node(_, l, v, r) => size(l) + 1 + size(r)
-  }) ensuring (_ >= 0)
-
-  def height(t: Tree) : Int = (t match {
-    case Empty() => 0
-    case Node(_,l,_,r) => max(height(l), height(r)) + 1
-  }) ensuring (_ >= 0)
-
-  def isBlack(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(),_,_,_) => true
-    case _ => false
-  }
-
-  def redNodesHaveBlackChildren(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(), l, _, r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-    case Node(Red(), l, _, r) => isBlack(l) && isBlack(r) && redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-  }
-
-  def redDescHaveBlackChildren(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(_,l,_,r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-  }
-
-  def blackBalanced(t : Tree) : Boolean = t match {
-    case Node(_,l,_,r) => blackBalanced(l) && blackBalanced(r) && blackHeight(l) == blackHeight(r)
-    case Empty() => true
-  }
-
-  def blackHeight(t : Tree) : Int = t match {
-    case Empty() => 0
-    case Node(Black(), l, _, _) => blackHeight(l) + 1
-    case Node(Red(), l, _, _) => blackHeight(l)
-  }
-
-  def valuesWithin(t : Tree, bound : Int) : Boolean = t match {
-    case Empty() => true
-    case Node(_,l,v,r) => 0 <= v && v <= bound && valuesWithin(l,bound) && valuesWithin(r,bound)
-  }
-
-  def orderedKeys(t : Tree) : Boolean = orderedKeys(t, NoneInt(), NoneInt())
-
-  def orderedKeys(t : Tree, min : OptionInt, max : OptionInt) : Boolean = t match {
-    case Empty() => true
-    case Node(c,a,v,b) =>
-      val minOK = 
-        min match {
-          case SomeInt(minVal) =>
-            v > minVal
-          case NoneInt() => true
-        }
-      val maxOK =
-        max match {
-          case SomeInt(maxVal) =>
-            v < maxVal
-          case NoneInt() => true
-        }
-      minOK && maxOK && orderedKeys(a, min, SomeInt(v)) && orderedKeys(b, SomeInt(v), max)
-  }
-
-  def isRedBlackTree(t : Tree) : Boolean = {
-    blackBalanced(t) && redNodesHaveBlackChildren(t) && orderedKeys(t) // && isBlack(t)
-  }
-  
-  // <<insert element x into the tree t>>
-  def ins(x: Int, t: Tree): Tree = {
-    require(redNodesHaveBlackChildren(t) && blackBalanced(t))
-    t match {
-      case Empty() => Node(Red(),Empty(),x,Empty())
-      case Node(c,a,y,b) =>
-        if      (x < y)  balance(c, ins(x, a), y, b)
-        else if (x == y) Node(c,a,y,b)
-        else             balance(c,a,y,ins(x, b))
-    }
-  } ensuring (res => content(res) == content(t) ++ Set(x) 
-                   && size(t) <= size(res) && size(res) <= size(t) + 1
-                   && redDescHaveBlackChildren(res)
-                   && blackBalanced(res))
-
-  def makeBlack(n: Tree): Tree = {
-    require(redDescHaveBlackChildren(n) && blackBalanced(n))
-    n match {
-      case Node(Red(),l,v,r) => Node(Black(),l,v,r)
-      case _ => n
-    }
-  } ensuring(res => redNodesHaveBlackChildren(res) && blackBalanced(res))
-
-  def add(x: Int, t: Tree): Tree = {
-    require(redNodesHaveBlackChildren(t) && blackBalanced(t))
-    makeBlack(ins(x, t))
-  } ensuring (res => content(res) == content(t) ++ Set(x) && redNodesHaveBlackChildren(res) && blackBalanced(res))
-  
-  def balance(c: Color, a: Tree, x: Int, b: Tree): Tree = {
-    Node(c,a,x,b) match {
-      case Node(Black(),Node(Red(),Node(Red(),a,xV,b),yV,c),zV,d) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),Node(Red(),a,xV,Node(Red(),b,yV,c)),zV,d) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),a,xV,Node(Red(),Node(Red(),b,yV,c),zV,d)) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),a,xV,Node(Red(),b,yV,Node(Red(),c,zV,d))) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(c,a,xV,b) => Node(c,a,xV,b)
-    }
-  } ensuring (res => content(res) == content(Node(c,a,x,b)))// && redDescHaveBlackChildren(res))
-}
-
-object RedBlackTreeMethods {
-  import Specs._
-
-  def addDeclarative(x : Int, tree : Tree) : Tree =
-    ((t : Tree) => isRedBlackTree(t) && content(t) == content(tree) ++ Set(x)).solve
-
-  def removeDeclarative(x : Int, tree : Tree) : Tree =
-    ((t : Tree) => isRedBlackTree(t) && content(t) == content(tree) -- Set(x)).solve
-
-  def main(args: Array[String]) : Unit = {
-    val defaultBound = 3
-    val bound = if (args.isEmpty) defaultBound else args(0).toInt
-    val nbTrees = if (args.size == 2) args(1).toInt else 5
-
-    val tree = ((t : Tree) => isRedBlackTree(t) && size(t) == bound).solve
-
-    val someTrees = for (i <- 1 to nbTrees) yield ((t : Tree) => isRedBlackTree(t) && size(t) == bound).solve
-
-    println("Initial trees:")
-    println(someTrees.map(treeString(_)).mkString("\n---------\n"))
-
-    val beforeAdd = System.currentTimeMillis
-    val treesWith42 = someTrees.map(addDeclarative(42, _))
-    val afterAdd  = System.currentTimeMillis
-
-
-    println("New trees with added element:")
-    println(treesWith42.map(treeString(_)).mkString("\n---------\n"))
-
-    val beforeRemove = System.currentTimeMillis
-    val treesWithout42 = treesWith42.map(removeDeclarative(42, _))
-    val afterRemove  = System.currentTimeMillis
-
-    println("New trees with removed element:")
-    println(treesWithout42.map(treeString(_)).mkString("\n---------\n"))
-
-    Stopwatch.printSummary
-
-    println("Tree size : " + bound + " (running on " + nbTrees + " trees)")
-    val addTime = (afterAdd - beforeAdd).toDouble / (nbTrees * 1000.0d)
-    val remTime = (afterRemove - beforeRemove).toDouble / (nbTrees * 1000.0d)
-    println("Adding took   (on avg.) : " + addTime + " seconds.")
-    println("Removing took (on avg.) : " + remTime + " seconds.")
-
-    // LaTeX-friendly line
-    println("%2d & %1.2f & %1.2f".format(bound, addTime, remTime))
-  }
-
-  /** Printing trees */
-  def indent(s: String) = ("  "+s).split('\n').mkString("\n  ")
-
-  def treeString(tree: Tree): String = tree match {
-    case Node(c,l,v,r) =>
-      indent(treeString(r)) + "\n" + (if (c == Black()) "B" else "R") + " " + v.toString + "\n" + indent(treeString(l))
-    case Empty() => "E"
-  }
-}
diff --git a/cp-demo/executing-specs/SortedListMethods.scala b/cp-demo/executing-specs/SortedListMethods.scala
deleted file mode 100644
index 510d3e669bc5a9a64fc00d3cf6d512e0e87f45b2..0000000000000000000000000000000000000000
--- a/cp-demo/executing-specs/SortedListMethods.scala
+++ /dev/null
@@ -1,98 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Annotations._
-import funcheck.Utils._
-
-import cp.Definitions._
-import cp.Terms._
-
-import scala.collection.immutable.{List=>SList}
-
-@spec object Specs {
-  sealed abstract class List
-  case class Cons(head : Int, tail : List) extends List
-  case class Nill() extends List
-
-  def content(l : List) : Set[Int] = l match {
-    case Nill() => Set.empty[Int]
-    case Cons(x, xs) => Set(x) ++ content(xs)
-  }
-
-  def size(l : List) : Int = (l match {
-    case Nill() => 0
-    case Cons(_, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def isSorted(l : List) : Boolean = l match {
-    case Nill() => true
-    case Cons(_, Nill()) => true
-    case Cons(x, xs @ Cons(y, ys)) => (x < y) && isSorted(xs)
-  }
-}
-
-object SortedListMethods {
-  import Specs._
-
-  implicit def l2sl(l : List) : SList[Int] = l match {
-    case Cons(x, xs) => x :: l2sl(xs)
-    case Nill() => Nil
-  }
-
-  implicit def sl2l(l : SList[Int]) : List = l match {
-    case Nil => Nill()
-    case x :: xs => Cons(x, sl2l(xs))
-  }
-
-  def addDeclarative(x : Int, list : List) : List =
-    ((l : List) => isSorted(l) && content(l) == content(list) ++ Set(x)).solve
-
-  def removeDeclarative(x : Int, list : List) : List = 
-    ((l : List) => isSorted(l) && content(l) == content(list) -- Set(x)).solve
-
-  def randomList(size : Int, from : Int, to : Int) : List = {
-    import scala.collection.mutable.{Set=>MSet}
-    val nums = MSet.empty[Int]
-    while(nums.size < size) {
-      nums += scala.util.Random.nextInt(1 + to - from) + from
-      nums -= 42
-    }
-    sl2l(nums.toList.sorted)
-  }
-
-  def printLists(lists : List*) : Unit = {
-    println(lists.toList.map(l2sl).mkString("\n"))
-  }
-
-  def main(args : Array[String]) : Unit = {
-    val listSize = if(args.isEmpty) 3 else args(0).toInt
-    val nbLists = if(args.size <= 1) 5 else args(1).toInt
-
-    val lists = for(i <- 1 to nbLists) yield randomList(listSize, -200, 200)
-
-    println("Starting lists :")
-    printLists(lists : _*)
-
-    val beforeAdd = System.currentTimeMillis
-    val listsWith42 = lists.map(addDeclarative(42, _))
-    val afterAdd = System.currentTimeMillis
-
-    println("Lists with 42 :")
-    printLists(listsWith42 : _*)
-
-    val beforeRemove = System.currentTimeMillis
-    val listsWithout42 = listsWith42.map(removeDeclarative(42, _))
-    val afterRemove = System.currentTimeMillis
-
-    println("Lists without 42 :")
-    printLists(listsWithout42 : _*)
-
-    println("List size : " + listSize + " (running on " + nbLists + " lists)")
-    val addTime = (afterAdd - beforeAdd).toDouble / (nbLists * 1000.0d)
-    val remTime = (afterRemove - beforeRemove).toDouble / (nbLists * 1000.0d)
-    println("Adding took   (on avg.) : " + addTime + " seconds.")
-    println("Removing took (on avg.) : " + remTime + " seconds.")
-
-    // LaTeX-friendly line
-    println("%2d & %1.2f & %1.2f".format(listSize, addTime, remTime))
-
-  }
-}
diff --git a/cp-demo/parsing/ArithmeticExpressionParser.scala b/cp-demo/parsing/ArithmeticExpressionParser.scala
deleted file mode 100644
index d048aeb4701cd1d5985b4ce91429253c94163220..0000000000000000000000000000000000000000
--- a/cp-demo/parsing/ArithmeticExpressionParser.scala
+++ /dev/null
@@ -1,80 +0,0 @@
-import cp.Definitions._
-
-@spec object Specs {
-  sealed abstract class Token
-  case class IntLit(value : Int) extends Token
-  case class Plus() extends Token
-  case class Minus() extends Token
-  case class Times() extends Token
-  case class Div() extends Token
-  case class LParen() extends Token
-  case class RParen() extends Token
-
-  sealed abstract class TokenList
-  case class Cons(head : Token, tail : TokenList) extends TokenList
-  case class Nil() extends TokenList
-
-  def size(l : TokenList) : Int = (l match {
-    case Nil() => 0
-    case Cons(x, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def append(l1 : TokenList, l2 : TokenList) : TokenList = (l1 match {
-    case Nil() => l2
-    case Cons(t, ts) => Cons(t, append(ts, l2))
-  }) ensuring(size(_) == size(l1) + size(l2))
-  
-  sealed abstract class Tree
-  case class IntLitTree(value : Int) extends Tree
-  case class PlusTree(left : Tree, right : Tree) extends Tree
-  case class MinusTree(left : Tree, right : Tree) extends Tree
-  case class TimesTree(left : Tree, right : Tree) extends Tree
-  case class DivTree(left : Tree, right : Tree) extends Tree
-
-  def treeSize(t : Tree) : Int = (t match {
-    case IntLitTree(_) => 1
-    case PlusTree(l,r) => 1 + treeSize(l) + treeSize(r)
-    case MinusTree(l,r) => 1 + treeSize(l) + treeSize(r)
-    case TimesTree(l,r) => 1 + treeSize(l) + treeSize(r)
-    case DivTree(l,r) => 1 + treeSize(l) + treeSize(r)
-  }) ensuring(_ >= 0)
-
-  def valuesWithin(t : Tree, lower : Int, upper : Int) : Boolean = t match {
-    case IntLitTree(v) => lower <= v && v <= upper
-    case PlusTree(l, r) => valuesWithin(l, lower, upper) && valuesWithin(r, lower, upper)
-    case MinusTree(l, r) => valuesWithin(l, lower, upper) && valuesWithin(r, lower, upper)
-    case TimesTree(l, r) => valuesWithin(l, lower, upper) && valuesWithin(r, lower, upper)
-    case DivTree(l, r) => valuesWithin(l, lower, upper) && valuesWithin(r, lower, upper)
-  }
-
-  def enclose(l : TokenList) : TokenList =
-    append(Cons(LParen(), l), Cons(RParen(), Nil()))
-
-  def print(tree : Tree) : TokenList = tree match {
-    case IntLitTree(value) => Cons(IntLit(value), Nil())
-    case PlusTree(l, r) => append(print(l), Cons(Plus(), print(r)))
-    case MinusTree(l, r) => append(print(l), Cons(Minus(), print(r)))
-    case TimesTree(l, r) => append(print(l), Cons(Times(), print(r)))
-    case DivTree(l, r) => append(print(l), Cons(Div(), print(r)))
-  }
-
-  def printAlternative(tree : Tree, acc : TokenList) : TokenList = tree match {
-    case IntLitTree(value) => Cons(IntLit(value), acc)
-    case PlusTree(l, r) => printAlternative(l, Cons(Plus(), printAlternative(r, acc)))
-    case MinusTree(l, r) => printAlternative(l, Cons(Minus(), printAlternative(r, acc)))
-    case TimesTree(l, r) => printAlternative(l, Cons(Times(), printAlternative(r, acc)))
-    case DivTree(l, r) => printAlternative(l, Cons(Div(), printAlternative(r, acc)))
-  }
-}
-
-object ArithmeticExpressionParser {
-  import Specs._
-
-  def main(args : Array[String]) : Unit = {
-    val tokens = Cons(IntLit(0), Cons(Plus(), Cons(IntLit(0), Nil())))
-    val tree = ((t : Tree) => valuesWithin(t, 0, 0) && print(t) == tokens).solve
-
-    println("The tree I found: " + tree)
-    println("Printing : " + print(tree))
-  }
-}
diff --git a/cp-demo/parsing/ParserWithNat.scala b/cp-demo/parsing/ParserWithNat.scala
deleted file mode 100644
index 75c351a21a83d3ca18400973c0df33fcda620508..0000000000000000000000000000000000000000
--- a/cp-demo/parsing/ParserWithNat.scala
+++ /dev/null
@@ -1,77 +0,0 @@
-import cp.Definitions._
-
-@spec object Specs {
-  sealed abstract class Nat
-  case class Zero() extends Nat
-  case class Succ(n : Nat) extends Nat
-
-  def natValue(nat : Nat) : Int = (nat match {
-    case Zero() => 0
-    case Succ(n) => 1 + natValue(n)
-  }) ensuring(_ >= 0)
-
-  sealed abstract class Token
-  case class IntLit(value : Nat) extends Token
-  case class Plus() extends Token
-  case class Minus() extends Token
-  case class Times() extends Token
-  case class Div() extends Token
-
-  sealed abstract class TokenList
-  case class Cons(head : Token, tail : TokenList) extends TokenList
-  case class Nil() extends TokenList
-
-  def size(l : TokenList) : Int = (l match {
-    case Nil() => 0
-    case Cons(x, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def append(l1 : TokenList, l2 : TokenList) : TokenList = (l1 match {
-    case Nil() => l2
-    case Cons(t, ts) => Cons(t, append(ts, l2))
-  }) ensuring(size(_) == size(l1) + size(l2))
-  
-  sealed abstract class Tree
-  case class IntLitTree(value : Nat) extends Tree
-  case class PlusTree(left : Tree, right : Tree) extends Tree
-  case class MinusTree(left : Tree, right : Tree) extends Tree
-  case class TimesTree(left : Tree, right : Tree) extends Tree
-  case class DivTree(left : Tree, right : Tree) extends Tree
-
-  def treeSize(t : Tree) : Int = (t match {
-    case IntLitTree(_) => 1
-    case PlusTree(l,r) => 1 + treeSize(l) + treeSize(r)
-    case MinusTree(l,r) => 1 + treeSize(l) + treeSize(r)
-    case TimesTree(l,r) => 1 + treeSize(l) + treeSize(r)
-    case DivTree(l,r) => 1 + treeSize(l) + treeSize(r)
-  }) ensuring(_ >= 0)
-
-  def print(tree : Tree) : TokenList = tree match {
-    case IntLitTree(value) => Cons(IntLit(value), Nil())
-    case PlusTree(l, r) => append(print(l), Cons(Plus(), print(r)))
-    case MinusTree(l, r) => append(print(l), Cons(Minus(), print(r)))
-    case TimesTree(l, r) => append(print(l), Cons(Times(), print(r)))
-    case DivTree(l, r) => append(print(l), Cons(Div(), print(r)))
-  }
-
-  /*
-  def valuesBoundedBy(tree : Tree, nat : Nat) : Boolean = tree match {
-    
-  }
-  */
-}
-
-object Parser {
-  import Specs._
-
-  implicit def int2nat(i : Int) : Nat = if (i <= 0) Zero() else Succ(int2nat(i-1))
-
-  def main(args : Array[String]) : Unit = {
-    // val tokens = Cons(IntLit(42), Cons(Plus(), Cons(IntLit(43), Cons(Times(), Cons(IntLit(44), Nil())))))
-    val tokens = Cons(IntLit(1), Cons(Plus(), Cons(IntLit(2), Nil())))
-    val tree = ((t : Tree) => print(t) == tokens).solve
-    println("The tree I found: " + tree)
-
-    println("Printing : " + print(tree))
-  }
-}
diff --git a/cp-demo/parsing/PropositionalLogicParser.scala b/cp-demo/parsing/PropositionalLogicParser.scala
deleted file mode 100644
index f2637dde9994a9ff630e2d3a38837f0399bfaf0f..0000000000000000000000000000000000000000
--- a/cp-demo/parsing/PropositionalLogicParser.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-import cp.Definitions._
-
-@spec object Specs {
-  sealed abstract class Bool
-  case class True() extends Bool
-  case class False() extends Bool
-
-  sealed abstract class Token
-  case class BooleanLit(value : Bool) extends Token
-  case class And() extends Token
-  case class Not() extends Token
-
-  sealed abstract class TokenList
-  case class Cons(head : Token, tail : TokenList) extends TokenList
-  case class Nil() extends TokenList
-
-  def size(l : TokenList) : Int = (l match {
-    case Nil() => 0
-    case Cons(x, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def append(l1 : TokenList, l2 : TokenList) : TokenList = (l1 match {
-    case Nil() => l2
-    case Cons(t, ts) => Cons(t, append(ts, l2))
-  }) ensuring(size(_) == size(l1) + size(l2))
-  
-  sealed abstract class Tree
-  case class BooleanLitTree(value : Bool) extends Tree
-  case class AndTree(left : Tree, right : Tree) extends Tree
-  case class NotTree(tree : Tree) extends Tree
-
-  def treeSize(t : Tree) : Int = (t match {
-    case BooleanLitTree(_) => 1
-    case AndTree(l,r) => 1 + treeSize(l) + treeSize(r)
-    case NotTree(inner) => 1 + treeSize(inner)
-  }) ensuring(_ >= 0)
-
-  def print(tree : Tree) : TokenList = tree match {
-    case BooleanLitTree(value) => Cons(BooleanLit(value), Nil())
-    case AndTree(l, r) => append(print(l), Cons(And(), print(r)))
-    case NotTree(t) => Cons(Not(), print(t))
-  }
-}
-
-object PropositionalLogicParser {
-  import Specs._
-
-  implicit def scalaList2list(l : List[Token]) : TokenList = l match {
-    case scala.collection.immutable.Nil => Nil()
-    case t :: ts => Cons(t, scalaList2list(ts))
-  }
-
-  def main(args : Array[String]) : Unit = {
-    //val tokens : TokenList = List[Token](BooleanLit(False()), And(), BooleanLit(True()), And(), BooleanLit(True()), And(), Not(), BooleanLit(False()))
-    val tokens : TokenList = List[Token](BooleanLit(False()), And(), Not(), BooleanLit(True()))
-    val tree = ((t : Tree) => print(t) == tokens).solve
-
-    println("The tree I found: " + tree)
-    println("Printing : " + print(tree))
-  }
-}
diff --git a/cp-demo/stubs/Scheduling.scala b/cp-demo/stubs/Scheduling.scala
deleted file mode 100644
index d894cf4ca69d8dc06e1762d3cf71038ca67c6cdb..0000000000000000000000000000000000000000
--- a/cp-demo/stubs/Scheduling.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-import cp.Definitions._
-
-object Scheduling {
-  @spec abstract class IntList
-  @spec case class IntCons(head : Int, tail : IntList) extends IntList
-  @spec case class IntNil() extends IntList
-
-  @spec abstract class ListList
-  @spec case class ListCons(head : IntList, tail : ListList) extends ListList
-  @spec case class ListNil() extends ListList
-
-  @spec def sum(l : IntList) : Int = l match {
-    case IntNil() => 0
-    case IntCons(x, xs) => x + sum(xs)
-  }
-
-  @spec def sum(l : ListList) : Int = l match {
-    case ListNil() => 0
-    case ListCons(l, ls) => sum(l) = sum(ls)
-  }
-}
diff --git a/cp-demo/stubs/UI.scala b/cp-demo/stubs/UI.scala
deleted file mode 100644
index bb821e54762c891432698c8777f17abaf91ed266..0000000000000000000000000000000000000000
--- a/cp-demo/stubs/UI.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-@spec object UISpecs {
-  sealed abstract class UIWidget
-  case class Widget extends UIWidget(kind : WidgetKind, contents : OptionString, reference : OptionUIRef, handlers : HandlerList, layoutElems : StyleClassList, subwidgets : UIWidgetList)
-  
-  // no constructors, just abstract type:
-  sealed abstract class UIRef
-
-  // also an abstraction, the environment (mapping of widget references to contents):
-  sealed abstract class UIEnv
-
-  // how do we store this function?
-  sealed abstract class CommandAbs
-  case class Command(function : UIEnv => Unit) extends CommandAbs
-
-  sealed abstract class HandlerAbs
-  case class Handler(event : Event, command : Command) extends HandlerAbs
-
-  sealed abstract class Event
-  case class DefaultEvent() extends Event
-  case class FocusIn() extends Event
-  case class FocusOut() extends Event
-  case class MouseButton1() extends Event
-  case class MouseButton2() extends Event
-  case class MouseButton3() extends Event
-  case class KeyPress() extends Event
-  case class Return() extends Event
-  case class Change() extends Event
-  case class DoubleClick() extends Event
-
-  sealed abstract class WidgetKind
-  case class Col() extends WidgetKind
-  case class Row() extends WidgetKind
-  case class Label() extends WidgetKind
-  case class Button() extends WidgetKind
-  case class Entry() extends WidgetKind
-  case class TextEdit(height : Int, width : Int) extends WidgetKind
-  // ...
-
-  def col(ws : UIWidgetList) : UIWidget =
-    Widget(Col(), NoneString(), NoneUIRef(), NilHandler(), NilStyleClass(), ws)
-
-  def row(ws : UIWidgetList) : UIWidget =
-    Widget(Row(), NoneString(), NoneUIRef(), NilHandler(), NilStyleClass(), ws)
-
-  def label(str : String) : UIWidget =
-    Widget(Label(), SomeString(str), NoneUIRef(), NilHandler(), NilStyleClass(), NilUIWidget())
-  
-  // ...
-}
diff --git a/cp-run b/cp-run
deleted file mode 100755
index b0d1fb34ee7fb9609e0eb45c7f88bb54fcdc9610..0000000000000000000000000000000000000000
--- a/cp-run
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-LD_LIBRARY_PATH=lib-bin \
-JAVA_OPTS="-Xmx512M -Xms512M -Xss256M" \
-scala -classpath bin/purescala/purescala-definitions_2.9.0-1-1.0.jar:lib/z3.jar:bin/cp/constraint-programming-plugin_2.9.0-1-1.0.jar:lib/scalacheck_2.8.1-1.8.jar:out ${@}
diff --git a/curry-testcases/RBT.curry b/curry-testcases/RBT.curry
deleted file mode 100644
index 94aed3b779dce11df8901c1742c20ef71f01580a..0000000000000000000000000000000000000000
--- a/curry-testcases/RBT.curry
+++ /dev/null
@@ -1,46 +0,0 @@
-module RBT
-  (Tree, size, isRBT
-  )   where
-
---- The colors of a node in a red-black tree.
-data Color = Red | Black
-
---- The structure of red-black trees.
-data Tree = Node Color Int Tree Tree
-            | Empty
-
-max :: Int -> Int -> Int
-max a b = if (a > b) then a else b
-
-size :: Tree -> Int
-size Empty = 0
-size (Node _ _ l r) = 1 + (size l) + (size r)
-
-isBlack :: Tree -> Bool
-isBlack Empty = True
-isBlack (Node c _ _ _) = c==Black
-
-redNodesHaveBlackChildren :: Tree -> Bool
-redNodesHaveBlackChildren Empty = True
-redNodesHaveBlackChildren (Node Black _ l r) = 
-  (redNodesHaveBlackChildren l) && (redNodesHaveBlackChildren r)
-redNodesHaveBlackChildren (Node Red _ l r) =
-  (isBlack l) && (isBlack r) && (redNodesHaveBlackChildren l) && (redNodesHaveBlackChildren r)
-
-blackBalanced :: Tree -> Bool
-blackBalanced Empty = True
-blackBalanced (Node _ _ l r) =
-  (blackBalanced l) && (blackBalanced r) && (blackHeight l == blackHeight r)
-
-blackHeight :: Tree -> Int
-blackHeight Empty = 0
-blackHeight (Node Black _ l _) = 1 + (blackHeight l)
-blackHeight (Node Red _ l _) = blackHeight l
-
-isRBT :: Tree -> Bool
-isRBT t = (blackBalanced t) && (redNodesHaveBlackChildren t)
-
-valuesWithin :: Tree -> Int -> Bool
-valuesWithin Empty _ = True
-valuesWithin (Node _ v l r) bound =
-  0 <= v && v <= bound && (valuesWithin l bound) && (valuesWithin r bound)
diff --git a/curry-testcases/SortedList.curry b/curry-testcases/SortedList.curry
deleted file mode 100644
index d981bcbe1b0bee0ea61c2c4e01a3b77391650d6e..0000000000000000000000000000000000000000
--- a/curry-testcases/SortedList.curry
+++ /dev/null
@@ -1,16 +0,0 @@
-module SortedList
-  (isSorted, size
-  )   where
-
-isSorted :: [Int] -> Bool
-isSorted [] = True
-isSorted [_] = True
-isSorted (x:y:ys) = x <= y && (isSorted (y:ys))
-
-size :: [Int] -> Int
-size [] = 0
-size (_:xs) = 1 + (size xs)
-
-contains :: [Int] -> Int -> Bool
-contains [] _ = False
-contains (x:xs) e = (x == e) || (contains xs e)
diff --git a/demo-munch b/demo-munch
deleted file mode 100644
index 9b1b6a7de9cfc05e7a4f0cd4914123d942a8e72d..0000000000000000000000000000000000000000
--- a/demo-munch
+++ /dev/null
@@ -1 +0,0 @@
-./scalac-funcheck -P:funcheck:nodefaults -P:funcheck:extensions=multisets.Main testcases/MultiExample.scala
diff --git a/doc/phd-project-2009-07/bib.bib b/doc/phd-project-2009-07/bib.bib
deleted file mode 100644
index fabf9f39a743e2eab988791a1d44510d88daee05..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/bib.bib
+++ /dev/null
@@ -1,39 +0,0 @@
-@article{guttag1978adt,
-    title={{A}bstract {D}ata {T}ypes and {S}oftware {V}alidation},
-    author={Guttag, J.V. and Horowitz, E. and Musser, D.R.},
-    journal={Communications of the ACM},
-    pages={1048--1064},
-    volume={21},
-    month={December},
-    year={1978},
-    publisher={ACM New York, NY, USA}
-}
-
-@inproceedings{hutton1998fau,
-    title={{F}old and {U}nfold for {P}rogram {S}emantics},
-    author={Hutton, G.},
-    booktitle={ICFP},
-    year={1998},
-    month={September},
-}
-
-@techreport{scalalang,
-    author={Odersky, Martin and Altherr, Philippe and Cremet, Vincent and Dragos, Iulian and Dubochet, Gilles and Emir, Burak and McDirmid, Sean and Micheloud, Stéphane and Mihaylov, Nikolay and Schinz, Michel and Spoon, Lex and Stenman, Erik and Zenger, Matthias},
-    title={An {O}verview of the {S}cala {P}rogramming {L}anguage (2nd {E}dition)},
-    unit={LAMP},
-    year=2006
-}
-
-@techreport{burak06mop,
-    title={{M}atching {O}bjects with {P}atterns},
-    author={Emir, Burak and Odersky, Martin and Williams, John},
-    year={2006},
-    unit={LAMP}
-}
-
-@techreport{dotta08pm,
-    author={Dotta, Mirco and Suter, Philippe and Kuncak, Viktor},
-    title={On {S}tatic {A}nalysis for {E}xpressive {P}attern {M}atching},
-    unit={LARA},
-    year={2008}
-}
diff --git a/doc/phd-project-2009-07/c b/doc/phd-project-2009-07/c
deleted file mode 100755
index b1dc79a2768414db18e649d8874f293adc6436dc..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/c
+++ /dev/null
@@ -1,4 +0,0 @@
-rm -rf *.aux *.log *.dvi *.pdf *.ps *.eps *.out *.bbl *.blg
-cd code
-./clean.sh
-cd ..
diff --git a/doc/phd-project-2009-07/challenges.tex b/doc/phd-project-2009-07/challenges.tex
deleted file mode 100644
index bfbcf8989e4cf036261be2e378d8f4235716d654..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/challenges.tex
+++ /dev/null
@@ -1,45 +0,0 @@
-\section{Reasoning}
-This section presents an example of proof of a specification. It should be
-noted that it does \emph{not} describe a general decision procedure for
-deciding the validity of such contracts. The mechanisms used are induction on
-data types (in this example, the primitive type of linked lists), and
-fold/unfold operations, that is inlining function calls and replacing
-expressions by equivalent function calls.
-
-We want to prove the third contract of Figure~\ref{fig:listset}:
-\begin{lstlisting}
-$\forall$ xs: List[Int], ys: List[Int], z: Int .
-  content(xs) = content(ys) $\rightarrow$ content(insert(z, xs)) = content(insert(z, ys))
-\end{lstlisting}
-
-We do it by induction on \K{xs}. For \K{xs = Nil}:
-\begin{lstlisting}
-content(Nil) = content(ys) $\rightarrow$ content(insert(z, Nil)) = content(insert(z, ys))
-\end{lstlisting} 
-By unfolding \K{content(Nil)} and \K{insert(z, Nil)} we get:
-\begin{lstlisting}
-Set.empty = content(ys) $\rightarrow$ content(z :: Nil) = content(insert(z, ys))
-\end{lstlisting}
-By folding \K{content(ys)}, we get that for the left hand side to be true, we need \K{ys} to be \K{Nil}. We thus have:
-\begin{lstlisting}
-Set.empty = Set.empty $\rightarrow$ content(z :: Nil) = content(insert(z, Nil))
-\end{lstlisting}
-\ldots and by unfolding \K{insert} and \K{content} we get to the correct statement:
-\begin{lstlisting}
-Set.empty = Set.empty $\rightarrow$ Set(z) = Set(z)
-\end{lstlisting}
-
-Now for the case where \K{x = x' :: xs'}, \K{y = y' :: ys'}, assuming
-that the statement holds for \K{xs'} and \K{ys'}:
-\begin{lstlisting}
-content(x' :: xs') = content(y' :: ys') $\rightarrow$ content(insert(z, x' :: xs')) = content(insert(z, y' :: ys'))
-\end{lstlisting}
-We unfold \K{content} and \K{insert}:
-\begin{lstlisting}
-content(xs') + x = content(ys') + y $\rightarrow$ content(z :: x' :: xs')) = content(z :: y' :: ys'))
-\end{lstlisting}
-We unfold \K{content} again:
-\begin{lstlisting}
-content(xs') + x = content(ys') + y $\rightarrow$ content(xs') + x' + z = content(ys') + y' + z
-\end{lstlisting}
-\ldots and the statement is clearly true.
diff --git a/doc/phd-project-2009-07/code/ListSet.scala b/doc/phd-project-2009-07/code/ListSet.scala
deleted file mode 100644
index fb2c51373768ec005ee5b5e25bf9931066097e03..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/code/ListSet.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Specs.{`==>`,forAll}
-
-object ListSet {
-  $\forall$ x: Int, xs: List[Int] .
-    content(insert(x, xs)) = content(xs) + x
-
-  $\forall$ x: Int, xs: List[Int] .
-    content(delete(x, xs)) = content(xs) - x
-
-  $\forall$ xs: List[Int], ys: List[Int], z: Int .
-    content(xs) == content(ys) ==> content(insert(z, xs)) == content(insert(z, ys))
-
-  $\forall$ xs: List[Int], ys: List[Int], z: Int .
-    content(xs) == content(ys) ==> content(delete(z, xs)) == content(delete(z, ys))
-
-  def content(xs: List[Int]): Set[Int] = xs match {
-    case Nil => Set.empty
-    case x :: xs => content(xs) + x
-  }
-
-  def insert(x: Int, xs: List[Int]): List[Int] = x :: xs
-
-  def remove(x: Int, xs: List[Int]): List[Int] = xs match {
-    case Nil => Nil
-    case y :: ys if (y == x) => remove(x, ys)
-    case y :: ys if (y != x) => y :: remove(x, ys)
-  }
-
-  def member(x: Int, xs: List[Int]): Boolean = xs match {
-    case Nil => false
-    case y :: _ if (y == x) => true
-    case _ :: ys => member(x, ys)
-  }
-
-  def main(args: Array[String]): Unit = {
-    /* ... */
-  }
-}
diff --git a/doc/phd-project-2009-07/code/beautify.sh b/doc/phd-project-2009-07/code/beautify.sh
deleted file mode 100755
index 25c729ae8d8dbdaa9b1822f144ea77ada59f8a0f..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/code/beautify.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-rm -f *.cute
-
-for src in *.scala ; do
-    cat ${src} | \
-    sed -e "s/==>/$\\\\rightarrow$/g" | \
-    sed -e "s/=>/$\\\\Rightarrow$/g" | \
-    sed -e "s/<=/$\\\\leq$/g" | \
-    sed -e "s/>=/$\\\\geq$/g" | \
-    sed -e "s/!=/$\\\\neq$/g" |
-    sed -e "s/==/=/g" |
-    cat > ${src}.cute
-done
diff --git a/doc/phd-project-2009-07/code/clean.sh b/doc/phd-project-2009-07/code/clean.sh
deleted file mode 100755
index ca34edf23a9d989a18b022ed814bc08d1e8ec3bd..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/code/clean.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-rm -f *.class *.cute
diff --git a/doc/phd-project-2009-07/code/forall-method.scala b/doc/phd-project-2009-07/code/forall-method.scala
deleted file mode 100644
index a0724e8ca20ab944b17cba80e79998a9f44ed492..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/code/forall-method.scala
+++ /dev/null
@@ -1 +0,0 @@
-def forAll[A](f: A => Boolean): Boolean
diff --git a/doc/phd-project-2009-07/code/spec-long.scala b/doc/phd-project-2009-07/code/spec-long.scala
deleted file mode 100644
index 917dbeb7f1a20f2d89c9d6bec3e4ef69cd780531..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/code/spec-long.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-assert(
-  forAll((xs: List[Int]) =>
-  forAll((ys: List[Int]) =>
-  forAll((z: Int) => {
-    (content(xs) == content(ys)) ==> (content(insert(z, xs)) == content(insert(z, ys)))
-  })))
-)
diff --git a/doc/phd-project-2009-07/code/spec-short.scala b/doc/phd-project-2009-07/code/spec-short.scala
deleted file mode 100644
index 507bf0ae5130b3ad5feaf9170bf4562e49f80329..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/code/spec-short.scala
+++ /dev/null
@@ -1,2 +0,0 @@
-$\forall$ xs: List[Int], ys: List[Int], z: Int .
-  content(xs) == content(ys) ==> content(insert(z, xs)) == content(insert(z, ys))
diff --git a/doc/phd-project-2009-07/commands.tex b/doc/phd-project-2009-07/commands.tex
deleted file mode 100644
index f59a443ad32b143157d39849a903b38be50ddcf1..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/commands.tex
+++ /dev/null
@@ -1,3 +0,0 @@
-\newcommand{\purescala}{\textsf{f}Scala}
-
-\newcommand{\K}[1]{\textsf{#1}}
diff --git a/doc/phd-project-2009-07/examples.tex b/doc/phd-project-2009-07/examples.tex
deleted file mode 100644
index 1a75c1add94dc0c67364fcca3df47b562b1060f6..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/examples.tex
+++ /dev/null
@@ -1,18 +0,0 @@
-\subsection{An Example}
-Figure~\ref{fig:listset} shows an example program; a set data-structure
-implemented using a linked list, along with some specifications about the
-implemented functions.
-
-\begin{figure}
-\lstinputlisting{code/ListSet.scala.cute}
-\caption{A set implemented as a list in \purescala, along with universally quantified specifications.}
-\label{fig:listset}
-\end{figure}
-
-One can note that in our example, the function \K{content} really plays
-the role of an abstraction function over the implementation. This
-(executable) function is then used very naturally in other contracts
-specifying for instance that \K{insert} is an operation compatible with
-the congruence relation defined by \K{content($a$) = content($b$)}. Such
-specifications would be either very unnaturally expressed using only pre-
-and post- conditions, or not expressible at all.
diff --git a/doc/phd-project-2009-07/funcheck-purescala.html b/doc/phd-project-2009-07/funcheck-purescala.html
deleted file mode 100644
index bfef4e52c6c3bebbf1e3780c8ba82de2b25aea13..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/funcheck-purescala.html
+++ /dev/null
@@ -1,453 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-
-<head>
-  <title>Laboratory for Automated Reasoning and Analysis: Wiki</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-  <meta name="Author" content="Viktor Kuncak"/>
-  <meta name="Author" content="Stephane Micheloud"/>
-  <meta name="Author" content="Fabien Salvi"/>
-  <meta name="Author" content="Laboratory for Automated Reasoning and Analysis"/>
-  <meta name="Keywords" content="verification, analysis, automated reasoning, software reliability, EPFL"/>
-  <link rel="stylesheet" type="text/css" media="screen" href="http://mtc.epfl.ch/styles/css/screen.css"/>
-  <link rel="stylesheet" type="text/css" media="print" href="http://mtc.epfl.ch/styles/css/print.css"/>
-  <link rel="shortcut icon" href="http://mtc.epfl.ch/styles/images/epfl.ico"/>
-  <script type="text/javascript" src="http://mtc.epfl.ch/styles/js/decls.js"></script>
-</head>
-
-<body>
-  <table cellpadding="0" cellspacing="0" width="100%">
-    <tr>
-      <td style="width:35px;" rowspan="4"> 
-      </td>
-      <td style="width:120px;" >  
-        <a id="epfl" href="http://www.epfl.ch/">
-        <img src="http://mtc.epfl.ch/styles/images/pixel.gif" alt="Logo EPFL" width="1" height="1"/></a></td>
-      <td style="width:4px; height:34px;"><img src="http://mtc.epfl.ch/styles/images/pixel.gif" alt="" width="1" height="1"/></td>
-      <td class="title">
-        <table cellpadding="0" cellspacing="0" width="100%">
-          <tr>
-            <td><div id="title"><a href="/"><img src="http://tresor.epfl.ch/styles/txt_m_lara.gif" alt="I&amp;C" width="360" height="34"/></a></div></td>
-            <td align="right"><div id="title-right"></div></td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-    <tr><td colspan="3" style="height:1px;"></td></tr>
-    <tr>
-      <td style="height:28px;"><a href="http://www.epfl.ch/"><img src="http://mtc.epfl.ch/styles/images/epfl_text.gif" alt="Ecole Polytechnique F&eacute;d&eacute;rale de Lausanne" width="120" height="28"/></a></td>
-      <td style="height:28px;"><img src="http://mtc.epfl.ch/images/pixel.gif" alt="" width="4" height="1"/></td>
-      <td class="subtitle">
-        <div id="subtitle">Wiki</div>
-      </td>
-    </tr>
-    <tr><td colspan="3" style="height:1px;"></td></tr>
-    <tr>
-      <td class="language"></td>
-      <td class="language">
-        <div id="language" class="path">
-          english only
-        </div>
-      </td>
-      <td class="navigation"></td>
-      <td class="navigation">
-        <div id="navigation" class="path">&nbsp;
-          <a href="http://www.epfl.ch/">EPFL</a>&nbsp;&gt;
-          <a href="http://ic.epfl.ch/">I&amp;C</a>&nbsp;&gt;
-          <a href="http://iif.epfl.ch/">IIF</a>&nbsp;&gt;
-          <span style="font-weight:bold; color:#888888"> <a href="http://lara.epfl.ch/">LARA</a> </span>
-        </div>
-      </td>
-    </tr>
-    <tr><td colspan="3" style="height:8px;"></td></tr>
-  </table>
-
-<!-- End of Header -->
-
-<!-- 
-</body></html>
-
--->
-
-<meta name="generator" content="DokuWiki Release 2007-06-26b" />
-<meta name="robots" content="index,follow" />
-<meta name="date" content="2009-06-08T14:17:33+0200" />
-<meta name="keywords" content="projects,funcheck-purescala" />
-<link rel="start" href="/dokuwiki/" />
-<link rel="contents" href="/dokuwiki/projects:funcheck-purescala?do=index" title="Index" />
-<link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/dokuwiki/feed.php" />
-<link rel="alternate" type="application/rss+xml" title="Current Namespace" href="/dokuwiki/feed.php?mode=list&amp;ns=projects" />
-<link rel="alternate" type="text/html" title="Plain HTML" href="/dokuwiki/_export/xhtml/projects:funcheck-purescala" />
-<link rel="alternate" type="text/plain" title="Wiki Markup" href="/dokuwiki/_export/raw/projects:funcheck-purescala" />
-<link rel="stylesheet" media="screen" type="text/css" href="/dokuwiki/lib/exe/css.php" />
-<link rel="stylesheet" media="print" type="text/css" href="/dokuwiki/lib/exe/css.php?print=1" />
-<script type="text/javascript" charset="utf-8" src="/dokuwiki/lib/exe/js.php?edit=0&amp;write=1" ></script>
-
-  <link rel="shortcut icon" href="/dokuwiki/lib/tpl/lara/images/favicon.ico" />
-
-  
-<div class="dokuwiki">
-  
-  <div class="stylehead">
-
-    <div class="header">
-
-      <div class="clearer"></div>
-    </div>
-
-    
-    <div class="bar" id="bar__top">
-      <div class="bar-left" id="bar__topleft">
-        <form class="button" method="post" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="" /><input type="submit" value="Edit this page" class="button" accesskey="e" title="Edit this page [ALT+E]" /></div></form>        <form class="button" method="get" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="revisions" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [ALT+O]" /></div></form>      </div>
-
-      <div class="bar-right" id="bar__topright">
-        <form class="button" method="get" action="/dokuwiki/"><div class="no"><input type="hidden" name="do" value="recent" /><input type="submit" value="Recent changes" class="button" accesskey="r" title="Recent changes [ALT+R]" /></div></form>        <form action="/dokuwiki/" accept-charset="utf-8" class="search" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" class="edit" title="[ALT+F]" /><input type="submit" value="Search" class="button" title="Search" /><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>&nbsp;
-      </div>
-
-      <div class="clearer"></div>
-    </div>
-
-        <div class="breadcrumbs">
-      Trace: <span class="bcsep">&raquo;</span> <a href="/dokuwiki/projects:funcheck"  class="breadcrumbs" title="projects:funcheck">funcheck</a> <span class="bcsep">&raquo;</span> <span class="curid"><a href="/dokuwiki/projects:funcheck-purescala"  class="breadcrumbs" title="projects:funcheck-purescala">funcheck-purescala</a></span>          </div>
-    
-    
-  </div>
-  
-  
-  <div class="page">
-    <!-- wikipage start -->
-    
-
-
-<h1><a name="pure_scala" id="pure_scala">Pure Scala</a></h1>
-<div class="level1">
-
-<p>
- Description of the Pure Scala subset of Scala, used for specifications in the <a href="/dokuwiki/projects:funcheck" class="wikilink1" title="projects:funcheck">FunCheck</a> project.
-</p>
-
-<p>
-Pure code can be translated into partial functions from inputs to outputs.
-</p>
-
-<p>
-Check the status of purity effect system with Lukas.
-</p>
-
-<p>
-We will use extraction of pure code for:
-</p>
-<ul>
-<li class="level1"><div class="li"> Scala formula language of Vepar</div>
-</li>
-<li class="level1"><div class="li"> A version of Funcheck that works only on pure code</div>
-</li>
-</ul>
-
-<p>
- Important semantic questions are the status of object allocation and equality.
-</p>
-
-</div>
-
-<h4><a name="abstraction_from_object_graphs_to_algebraic_data_types" id="abstraction_from_object_graphs_to_algebraic_data_types">Abstraction from object graphs to algebraic data types</a></h4>
-<div class="level4">
-
-<p>
- It seems convenient to introduce abstraction mechanisms that will allow us to define the algebraic data type corresponding to the content of a data structure that has reference equality. We need to think how to do this, but this is for later.
-</p>
-
-</div>
-
-<h4><a name="parametric_polymorphism" id="parametric_polymorphism">Parametric Polymorphism</a></h4>
-<div class="level4">
-
-<p>
- And its encoding into Vepar set-theretic type system.
-</p>
-
-</div>
-<div class="secedit"><form class="button" method="post" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="lines" value="1-879" /><input type="hidden" name="rev" value="1244463453" /><input type="submit" value="Edit" class="button" title="Pure Scala" /></div></form></div>
-<h2><a name="semantics_of_data_structures_and_collections" id="semantics_of_data_structures_and_collections">Semantics of Data Structures and Collections</a></h2>
-<div class="level2">
-
-<p>
- In addition to accessing effect information, Scala mapping should recognize certain special data structures from Scala and map them to mathematical data structures of the specification language. This includes:
-</p>
-
-</div>
-
-<h4><a name="tuples" id="tuples">Tuples</a></h4>
-<div class="level4">
-
-<p>
- Scala has one case class per size of tuples, for sizes from 1 to 22 (inclusive). 
-</p>
-<table class="inline">
-	<tr>
-		<th> Math </th><th> Scala </th>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Ae99d247685891507162efa0e9fc4b077.png" alt="$(a_1, \ldots, a_n)$" />     </td><td> <code>Tuple<em>N</em>(a1, ..., a<em>N</em>)</code> (where <em>N</em>  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A0aefc15a9c3ddb58fb24e9abc69d3cbd.png" alt="$ \in [1 \ldots 22]$" />) </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A8588a0d1800757f2912313c957c077cd.png" alt="$\text{proj}_k(T)$" />       </td><td class="leftalign"> <code>T._<em>k</em></code>                                                       </td>
-	</tr>
-</table>
-
-</div>
-
-<h4><a name="options" id="options">Options</a></h4>
-<div class="level4">
-
-<p>
- The real question is maybe: how do we represent option types in math? Looks like the (almost) simplest possible case of an algebraic data type, except that it&rsquo;s polymorphic. 
-</p>
-<table class="inline">
-	<tr>
-		<th> Math </th><th> Scala </th>
-	</tr>
-	<tr>
-		<td>  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A0ca97401b665d390858d81277afc7802.png" alt="$\text{some}(e)$" /> </td><td> <code>Some(e)</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Aa5d4178ee853391d31f1c184ff8c5485.png" alt="$\text{none}$" />    </td><td> <code>None</code> </td>
-	</tr>
-</table>
-
-<p>
- (we should pay attention to the type of each instance of <code>None</code>, though)
-</p>
-
-</div>
-
-<h4><a name="sets" id="sets">Sets</a></h4>
-<div class="level4">
-
-<p>
- From <code>scala.collection.Set</code>: 
-</p>
-<table class="inline">
-	<tr>
-		<th> Math </th><th> Scala </th>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-1.36665pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A15d799b60290fc8197071c51b0127c8a.png" alt="$\emptyset$" />              </td><td> <code>Set.empty[T]</code> </td>
-	</tr>
-	<tr>
-		<td>  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A8e8609e431e2bdb5db8a33e324e04b21.png" alt="$\{ a_1, \ldots, a_n \}$" /> </td><td> <code>Set(s : Seq[T])</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-1.16916pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Acf511f46eff86e4fcee5fa61923b9f5d.png" alt="$a \in A$" />                </td><td> <code>A(a)</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-1.36665pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A48bcdb60cc1664ea03a8dd31609c0225.png" alt="$A = \emptyset$" />          </td><td> <code>A.isEmpty</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A6bd9b836e6fd4e59a8f2a283b64fb233.png" alt="$A = B$" />                  </td><td> <code>A.equals(B)</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A3fec13a4a57b2f359e5e530d8c82dc06.png" alt="$\left| A \right|$" />       </td><td> <code>A.size</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-2.33165pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Ac765a5dd8e1971e98425d5b7bb28ee22.png" alt="$A \subseteq B$" />          </td><td> <code>A.subsetOf(B)</code> </td>
-	</tr>
-</table>
-
-<p>
- From <code>scala.collection.immutable.Set</code> (which extends <code>scala.collection.Set</code>): 
-</p>
-<table class="inline">
-	<tr>
-		<th> Math </th><th> Scala </th>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A826fae92ec32d8537fb6841424a65c8d.png" alt="$A \cap B$" />                           </td><td> <code>A.**(B)</code> or <code>A.intersect(B)</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Abf3bc2fdf99180855400f8ca5fa5c93b.png" alt="$A \cup B$" />                           </td><td> <code>A.++(B)</code> where <code>B : Iterable[T]</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A6050c914ef609f6ec4f3c211a10657c6.png" alt="$A \setminus B$" />                      </td><td> <code>A.--(B)</code> where <code>B : Iterable[T]</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A2370f94c3a6fa83b9590c34d6e9ec719.png" alt="$A \cup \{ a_1, \ldots, a_n \}$" />      </td><td> <code>A.+(a_1, ..., a_n)</code> (using varargs) </td>
-	</tr>
-	<tr>
-		<td>  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A2955f13f2683fbcf610cf6d1a50a5312.png" alt="$A \setminus \{ a_1, \ldots, a_n \}$" /> </td><td> <code>A.-(a_1, ..., a_n)</code> (using varargs) </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A607f416c7a80dffc5af2625c3d18c644.png" alt="$\{ a \in A~:~P(a) \}$" />               </td><td> <code>A.filter(x &rArr; P(x))</code> (provided  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A4fcf7a7b612a18d8f6eca555ed16ca12.png" alt="$P$" /> is expressible in Pure Scala) </td>
-	</tr>
-</table>
-
-</div>
-
-<h4><a name="multisets" id="multisets">Multisets</a></h4>
-<div class="level4">
-
-<p>
- Multisets are not implemented in the Scala standard library so we have to do it ourselves.
-</p>
-
-<p>
-From <code>scala.collection.Multiset</code>: 
-</p>
-<table class="inline">
-	<tr>
-		<th> Math </th><th> Scala </th>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-1.36665pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A15d799b60290fc8197071c51b0127c8a.png" alt="$\emptyset$" />                          </td><td> <code>Multiset.empty[T]</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A8e8609e431e2bdb5db8a33e324e04b21.png" alt="$\{ a_1, \ldots, a_n \}$" />             </td><td> <code>Multiset(s : Seq[T])</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A5c0c75e7dbbee1e36104aea01a9500bf.png" alt="$A(a)$" /> (multiplicity)                </td><td> <code>A(a)</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-1.36665pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A48bcdb60cc1664ea03a8dd31609c0225.png" alt="$A = \emptyset$" />                      </td><td> <code>A.isEmpty</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A6bd9b836e6fd4e59a8f2a283b64fb233.png" alt="$A = B$" />                              </td><td> <code>A.equals(B)</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A3fec13a4a57b2f359e5e530d8c82dc06.png" alt="$\left| A \right|$" />                   </td><td> <code>A.size</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-2.33165pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Ac765a5dd8e1971e98425d5b7bb28ee22.png" alt="$A \subseteq B$" />                      </td><td> <code>A.subsetOf(B)</code> (which means:  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A4bcc3b0ee67fb2d19459d712885987ba.png" alt="$\forall a. A(a) \leq B(a)$" />) </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A826fae92ec32d8537fb6841424a65c8d.png" alt="$A \cap B$" />                           </td><td> <code>A.**(B)</code> or <code>A.intersect(B)</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Abf3bc2fdf99180855400f8ca5fa5c93b.png" alt="$A \cup B$" />                           </td><td> <code>A.++(B)</code> where <code>B : Iterable[T]</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A948089323019beb3a7b571724bdfe339.png" alt="$A \uplus B$" />                         </td><td> <code>A.+++(B)</code> where <code>B : Iterable[T]</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A6050c914ef609f6ec4f3c211a10657c6.png" alt="$A \setminus B$" />                      </td><td> <code>A.--(B)</code> where <code>B : Iterable[T]</code> </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A2370f94c3a6fa83b9590c34d6e9ec719.png" alt="$A \cup \{ a_1, \ldots, a_n \}$" />      </td><td> <code>A.+(a_1, ..., a_n)</code> (using varargs) </td>
-	</tr>
-	<tr>
-		<td>  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A2955f13f2683fbcf610cf6d1a50a5312.png" alt="$A \setminus \{ a_1, \ldots, a_n \}$" /> </td><td> <code>A.-(a_1, ..., a_n)</code> (using varargs) </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A607f416c7a80dffc5af2625c3d18c644.png" alt="$\{ a \in A~:~P(a) \}$" />               </td><td> <code>A.filter(x &rArr; P(x))</code> (provided  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A4fcf7a7b612a18d8f6eca555ed16ca12.png" alt="$P$" /> is expressible in Pure Scala) </td>
-	</tr>
-</table>
-
-</div>
-
-<h4><a name="maps" id="maps">Maps</a></h4>
-<div class="level4">
-
-<p>
- We will see a <code>Map[T1,T2]</code> as a total function from <code>T1</code> to <code>Option[T2]</code>. 
-</p>
-<table class="inline">
-	<tr>
-		<th> Math </th><th> Scala </th>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-1.36665pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A15d799b60290fc8197071c51b0127c8a.png" alt="$\emptyset$" />                                                       </td><td class="leftalign"> <code>Map.empty[T1,T2]</code>                                  </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Aea3ea1d1102b75ef1350254845c58c12.png" alt="$(a \mapsto b)$" />                                                   </td><td class="leftalign"> <code>(a &rarr; b)</code>                                          </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A224cae26abe2d0f21b3a903bb9e42eeb.png" alt="$M(a)$" />                                                            </td><td class="leftalign"> <code>M.get(a)</code> (returns an <code>Option</code> type)             </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Ac1b9681e52efef7c58a8bc58e0282664.png" alt="$M \cup N$" />                                                        </td><td class="leftalign"> <code>M.++(N)</code>                                           </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A67582ca357cf4269b612072ab74f5e90.png" alt="$M \setminus K$" /> ( <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Acfda5de49ba6b064919c0c89fc8b869e.png" alt="$K$" /> is a set of keys)                            </td><td class="leftalign"> <code>M.--(K)</code>                                           </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A2092ed094bede22c30e78ed50f60ca2d.png" alt="$M \cup \{ a_1 \mapsto b_1, \ldots, a_n \mapsto b_n \}$" />           </td><td class="leftalign"> <code>M.+(a_1 &rarr; b_1, ..., a_n &rarr; b_n)</code> (using varargs)  </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A30119186669934714bb340cad368d6ae.png" alt="$M \setminus \{ k_1, \ldots, k_n \}$" />                              </td><td class="leftalign"> <code>M.-(k_1, ..., k_n)</code> (removes a set of keys)        </td>
-	</tr>
-</table>
-
-</div>
-
-<h4><a name="lists" id="lists">Lists</a></h4>
-<div class="level4">
-<table class="inline">
-	<tr>
-		<th> Math </th><th> Scala </th>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-0.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A2c09b308f89065faa25ed60d5a0112c4.png" alt="$\text{nil}$" />               </td><td class="leftalign"> <code>Nil</code>                      </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A28433a4ec328b6e25d244b86446e0638.png" alt="$\text{cons}(h, t)$" />        </td><td> <code>h :: t</code> (which is in fact quite ugly once desugared: <code>t.::(h0)</code>, where <code>h0</code> contains the evaluated version of <code>h</code> to preserve the left-to-right eval. order) </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Ab6e77cb83292765f4330585b6f68ca70.png" alt="$\text{car}(l)$" />            </td><td class="leftalign"> <code>l.head</code>  </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Ae6b481d4ff28044ef4e0c422db89d877.png" alt="$\text{cdr}(l)$" />            </td><td class="leftalign"> <code>l.tail</code>  </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3Ac5595142fb417fd55689ca3065b68a77.png" alt="$\text{concat}(l_1, l_2)$" />  </td><td class="leftalign"> <code>l_1 ::: l_2</code> (similar to <code>::</code>)  </td>
-	</tr>
-	<tr>
-		<td class="leftalign">  <img style="vertical-align:-3.7pt;" src="/dokuwiki/lib/exe/fetch.php?cache=&amp;media=latex%3A9f338cc39b0ab887ccb48176d13d55a6.png" alt="$\text{at}(l, i)$" /> (random access)  </td><td class="leftalign"> <code>l(i)</code> (returns an <code>Option</code> type)  </td>
-	</tr>
-</table>
-
-</div>
-
-<h4><a name="algebraic_data_types" id="algebraic_data_types">Algebraic Data Types</a></h4>
-<div class="level4">
-
-<p>
- Recognizing algebraic data types is somewhat open ended because of the way they interact with Java-like classes and the fact that they need not be sealed. This can be done in two stages, with the first phase recognizing only those case classes that correspond to ML-style datatype definitions.
-</p>
-
-<p>
-Tree hierarchy where leaves are case classes and internal nodes are abstract parameterless sealed classes.
-</p>
-
-</div>
-<div class="secedit"><form class="button" method="post" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="lines" value="880-" /><input type="hidden" name="rev" value="1244463453" /><input type="submit" value="Edit" class="button" title="Semantics of Data Structures and Collections" /></div></form></div>
-    <!-- wikipage stop -->
-  </div>
-
-  <div class="clearer">&nbsp;</div>
-
-  
-  <div class="stylefoot">
-
-    <div class="meta">
-      <div class="user">
-        Logged in as: philippe.suter      </div>
-      <div class="doc">
-        projects/funcheck-purescala.txt &middot; Last modified: 2009/06/08 14:17 by philippe.suter      </div>
-    </div>
-
-   
-    <div class="bar" id="bar__bottom">
-      <div class="bar-left" id="bar__bottomleft">
-        <form class="button" method="post" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="" /><input type="submit" value="Edit this page" class="button" accesskey="e" title="Edit this page [ALT+E]" /></div></form>        <form class="button" method="get" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="revisions" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [ALT+O]" /></div></form>      </div>
-      <div class="bar-right" id="bar__bottomright">
-                <form class="button" method="get" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="admin" /><input type="submit" value="Admin" class="button" title="Admin" /></div></form>        <form class="button" method="get" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="profile" /><input type="submit" value="Update Profile" class="button" title="Update Profile" /></div></form>        <form class="button" method="get" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="logout" /><input type="submit" value="Logout" class="button" title="Logout" /></div></form>        <form class="button" method="get" action="/dokuwiki/projects:funcheck-purescala"><div class="no"><input type="hidden" name="do" value="index" /><input type="submit" value="Index" class="button" accesskey="x" title="Index [ALT+X]" /></div></form>        <a class="nolink" href="#dokuwiki__top"><input type="button" class="button" value="Back to top" onclick="window.scrollTo(0, 0)" title="Back to top" /></a>&nbsp;
-      </div>
-      <div class="clearer"></div>
-    </div>
-
-  </div>
-
-</div>
-
-<div class="no"><img src="/dokuwiki/lib/exe/indexer.php?id=projects%3Afuncheck-purescala&amp;1246629991" width="1" height="1" alt=""  /></div>
-</body>
-</html>
diff --git a/doc/phd-project-2009-07/future.tex b/doc/phd-project-2009-07/future.tex
deleted file mode 100644
index fe823f4545bdd92e1b53434a1e8aa4519572c188..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/future.tex
+++ /dev/null
@@ -1,20 +0,0 @@
-\section{Future Work}
-\paragraph{Implementation}
-The natural next step is to finish our implementation. This involves several
-challenges, some purely technical, such as dealing with the internal structure
-of {\tt scalac}, other more theoretical, such as how to automate fold/unfold
-reasoning techniques.
-
-\paragraph{Extension of {\purescala}}
-We would like to support \emph{extractors} \cite{burak06mop} in {\purescala}. Extractors are user
-defined functions to perform pattern-matching on recursive data types using a
-different construction mechanism that the standard one consisting on matching
-on the constructor arguments. To use a different terminology, they provide a
-different \emph{view} on the same data. Supporting extractors and universally
-quantified specifications over them would allow us to superseed some of our
-previous work \cite{dotta08pm}.
-
-In the longer term, we would like to keep {\purescala} as our specification
-language, but start extending the verified language. Some of the features we
-want to add include standard classes with mutable fields and comparison by
-reference.
diff --git a/doc/phd-project-2009-07/introduction.tex b/doc/phd-project-2009-07/introduction.tex
deleted file mode 100644
index 822af61718fb6d689ddefbcce48e4791f555a3be..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/introduction.tex
+++ /dev/null
@@ -1,45 +0,0 @@
-\section{Introduction}
-Static software analysis systems typically work on source code annotated with
-specifications. The executable code is written in a programming language, and
-the annotations in a specification language. It is desirable for the latter to
-be easily comprehensible by the programmer, who, by definition, is an expert in
-the former. The design decisions which govern these languages are different,
-though: the programming language on the one hand, should allow the developer to
-efficiently describe computational processes, that is the algorithmic
-transformation of data. The specification language on the other hand should
-serve the purpose of describing relationships between data, for instance the
-relationship between a function arguments and its result, or between the
-results of two functions applied to the same arguments. (In a purely functional
-language, these two purposes become very close.) Additionally, the verification
-conditions eventually generated by the system should be expressed in a
-tractable logic, and that logic is closely tied to the choice of the
-specification language.
-
-Our long-term goal is the verification of programs written in the Scala
-programming language \cite{scalalang}, annotated with specifications written in
-a subset of Scala itself. Apart from the advantage that a user will be able to
-write these specifications as easily as the rest of his code, a second
-immediate benefit is that it will allow us to combine a test-based approach
-with our static analyses, since such specifications are executable. Finally,
-should both testing and static checking fail to convince a user that his
-program is conforming to its stated properties, the specifications will always
-be available for runtime checking, {\it \`a la} Eiffel. A natural choice for
-our specification language is a purely functional subset of Scala, which we
-call \purescala, and which we describe in the next section. As a first step in
-our long-term project, we will use \purescala\ as both the specification
-\emph{and} the programming language. That is, we will verify \purescala\
-programs annotated with \purescala\ specifications.
-
-This may appear to be a curious choice: indeed, if our specifications consisted
-only in pre- and post- conditions, as in most verification
-systems\footnote{Verification systems for object-oriented languages usually
-also have a mechanism to express class invariants.}, the temptation would be
-high for a programmer to always copy a function body in its post-condition, and
-this would defeat the purpose of have specifications, which are supposed to
-provide an abstraction mechanism for the computations taking place in the
-functions. To give contracts additional expressive power, our system allows
-universally quantified global specifications.
-
-The rest of this report is as follows: the next section describes
-{\purescala}, the third one an example of a proof in the system, then we
-give an overview of the implementation status and describe future work.
diff --git a/doc/phd-project-2009-07/l b/doc/phd-project-2009-07/l
deleted file mode 100755
index d5e8b4701a407e0bd591f74caefcbe29a733c3bd..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/l
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# makes Scala code look nicer
-cd code
-./beautify.sh
-cd ..
-
-pdflatex main
-bibtex main
-pdflatex main
-pdflatex main
-# dvipdf main
diff --git a/doc/phd-project-2009-07/main.tex b/doc/phd-project-2009-07/main.tex
deleted file mode 100644
index 19899fe0f8afdacf0a4ecf95294b90971c385700..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/main.tex
+++ /dev/null
@@ -1,39 +0,0 @@
-% This document should be compilable with both latex and pdflatex.
-\documentclass{article}
-
-\usepackage{amsmath,amsfonts,amssymb}
-\usepackage{hyperref}
-\usepackage{graphicx}
-\usepackage{stmaryrd}
-
-\input{scalalistings}
-\input{commands}
-
-\setcounter{secnumdepth}{0}
-
-\title{Verification of Purely Functional Scala}
-\author{Philippe Suter}
-\date{July 3, 2009} % hardcoded for the eventual satisfaction of our administration :)
-
-\begin{document}
-\maketitle
-
-\input{introduction}
-
-\input{purescala}
-
-\input{examples}
-
-\input{challenges}
-
-\input{status}
-
-\input{future}
-
-%\nocite{*}
-
-\clearpage
-\bibliographystyle{abbrv}
-\bibliography{bib}
-
-\end{document}
diff --git a/doc/phd-project-2009-07/purescala.tex b/doc/phd-project-2009-07/purescala.tex
deleted file mode 100644
index b260acfb89dadf0c45de3937b47d91fe602769d4..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/purescala.tex
+++ /dev/null
@@ -1,114 +0,0 @@
-\section{A Purely Functional Subset of Scala}
-This section describes \purescala, the specification language of our
-verification system, as well as the programming language under consideration
-in its first version. As mentioned previously, {\purescala} is purely
-functional: computations have no side effects. All features, including the
-concrete syntax, are taken from Scala or added as part of a minimalistic
-library, and as a result, any valid {\purescala} program is a valid Scala
-program as well\footnote{Provided the inclusion of our small library, that
-is.}, and can be compiled and executed using {\tt scalac} and {\tt scala}.
-When displaying code examples, for reasons of space and clarity, we sometimes
-replace elements of the concrete syntax by shorter versions (printing $\neq$
-instead of \K{!=}, for instance). It particular, since there are no assignments
-in {\purescala}, we always print $=$ instead of \K{==}, with no risk of
-confusion. All object-oriented features of Scala are kept out {\purescala}:
-there are no classes (expect for case classes, but with the restrictions we
-impose on them, they really just become immutable records).
-
-\subsection{Features}
-\subsubsection{Primitive Types}
-The \K{Boolean} type is associated with the literals \K{true} and \K{false}
-and the usual operators ($\neg$, $\land$, $\lor$, $=$, $\neq$). There is also
-an additional binary operator $\rightarrow$ which we describe later. This
-type is also used as the basic type for assertions and contracts.
-
-The \K{Int} type represent 32-bit integers and comes with the standard set of
-arithmetic operators and relation symbols ($+$, $-$, $\cdot$, $/$, $=$,
-$\neq$, $<$, $\leq$, $>$, $\geq$). Integer constants can be written in any
-format defined in the Scala specification.
-
-\subsubsection{Collection Types}
-The \K{Option[A]} parametric type represents collections of $0$ or $1$
-element. Just like any other parametric type of {\purescala}, it can be
-instantiated with any other {\purescala} type, but since there are no type
-variables, it has to be made concrete. Values of types \K{Option[A]} are
-constructed by using \K{Some(\ldots)} or \K{None}, with the semantics being
-that all \K{None} values (of the same type) are equal, \K{None} is never
-equal to a \K{Some} value, and \K{Some($v_1$)} equals \K{Some($v_2$)} if and
-only if \K{$v_1$} and \K{$v_2$} are of the same type and are equal according
-to the definition of equality on that type.
-
-The \K{List[A]} type is used to represent linked lists. Although lists are
-pointer-based data structures, the comparison of two lists is always done
-element-by-element, and never on the references.
-
-Sets are useful for abstracting the content of data structures and are
-available in {\purescala} through the use of the (parametric) Scala library
-class \K{scala.collection.immutable.Set} and its companion object. The expected
-constructors, operators and relation symbols ($\emptyset$, $\{ \ldots \}$,
-$\cup$, $\cap$, $\in$, $\subseteq$) are available in this class.
-
-Multisets are not a part of the Scala library, but we consider them to be part
-of {\purescala} for convenience. We have a concrete implementation of that
-class so in practice,{\purescala} programs using multisets can be compiled by
-importing the proper definition. The operations are similar to those on sets, with the addition of the multiplicity function and $\uplus$.
-
-The parametric type \K{Map[A,B]} is used to represent functional maps. Like the
-other data types, it is purely functional, so updating a map returns a new map.
-The operations on maps are insertion, deletion and lookup. Lookup returns an
-\K{Option} type.
-
-\subsubsection{Algebraic Data Types}
-An important feature of {\purescala} is the possibility to define recursive
-data types. They correspond to case classes in Scala with the additional
-restrictions that all class hierarchies should be sealed, that classes can not
-declare methods or fields that are not arguments to the constructor, and that
-they should not be type-parametric.
-
-\subsubsection{Expressions}
-An expression in {\purescala} is either a value of the types mentioned above
-expressed a literal, or returned by a call to a constructor or a function call,
-or the result of the evaluation of one of the two control-flow contructs;
-if-then-else expressions and pattern matching. If-then-else expressions work as
-in Scala, and the else branch is not optional. Pattern matching can be done on
-integers, booleans, option types and user-defined recursive data types.
-Patterns can be guarded by an additional boolean constraint.
-
-\subsubsection{Structure of Programs}
-For simplicity reasons, a {\purescala} program should be written entirely
-within one component, or \K{object} in Scala terminology. All function, type,
-and ``global'' value definitions therefore have the same lexical scope. An
-exception to this rule is the possibility to write a \K{main} function, which
-is ignored by the static analysis, yet useful for runtime evaluation.
-
-\subsection{Specifications}
-Specifications can be given in terms of pre- and post-conditions of functions,
-but as mentioned in the introduction, this is not the most interesting form of
-contracts for {\purescala}. We write global specifications by means of calls to
-\K{assert} placed at the top-level of the main component. The special method \K{forAll} works as a universal quantifier on {\purescala} types. Its signature is the following:
-
-\lstinputlisting{code/forall-method.scala.cute}
-
-Its semantics are that \K{forAll[A](f: A $\Rightarrow$ Boolean)} is true if and
-only if \K{f} returns true for any argument of type \K{A}. It should be clear that we can write a predicate with multiple universal quantifications using \K{forAll} repeatedly in a nested way, however this can lead to lengthy expressions, so we write these in a shorter way. For instance, we display the following universally quantified specification:
-
-\lstinputlisting{code/spec-long.scala.cute}
-
-\ldots as:
-
-\lstinputlisting{code/spec-short.scala.cute}
-
-It should be noted that these universally quantified assertions are strictly
-more expressive that contracts expressed as pre- and post-conditions. Indeed,
-consider a function \K{f($x_1$, \ldots, $x_n$)} with pre-condition \K{pre($x_1$,
-\ldots, $x_n$)} and post-condition \K{res $\Rightarrow$ post(res, $x_1$, \ldots,
-$x_n$)}, where \K{res} is a variable representing the result of the evaluation. Then the contracts can be rewritten as the universally quantified specification:
-
-\begin{lstlisting}
-$\forall$ $x_1$, ..., $x_n$ . 
-  pre($x_1$, ..., $x_n$) $\rightarrow$ post(f($x_1$, ..., $x_n$), $x_1$, ..., $x_n$)
-\end{lstlisting}
-
-In contrast, pre- and post-conditions can not be used to reason about different
-executions, for example to state that two different functions applied to the
-same arguments always yield the same result.
diff --git a/doc/phd-project-2009-07/scalalistings.tex b/doc/phd-project-2009-07/scalalistings.tex
deleted file mode 100644
index 6466f4aec2522898bcf65307d53ba492aa824889..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/scalalistings.tex
+++ /dev/null
@@ -1,23 +0,0 @@
-%% To import in the preambule
-\usepackage{listings}
-
-% "define" Scala
-\lstdefinelanguage{scala}{
-  morekeywords={abstract, case, catch, class, def, do, else, extends, false, final, finally, for, if, implicit, import, match, new, null, object, override, package, private, protected, requires, return, sealed, super, this, throw, trait, try, true, type, val, var, while, with, yield, domain, postcondition, precondition,invariant, constraint, forall, in, _, return },
-  sensitive=true,
-  morecomment=[l]{//},
-  morecomment=[s]{/*}{*/},
-  morestring=[b]"
-}
-
-% Default settings for code listings
-\lstset{
-  frame=tb,
-  language=scala,
-  aboveskip=3mm,
-  belowskip=3mm,
-  showstringspaces=false,
-  columns=fullflexible,
-  mathescape=true,
-  basicstyle={\small\sffamily}
-} 
diff --git a/doc/phd-project-2009-07/status.tex b/doc/phd-project-2009-07/status.tex
deleted file mode 100644
index aec8836e70801a50ebe1998a77bd89bae222b4af..0000000000000000000000000000000000000000
--- a/doc/phd-project-2009-07/status.tex
+++ /dev/null
@@ -1,6 +0,0 @@
-\section{Implementation Status}
-Our implementation is still at an early stage. We have defined a representation
-for abstract syntax trees of {\purescala} programs, and have started working on
-a compiler plugin for {\tt scalac} which generates the proper AST from actual
-Scala trees, and rejects Scala programs which are not {\purescala}. No
-procedure for automated reasoning is yet implemented.
diff --git a/eval/cp/scripts/base-gnuplot-script b/eval/cp/scripts/base-gnuplot-script
deleted file mode 100644
index 148c76602b8dd8e7920cc000b2ce7e39c6756a88..0000000000000000000000000000000000000000
--- a/eval/cp/scripts/base-gnuplot-script
+++ /dev/null
@@ -1,7 +0,0 @@
-set terminal postscript color
-set key autotitle columnhead
-set style fill solid 1.00 border -1
-set style data histogram
-set style histogram cluster gap 1
-#set boxwidth 0.75 absolute
-#set xrange [0:*]
diff --git a/eval/cp/scripts/generate-graph b/eval/cp/scripts/generate-graph
deleted file mode 100755
index 93da7cc238a1f94f883a5ffd8b13fd6259bdd00b..0000000000000000000000000000000000000000
--- a/eval/cp/scripts/generate-graph
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-filename=$1
-title=`basename ${1}`
-graphName=../graphs/${title}.ps
-trans=transposed
-cat ${filename} | grep "GRAPH: " | sed 's/GRAPH: '// | ./transpose.awk > ${trans}
-
-mkdir -p ../graphs
-
-cat base-gnuplot-script > plotscript
-echo "set title \"${title}\"" >> plotscript
-echo "set output \"${graphName}\"" >> plotscript
-echo "set xlabel \"Invocations\"" >> plotscript
-echo "set ylabel \"Execution time (s)\"" >> plotscript
-echo "plot \"${trans}\" using 1, '' using 2, '' using 3, '' using 4, '' using 5, '' using 6" >> plotscript
-gnuplot plotscript
-rm plotscript
-rm ${trans}
diff --git a/eval/cp/scripts/run-cp-evaluation b/eval/cp/scripts/run-cp-evaluation
deleted file mode 100755
index 59bd81c2482860c6af3e1e22499ce538bb92e1c2..0000000000000000000000000000000000000000
--- a/eval/cp/scripts/run-cp-evaluation
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-cd ../../..
-
-ts=`date +%F-%R`
-demoFolder="cp-demo"
-cc="./cp-compile"
-rc="./cp-run"
-
-#classes=( "RedBlackTree" "SortedList" )
-
-if [ "$#" -lt "4" ]
-then
-  echo "Please provide a file name, main class name and bounds for problem size"
-  exit 1
-fi
-
-filename=${1}
-mainclass=${2}
-base=${3}
-limit=${4}
-
-evalFolder="eval/cp/data/${ts}-${mainclass}"
-
-mkdir -p ${evalFolder}
-
-evalFileBase=${evalFolder}/${mainclass}-${ts}
-${cc} axioms scalaEval ${filename} || (echo "Could not compile..." && exit 1)
-
-for (( i=${base}; i<=${limit}; i++ ))
-do
-  currentFile=${evalFileBase}-${i}
-  ${rc} ${mainclass} $i | tee -a ${currentFile}
-  cd eval/cp/scripts
-  ./generate-graph ../../../${currentFile}
-  cd ../../..
-done
-
-mv eval/cp/graphs/${mainclass}-${ts}-* ${evalFolder}
diff --git a/eval/cp/scripts/transpose.awk b/eval/cp/scripts/transpose.awk
deleted file mode 100755
index 5f6bdd6abe1069a5ae68555d4acd12ed61aa4284..0000000000000000000000000000000000000000
--- a/eval/cp/scripts/transpose.awk
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/gawk -f
-# ___  _  _ ____ ___ ___ ____ ___  ____ 
-# |  \ |  | |     |   |  |__| |__] |___ 
-# |__/ |__| |___  |   |  |  | |    |___ 
-#
-# The scripts were written to be usefull in
-# a research enviornment, but anyone is welcome
-# to use them.  Happy awking.  -Tim Sherwood
-
-BEGIN {
-	FS = " ";
-	max_x =0;
-	max_y =0;
-}
-
-{
-	max_y++;
-	for( i=1; i<=NF; i++ )
-	{
-		if (i>max_x) max_x=i;
-		A[i,max_y] = $i;
-	}
-}
-
-END {
-	for ( x=1; x<=max_x; x++ )
-	{
-		for ( y=1; y<=max_y; y++ )
-		{
-			if ( (x,y) in A ) printf "%s",A[x,y];
-			if ( y!=max_y ) printf " ";
-		}
-		printf "\n";
-	}
-}
diff --git a/eval/funcheck/scripts/run-evaluation b/eval/funcheck/scripts/run-evaluation
deleted file mode 100755
index 76f913e1116d2324d0f930b65851dc40dba18c5a..0000000000000000000000000000000000000000
--- a/eval/funcheck/scripts/run-evaluation
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-cd ../../..
-
-ts=`date +%F-%R`
-demoFolder="demo"
-files=( ${demoFolder}"/AssociativeList.scala" ${demoFolder}/"InsertionSort.scala" ${demoFolder}"/RedBlackTree.scala" ${demoFolder}"/PropositionalLogic.scala" "${demoFolder}/ListWithSize.scala")
-
-dataFolder="eval/funcheck/data"
-
-if [ "$#" -lt "1" ]
-then
-  echo "Please provide an unrolling value"
-  exit 1
-fi
-
-rm -rf summary
-
-for f in ${files[@]}
-do
-  ./funcheck CAV $f
-done
-
-mv summary ${dataFolder}/summary-CAV-${ts}
-
-for f in ${files[@]}
-do
-  ./funcheck CAV prune $f
-done
-
-mv summary ${dataFolder}/summary-CAV-prune-${ts}
-
-for f in ${files[@]}
-do
-  ./funcheck PLDI unrolling=${1} $f
-done
-
-mv summary ${dataFolder}/summary-PLDI-${ts}
diff --git a/examples/README b/examples/README
deleted file mode 100644
index 38964da74aa86c74ad12ba60be005e23d20f9bea..0000000000000000000000000000000000000000
--- a/examples/README
+++ /dev/null
@@ -1,2 +0,0 @@
-This directory contains examples we'd like to verify. It's work in progress so
-it doesn't mean we cover everything that's in these programs.
diff --git a/examples/contracts/bst/BSTAsSet.scala b/examples/contracts/bst/BSTAsSet.scala
deleted file mode 100644
index c3c402098f749e6c36316c1760310132d40e1827..0000000000000000000000000000000000000000
--- a/examples/contracts/bst/BSTAsSet.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-package contracts.bst
-
-object BSTAsSet extends Application {
-  sealed abstract case class BST(/*: specvar */ content : Set[Int]) {
-    // patterns are exhaustive, disjoint and all reachable     
-    def add(x: Int): BST = {
-      this match {
-        case Empty(_) => Node(Set(x), 
-			      Empty(Set.empty),x,Empty(Set.empty))
-        case Node(_,left,v,right) if (x < v) => Node(content + x, 
-						   left.add(v), v, right)
-        case Node(_,left,v,right) if (x > v) => Node(content + x, 
-						   left, v, right.add(x))
-        case Node(_,_,v,_) if (v == x) => this
-// this is due to limitation of pattern matching check
-	case _ => this
-      }
-    } ensuring (_.content == content + x)
-
-    // patterns are exhaustive, disjoint and all reachable 
-    def contains(key: Int): Boolean = {
-      this match { 
-        case Node(_,left,v,_) if (key < v) => left.contains(key)
-        case Node(_,_,v,right) if (key > v) => right.contains(key)
-        case Node(_,_,v, _) if (key == v) => true
-        case Empty(_) => false
-// this is due to limitation of pattern matching check
-	case _ => false
-      }
-    } ensuring (_ == content.contains(key))
-  }
-  
-  case class Empty(override val content : Set[Int]) extends BST(Set.empty)
-  case class Node(override val content : Set[Int], val left: BST, val value: Int, val right: BST) extends BST(content)
-
-  val empt = Empty(Set.empty)
-  
-  // main, only for testing purposes
-  val t = empt.add(3).add(5).add(17)
-  println(t);
-  println(t.contains(3))
-}
diff --git a/examples/contracts/bst/test-bst b/examples/contracts/bst/test-bst
deleted file mode 100755
index b1ae64c771430b9d72f87b0822e46e097d0cead2..0000000000000000000000000000000000000000
--- a/examples/contracts/bst/test-bst
+++ /dev/null
@@ -1,3 +0,0 @@
-mkdir class
-fsc -d class/ BSTAsSet.scala
-scala -cp class/ contracts.bst.BSTAsSet
diff --git a/examples/contracts/bstdefspec/BSTAsSet.scala b/examples/contracts/bstdefspec/BSTAsSet.scala
deleted file mode 100644
index 52327b9a88b12752ea13b465e14237bc2b8a754d..0000000000000000000000000000000000000000
--- a/examples/contracts/bstdefspec/BSTAsSet.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-package contracts.bstdefspec
-
-object BSTAsSet extends Application {
-  sealed abstract class BST
-  case object Empty extends BST
-  case class Node(left: BST, value: Int, right: BST) extends BST
-
-  def content(t : BST) : Set[Int] = t match {
-    case Empty => Set.empty
-    case Node(left,v,right) => (content(left) ++ Set(v) ++ content(right))
-  }
-
-  def size(t : BST) : Int = t match {
-    case Empty => 0
-    case Node(left,v,right) => size(left) + 1 + size(right)
-  }
-
-  def add(x : Int, t : BST) : BST = {
-    t match {
-      case Empty => Node(Empty,x,Empty)
-      case Node(left,v,right) => {
-	if (x < v) 
-	  Node(add(x, left), v, right)
-	else if (x==v) t
-	else
-	  Node(left, v, add(x, right))
-      }
-    }
-  } // ensuring(result => (content(result) == content(t) + x))
-
-  def contains(key: Int, t : BST): Boolean = { 
-    t match {
-      case Empty => false
-      case Node(left,v,right) => {
-	if (key == v) true
-	else if (key < v) contains(key, left)
-	else contains(key, right)
-      }
-      }
-  } // ensuring(res => (res == content(t).contains(key)))
-
-  // executable functions that 'illustrate' the meaning of quantifiers
-  def forallTree(property : (BST => Boolean)) : Boolean = {
-    property(Empty) &&
-    property(Node(Empty, 3, Empty)) &&
-    property(Node(Node(Empty, 3, Empty), 5, Node(Empty, 7, Empty)))
-    // if it holds for these trees, why wouldn't it hold in general?
-  }
-  def forallInt(property : (Int => Boolean)) : Boolean = {
-    property(0) &&
-    property(1) &&
-    property(2) &&
-    property(3) &&
-    property(-2)
-  }
-
-  // main, only for testing purposes
-  val t = add(17, add(6, add(3, add(5, add(3, Empty)))))
-  println(t)
-  println(content(t))
-  println(size(t))
-  println(contains(5, t))
-
-  // instead of contracts, we can write global assertions:
-  println(
-    forallInt(x => forallTree(t =>
-	content(add(x, t)) == content(t) + x)))
-  println(
-    forallInt(x => forallTree(t =>
-	(contains(x,t) == content(t).contains(x)))))
-}
diff --git a/examples/contracts/bstdefspec/test-bst b/examples/contracts/bstdefspec/test-bst
deleted file mode 100755
index 15ac1ff38e86bc5bbd1fcb825419a5b2f89e3e59..0000000000000000000000000000000000000000
--- a/examples/contracts/bstdefspec/test-bst
+++ /dev/null
@@ -1,3 +0,0 @@
-mkdir class
-fsc -d class/ BSTAsSet.scala
-scala -cp class/ contracts.bstdefspec.BSTAsSet
diff --git a/examples/contracts/heap/LeftistHeap.scala b/examples/contracts/heap/LeftistHeap.scala
deleted file mode 100644
index c7bf70b56a5c5a895671eb2f6a142bbe293b8929..0000000000000000000000000000000000000000
--- a/examples/contracts/heap/LeftistHeap.scala
+++ /dev/null
@@ -1,113 +0,0 @@
-package contracts.heap
-
-import scala.collection.immutable.Multiset
-
-/**
- * Example adapted from book "Purely Functional Data Structures"
- * by Chris Okasaki.
- */ 
-  
-object LeftistHeap {
-  
-  // UTILITARY FUNCTS USED FOR THE SPECIFICATION
-  def min(xs: List[Elem]): Elem = {
-    def inner(xs: List[Elem], local: Elem): Elem = xs match {
-      case Nil => local
-      case head :: tail =>
-        if(local <= head)
-          inner(tail,local)
-        else
-          inner(tail,head)
-    }
-    inner(xs,Elem(Integer.MAX_VALUE))
-  }
-  
-   def content(t : Heap): Multiset[Elem] = {
-    def inner(t: Heap, mset: Multiset[Elem]): Multiset[Elem] = t match {
-      case E => mset
-      case T(rank,el,left,right) => inner(right, inner(left, mset +++ List(el)))
-    }
-    inner(t,Multiset.empty[Elem])
-  } 
-}
-
-sealed abstract class Heap  {
-  import funcheck.lib.Specs._
-  import LeftistHeap._
-  
-  /** mege the current heap <code>this</code> with the <code>that</code> 
-   *  heap.
-   */
-  def merge(that: Heap): Heap = { this match {
-    case E => that
-    case T(_,x,a1,b1) => that match {
-      case E => this
-      case T(_,y,_,_) if x <= y =>
-        a1.makeT(x,b1.merge(that))
-      case T(_,y,a2,b2) if x > y =>
-        a2.makeT(y,merge(b2))
-    }
-  }} ensuring(res => content(res).equals(content(this) +++ content(that)))
-  
-  //val heapMerge = forAll( (thiz: Heap, that: Heap) => content(thiz.merge(that)).equals(content(thiz) +++ content(that)))
-  //val heapMerge = forAll[(Heap,Heap)] (heaps => content(heaps._1.merge(heaps._2)).equals(content(heaps._1) +++ content(heaps._2)))
-  
-  /** helper function that calculates the rank of a <code>T</code> node
-   *  and swaps its children if necessary.
-   */ 
-  private def makeT(x: Elem, that: Heap): Heap = { 
-    if(rankk >= that.rankk) {
-      T(that.rankk + 1, x, this, that)
-    } else {
-      T(rankk + 1, x, that, this)
-    }
-  } 
-
-  /** find the rank of a heap */
-  def rankk: Int = { this match {
-    case E => 0
-    case T(rank,_,_,_) => rank
-  }} 
-  
-  /** insert an element in the current heap <code>this</code>*/
-  def insert(x: Elem): Heap = {
-    merge(T(1,x,E,E))
-  } ensuring(res => content(res)(x) == content(this)(x) + 1)
-  
-  //val heapInsert = forAll( (heap: Heap, value: Elem) => content(heap.insert(value))(value) == content(heap)(value) + 1)
-  //val heapInsert = forAll[(Heap,Elem)]( p => content(p._1.insert(p._2))(p._2) == content(p._1)(p._2) + 1)
-  
-  /** Find the smallest element of the current heap <code>this</code>. 
-   *  Invariant on this data structure entails that the minimum is at the root.
-   */ 
-  def findMin: Elem = { this match {
-    case E => error(toString())
-    case T(_,x,_,_) => x
-  }} ensuring(res => res == min(content(this).elements.toList))
-  
-  //val heapFindMin = forAll{ heap : Heap => (heap.rankk > 0) ==> (heap.findMin == min(content(heap).elements.toList))}
-  //val heapFindMin = forAll{ heap : Heap => (heap.rankk > 0) ==> (heap.findMin == min(content(heap).elements.toList))}
-  
-  /** Delete the smallest element of the current heap <code>this</code>.
-   *  Invariant on this data structure entails that the minimum is at the root.
-   */
-  def deleteMin: Heap = {this match {
-    case E => Predef.error(toString())
-    case T(_,_,a: Heap,b: Heap) => a.merge(b)
-  }} ensuring(res  => content(res).equals(content(this) - findMin))
-  
-  //val heapDeleteMin = forAll{ heap: Heap => (heap.rankk > 0) ==> (content(heap.deleteMin).equals(content(heap) - heap.findMin))}
-  //val heapDeleteMin = forAll{ heap: Heap => (heap.rankk > 0) ==> (content(heap.deleteMin).equals(content(heap) - heap.findMin))}
-  
-}
-
-case class T(val rank: Int, val el: Elem, val left: Heap,val right: Heap) extends Heap
-case object E extends Heap
-
-
-case class Elem(val value: Int) extends Ordered[Elem] {
-  override def compare(that: Elem): Int = value compare that.value
-   
-  override def toString = "Elem("+value+")"
-}
-
diff --git a/examples/contracts/insertionsort/InsertionSort.scala b/examples/contracts/insertionsort/InsertionSort.scala
deleted file mode 100644
index a262e326736fe69010c77fe77b23ae54c07f7293..0000000000000000000000000000000000000000
--- a/examples/contracts/insertionsort/InsertionSort.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-package contracts.insertionsort
-
-import scala.collection.immutable.Set
-
-object InsertionSort {
-  import funcheck.lib.Specs
-
-  assert(
-    Specs.forAll(
-      (l: List[Int]) => { content(sorted(l)) equals content(l) }
-    )
-  )
-
-  def content(l: List[Int]): Set[Int] = l match {
-    case Nil => Set.empty
-    case x :: xs => content(xs) + x
-  }
-
-  def sortedIns(e: Int, l: List[Int]): List[Int] = l match {
-    case Nil => e :: Nil
-    case x :: xs if (x < e) => x :: sortedIns(e, xs)
-    case _ => e :: l
-  }
-
-  def sorted(l: List[Int]): List[Int] = l match {
-    case Nil => Nil
-    case x :: xs => sortedIns(x, sorted(xs))
-  }
-
-  def main(args: Array[String]): Unit = {
-    val ls: List[Int] = List(5, 2, 4, 5, 1, 8)
-
-    println(ls)
-    println(sorted(ls))
-  }
-}
diff --git a/examples/debug/SimpleContractTest.scala b/examples/debug/SimpleContractTest.scala
deleted file mode 100644
index acf9b4236aa96b722d2cea31feb255926a0dc0fe..0000000000000000000000000000000000000000
--- a/examples/debug/SimpleContractTest.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-package debug
-
-object SimpleContractTest {
-  def main(args: Array[String]): Unit = {
-    println("All set.")
-
-    println(checkedFunction(12))
-
-    // pre-cond fails
-    //println(checkedFunction(-1))
-
-    // post-cond fails
-    //println(checkedFunction(1))
-
-  }
-
-  def checkedFunction(i: Int): Int = { require(i >= 0) 
-    i * i
-  } ensuring(res => (res > i  && res >= 0))
-}
diff --git a/examples/funpm/logic/DPLL.scalac b/examples/funpm/logic/DPLL.scalac
deleted file mode 100644
index b9004b6f67fde8817a4d8f844e0027f590c501b7..0000000000000000000000000000000000000000
--- a/examples/funpm/logic/DPLL.scalac
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * DPLL in Scala implemented by Hossein. This program has been suggested by Viktor 
- * because it uses Set and Map. Though, in order to fit in our purely functional 
- * Scala subset we will have to rework it a little bit.
- * 
- * [TODO] Make this program to fit in our purely functional Scala subset.
- */
-
-package funpm.logic
-
-import scala.collection.immutable.ListSet
-
-
-object DPLL {
-  type Clause = Set[Literal]
-  type ClauseSet = Set[Clause]
-  
-  sealed abstract class Literal() {
-    def flip: Literal    
-  }
-  case class pos(v : String) extends Literal {
-    override def flip = neg(v)  
-  }
-  case class neg(v: String) extends Literal {
-    override def flip = pos(v)
-  }
-
-  
-
-  def negation(l: Literal) = l.flip
-  
-  /**
-   * Finds the unit literals in a formula
-   */
-  def find_one_literals( cs : ClauseSet) : Clause = 
-    new ListSet() ++ (cs.flatMap(c => if( c.size == 1) List(c.toArray(0)) else Nil)).elements
-   
-  
-  
-  /**
-   * Apply the one-literal rule on a literal ``l''
-   */
-  def one_literal_rule( c : ClauseSet, l : Literal) : ClauseSet =
-  { 
-    var result = Set.empty[Clause]
-    c.foreach(
-         clause => if( clause.contains( negation(l))) result = result + (clause - negation(l))
-                   else {if( !clause.contains(l)) result = result + clause}
-       )
-    result
-  }
-  /**
-   * Repeatedly apply the one-literal rule
-   * Returns the resulted clause set and the variable assignment
-   */
-  def repeat_one_literal( c : ClauseSet) : (ClauseSet,Map[String,Boolean]) =
-  {
-    val one_literals = find_one_literals( c)
-    var result_clauseset = c
-    var result_assignment = Map.empty[String,Boolean]
-    for( l <- one_literals)
-    {
-      result_clauseset = one_literal_rule( result_clauseset, l)
-      l match
-      {
-        case neg( v) => result_assignment = result_assignment + ( v -> false)
-        case pos( v) => result_assignment = result_assignment + ( v -> true)  
-      } 
-    }
-    (result_clauseset,result_assignment)
-  }
-  /**
-   * Find the literal which occur only positively or negatively in a Clause set
-   */
-  def find_unique_literals( c : ClauseSet) : Clause =
-  {
-    var unique_literals = Set.empty[Literal]
-    c.foreach( clause => unique_literals = unique_literals ++ clause)  
-    unique_literals.foreach( l => if( unique_literals.contains( negation( l))) 
-      {
-        unique_literals = unique_literals - l
-        unique_literals = unique_literals - negation(l)
-      })    
-    unique_literals    
-  }
-  
-  /**
-   * Apply the affirmative-negative rule on a literal ``l''
-   */
-  def affirmative_negative_rule( c : ClauseSet, l : Literal) : ClauseSet =
-  {
-    var result = c
-    c.foreach( clause => if( clause.contains(l)) result = result - clause)    
-    result  
-  }
-  /**
-   * Repeatedly apply the affirmative-negative rule
-   * Returns the resulted clause set and the variable assignment
-   */
-  def repeat_affirmative_negative( c : ClauseSet) : (ClauseSet,Map[String,Boolean]) = 
-  {
-    val unique_literals = find_unique_literals( c)
-    var result_clauseset = c
-    var result_assignment = Map.empty[String,Boolean]
-    for( l <- unique_literals)
-    {
-      result_clauseset = affirmative_negative_rule( result_clauseset, l)
-      l match
-      {
-        case neg( v) => result_assignment = result_assignment + ( v -> false)
-        case pos( v) => result_assignment = result_assignment + ( v -> true)  
-      }
-    }
-    (result_clauseset,result_assignment)
-  }
-  
-  /**
-   * Determines whether a clause set is satisfiable
-   * Computes the assignment to the variables
-   */
-  def dpll( c : ClauseSet) : (Boolean,Map[String,Boolean]) =
-  {
-    var assignment = Map.empty[String,Boolean]
-    // 1 - one-literal rule
-    var current_clauseset = repeat_one_literal(c)
-    assignment = current_clauseset._2
-    if( current_clauseset._1.exists( clause => clause.isEmpty)) return (false,assignment)
-    else if( current_clauseset._1.isEmpty) return (true,assignment)
-    // 2 - affirmative-negative rule
-    current_clauseset = repeat_affirmative_negative( current_clauseset._1)
-    assignment = assignment ++ current_clauseset._2
-    if( current_clauseset._1.exists( clause => clause.isEmpty)) return (false,assignment)
-    else if( current_clauseset._1.isEmpty) return (true,assignment)
-    // 3- splitting rule
-    val first_clause = current_clauseset._1.toArray.first
-    val literal_to_split = first_clause.toArray.first
-    val split_left = dpll(current_clauseset._1 + Set(negation(literal_to_split)) )
-    if( split_left._1) return ( true, split_left._2 ++ assignment)
-    val split_right = dpll(current_clauseset._1 + Set(literal_to_split)) 
-    return ( split_right._1, split_right._2 ++ assignment)
-  }
-    
-    
-  def main(args : Array[String]) : Unit = 
-  {
-    val form : ClauseSet = Set(  Set(neg("A"),neg("B"),pos("C")) , Set(pos("A"),pos("C"),pos("D")) , 
-                                  Set(pos("A"),pos("C"),neg("D")) , Set(pos("A"),neg("C"),pos("D")) ,
-                                  Set(pos("A"),neg("C"),neg("D")) , Set(neg("B"),neg("C"),pos("D")) ,
-                                  Set(neg("A"),pos("B"),neg("C")) , Set(neg("A"),neg("B"),pos("C")))
-    val res =  dpll( form)
-    
-    assert(res == (true,Map("B" -> true, "C" -> true, "A" -> true, "D" -> true)))
-
-  }
-}
diff --git a/examples/funpm/vcg/VerificationConditionGenerator.scala b/examples/funpm/vcg/VerificationConditionGenerator.scala
deleted file mode 100644
index 41dd33fade7b2c172c936f7bb9e02a4fe3135fc3..0000000000000000000000000000000000000000
--- a/examples/funpm/vcg/VerificationConditionGenerator.scala
+++ /dev/null
@@ -1,274 +0,0 @@
-/** =================================================
- *          Verification Condition Generator
- * 
- *  Grammar:
- * 
- *  S ::= (v=T)
- *       | assume(F)
- *       | assert(F)
- *       | havoc(v,...,v)
- *       | S ; S
- *       | while  (F) [inv F] { S } 
- *       | if (F) { S } else { S }
- *  T ::= T+T | T-T | K*T | v | K
- *  A ::= T=T | T < T | ITrue | IFalse
- *  F ::= A | (F&F) | (F|F) | ~F | ALL v.F | EX v.F
- *  K ::= 0 | 1 | 2 | ...
- *  v ::= x | y | z | ...
- *  =================================================
- */
-
-package funpm.vcg
-
-/** =================================================
- *           Class hierarchy and Extractors
- *  =================================================
- */
-
-sealed abstract class Tree
-abstract class IGuard extends Tree
-
-/** (x = T) */
-case class IAssign(val x: String, val t: Term) extends IGuard
-
-/** assume(f) */
-case class IAssume(val f: Form) extends IGuard 
-
-/** assert(f) */
-case class IAssert(val f: Form) extends IGuard 
-
-/** havoc(v,v,...,v) */
-case class IHavoc(val vars: Seq[IVar]) extends IGuard 
-
-/** S ; S */
-case class ISequence(val s1: IGuard, val s2: IGuard) extends IGuard 
-
-/** while (cond) { block } */
-case class IWhile(val cond: Form, val inv: Form,  val block: IGuard) extends IGuard 
-
-/** if (cond) { then } else { elses }*/
-case class IIf(val cond: Form, val then: IGuard, val elses: IGuard) extends IGuard 
-
-abstract class Term extends Tree
-/** T + T */
-case class IPlus(val t1: Term, val t2: Term) extends Term 
-
-/** T - T */
-case class IMinus(val t1: Term, val t2: Term) extends Term 
-
-/** K*T */
-case class IProd(val k: IConst, val t: Term) extends Term 
-
-/** v */
-case class IVar(val name: String) extends Term 
-
-/** 0 | 1 | 2 | ... */
-case class IConst(val number: Int) extends Term 
-
-abstract class Form extends Tree
-
-/** (F & F) */
-case class IAnd(val f1: Form, val f2: Form) extends Form 
-
-/** (F | F) */
-case class IOr(val f1: Form, val f2: Form) extends Form 
-
-/** ~F */
-case class INot(val f: Form) extends Form 
-
-/** EX v.F */
-case class IExists(val v: String, val f: Form) extends Form 
-
-/** ALL v.F */
-case class IForall(val v: String, val f: Form) extends Form 
-
-abstract class Atom extends Form
-
-/** t1 = t2 */
-case class IEqual(val t1: Term, val t2: Term) extends Atom 
-
-/** t1 < t2 */
-case class ILess(val t1: Term, val t2: Term) extends Atom 
-
-/** true */
-case class ITrue() extends Atom 
-
-/** false */
-case class IFalse() extends Atom 
-
-/** =================================================
- *             Substitution
- *  =================================================
- */
-
-object Substitution {
-  
-  def apply(x: String, s: Term, f: Form): Form = substFormula(x,s,f)
-  
-  def substFormula(x: String, s: Term, f: Form): Form = f match {
-    case IEqual(t1,t2) => IEqual(substTerm(x,s,t1), substTerm(x,s,t2))
-    case ILess(t1,t2)  => ILess(substTerm(x,s,t1), substTerm(x,s,t2))
-    case IAnd(f1,f2)   => IAnd(substFormula(x,s,f1), substFormula(x,s,f2))
-    case IOr(f1,f2)    => IOr(substFormula(x,s,f1), substFormula(x,s,f2))
-    case INot(f)       => INot(substFormula(x,s,f))
-    
-    case IExists(x1,f1) =>
-      if(x == x1) { IExists(x1,f1) }
-      else {
-        if(x != x1 && !FV(x1,s)) { IExists(x1,substFormula(x,s,f1)) }
-        else {
-          substFormula(x,s,substFormula(x1,IVar(x1+"1"),f))
-        }
-      }
-
-    case IForall(x1,f1) =>
-      if(x==x1) { IForall(x1,f1) } 
-      else {
-        if(x != x1 && !FV(x1,s)) { IForall(x1,substFormula(x,s,f1)) }
-        else {
-          substFormula(x,s,IForall(x1+"1",substFormula(x1,IVar(x1+"1"),f1)))
-        }
-      }
-
-    case ITrue()  => f
-    case IFalse() => f
-  } 
-  
-  
-  def substTerm(x: String, s: Term, t: Term): Term = t match {
-    case IVar(y) if x == y => s /**[x |-> s]x = s*/
-    case IVar(y) if x != y => t /**[x |-> s]x = s*/
-    case IPlus(t1,t2)      => IPlus(substTerm(x,s,t1),substTerm(x,s,t2))
-    case IMinus(t1,t2)     => IMinus(substTerm(x,s,t1),substTerm(x,s,t2))
-    case IProd(k,t)        => IProd(k,substTerm(x,s,t))
-    case IConst(_)         => t /**[x |-> s] y = y*/
-  }
-  
-  
-  def renameFormula(oldx: String, newx: String, f: Form): Form = f match {
-    case IExists(x,f) => 
-      if(x == oldx) { IExists(newx,renameFormula(oldx,newx,f)) }
-      else { IExists(oldx,renameFormula(oldx,newx,f)) }
-      
-    case IForall(x,f) =>  
-      if(x == oldx) { IForall(newx,renameFormula(oldx,newx,f)) }
-      else { IForall(oldx,renameFormula(oldx,newx,f)) }
-      
-    case IEqual(t1,t2) => IEqual(renameTerm(oldx,newx,t1),renameTerm(oldx,newx,t2))
-    case ILess(t1,t2)  => ILess(renameTerm(oldx,newx,t1), renameTerm(oldx,newx,t2))
-    case IAnd(f1,f2)   => IAnd(renameFormula(oldx,newx,f1), renameFormula(oldx,newx,f2))
-    case IOr(f1,f2)    => IOr(renameFormula(oldx,newx,f1), renameFormula(oldx,newx,f2))
-    case INot(f)       => INot(renameFormula(oldx,newx,f))
-    case ITrue()       => f
-    case IFalse()      => f
-  }
-  
-  
-  def renameTerm(oldx: String, newx: String, t: Term): Term = t match {
-    case IVar(y) if y == oldx => IVar(newx)
-    case IVar(y) if y != oldx => t
-    case IPlus(t1,t2)         => IPlus(renameTerm(oldx,newx,t1),renameTerm(oldx,newx,t2))
-    case IMinus(t1,t2)        => IMinus(renameTerm(oldx,newx,t1),renameTerm(oldx,newx,t2))
-    case IProd(k,t)           => IProd(k,renameTerm(oldx,newx,t))
-    case IConst(_)            => t
-  } 
-  
-  def FV(y: String ,s: Term): Boolean = s match {
-    case IVar(x)       => x == y
-    case IPlus(t1,t2)  => FV(y,t1) || FV(y,t2)
-    case IMinus(t1,t2) => FV(y,t1) || FV(y,t2)
-    case IProd(k,t)    => FV(y,t)
-    case IConst(_)     => false
-  }
-}
-
-
-/** =================================================
- *           Weakest Precondition Generator
- *  =================================================
- */
-
-object Wp {
-  
-   def apply(s: IGuard, q: Form): Form = s match {
-     /**wp(Q, x=t) = Q[x:=t]*/
-     case IAssign(x, t) => Substitution(x,t,q)
-     /**wp(Q, assume F) = F => Q*/
-     case IAssume(f) => IOr(INot(f),q)
-     /**wp(Q, assert F) = F & Q*/
-     case IAssert(f) => IAnd(f,q)
-     /**wp(Q, havoc(x)) = ALL x.Q  (or introduce a fresh variable)*/
-     case IHavoc(vars) => havoc2formula(q,vars)
-     /**wp(Q, c1 ; c2) = wp(wp(Q,c2),c1)*/
-     case ISequence(s1,s2) => apply(s1,apply(s2,q))
-     
-     case IWhile(cond,inv,block) => 
-       apply(ISequence(IAssert(inv),
-                       ISequence(IHavoc(lookupIVars(block)),
-                                 ISequence(IAssume(inv), IIf(cond, 
-                                                             ISequence(block,ISequence(IAssert(inv),
-                                                                             IAssume(IFalse())))
-                                                             ,
-                                                             IAssume(ITrue())))))
-             ,
-             q)
-     
-     /** if (f) c1 c2 <=> (assume(f);c1) [] (assume(�f);c2)
-         As wp(Q,c1 [] c2) = wp(Q,c1) & wp(Q,c2) */
-     case IIf(cond,then,elses) =>  
-       IAnd(
-         apply(ISequence(IAssume(cond),then),
-               q)
-         ,
-         apply(ISequence(IAssume(INot(cond)),elses),
-               q)
-         )
-     
-  }
-   
-
-  def havoc2formula(q: Form, xs: Seq[IVar]): Form = 
-    if(xs.isEmpty) { q }
-    else { havoc2formula(IForall(xs.headOption.get.name,q),xs.drop(1)) }
-  
-  
-  
-  def lookupIVars(instr: IGuard): Seq[IVar] = instr match {
-      case IAssign(x,t)           => List(IVar(x))
-      case IHavoc(vars)           => vars
-      case ISequence(s1,s2)       => lookupIVars(s1).concat(lookupIVars(s2))
-      case IIf(cond,then,elses)   => lookupIVars(then).concat(this.lookupIVars(elses))
-      case IWhile(cond,inv,block) => lookupIVars(block)
-      case IAssume(_)             => List()
-      case IAssert(_)             => List()
-    }
-  
-
-}
-
-        
-object VerificationConditionGenerator extends Application {
-
-  /**
-   * Program:
-   *
-   * x = 0;
-   * y = x + 3;
-   * havoc(x);
-   * assert (y=3);
-   *
-   * Test: Wp(Program,true) held a valid formula
-   */
-  assert(Wp( 
-           ISequence(IAssign("x",IConst(0)),
-           ISequence(IAssign("y",IPlus(IVar("x"),IConst(3))), 
-           ISequence(IHavoc(List(IVar("x"))),
-                    IAssert(IEqual(IVar("y"),IConst(3)))))
-           ),
-           ITrue()
-       )
-       ==
-       IForall("x1",IAnd(IEqual(IPlus(IConst(0),IConst(3)),IConst(3)),ITrue()))
-  )
-
-}
diff --git a/examples/parsable/IntSets.scala b/examples/parsable/IntSets.scala
deleted file mode 100644
index 445062d88c0273d2098ae725c560d8ec6746ecf3..0000000000000000000000000000000000000000
--- a/examples/parsable/IntSets.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-package parsable
-
-object IntSets {
-  import scala.collection.immutable.Set
-
-  def union(s1: Set[Int], s2: Set[Int]): Set[Int] = {
-    require(!s1.isEmpty && !s2.isEmpty)
-    s1 ++ s2
-  } ensuring((res: Set[Int]) => res.size > s1.size && res.size > s2.size && res.size <= s1.size + s2.size)
-
-  def main(args: Array[String]): Unit = {
-    println(union(Set(1, 2, 3), Set(2, 3, 4)))
-  }
-}
diff --git a/examples/plugin/BST.scala b/examples/plugin/BST.scala
deleted file mode 100644
index c453014a3f3bfe4668fc66c9f263075399b5de86..0000000000000000000000000000000000000000
--- a/examples/plugin/BST.scala
+++ /dev/null
@@ -1,55 +0,0 @@
-package plugin
-
-import funcheck.lib.Specs._
-
-object BST {
-  /** class hierarchy*/
-  sealed abstract class BST
-  @generator case class Empty() extends BST
-  case class Node(left: BST, value: Int, right: BST) extends BST
-
-  /** used for specification purposes */
-  def content(t : BST) : Set[Int] = t match {
-    case Empty() => Set.empty
-    case Node(left,v,right) => (content(left) ++ Set(v) ++ content(right))
-  }
-
-  /** compute the size of the given tree*/
-  def size(t : BST) : Int = t match {
-    case Empty() => 0
-    case Node(left,v,right) => size(left) + 1 + size(right)
-  }
-
-  /** build correct binary trees (this should be used instead of the default 
-   * case class constructor) */
-  @generator 
-  def add(x : Int, t : BST) : Node = {
-    t match {
-      case Empty() => Node(Empty(),x,Empty())
-      case t @ Node(left,v,right) => {
-	    if (x < v) Node(add(x, left), v, right)
-	    else if (x==v) t
-	    else Node(left, v, add(x, right))
-      }
-    }
-  } 
-
-  /** check if the tree contains the key */
-  def contains(key: Int, t : BST): Boolean = { 
-    t match {
-      case Empty() => false
-      case Node(left,v,right) => {
-	    if (key == v) true
-	    else if (key < v) contains(key, left)
-	    else contains(key, right)
-      }
-    }
-  } 
-
-  /** global assertions */
-  forAll{ p: (BST,Int) => contains(p._2,p._1) == content(p._1).contains(p._2)}
-  forAll{ p: (BST,Int) => content(add(p._2, p._1)) == content(p._1) + p._2}
-  
-  def main(args: Array[String]) = {}
-}
-
diff --git a/examples/plugin/ConsSnoc.scala b/examples/plugin/ConsSnoc.scala
deleted file mode 100644
index ace4da4d37b3722c3176143624774bc9d02951fb..0000000000000000000000000000000000000000
--- a/examples/plugin/ConsSnoc.scala
+++ /dev/null
@@ -1,104 +0,0 @@
-package plugin
-
-import funcheck.lib.Specs._
-
-
-  
-object ConsSnoc {
-  
-  /* Class Hierarchy */
-  @generator
-  sealed abstract class Lst
-  class Cons(val head: Int, val tail: Lst) extends Lst 
-  class Nill extends Lst
-
-  
-  /* Extractors */
-  object Nill {
-    def apply(): Nill = new Nill()
-    
-    //def unapply(n: Nill): Boolean = true
-    def unapply(l: Lst): Boolean = l match {
-      case n: Nill => true
-      case c: Cons => false
-    }
-  }
-
-  object Cons {
-    def apply(head: Int, tail: Lst): Cons = new Cons(head,tail)
-    
-    //def unapply(c: Cons): Option[(Int,Lst)] = Some((c.head,c.tail))
-    def unapply(l: Lst): Option[(Int,Lst)] = l match {
-      case n: Nill => None
-      case c: Cons => Some((c.head,c.tail)) 
-    } 
-      
-  }
-  
-  object Snoc {
-    def unapply(l: Lst): Option[(Lst,Int)] = l match {
-      case Nill() => None
-      case Cons(c, xs) => xs match {
-        case Nill() => Some((Nill(),c))
-        case Snoc(ys, y) => Some((Cons(c,ys),y))
-      }
-    }
-  }
-
-  def firstAndLast(lst: Lst): Lst = lst match {
-    case Nill()             => lst
-    case Cons(x, Nill())    => lst
-    case Cons(x, Snoc(_,y)) => Cons(x,Cons(y,Nill()))
-  }
-  
- 
-
-  
-  // Nill extractor always succeed for Nill instances
-  forAll{n: Nill => Nill.unapply(n)}             
-  // Cons extractor always succeed for Cons instances
-  forAll{c: Cons => Cons.unapply(c).isDefined}   
-  // Cons extractor succeed iff the passed object instance is of type Cons
-  forAll{l: Lst => Cons.unapply(l).isEmpty || (Cons.unapply(l).isDefined && l.isInstanceOf[Cons]) }
-  // Snoc extractor always succeed for Cons instances
-  forAll{c: Cons => Snoc.unapply(c).isDefined} 
-  // Snoc extractor succeed iff the passed object instance is of type Cons
-  forAll{l: Lst => Cons.unapply(l).isEmpty || (Snoc.unapply(l).isDefined && l.isInstanceOf[Cons])}
-  
-  /* These are postconditions, but they are checked as program axioms */
-  // Check behavior of Cons extractor 
-  forAll{c: Cons => equalLst(cons(Cons.unapply(c).get), c)}
-  // Check behavior of Snoc extractor  
-  forAll{c: Cons => equalLst(concat(Snoc.unapply(c).get), c) }
-  
-  // partition
-  // For any Lst, either the Cons or the Nill extractor applies
-  forAll{l: Lst => Cons.unapply(l).isDefined || Nill.unapply(l)} 
-  // For any Lst, it is never the case that both the Cons and the Nill extractor applies
-  forAll{l: Lst => !(Cons.unapply(l).isDefined && Nill.unapply(l))} 
-  // the two above properties could be simmply be written as
-  //forAll{l: Lst => Cons.unapply(l).isDefined ^^ Nill.unapply(l)} 
-  
-  /* list axioms */  
-  forAll[(Int,Cons)]{ p => (Cons.unapply(Cons(p._1,p._2)).get._1 == p._1) && 
-                           equalLst(Cons.unapply(Cons(p._1,p._2)).get._2, p._2) }
-  forAll[(Int, Cons)] { p => Cons(p._1,p._2).head == p._1}
-  forAll[(Int, Cons)] { p => Cons(p._1,p._2).tail == p._2}
-  
-  
-  def cons(s: (Int,Lst)): Cons = Cons(s._1, s._2)
-  
-  def concat(c: (Lst, Int)): Lst = c._1 match {
-    case Nill() => Cons(c._2, Nill())
-    case Cons(x,xs) => Cons(x,concat(xs,c._2))
-  }
-  
-  def equalLst(l1: Lst, l2: Lst): Boolean = (l1,l2) match {
-    case (Nill(),Nill()) => true
-    case (Cons(x,xs),Cons(y,ys)) if x == y =>
-      equalLst(xs,ys)
-    case _ => false
-  }
-  
-  def main(args: Array[String]) = {}
-}
\ No newline at end of file
diff --git a/examples/plugin/LambdaEvaluator.scala b/examples/plugin/LambdaEvaluator.scala
deleted file mode 100644
index 92e45ff76e53564c469b9e8117caa45af47f0fbe..0000000000000000000000000000000000000000
--- a/examples/plugin/LambdaEvaluator.scala
+++ /dev/null
@@ -1,93 +0,0 @@
-package plugin
-
-/** ================================================= 
- *  Evaluator for the untyped lambda calculus using
- *  The de Bruijn notation for lambda-terms
- * =================================================
- */ 
-
-import funcheck.lib.Specs._
-
-object LambdaEvaluator {
-  /** =================================================
-   *      Lambda Terms for Untyped Lambda Calculus
-   *  =================================================
-   */
-  @generator
-  sealed abstract class Term
-  case class App(val t1: Term, val t2: Term) extends Term
-  case class Abstr(val t: Term) extends Term
-  case class Var(val index: Int) extends Term
-  case class Const() extends Term
-  
-  def reduce(that: Term): Term = {
-    if(reduceCallByValue(that) == that) 
-      that
-    else  
-      reduce(reduceCallByValue(that))
-  }
-  
-  def isValue(that: Term): Boolean = that.isInstanceOf[Abstr]
-  
-  def reduceCallByValue(that: Term): Term = that match {
-    
-    case App(Abstr(t1), v2) if isValue(v2) =>
-      subst(t1,1,v2)
-  
-    case App(v1: Abstr, t2) if !isValue(t2) =>
-      App(v1, reduceCallByValue(t2))
-
-    case App(t1, t2) if !isValue(t1) =>
-      App(reduceCallByValue(t1), t2)
-        
-    case Abstr(t1) => Abstr(reduceCallByValue(t1))
-    case Var(_) => that
-    case Const() => that
-  }
-  
-  def subst(t: Term, index: Int, s: Term): Term = t match {
-    case Const() => t
-    
-    case Var(y) =>
-      if (y == index) { s } else { t }
-    
-    case Abstr(t1: Term) => Abstr(subst(t1,index+1,s))
-      
-    case App(t1, t2) =>
-      App(subst(t1,index,s), subst(t2,index,s))
-  }
-  
-  //forAll[(Term,Int,Term)]{p => p._1 == subst(subst(p._1,p._2,p._3),p._2,p._1)}
-  // this (correctly) fails 
-  // counter-example: p._1=Var(13) , p._2 = 13 , p._3 = Const()
-  
-  
-  
-  def main(args: Array[String]) = {
-    /** =================================================
-     *   \\z. (\\y. y (\\x. x)) (\\x. z x) 
-     *   is in de Bruijn notation
-     *   \\ (\\ 1 (\\ 1)) (\\ 2 1)
-     *   and it evaluates to:
-     *   \\ 2 (\\ 1) that is \\z. z (\\x. x)
-     *  =================================================
-     */ 
-//    assert(
-//      reduce(
-//        Abstr(
-//          App(
-//            Abstr(App(Var(1), Abstr(Var(1)))),
-//            Abstr(App(Var(2),Var(1)))
-//          )
-//        )
-//      )
-//      ==
-//      Abstr(App(Var(2), Abstr(Var(1))))
-//    )
-  }
-  
-  
-}
-  
-
-
diff --git a/examples/plugin/LeftistHeap.scala b/examples/plugin/LeftistHeap.scala
deleted file mode 100644
index 5dd2ceae0976631878f3a8fb8accb3dd98cd4c5b..0000000000000000000000000000000000000000
--- a/examples/plugin/LeftistHeap.scala
+++ /dev/null
@@ -1,113 +0,0 @@
-package plugin
-
-import funcheck.lib.Specs._
-import scala.collection.immutable._
-
-/**
- * Example adapted from book "Purely Functional Data Structures"
- * by Chris Okasaki.
- */ 
-  
-object LeftistHeap {
-  
-  /** method used for specification */
-  def min(xs: List[Elem]): Elem = {
-    def inner(xs: List[Elem], local: Elem): Elem = xs match {
-      case Nil => local
-      case head :: tail =>
-        if(leq(local,head))
-          inner(tail,local)
-        else
-          inner(tail,head)
-    }
-    inner(xs,Elem(Integer.MAX_VALUE))
-  }
-  
-  /** method used for specification */
-  def content(t : Heap): Multiset[Elem] = {
-    def inner(t: Heap, mset: Multiset[Elem]): Multiset[Elem] = t match {
-      case E() => mset
-      case T(rank,el,left,right) => inner(right, inner(left, mset +++ List(el)))
-    }
-    inner(t,Multiset.empty[Elem])
-  }
-  
-  /** class hierarchy */
-  sealed abstract class Heap
-  case class T(val rank: Int, val el: Elem, val left: Heap,val right: Heap) extends Heap
-  @generator case class E() extends Heap
-  
-  @generator case class Elem(val value: Int) 
-
-  def leq(e1: Elem, e2: Elem): Boolean =  e1.value <= e2.value
-  
-  /** mege the current heap <code>this</code> with the <code>that</code> */
-  def merge(thiz: Heap, that: Heap): Heap = thiz match {
-    case E() => that
-    case T(_,x,a1,b1) => that match {
-      case E() => thiz
-      case T(_,y,_,_) if leq(x,y) =>
-        makeT(a1, x, merge(b1, that))
-      case T(_,y,a2,b2) if !leq(x,y) =>
-        makeT(a2, y, merge(thiz, b2))
-    }
-  }
-  
-  /** helper function that calculates the rank of a <code>T</code> node
-   *  and swaps its children if necessary. */ 
-  def makeT(thiz: Heap, x: Elem, that: Heap): Heap = { 
-    if(rankk(thiz) >= rankk(that)) {
-      T(rankk(that) + 1, x, thiz, that)
-    } else {
-      T(rankk(thiz) + 1, x, that, thiz)
-    }
-  } 
-  
-  /** find the rank of a heap */
-  def rankk(thiz: Heap): Int = thiz match {
-    case E() => 0
-    case T(rank,_,_,_) => rank
-  }
-
-  /** insert an element in the current heap <code>this</code>*/
-  @generator
-  def insert(thiz: Heap, x: Elem): Heap = merge(thiz, T(1,x,E(),E()))
-  
-  /** Find the smallest element of the current heap <code>this</code>. 
-   *  Invariant on this data structure entails that the minimum is at the root.
-   */ 
-  def findMin(thiz: Heap): Elem = thiz match {
-    case E() => error(toString())
-    case T(_,x,_,_) => x
-  }
-
-  /** Delete the smallest element of the current heap <code>this</code>.
-   *  Invariant on this data structure entails that the minimum is at the root.
-   */
-  def deleteMin(thiz: Heap): Heap = thiz match {
-    case E() => error(toString())
-    case T(_,_,a: Heap,b: Heap) => merge(a,b)
-  }
-  
-  
-  /** global invariants */
-  //val heapMerge = forAll( (thiz: Heap, that: Heap) => content(thiz.merge(that)).equals(content(thiz) +++ content(that)))
-  forAll[(Heap,Heap)] (heaps => content(merge(heaps._1,heaps._2)).equals(content(heaps._1) +++ content(heaps._2)))
-
-  
-  //val heapInsert = forAll( (heap: Heap, value: Elem) => content(heap.insert(value))(value) == content(heap)(value) + 1)
-  forAll[(Heap,Elem)]( p => content(insert(p._1,p._2))(p._2) == content(p._1)(p._2) + 1)
-  
-  // This property should (and does) fail
-  //forAll[(Heap,Elem)]( p => ((rankk(p._1) > 0 && findMin(p._1).value == p._2.value) ==> (findMin(p._1).value < p._2.value)))
-    
-  //val heapFindMin = forAll{ heap : Heap => (heap.rankk > 0) ==> (heap.findMin == min(content(heap).elements.toList))}
-  forAll{ heap : Heap => (rankk(heap) > 0) ==> (findMin(heap) == min(content(heap).elements.toList))}
-  
-  
-  //val heapDeleteMin = forAll{ heap: Heap => (heap.rankk > 0) ==> (content(heap.deleteMin).equals(content(heap) - heap.findMin))}
-  forAll{ heap: Heap => (rankk(heap) > 0) ==> (content(deleteMin(heap)).equals(content(heap) - findMin(heap)))}
-  
-  def main(args: Array[String]) = {}
-}
-
diff --git a/examples/plugin/ListSet.scala b/examples/plugin/ListSet.scala
deleted file mode 100644
index 3937c1016a0d0c8f51631bcab737d6c334a10fc2..0000000000000000000000000000000000000000
--- a/examples/plugin/ListSet.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-package plugin
-
-import scala.collection.immutable.Set
-import funcheck.lib.Specs._
-
-object ListSet {
-  forAll[(Int,List[Int])] (p =>
-    content(insert(p._1, p._2)) == content(p._2) + p._1)
-
-  forAll[(Int,List[Int])] (p =>
-    content(remove(p._1, p._2)) == content(p._2) - p._1)
-
-  forAll[(List[Int],List[Int],Int)] (p =>
-    eqlists(p._1, p._2) ==> eqlists(insert(p._3, p._1), insert(p._3, p._2)))
-
-  forAll[(List[Int],List[Int],Int)] (p =>
-    eqlists(p._1, p._2) ==> eqlists(remove(p._3, p._1), remove(p._3, p._2)))
-
-  def eqlists(xs: List[Int], ys: List[Int]): Boolean = content(xs) == content(ys)
-
-  def content(xs: List[Int]): Set[Int] = xs match {
-    case Nil => Set.empty
-    case x :: xs => content(xs) + x
-  }
-
-  //@generator 
-  def insert(x: Int, xs: List[Int]): List[Int] = if(member(x, xs)) xs else x :: xs
-
-  def remove(x: Int, xs: List[Int]): List[Int] = xs match {
-    case Nil => Nil
-    case y :: ys if (y == x) => remove(x, ys)
-    case y :: ys if (y != x) => y :: remove(x, ys)
-  }
-
-  def member(x: Int, xs: List[Int]): Boolean = xs match {
-    case Nil => false
-    case y :: _ if (y == x) => true
-    case _ :: ys => member(x, ys)
-  }
-
-  //@generator 
-  def makeNil: List[Int] = Nil
-  
-  
-  def main(args: Array[String]): Unit = {}
-}
diff --git a/examples/plugin/PropositionalLogic.scala b/examples/plugin/PropositionalLogic.scala
deleted file mode 100644
index db1195a3404195c91029b0eb908bf0cd1f92e427..0000000000000000000000000000000000000000
--- a/examples/plugin/PropositionalLogic.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-package plugin
-
-import funcheck.lib.Specs._
-
-object PropositionalLogic {
-  @generator
-  sealed abstract class Formula
-  case class Or(left: Formula, right: Formula) extends Formula
-  case class Neg(f: Formula) extends Formula
-  case class True() extends Formula
-  case class False() extends Formula
-  case class Imply(left: Formula,right: Formula) extends Formula
-
-
-  def desugar(f: Formula): Formula = f match {
-    case True()            => f
-    case False()           => f
-    case Or(left,right)    => Or(desugar(left),desugar(right))
-    case Neg(f)            => Neg(desugar(f))
-    case Imply(left,right) => Or(Neg(desugar(left)),desugar(right))
-  }
-  
-  def isDesugared(f: Formula): Boolean = f match {
-    case Or(left,right)    => isDesugared(left) && isDesugared(right)
-    case Neg(f)            => isDesugared(f)
-    case True()            => true
-    case False()           => true
-    case i: Imply          => false
-  }
-  
-  //Type refinement: A desugarized formula does not contain an Imply node.
-  forAll{f : Formula => isDesugared(f) ==> (desugar(f) == f) }
-  
-    
-  def main(args: Array[String]) = {}
-}
-
diff --git a/examples/plugin/SetRedBlackTree.scala b/examples/plugin/SetRedBlackTree.scala
deleted file mode 100644
index 77787ed540e62a98c8a363ffb531dee73824873e..0000000000000000000000000000000000000000
--- a/examples/plugin/SetRedBlackTree.scala
+++ /dev/null
@@ -1,106 +0,0 @@
-package plugin
-
-import funcheck.lib.Specs._
-
-/*** Okasaki-style red-black tree maps. ***/
-
-// Based on:
-// http://www.eecs.usma.edu/webs/people/okasaki/jfp99.ps
-
-object SetRedBlackTree {
-  @generator
-  sealed abstract class Color
-  case class Red() extends Color // Red.
-  case class Black() extends Color // Black.
-  
-  
-  sealed abstract class Tree
-  @generator case class Empty() extends Tree
-  case class Node(color: Color, left: Tree, value: Int, right: Tree) extends Tree
-  
-  
-  def member(x: Int, t:Tree): Boolean = t match {
-    case Empty() => false
-    case Node(_,a,y,b) => 
-      if (x < y) member(x,a)
-      else if (x > y) member(x,b)
-      else true
-  }
-  
-  @generator
-  def insert(x: Int, t: Tree): Tree = {
-    def ins(t: Tree): Tree = t match {
-      case Empty() => Node(Red(),Empty(),x,Empty())
-      case Node(c,a,y,b) =>
-        if      (x < y)  balance(c, ins(a), y, b)
-        else if (x == y) Node(c,a,y,b)
-        else             balance(c,a,y,ins(b))
-    }
-    makeBlack(ins(t))
-  }
-  
-  def balance(c: Color, a: Tree, x: Int, b: Tree): Tree = (c,a,x,b) match {
-    case (Black(),Node(Red(),Node(Red(),a,xV,b),yV,c),zV,d) => 
-      Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-    case (Black(),Node(Red(),a,xV,Node(Red(),b,yV,c)),zV,d) => 
-      Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-    case (Black(),a,xV,Node(Red(),Node(Red(),b,yV,c),zV,d)) => 
-      Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-    case (Black(),a,xV,Node(Red(),b,yV,Node(Red(),c,zV,d))) => 
-      Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-    case (c,a,xV,b) => Node(c,a,xV,b)  
-  }
-  
-  /** makeBlack: Turn a node black. */
-  def makeBlack(n: Tree): Tree = n match {
-    case Node(Red(),l,v,r) => Node(Black(),l,v,r)
-    case _ => n
-  }
-  
-  /* global invariants: 
-   * Red-black trees are binary search trees obeying two key invariants:
-   *
-   * (1) Any path from a root node to a leaf node contains the same number
-   *     of black nodes. (A balancing condition.)
-   *
-   * (2) Red nodes always have black children.
-   *
-   */
-  forAll{t: Tree => anyPathsContainsSameNumberOfBlackNodes(t)} //(1)
-  forAll{t: Tree => areRedNodeChildrenBlack(t)} //(2)
-  
-  
-  /* Empty tree are considered to be black */
-  def isBlack(t: Tree): Boolean = t match {
-    case Node(Red(),_,_,_) => false
-    case _ => true
-  }
-  
-  
-  def anyPathsContainsSameNumberOfBlackNodes(t: Tree): Boolean = {
-    def blacks(t: Tree, acc: Int): List[Int] = t match {
-      case Empty() => List(acc + 1) // because Empty are assumed to be black
-      case n @ Node(_,l,_,r) => 
-        val upAcc = if(isBlack(t)) acc + 1 else acc 
-        blacks(l,upAcc) ::: blacks(r,upAcc)  
-    }
-    val paths = blacks(t, 0)
-    
-    if(paths.isEmpty)
-      true
-    else
-      paths.forall(_ == paths.head)
-  } 
-  
-  def areRedNodeChildrenBlack(t: Tree): Boolean = t match {
-    case Node(Red(),l,_,r) =>
-      isBlack(l) && isBlack(r) &&
-      areRedNodeChildrenBlack(l) && areRedNodeChildrenBlack(r)
-    case Node(Black(),l,_,r) =>
-      areRedNodeChildrenBlack(l) && areRedNodeChildrenBlack(r)
-    case _ => true
-  }
-  
-  def main(args: Array[String]) = {}
-}
-
diff --git a/examples/plugin/SkewBinaryRandomAccessList.scala b/examples/plugin/SkewBinaryRandomAccessList.scala
deleted file mode 100644
index 3bfd443d3a6036afac244810685c6ee0378a29b5..0000000000000000000000000000000000000000
--- a/examples/plugin/SkewBinaryRandomAccessList.scala
+++ /dev/null
@@ -1,74 +0,0 @@
-package plugin
-
-import funcheck.lib.Specs._
-
-/* SkewBinaryRandomAccessList: Okasaki's "Purely Functional Data Structures" p.134 Fig. 9.7. */
-
-object SkewBinaryRandomAccessList {
-
-  sealed abstract class Tree
-  case class Leaf(w: Int) extends Tree
-  case class Node(w: Int, left: Tree, right: Tree) extends Tree
-  
-  type RList = List[(Int, Tree)]  
-  
-  val empty = Nil
-  
-  def isEmpty(ts: RList) = ts.isEmpty
-  
-  def cons(w: Int, ts: RList): RList = ts match {
-    case (w1,t1) :: (w2,t2) :: rest if (w1 == w2) => 
-      (1+w1+w2, Node(w,t1,t2)) :: rest
-      
-    case _ => 
-      (1, Leaf(w)) :: ts 
-  }
-  
-  def head(ts: RList): Int = ts match {
-    case Nil => error("head of empty list")
-    case (1, Leaf(x)) :: ts => x
-    case (_, Node(x, _, _)) :: ts => x
-  }
-  
-  def tail(ts: RList): RList = ts match {
-    case Nil => error("tail of empty list")
-    case (1, Leaf(x)) :: ts => ts
-    case (w, Node(x, t1, t2)) :: rest => 
-      (w/2, t1) :: (w/2, t2) :: rest
-  }
-  
-  def lookup(i: Int, ts: RList): Int = ts match {
-    case Nil => error("lookup of empty list")
-    case (w,t) :: ts =>
-      if (i < w) lookupTree(w,i,t)
-      else lookup(i-w, ts)
-  }
-  
-  def lookupTree(w: Int, i: Int, t: Tree): Int = (w,i,t) match {
-    case (1,0, Leaf(x)) => x
-    case tuple @ (1,_,Leaf(x)) => error("lookupTree: error for "+tuple)
-    case (_,0, Node(x,_,_)) => x
-    case (_,_,Node(x,t1,t2)) =>
-      if (i < w/2) lookupTree(w/2,i-1,t1)
-      else lookupTree(w/2,i-1-w/2,t2)
-  }
-  
-  def updateTree(w: Int, i: Int, y: Int, t: Tree): Tree = (w,i,y,t) match {
-    case (1,0,_,Leaf(x)) => Leaf(y)
-    case tuple @ (1,_,_,Leaf(x)) => error("updateTree: Error for "+tuple)
-    case (_,0,_,Node(x,t1,t2)) => Node(y,t1,t2)
-    case (_,_,_,Node(x,t1,t2)) => 
-      if (i <= w/2) Node(x,updateTree(w/2,i-1,y,t1),t2)
-      else Node(x,t1, updateTree(w/2,i-1-w/2,y,t2))
-  } 
- 
-  
-  def update(i: Int, y: Int, ts: RList): RList = ts match {
-    case Nil => error("update of empty list")
-    case (w,t) :: ts =>
-      if (i < w) (w, updateTree(w,i,y,t)) :: ts
-      else (w,t) :: update(i-w,y,ts)
-  }
-  
-  def main(args: Array[String]): Unit = {}
-}
diff --git a/examples/plugin/kawaguchi_pldi2010/InsertSort.scala b/examples/plugin/kawaguchi_pldi2010/InsertSort.scala
deleted file mode 100644
index 448b8bebdfa32cdac3189c4133ba21b0e6611a87..0000000000000000000000000000000000000000
--- a/examples/plugin/kawaguchi_pldi2010/InsertSort.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-package plugin.kawaguchi_pldi2010
-
-/* Example from paper "Type-based Data Structure Verification"
- * http://pho.ucsd.edu/liquid/demo/index2.php */
-
-import funcheck.lib.Specs._
-
-object InsertSort {
-
-  def insert(ys: List[Int], x: Int): List[Int] = ys match {
-    case Nil => List(x)
-    case y :: ys => 
-      if (x < y) x :: y :: ys
-      else y :: insert(ys,x)
-  }
-  
-  def insert_sort(xs: List[Int]): List[Int] = xs match {
-    case Nil => Nil
-    case x :: xs => 
-      insert(insert_sort(xs),x)
-  }
-  
-  def insert_sort2(xs: List[Int]): List[Int] = 
-    xs.foldLeft[List[Int]](Nil)((x,xs) => insert(x,xs))
-  
-  def check(xs: List[Int]): Boolean = xs match {
-    case Nil => true
-    case List(x) => true
-    case x :: y :: xs => 
-      x <= y && check(y :: xs)
-  }
-  
-  def test(xs: List[Int]): Boolean = 
-    check(insert_sort(xs)) && check(insert_sort2(xs))
-  
-  forAll{xs: List[Int] => test(xs)}
-  
-  def main(args: Array[String]) = {}
-}
diff --git a/examples/plugin/kawaguchi_pldi2010/MapReduce.scala b/examples/plugin/kawaguchi_pldi2010/MapReduce.scala
deleted file mode 100644
index 2388c3476298920c5cc720b56ed0fee1d65c0054..0000000000000000000000000000000000000000
--- a/examples/plugin/kawaguchi_pldi2010/MapReduce.scala
+++ /dev/null
@@ -1,94 +0,0 @@
-package plugin.kawaguchi_pldi2010
-
-/* Example from paper "Type-based Data Structure Verification"
- * http://pho.ucsd.edu/liquid/demo/index2.php */
-
-import funcheck.lib.Specs._
-
-import scala.collection.immutable.Multiset
-
-object MapReduce {
-  
-  /* specification */
-  def insert(map: Map[Int, Multiset[Int]], entry: (Int, Int)): Map[Int, Multiset[Int]] = {
-    val (key,value) = entry
-    map.get(key) match {
-      case None => map + ((key, Multiset(value)))
-      case Some(vs) => map + ((key, vs +++ List(value))) 
-    }
-  }
-  
-  def content(kvs: List[(Int, List[Int])]): Map[Int, Multiset[Int]] = 
-    (Map.empty[Int, Multiset[Int]] /: kvs) {
-      case (map,(key,values)) => 
-        (map /: values) {
-          case (map,v) => insert(map,(key,v))
-        }
-    } 
-    
-    
-  
-  /*****************************************/
-  
-  
-  forAll[(List[(Int,List[Int])],(Int,Int))]{p => insert(content(p._1),p._2) == content(insert(p._1,p._2))}
-  
-  def insert(t: List[(Int,List[Int])], x: (Int,Int)): List[(Int,List[Int])] = {
-    val (key,value) = x
-    t match {
-      case Nil => List((key, List(value)))
-      case (k,vs) :: t => 
-        if(k == key)
-          (k, value :: vs) :: t
-        else
-          (k,vs) :: (insert(t,x))
-    }
-  }
-  
-  def expand(f: Int => List[(Int, Int)], xs: List[Int]): List[(Int,Int)] = xs match {
-    case Nil => Nil
-    case x :: xs => f(x) ::: expand(f,xs) 
-  } 
-  
-  
-  
-  def group(kvs: List[(Int, Int)]): List[(Int,List[Int])] = {
-    val nil: List[(Int,List[Int])] = Nil
-    (nil /: kvs) {
-      case (z, a) => insert(z, a)
-    }
-  }
-  
-  
-  def collapse(f: (Int,Int) => Int, gs: List[(Int, List[Int])]): List[(Int, Int)] = {
-    val collapser = {
-      x: (Int, List[Int]) => x match {
-        case (k, Nil) => error("cannot collapse")
-        case (k, v :: vs)  => (k, vs.foldLeft(v)((z: Int,a: Int) => f(z,a)))  
-       
-      }
-    }
-    
-    gs.map(collapser(_))
-  } 
-  
-  
-  def map_reduce(xs: List[Int], mapper: Int => List[(Int, Int)], reducer: (Int,Int) => Int): List[(Int, Int)] = {
-    val kvs: List[(Int,Int)] = expand(mapper,xs)
-    val gs: List[(Int,List[Int])] = group(kvs)
-    val rs  = collapse(reducer, gs)
-    rs
-  }
-  
-  
-  
-  
-  def main(args: Array[String]) = {
-//    val xs = List.range(1,5)
-//    val mapper: Int => List[(Int,Int)] = {x: Int => List((x,x+2), (x,x+3))}
-//    val reducer = {(a: Int,b: Int) => a + b}
-//    
-//    println(map_reduce(xs,mapper,reducer))
-  }
-  
-}
diff --git a/examples/plugin/kawaguchi_pldi2010/MergeSort.scala b/examples/plugin/kawaguchi_pldi2010/MergeSort.scala
deleted file mode 100644
index 835334de22759667588f81faa5c42da8e848f6d6..0000000000000000000000000000000000000000
--- a/examples/plugin/kawaguchi_pldi2010/MergeSort.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-package plugin.kawaguchi_pldi2010
-
-import funcheck.lib.Specs._
-
-/* Example from paper "Type-based Data Structure Verification"
- * http://pho.ucsd.edu/liquid/demo/index2.php */
-
-object MergeSort {
-
-  def halve(xs: List[Int]): (List[Int],List[Int]) = xs match {
-    case Nil => (Nil,Nil)
-    case x :: xs => 
-      val (ys,zs) = halve(xs)
-      (x :: zs, ys)
-  } 
-  
-  def merge(xs: List[Int], ys: List[Int]): List[Int] = (xs,ys) match {
-    case (Nil,_) => ys
-    case (_,Nil) => xs
-    case (x :: xs, y :: ys) => 
-      if (x < y) x :: merge(xs, y :: ys)
-      else y :: merge(x:: xs, ys)
-  }
-  
-  def mergesort(ps: List[Int]): List[Int] = ps match {
-    case Nil => Nil
-    case List(p) => List(p)
-    case _ => 
-      val (qs,rs) = halve(ps)
-      val qs1 = mergesort(qs)
-      val rs1 = mergesort(rs)
-      merge(qs1,rs1)
-  }
-  
-  def check(xs: List[Int]): Boolean = xs match {
-    case x :: y :: xs => 
-      x <= y && check(y :: xs)
-      
-    case _ => true
-  }
-  
-  def test(xs: List[Int]): Boolean = check(mergesort(xs))
-  
-  forAll{xs: List[Int] => test(xs)}
-  
-  def main(args: Array[String]) = {}
-}
diff --git a/examples/plugin/kawaguchi_pldi2010/MergeSortBug.scala b/examples/plugin/kawaguchi_pldi2010/MergeSortBug.scala
deleted file mode 100644
index b3aa4906c414a5e214de86a92d29e8fe3d089590..0000000000000000000000000000000000000000
--- a/examples/plugin/kawaguchi_pldi2010/MergeSortBug.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-package plugin.kawaguchi_pldi2010
-
-import funcheck.lib.Specs._
-
-/* Example from paper "Type-based Data Structure Verification"
- * http://pho.ucsd.edu/liquid/demo/index2.php */
-
-object MergeSortBug {
-
-  def halve(xs: List[Int]): (List[Int],List[Int]) = xs match {
-    case Nil => (Nil,Nil)
-    case x :: xs => 
-      val (ys,zs) = halve(xs)
-      (x :: zs, ys)
-  } 
-  
-  def merge(xs: List[Int], ys: List[Int]): List[Int] = (xs,ys) match {
-    case (Nil,_) => ys
-    case (_,Nil) => xs
-    case (x :: xs, y :: ys) => 
-      if (x < y) x :: merge(xs, y :: ys)
-      else y :: merge(x:: xs, ys)
-  }
-  
-  def mergesort(ps: List[Int]): List[Int] = ps match {
-    case Nil => Nil
-    //case List(p) => List(p)  XXX: BUG: Missing case
-    case _ => 
-      val (qs,rs) = halve(ps)
-      val qs1 = mergesort(qs)
-      val rs1 = mergesort(rs)
-      merge(qs1,rs1)
-  }
-  
-  def check(xs: List[Int]): Boolean = xs match {
-    case x :: y :: xs => 
-      x <= y && check(y :: xs)
-      
-    case _ => true
-  }
-  
-  def test(xs: List[Int]): Boolean = check(mergesort(xs))
-  
-  forAll{xs: List[Int] => test(xs)}
-  
-  def main(args: Array[String]) = {}
-}
diff --git a/examples/plugin/kawaguchi_pldi2010/MiniBDD.scala b/examples/plugin/kawaguchi_pldi2010/MiniBDD.scala
deleted file mode 100644
index c8e225d723c981495b133c209fc7e8563bd4eb91..0000000000000000000000000000000000000000
--- a/examples/plugin/kawaguchi_pldi2010/MiniBDD.scala
+++ /dev/null
@@ -1,181 +0,0 @@
-package plugin.kawaguchi_pldi2010
-
-/* Example from paper "Type-based Data Structure Verification"
- * http://pho.ucsd.edu/liquid/demo/index2.php */
-
-import funcheck.lib.Specs._
-
-object MiniBDD {
-
-  @generator
-  sealed abstract class BDD
-  case class Node(v: Int, low: BDD, high: BDD) extends BDD
-  case class Zero() extends BDD
-  case class One() extends BDD
-  
-  @generator
-  sealed class Op
-  case class And() extends Op
-  case class Or() extends Op
-  case class Imp() extends Op
-  case class Any(f: (Boolean,Boolean) => Boolean) extends Op
-  
-  def myfail: BDD = {
-    assert(false)
-    null
-  }
-  
-  def bdd2int(b: BDD): Int = b match {
-    case Zero() | One() => 1000
-    case Node(v,_,_) => v
-  }
-  
-  def utag(b: BDD): Int = b match {
-    case Zero() => 0
-    case One() => 1
-    case Node(v,_,_) => v
-  }
-  
-  def low(b: BDD): BDD = b match {
-    case Node(_,l,_) => l
-    case _ => myfail
-  }
-  
-  def high(b: BDD): BDD = b match {
-    case Node(_,_,h) => h
-    case _ => myfail
-  }
-  
-  
-  val zero = Zero()
-  val one = One()
-  
-  def of_bool(b: Boolean): BDD = if(b) one else zero
-  
-  def check(b: BDD): Boolean = b match {
-    case Zero() | One() => true
-    case Node(v,l,h) => 
-      (v < bdd2int(l)) &&
-      (v < bdd2int(h)) &&
-      check(l) && check(h)
-  }
-  
-  def mk(x: Int, low: BDD, high: BDD) = 
-    if(low == high) low else Node(x,low,high)
-  
-  def empty = Map.empty[BDD,BDD]
-  def empty2 = Map.empty[(BDD,BDD),BDD]
-  
-  def mk_not(x: BDD): BDD = {
-    require(check(x))
-    val cache = empty
-    
-    def mk_not_rec(cache: Map[BDD,BDD], x: BDD): (Map[BDD,BDD],BDD) = {
-      cache.get(x) match {
-        case Some(x) => 
-          (cache,x)
-        case None => {
-          val (table,res) = {
-            x match {
-              case Zero() => (cache,one)
-              case One() => (cache,zero)
-              case Node(v,l,h) =>
-                val (cachel,ll) = mk_not_rec(cache,l)
-                val (cacheh, hh) = mk_not_rec(cache,h)
-                (cachel ++ cacheh, mk(v,ll,hh))
-            }
-          }
-          
-          (table + ((x -> res)),res)
-        }
-      }
-    }
-    
-    val (_,rv) = mk_not_rec(cache, x)
-    rv
-  } ensuring { res => check(res)}
-  
-  def apply_op(op: Op, b1: Boolean, b2: Boolean): Boolean = op match {
-    case And() => b1 && b2
-    case Or() => b1 || b2
-    case Imp() => !b1 || b2
-    case Any(f) => f(b1,b2)
-  }
-  
-  def gapply(op: Op): (BDD,BDD) => BDD = {
-    val op_z_z = of_bool(apply_op(op, false,false))
-    val op_z_o = of_bool(apply_op(op, false,true))
-    val op_o_z = of_bool(apply_op(op, true,false))
-    val op_o_o = of_bool(apply_op(op, true,true))
-    
-    (b1: BDD, b2: BDD) => {
-       val cache = empty2
-       
-       def app(cache: Map[(BDD,BDD),BDD], u1: BDD, u2: BDD): (Map[(BDD,BDD),BDD], BDD) = { 
-         def default(res: BDD) = (cache,res)
-         op match {
-           case And() =>
-             if(u1 == u2) default(u1)
-             else if(u1 == zero || u2 == zero) default(zero)
-             else if(u1 == one) default(u2)
-             else if(u2 == one) default(u1)
-             else app_gen(cache, u1,u2)
-           
-           case Or() =>
-             if(u1 == u2) default(u1)
-             else if(u1 == one || u2 == one) default(one)
-             else if(u1 == zero) default(u2)
-             else if(u2 == zero) default(u1)
-             else app_gen(cache, u1,u2)
-           
-           case Imp() =>
-             if(u1 == zero) default(one)
-             else if(u1 == one) default(u2)
-             else if(u2 == one) default(u1)
-             else app_gen(cache, u1,u2)
-         
-           case Any(_) => app_gen(cache, u1,u2)
-         }
-       }
-       
-       def app_gen(cache: Map[(BDD,BDD),BDD], u1: BDD, u2: BDD): (Map[(BDD,BDD),BDD],BDD) = (u1,u2) match {
-         case (Zero(),Zero()) => (cache, op_z_z)
-         case (Zero(),One()) => (cache, op_z_o)
-         case (One(),Zero()) => (cache, op_o_z)
-         case (One(),One()) => (cache, op_o_o)
-         case _ =>
-           cache.get((u1,u2)) match {
-             case Some(x) => (cache, x)
-             case None =>
-               val (cacheres, res) = {
-                 val v1 = bdd2int(u1)
-                 val v2 = bdd2int(u2)
-                 if(v1 == v2) {
-                   val (cachelow,applow) = app(cache, low(u1),low(u2))
-                   val (cachehigh,apphigh) = app(cache, high(u1),high(u2))
-                   (cachelow ++ cachehigh, mk(v1, applow, apphigh))
-                 } else if(v1 < v2) {
-                   val (cachelow,applow) = app(cache, low(u1),u2)
-                   val (cachehigh,apphigh) = app(cache, high(u1),u2)
-                   (cachelow ++ cachehigh, mk(v1, applow, apphigh))
-                 } else {
-                   val (cachelow,applow) = app(cache, u1,low(u2))
-                   val (cachehigh,apphigh) = app(cache, u1,high(u2))
-                   (cachelow ++ cachehigh, mk(v2, applow, apphigh))
-                 }
-               }
-               (cacheres + (((u1,u2) -> res)), res)
-           }
-       }
-             
-       val (_,res) = app(cache, b1, b2)
-       res
-    
-    }
-  }
-  
-  
-  def main(args: Array[String]) = {
-    
-  }
-}
diff --git a/examples/plugin/kawaguchi_pldi2010/PosSplayHeap.scala b/examples/plugin/kawaguchi_pldi2010/PosSplayHeap.scala
deleted file mode 100644
index c97c2a20de0d3afd5d8620d680cf55577156fba4..0000000000000000000000000000000000000000
--- a/examples/plugin/kawaguchi_pldi2010/PosSplayHeap.scala
+++ /dev/null
@@ -1,143 +0,0 @@
-package plugin.kawaguchi
-
-/* Example from paper "Type-based Data Structure Verification"
- * http://pho.ucsd.edu/liquid/demo/index2.php */
-
-/* Splay Heaps: Okasaki's "Purely Functional Data Structures" p.50 Fig. 5.5. */
-
-import funcheck.lib.Specs._
-
-object SplayHeap {
-
-  
-  sealed abstract class Heap
-  @generator case class E() extends Heap
-  case class T(x: Int, a: Heap, b: Heap) extends Heap
-  
-  
-  
-  def isEmpty(h: Heap): Boolean = h.isInstanceOf[E]
-  
-  def partition(pivot: Int, t: Heap): (Heap,Heap) = t match {
-    case E() => (E(),E())
-    case T(x,a,b) =>
-      if(x <= pivot) b match {
-        case E() => (T(x,a,E()),E())
-        case T(y,b1,b2) =>
-          if(y <= pivot) {
-            val (small,big) = partition(pivot,b2)
-            val r1 = T(y,T(x,a,b1),small)
-            val r2 = big
-            (r1,r2)
-          } else  {
-            val (small,big) = partition(pivot,b1)
-            val r1 = T(x, a, small)
-            val r2 = T(y, big, b2)
-            (r1,r2)
-          }
-      } else a match {
-        case E() => (E(), T(x,E(),b))
-        case T(y,a1,a2) =>
-          if(y <= pivot) {
-            val (small,big) = partition(pivot,a2)
-            val r1 = T(y,a1,small)
-            val r2 = T(x,big,b)
-            (r1,r2)
-          } else {
-            val (small,big) = partition(pivot,a1)
-            val r1 = small
-            val r2 = T(y,big,T(x,a2,b))
-            (r1,r2)
-          }
-      }
-  }
-
-  def require[T](property : Boolean, original : T)(code : => T) : T = {
-    if (property) {
-      code
-    } else {
-      original
-    }
-  }
-  
-  case class IntPos(x : Int)
-
-  @generator
-  def mkIntPos(x : Int) = IntPos(abs(x))
-
-  @generator
-  def insert(x0: IntPos, t: Heap): Heap = {
-    val x = x0.x
-    val (a,b) = partition(x,t)
-      T(x,a,b)
-  }
-  
-  def merge(t1: Heap, t2: Heap): Heap = t1 match {
-    case E() => t2
-    case T(x,a,b) =>
-      val (ta,tb) = partition(x,t2)
-      val a1 = merge(ta,a)
-      val b1 = merge(tb,b)
-      T(x,a1,b1)
-  }
-  
-  def deleteMin(t: Heap): Heap = t match {
-    case E() => error("empty")
-    case T(x,E(),b) => b
-    case T(y,T(x,E(),b),c) => T(y,b,c)
-    case T(y,T(x,a,b),c) => T(x,deleteMin(a),T(y,b,c))  
-  }
-  
-  def deleteMin2(t: Heap): (Int,Heap) = t match {  
-    case E() => error("empty")
-    case T(x,E(),b) => (x, b)
-    case T(y,T(x,E(),b),c) => (x,T(y,b,c))
-    case T(y,T(x,a,b),c) =>
-      val (r, a1) = deleteMin2(a)
-      (r,T(x,a1,T(y,b,c)))
-  }
-  
-  def findMin(t: Heap): Int = t match { 
-    case E() => error("empty")
-    case T(x,E(),b) => x
-    case T(x,a,b) => findMin(a)
-  }
-  
-  def findMin2(t: Heap): (Int,Heap) = t match {
-    case E() => error("empty")
-    case T(x,E(),b) => (x, t)
-    case T(x,a,b) =>
-      val (x1, a1) = findMin2(a)
-      (x1,T(x,a1,b))
-  }
-  
-  def app(x: Int, ys: List[Int],  zs: List[Int]): List[Int] = ys match {
-    case Nil => x :: zs
-    case y :: ys => y :: app(x,ys,zs)
-  }
-  
-
-  def to_list(t: Heap): List[Int] = { 
-    // println(t)
-    t match { 
-      case E() => Nil
-      case T(x,a,b) => app(x,to_list(a),to_list(b))
-    }
-  }
-
-  def check_sorted(xs: List[Int]): Boolean = xs match {
-    case Nil => true
-    case x :: xs =>
-      xs.forall(x <= _) && check_sorted(xs)
-  }
-
-  def to_list2(t: Heap): List[Int] = { 
-    val xs = to_list(t)
-    check_sorted(xs)
-    xs
-  }
-  
-  forAll{h: Heap => check_sorted(to_list(h))}
-  
-  def main(args: Array[String]) = {}
-}
diff --git a/examples/plugin/kawaguchi_pldi2010/QuickSort.scala b/examples/plugin/kawaguchi_pldi2010/QuickSort.scala
deleted file mode 100644
index 783979063eeb224813466e98ded0e76855527113..0000000000000000000000000000000000000000
--- a/examples/plugin/kawaguchi_pldi2010/QuickSort.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-package plugin.kawaguchi_pldi2010
-
-/* Example from paper "Type-based Data Structure Verification"
- * http://pho.ucsd.edu/liquid/demo/index2.php */
-
-import funcheck.lib.Specs._
-
-object QuickSort {
-
-  sealed abstract class Top(v: Int)
-  case class T(v: Int) extends Top(v)
-  case class F(v: Int) extends Top(v)
-  
-  def partition(f: Int => Top, xs: List[Int]): (List[Int],List[Int]) = xs match {
-    case Nil => (Nil,Nil)
-    case x :: xs => 
-      val (ts,fs) = partition(f, xs)
-      f(x) match {
-        case T(x) => (x :: ts, fs)
-        case F(x) => (ts, x :: fs)
-      }
-  }
-  
-  
-  def quicksort(xs: List[Int]): List[Int] = xs match {
-    case Nil => Nil
-    case x :: xs => 
-      val (ls,rs) = partition(y => if (y < x) T(y) else F(x), xs)
-      val ls1 = quicksort(ls)
-      val rs1 = quicksort(rs)
-      ls1 ::: (x :: rs1)
-  }
-  
-  def check(xs: List[Int]): Boolean = xs match {
-    case Nil => true
-    case List(x) => true
-    case x :: y :: xs => 
-      (x <= y) && check(y :: xs)
-  }
-  
-  def test(xs: List[Int]): Boolean = check(quicksort(xs))
-  
-  forAll{xs: List[Int] => test(xs)}
-  
-  def main(args: Array[String]) = {}
-}
diff --git a/examples/plugin/kawaguchi_pldi2010/SplayHeap.scala b/examples/plugin/kawaguchi_pldi2010/SplayHeap.scala
deleted file mode 100644
index eaf7980a14cec0fadf61dd623066f32d3f89426a..0000000000000000000000000000000000000000
--- a/examples/plugin/kawaguchi_pldi2010/SplayHeap.scala
+++ /dev/null
@@ -1,126 +0,0 @@
-package plugin.kawaguchi_pldi2010
-
-/* Example from paper "Type-based Data Structure Verification"
- * http://pho.ucsd.edu/liquid/demo/index2.php */
-
-/* Splay Heaps: Okasaki's "Purely Functional Data Structures" p.50 Fig. 5.5. */
-
-import funcheck.lib.Specs._
-
-object SplayHeap {
-
-  
-  sealed abstract class Heap
-  @generator case class E() extends Heap
-  case class T(x: Int, a: Heap, b: Heap) extends Heap
-  
-  
-  
-  def isEmpty(h: Heap): Boolean = h.isInstanceOf[E]
-  
-  def partition(pivot: Int, t: Heap): (Heap,Heap) = t match {
-    case E() => (E(),E())
-    case T(x,a,b) =>
-      if(x <= pivot) b match {
-        case E() => (T(x,a,E()),E())
-        case T(y,b1,b2) =>
-          if(y <= pivot) {
-            val (small,big) = partition(pivot,b2)
-            val r1 = T(y,T(x,a,b1),small)
-            val r2 = big
-            (r1,r2)
-          } else  {
-            val (small,big) = partition(pivot,b1)
-            val r1 = T(x, a, small)
-            val r2 = T(y, big, b2)
-            (r1,r2)
-          }
-      } else a match {
-        case E() => (E(), T(x,E(),b))
-        case T(y,a1,a2) =>
-          if(y <= pivot) {
-            val (small,big) = partition(pivot,a2)
-            val r1 = T(y,a1,small)
-            val r2 = T(x,big,b)
-            (r1,r2)
-          } else {
-            val (small,big) = partition(pivot,a1)
-            val r1 = small
-            val r2 = T(y,big,T(x,a2,b))
-            (r1,r2)
-          }
-      }
-  }
-  
-  @generator
-  def insert(x: Int, t: Heap): Heap = {
-    val (a,b) = partition(x,t)
-    T(x,a,b)
-  }
-  
-  def merge(t1: Heap, t2: Heap): Heap = t1 match {
-    case E() => t2
-    case T(x,a,b) =>
-      val (ta,tb) = partition(x,t2)
-      val a1 = merge(ta,a)
-      val b1 = merge(tb,b)
-      T(x,a1,b1)
-  }
-  
-  def deleteMin(t: Heap): Heap = t match {
-    case E() => error("empty")
-    case T(x,E(),b) => b
-    case T(y,T(x,E(),b),c) => T(y,b,c)
-    case T(y,T(x,a,b),c) => T(x,deleteMin(a),T(y,b,c))  
-  }
-  
-  def deleteMin2(t: Heap): (Int,Heap) = t match {  
-    case E() => error("empty")
-    case T(x,E(),b) => (x, b)
-    case T(y,T(x,E(),b),c) => (x,T(y,b,c))
-    case T(y,T(x,a,b),c) =>
-      val (r, a1) = deleteMin2(a)
-      (r,T(x,a1,T(y,b,c)))
-  }
-  
-  def findMin(t: Heap): Int = t match { 
-    case E() => error("empty")
-    case T(x,E(),b) => x
-    case T(x,a,b) => findMin(a)
-  }
-  
-  def findMin2(t: Heap): (Int,Heap) = t match {
-    case E() => error("empty")
-    case T(x,E(),b) => (x, t)
-    case T(x,a,b) =>
-      val (x1, a1) = findMin2(a)
-      (x1,T(x,a1,b))
-  }
-  
-  def app(x: Int, ys: List[Int],  zs: List[Int]): List[Int] = ys match {
-    case Nil => x :: zs
-    case y :: ys => y :: app(x,ys,zs)
-  }
-  
-
-  def to_list(t: Heap): List[Int] = t match { 
-    case E() => Nil
-    case T(x,a,b) => app(x,to_list(a),to_list(b))
-  }
-
-  def check_sorted(xs: List[Int]): Boolean = xs match {
-    case Nil => true
-    case x :: xs =>
-      xs.forall(x <= _) && check_sorted(xs)
-  }
-
-  def to_list2(t: Heap): List[Int] = { 
-    val xs = to_list(t)
-    check_sorted(xs)
-    xs
-  }
-  
-  forAll{h: Heap => check_sorted(to_list(h))}
-  
-  def main(args: Array[String]) = {}
-}
diff --git a/liquid_benchs/README b/liquid_benchs/README
deleted file mode 100644
index 5f0a1358ebafabe4b25b81c083d890380c1bc59e..0000000000000000000000000000000000000000
--- a/liquid_benchs/README
+++ /dev/null
@@ -1,3 +0,0 @@
-In this folder we saved a list of benchmarks samples used in the Liquid paper
-("http://pho.ucsd.edu/liquid/") for assessing the improved ease and precision of
-presented type system.
diff --git a/liquid_benchs/arraymax b/liquid_benchs/arraymax
deleted file mode 100644
index f273d8d3e05a14d20f298d997b77a0095abc3205..0000000000000000000000000000000000000000
--- a/liquid_benchs/arraymax
+++ /dev/null
@@ -1,65 +0,0 @@
-Logical Quantifiers:
----------------------------------------------------------------
-
-qualif POS(_V): _V >= 0 
-qualif LT(_V)(A : int): _V < ~A  
-qualif LTLen(_V)(A : int array): _V < Array.length ~A 
-
-Ocaml Program:
----------------------------------------------------------------
-
-let show x = ()
-
-let max x y =
-  if x > y then x else y
-
-let rec sum k =
-  if k < 0 then 0 else
-    let s = sum (k-1) in
-    s + k
-
-let _ = show sum
-
-let foldn n b f =
-  let rec loop i c =
-    if i < n then loop (i+1) (f i c) else c in
-  loop 0 b
-
-let arraymax a =
-  let am l m = max (Array.get a l) m in
-  foldn (Array.length a) 0 am
-
-let arraytest a =
-  let vec = Array.make (Random.int 40)  0 in
-  arraymax vec
-
-
-Output:
----------------------------------------------------------------
-
-let show x = ()
-
-let max x y =
-  if x > y then x else y
-   
-let rec sum k =
-  if k < 0 then 0 else
-    let s = sum (k-1) in
-    s + k
- 
-let _ = show sum
-
-let foldn n b f =
-  let rec loop i c =
-    if i < n then loop (i+1) (f i c) else c in
-      loop 0 b
-
-let arraymax a =
-  let am l m = max (Array.get a l) m in
-    foldn (Array.length a) 0 am
- 
-let arraytest a =
-  let vec = Array.make (Random.int 40)  0 in
-    arraymax vec
-
-
diff --git a/liquid_benchs/binsearch b/liquid_benchs/binsearch
deleted file mode 100644
index 99dfac3a48a4c39c9ec31375cb1809522c80c056..0000000000000000000000000000000000000000
--- a/liquid_benchs/binsearch
+++ /dev/null
@@ -1,39 +0,0 @@
-Logical Quantifiers:
----------------------------------------------------------------
-
-qualif POS(_V): _V >= 0 
-qualif LT(_V)(A : int): _V < ~A  
-qualif LTLen(_V)(A : int array): _V < Array.length ~A 
-
-
-Ocaml Program:
----------------------------------------------------------------
-
-let show x = ()
-
-let bs a v =
-  let rec look lo hi =
-    if lo >= hi-1 then -1 else
-      let m = (hi + lo)/2 in
-      let x = Array.get a m in
-      if v < x then look lo (m-1) else
-       if v > x then look (m+1) hi else
-        m in
-  look 0 (Array.length a - 1)
-
-
-
-Output:
----------------------------------------------------------------
-
-let show x = ()
-
-let bs a v =
-  let rec look lo hi =
-    if lo >= hi-1 then -1 else
-      let m = (hi + lo)/2 in
-      let x = Array.get a m in
-      if v < x then look lo (m-1) else
-        if v > x then look (m+1) hi else
-          m in
-  look 0 (Array.length a - 1)
diff --git a/liquid_benchs/fold b/liquid_benchs/fold
deleted file mode 100644
index 929419109a05f02025392fd51f03bec80536749a..0000000000000000000000000000000000000000
--- a/liquid_benchs/fold
+++ /dev/null
@@ -1,158 +0,0 @@
-Logical Quantifiers:
----------------------------------------------------------------
-
-qualif POS(x): x >= 0 
-qualif NEG(x): x <= 0 
-qualif LEQ(x)(A:int) : x <= ~A
-qualif GEQ(x)(A:int) : ~A <= x    
-qualif IT_V(x): x.0 <= x.1 
-
-
-Ocaml Program:
----------------------------------------------------------------
-
-
-let rec generate m f b = 
-  if m <= 0 then [] else (b::(generate (m-1) f (f b)))
-
-let demo1 m = 
-  let xs = generate m (fun x -> x + 1) 0 in
-  let x  = List.fold_left (+) 0 xs in
-  assert (x >= 0)
-
-let demo2 m = 
-  let xs = generate m (fun x -> 2 * x) (-1) in
-  let x  = List.fold_left (+) 0 xs in
-  assert (x <= 0)
-
-let demo3 m = 
-  let xs  = generate m (fun x -> x + 1) 0 in
-  let xs' = List.map (fun x -> -x) xs in 
-  let x   = List.fold_left (+) 0 xs in
-  assert (x <= 0)
-
-let demo4 m = 
-  let xs = generate m (fun x -> 2 * x) (-1) in
-  let xs'= List.map (fun x -> -x) xs in 
-  let x  = List.fold_left (+) 0 xs in
-  assert (x >= 0)
-
-(*********************************************************************)
-
-let mmin (x:int) y = 
-  if x <= y then x else y
-
-let mmax (x:int) y = 
-  if x <= y then y else x
-
-let lub (p: int*int) (p':int*int) = 
-  let (x,y) = p in
-  let (x',y') = p' in
-  let x'' = mmin x x' in
-  let y'' = mmax y y' in
-  (x'',y'')
-
-let demo5 m = 
-  let xs = generate m (fun p -> let (a,b) = p in (2*a - 10, 3*b + 20)) (1,1) in
-  let (x,y) = List.fold_left lub (1,1) xs in
-  assert (x <= y)
-
-(*********************************************************************)
-
-let rec read_pos_int () = 
-  let x = read_int () in
-  if x >= 0 then x else read_pos_int ()
-
-let read_pair_wf () = 
-  let x = read_int () in
-  let y = read_pos_int () in
-  (x,x+y)
-
-let rec mklist n = 
-  if n < 0 then [] else 
-    let p = read_pair_wf () in
-    let xs = mklist (n-1) in
-    p::xs
-
-let demo6 m =  
-  let ys = mklist m in
-  let b = read_pair_wf () in
-  let (x,y) = List.fold_left lub b ys in
-  assert (x <= y) 
-
-(*********************************************************************)
-
-
-Output:
----------------------------------------------------------------
-
-let rec generate m f b = 
-  if m <= 0 then [] else (b::(generate (m-1) f (f b)))
-
-let demo1 m = 
-  let xs = generate m (fun x -> x + 1) 0 in
-  let x  = List.fold_left (+) 0 xs in
-  assert (x >= 0)
-
-let demo2 m = 
-  let xs = generate m (fun x -> 2 * x) (-1) in
-  let x  = List.fold_left (+) 0 xs in
-  assert (x <= 0)
-
-let demo3 m = 
-  let xs  = generate m (fun x -> x + 1) 0 in
-  let xs' = List.map (fun x -> -x) xs in 
-  let x   = List.fold_left (+) 0 xs in
-  assert (x <= 0)
-
-let demo4 m = 
-  let xs = generate m (fun x -> 2 * x) (-1) in
-  let xs'= List.map (fun x -> -x) xs in 
-  let x  = List.fold_left (+) 0 xs in
-  assert (x >= 0)
-
-(*********************************************************************)
-
-let mmin (x:int) y = 
-  if x <= y then x else y
-
-let mmax (x:int) y = 
-  if x <= y then y else x
-
-let lub (p: int*int) (p':int*int) = 
-  let (x,y) = p in
-  let (x',y') = p' in
-  let x'' = mmin x x' in
-  let y'' = mmax y y' in
-  (x'',y'')
-
-let demo5 m = 
-  let xs = generate m (fun p -> let (a,b) = p in (2*a - 10, 3*b + 20)) (1,1) in
-  let (x,y) = List.fold_left lub (1,1) xs in
-  assert (x <= y)
- 
-(*********************************************************************)
-
-let rec read_pos_int () = 
-  let x = read_int () in
-  if x >= 0 then x else read_pos_int ()
-
-let read_pair_wf () = 
-  let x = read_int () in
-  let y = read_pos_int () in
-  (x,x+y)
-
-let rec mklist n = 
-  if n < 0 then [] else 
-    let p = read_pair_wf () in
-    let xs = mklist (n-1) in
-    p::xs
- 
-let demo6 m =  
-  let ys = mklist m in
-  let b = read_pair_wf () in
-  let (x,y) = List.fold_left lub b ys in
-  assert (x <= y) 
-
-(*********************************************************************)
-
diff --git a/liquid_benchs/fold2 b/liquid_benchs/fold2
deleted file mode 100644
index f4cc0a4254796e3b96d3e13f6352eabaee614c06..0000000000000000000000000000000000000000
--- a/liquid_benchs/fold2
+++ /dev/null
@@ -1,44 +0,0 @@
-Logical Quantifiers:
----------------------------------------------------------------
-
-qualif POS(_V)  :  0 <= _V 
-qualif LEQ(_V)  : _V { <=, < } ~A
-qualif LTLen(_V): _V < Array.length ~A 
-
-
-Ocaml Program:
----------------------------------------------------------------
-
-let _ = List.fold_left 
-let _ = List.rev
-
-let range i j = 
-  let rec f k xs = 
-    if k > j
-    then List.rev xs 
-    else f (k+1) (k::xs) in
-  f i []
-
-let arraycat a =
-  let n  = Array.length a - 1 in
-  let is = range 0 n in
-  List.fold_left (fun s i -> s^(Array.get a i)) "" is
-
-
-Output:
----------------------------------------------------------------
-
-let _ = List.fold_left 
-let _ = List.rev
-
-let range i j = 
-  let rec f k xs = 
-    if k > j
-    then List.rev xs 
-    else f (k+1) (k::xs) in
-  f i []
-
-let arraycat a =
-  let n  = Array.length a - 1 in
-  let is = range 0 n in
-  List.fold_left (fun s i -> s^(Array.get a i)) "" is
diff --git a/liquid_benchs/list b/liquid_benchs/list
deleted file mode 100644
index d9605b11a5c0a780da94589c74f04691e8eae7c8..0000000000000000000000000000000000000000
--- a/liquid_benchs/list
+++ /dev/null
@@ -1,67 +0,0 @@
-Logical Quantifiers:
----------------------------------------------------------------
-
-qualif POS(_V): _V >= 0 
-qualif NEG(_V): _V <= 0 
-qualif GEQ(_V)(A:int): _V >= ~A 
-
-
-Ocaml Program:
----------------------------------------------------------------
-
-
-let rec generate m f b = 
-  if m <= 0 then [] else (b::(generate (m-1) f (f b)))
-
-let demo1 m k =
-  if (k < 0) then () else
-    let xs = generate m (fun x -> x + 1) (k+1) in
-    let x  = List.fold_left (fun a b -> a + b) k xs in
-    assert (x >= k)
-
-let demo2 m = 
-  let xs = generate m (fun x -> 2 * x) (-1) in
-  let x  = List.fold_left (+) 0 xs in
-  assert (x <= 0)
-
-let demo3 m = 
-  let xs  = generate m (fun x -> x + 1) 0 in
-  let xs' = List.map (fun x -> 0 - x) xs in 
-  let x   = List.fold_left (+) 0 xs' in
-  assert (x <= 0)
-
-let demo4 m = 
-  let xs = generate m (fun x -> 2 * x) (-1) in
-  let xs'= List.map (fun x -> 0 - x) xs in 
-  let x  = List.fold_left (+) 0 xs' in
-  assert (x >= 0)
-
-
-Output:
----------------------------------------------------------------
-
-let rec generate m f b = 
-  if m <= 0 then [] else (b::(generate (m-1) f (f b)))
-
-let demo1 m k =
-  if (k < 0) then () else
-    let xs = generate m (fun x -> x + 1) (k+1) in
-    let x  = List.fold_left (fun a b -> a + b) k xs in
-    assert (x >= k)
- 
-let demo2 m = 
-  let xs = generate m (fun x -> 2 * x) (-1) in
-  let x  = List.fold_left (+) 0 xs in
-  assert (x <= 0)
-
-let demo3 m = 
-  let xs  = generate m (fun x -> x + 1) 0 in
-  let xs' = List.map (fun x -> 0 - x) xs in 
-  let x   = List.fold_left (+) 0 xs' in
-  assert (x <= 0)
-
-let demo4 m = 
-  let xs = generate m (fun x -> 2 * x) (-1) in
-  let xs'= List.map (fun x -> 0 - x) xs in 
-  let x  = List.fold_left (+) 0 xs' in
-  assert (x >= 0)
diff --git a/liquid_benchs/tree b/liquid_benchs/tree
deleted file mode 100644
index c76bd3562827b0e4ddb243a2790434447305c456..0000000000000000000000000000000000000000
--- a/liquid_benchs/tree
+++ /dev/null
@@ -1,126 +0,0 @@
-Logical Quantifiers:
----------------------------------------------------------------
-
-qualif POS(_V): _V >= 0 
-(* qualif NEG(_V): _V <= 0 *) 
-qualif LEQ(_V)(A:int) : _V <= ~A 
-qualif GEQ(_V)(A:int) : ~A <= _V    
-qualif ITV(_V): _V.0 <= _V.1 
-
-
-Ocaml Program:
----------------------------------------------------------------
-
-
-type 'a tree = Leaf of 'a | Node of 'a tree * 'a tree
-
-let rec fold f b t =
-  match t with 
-  | Leaf x -> f b x
-  | Node (t1,t2) -> fold f (fold f b t1) t2
-
-let rec map f t =
-  match t with
-  | Leaf x -> Leaf (f x)
-  | Node (t1,t2) -> Node (map f t1, map f t2)
-
-let rec iter f t =
-  match t with
-  | Leaf x -> f x
-  | Node (t1,t2) -> iter f t1; iter f t2
-
-let rec build f b d = 
-  if d <= 0 then (Leaf b, f b) else 
-    let (t1,b1) = build f b  (d-1) in
-    let (t2,b2) = build f b1 (d-1) in
-    ((Node (t1,t2)), b2)
-
-(*********************************************************)
-
-let demo1 d k =
-  if k < 0 then () else
-    let (t,_) = build ((+) 1) (k+1) d in
-    let x = fold (+) k t in
-    assert (x >= k)
-
-(*********************************************************)
-
-let mmin (x:int) y = 
-  if x <= y then x else y
-
-let mmax (x:int) y = 
-  if x <= y then y else x
-
-let lub (p: int*int) (p':int*int) = 
-  let (x,y) = p in
-  let (x',y') = p' in
-  let x'' = mmin x x' in
-  let y'' = mmax y y' in
-  (x'',y'')
-
-let demo2 d k = 
-  if k < 0 then () else 
-    let (t,_) = build ((+) 1) k d in
-    let t1    = map (fun x -> (x,2*x + 1)) t in
-    let (x,y) = fold lub (k,k) t1 in
-    iter (fun (a,b) -> assert (k <= a && k <= b)) t1; 
-    assert (x <= y)
-
-
-Output:
----------------------------------------------------------------
-
-type 'a tree = Leaf of 'a | Node of 'a tree * 'a tree
- 
-let rec fold f b t =
-  match t with 
-  | Leaf x -> f b x
-  | Node (t1,t2) -> fold f (fold f b t1) t2
-
-let rec map f t =
-  match t with
-  | Leaf x -> Leaf (f x)
-  | Node (t1,t2) -> Node (map f t1, map f t2)
-
-let rec iter f t =
-  match t with
-  | Leaf x -> f x
-  | Node (t1,t2) -> iter f t1; iter f t2
-
-let rec build f b d = 
-  if d <= 0 then (Leaf b, f b) else 
-    let (t1,b1) = build f b  (d-1) in
-    let (t2,b2) = build f b1 (d-1) in
-    ((Node (t1,t2)), b2)
-
-  25: (*********************************************************)
-
-let demo1 d k =
-  if k < 0 then () else
-    let (t,_) = build ((+) 1) (k+1) d in
-    let x = fold (+) k t in
-    assert (x >= k)
- 
-  33: (*********************************************************)
-
-let mmin (x:int) y = 
-  if x <= y then x else y
-
-let mmax (x:int) y = 
-  if x <= y then y else x
-
-let lub (p: int*int) (p':int*int) = 
-  let (x,y) = p in
-  let (x',y') = p' in
-  let x'' = mmin x x' in
-  let y'' = mmax y y' in
-  (x'',y'')
-
-let demo2 d k = 
-  if k < 0 then () else 
-    let (t,_) = build ((+) 1) k d in
-    let t1    = map (fun x -> (x,2*x + 1)) t in
-    let (x,y) = fold lub (k,k) t1 in
-    iter (fun (a,b) -> assert (k <= a && k <= b)) t1; 
-    assert (x <= y)
-
diff --git a/liquid_benchs/trunc b/liquid_benchs/trunc
deleted file mode 100644
index 024e22a9582d6d6a8ec1d228819a7ffed686a42c..0000000000000000000000000000000000000000
--- a/liquid_benchs/trunc
+++ /dev/null
@@ -1,45 +0,0 @@
-Logical Quantifiers:
----------------------------------------------------------------
-
-qualif CMPZ(_V): _V { !=, >= } 0 
-
-
-Ocaml Program:
----------------------------------------------------------------
-
-let show x = ()
-
-let abs x = 
-  if x > 0 then x else (0-x)
-
-let div a b = 
-  assert (b != 0);
-  a/b
-
-let trunc i n = 
-  let i' = abs i in
-  let n' = abs n in
-  if i' <= n' then i else 
-    let _ = show i' in
-    n' * (div i i')
-
-
-Output:
----------------------------------------------------------------
-
-let show x = ()
-
-let abs x = 
-  if x > 0 then x else (0-x)
-
-let div a b = 
-  assert (b != 0);
-  a/b
-
-let trunc i n = 
-  let i' = abs i in
-  let n' = abs n in
-    if i' <= n' then i else 
-      let _ = show i' in
-      n' * (div i i')
-
diff --git a/oldsrc/funcheck/lib/Specs.scala b/oldsrc/funcheck/lib/Specs.scala
deleted file mode 100644
index 1f3167cb6c596e518bb44d3fc47aa6455e317103..0000000000000000000000000000000000000000
--- a/oldsrc/funcheck/lib/Specs.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-package funcheck.lib
-
-object Specs {
-  
-  /** 
-   * this is used to annotate the (unique) class method 
-   * that will be used by our funcheck plugin to 
-   * automagically define a class generator that can be used 
-   * by ScalaCheck to create test cases.
-   */ 
-  class generator extends StaticAnnotation
-
-  implicit def extendedBoolean(b: => Boolean) = new {
-    def ==>(p: => Boolean) = Specs ==> (b,p)
-  }
-  
-  def forAll[A](f: A => Boolean): Boolean = {
-    Console.err.println("Warning: ignored forAll. Are you using the funcheck plugin?")
-    true
-    // error("\"forAll\" combinator is currently unsupported by plugin.")
-  }
-
-
-  /** Implication */
-  def ==>(ifz: => Boolean, then: => Boolean): Boolean = !ifz || then
-}
diff --git a/oldsrc/funcheck/scalacheck/FilterGeneratorAnnotations.scala b/oldsrc/funcheck/scalacheck/FilterGeneratorAnnotations.scala
deleted file mode 100644
index be3aaae44058a9b2512607ff7e309d0c981a7265..0000000000000000000000000000000000000000
--- a/oldsrc/funcheck/scalacheck/FilterGeneratorAnnotations.scala
+++ /dev/null
@@ -1,69 +0,0 @@
-package funcheck.scalacheck
-
-import scala.tools.nsc.Global
-
-/** 
- * A tree traverser which filter the trees elements that contain the 
- * <code>@generator</code> annotation, defined in <code>funcheck.lib.Specs</code> 
- * module.  
- * 
- * Note: For the moment this is working only for <code>ClassDef</code> and 
- * <code>DefDef</code> tree elements.  
- *  
- * This trait is meant to be used with the <code>FilterTreeTraverser</code> 
- * class, available in the <code>scala.tools.nsc.ast.Trees</code> trait. 
- * 
- * 
- * Usage Example:
- * 
- * new FilterTreeTraverser(filterTreesWithGeneratorAnnotation(unit))
- * 
- * where <code>unit</code> is the current Compilation Unit.
- */
-trait FilterGeneratorAnnotations { 
-  val global: Global
-  // [[INFO]] "hasAttribute" is "hasAnnotation" in future compiler release 2.8
-  import global._
-  
-  /** Funcheck <code>@generator</code> annotation. */
-  private lazy val generator: Symbol = definitions.getClass("funcheck.lib.Specs.generator")
-  
-  
-  /**
-   * Check for <code>@generator</code> annotation only for class and method 
-   * definitions. A class is considered to be annotated if either the class itself 
-   * has the annotation, or if the class inherit from an annotated abstract class.
-   */
-  def filterTreesWithGeneratorAnnotation(Unit: CompilationUnit)(tree: Tree): Boolean = {
-    lazy val sym = tree.symbol
-    tree match {
-      case cd: ClassDef => isAbstractClass(sym) || 
-        				   sym.hasAttribute(generator) || 
-                           abstractSuperClassHasGeneratorAnnotation(sym.superClass)
-      case d: DefDef    => sym.hasAttribute(generator)
-      case _ => false
-    }
-  }
-  
-  
-  /** Return true if the class (or superclass) symbol is flagged as being ABSTRACT and contains 
-   * the <code>@generator</code> annotation.*/
-  private def abstractSuperClassHasGeneratorAnnotation(superclass: Symbol): Boolean = { 
-    //require(superclass.isInstanceOf[ClassSymbol], "expected ClassSymbol, found "+superclass)
-    superclass match {
-      case NoSymbol => false
-      case cs: ClassSymbol =>
-        (isAbstractClass(cs) && cs.hasAttribute(generator)) || 
-          abstractSuperClassHasGeneratorAnnotation(cs.superClass)
-      case _ => 
-        assert(false, "expected ClassSymbol, found "+superclass)
-        false
-    }
-  }
-  
-  private def isAbstractClass(s: Symbol): Boolean = s match {
-    case cs: ClassSymbol => cs.hasFlag(scala.tools.nsc.symtab.Flags.ABSTRACT) 
-    case _ => false
-  } 
-
-}
\ No newline at end of file
diff --git a/oldsrc/funcheck/scalacheck/ForAllTransformer.scala b/oldsrc/funcheck/scalacheck/ForAllTransformer.scala
deleted file mode 100644
index 4d02d6cca707ae4039ba8970a02fc65ad5cb3733..0000000000000000000000000000000000000000
--- a/oldsrc/funcheck/scalacheck/ForAllTransformer.scala
+++ /dev/null
@@ -1,200 +0,0 @@
-package funcheck.scalacheck
-
-import scala.tools.nsc.transform.TypingTransformers
-import scala.tools.nsc.util.NoPosition
-import funcheck.util.FreshNameCreator 
-
-/** Takes care of mapping Specs.forAll methods calls to
- * ScalaCheck org.scalacheck.Prop.forAll.
- */
-trait ForAllTransformer extends TypingTransformers
-  with ScalaCheck
-  with FreshNameCreator 
-{ 
-  import global._
-  
-  private lazy val specsModule: Symbol = definitions.getModule("funcheck.lib.Specs")
-  
-  
-  
-  def forAllTransform(unit: CompilationUnit): Unit = 
-    unit.body = new ForAllTransformer(unit).transform(unit.body)
-  
-    
-        
-    
-  class ForAllTransformer(unit: CompilationUnit) 
-    extends TypingTransformer(unit) 
-  { 
-    
-    override def transform(tree: Tree): Tree = {
-      curTree = tree
-       
-      tree match {
-        /* XXX: This only works for top-level forAll. Nested forAll are not handled by the current version*/
-        case Apply(TypeApply(s: Select, _), rhs @ List(f @ Function(vparams,body))) if isSelectOfSpecsMethod(s.symbol, "forAll") =>
-          atOwner(currentOwner) {
-            assert(vparams.size == 1, "funcheck.Specs.forAll properties are expected to take a single (tuple) parameter")
-            
-            val v @ ValDef(mods,name,vtpt,vinit) = vparams.head
-            
-            vtpt.tpe match {
-              // the type of the (single, by the above assumption) function parameter 
-              // will tell us what are the generators needed. In fact, we need to manually 
-              // provide the generators since despite the generators that we create are 
-              // implicit definitions, funcheck is hooking after the typechecking phase 
-              // and implicit definition are solved at typechecking. Therefore the need 
-              // of manually provide every single parameter to the org.scalacheck.Prop.forAll
-              // method. 
-              // This is actually one of the major limitations of this plugin since it is not 
-              // really quite flexible. For a future work it might be a good idea to rethink 
-              // how this problem can be fixed (an idea could be to inject the code and actuate 
-              // the forall conversion and then typecheck the whole program from zero).
-              case tpe @ TypeRef(_,value,vtpes) =>
-                var fun: Function = {
-                  if(vtpes.size <= 1) {
-                    // if there is less than one parameter then the function tree can be injected 
-                    // without (almost) no modificcation because it matches what Scalacheck Prop.forAll
-                    // expects
-                    f
-                  } 
-                  else {
-                    // Transforming a pair into a list of arguments (this is what ScalaCheck Prop.forAll expects)
-                    
-                    // create a fresh name for each parameter declared parametric type
-                    val freshNames = vtpes.map(i =>  fresh.newName(NoPosition,"v"))
-                    
-                    val funSym = tree.symbol
-                    
-                    val subst = for { i <- 0 to vtpes.size-1} yield {
-                      val toSym = funSym.newValueParameter(funSym.pos, freshNames(i)).setInfo(vtpes(i))
-                      
-                      val from = Select(v, v.symbol.tpe.decl("_"+(i+1)))
-                      val to =  ValDef(toSym, EmptyTree) setPos (tree.pos)                        
-                      
-                      (from, to)
-                    } 
-                      
-                      
-                    val valdefs = subst.map(_._2).toList
-                    val fun = localTyper.typed {
-                      val newBody = new MyTreeSubstituter(subst.map(p => p._1.symbol).toList, valdefs.map(v => Ident(v.symbol)).toList).transform(resetAttrs(body))
-                      Function(valdefs, newBody)
-                    }.asInstanceOf[Function]
-                      
-                      
-                    new ChangeOwnerTraverser(funSym, fun.symbol).traverse(fun);
-                    new ForeachTreeTraverser({t: Tree => t setPos tree.pos}).traverse(fun)
-                    fun
-                  }
-                }
-              
-                // Prop.forall(function , where function is of the form (v1,v2,...,vn) => expr(v1,v2,..,vn))   
-                val prop = Prop.forAll(List(transform(fun)))
-                      
-                
-                // the following are the list of (implicit) parameters that need to be provided 
-                // when calling Prop.forall
-                
-                var buf = new collection.mutable.ListBuffer[Tree]()
-                      
-                val blockValSym = newSyntheticValueParam(fun.symbol, definitions.BooleanClass.typeConstructor)
-                      
-                val fun2 = localTyper.typed {
-                  val body = Prop.propBoolean(resetAttrs(Ident(blockValSym)))
-                  Function(List(ValDef(blockValSym, EmptyTree)), body)
-                }.asInstanceOf[Function]
-                       
-                   
-                new ChangeOwnerTraverser(fun.symbol, fun2.symbol).traverse(fun2);
-                new ForeachTreeTraverser({t: Tree => t setPos tree.pos}).traverse(fun2)
-                      
-                buf += Block(Nil,fun2)
-              
-              
-                if(vtpes.size <= 1) {
-                  buf += resetAttrs(Arbitrary.arbitrary(tpe))
-                  buf += resetAttrs(Shrink.shrinker(tpe))
-                } else {
-                  for { tpe <- vtpes } {
-                    buf += resetAttrs(Arbitrary.arbitrary(tpe))
-                    buf += resetAttrs(Shrink.shrinker(tpe))
-                  }
-                }
-                   
-
-                import posAssigner.atPos         // for filling in tree positions
-
-                   
-                val property = localTyper.typed {
-                  atPos(tree.pos) {
-                    Apply(prop, buf.toList)
-                  }
-                }
-                
-                
-                
-                localTyper.typed {
-                  atPos(tree.pos) {
-                    Test.isPassed(Test.check(property))
-                  }
-                }
-              
-            
-            case t => 
-              assert(false, "expected ValDef of type TypeRef, found "+t)
-              tree
-          }
-        }
-  
-  	    /** Delegates the recursive traversal of the tree. */
-       	case _ => super.transform(tree)
-      }
-      
-    }
-    
-     class ChangeOwnerTraverser(val oldowner: Symbol, val newowner: Symbol) extends Traverser {
-    override def traverse(tree: Tree) {
-	      if (tree != null && tree.symbol != null && tree.symbol != NoSymbol && tree.symbol.owner == oldowner)
-	        tree.symbol.owner = newowner;
-	      super.traverse(tree)
-	    }
-	  }
-    
-    /** Synthetic value parameters when parameter symbols are not available
-    */
-    final def newSyntheticValueParam(owner: Symbol, argtype: Type): Symbol = {
-      var cnt = 0
-      def freshName() = { cnt += 1; newTermName("x$" + cnt) }
-      def param(tp: Type) =
-    	  owner.newValueParameter(owner.pos, freshName()).setFlag(scala.tools.nsc.symtab.Flags.SYNTHETIC).setInfo(tp)
-      param(argtype)
-    }
-    
-    private def isSelectOfSpecsMethod(s: Symbol, method: String): Boolean = 
-      s == specsModule.tpe.decl(method)
-    
-        
-    
-    /** Quick (and dirty) hack for enabling tree substitution for pair elements.
-     * Specifically, this allow to map pair accesses such as p._1 to a new variable 'x'
-     * ([p._1 |-> x, p._2 |-> y, ..., p._n |-> z])
-     */
-    class MyTreeSubstituter(from: List[Symbol], to: List[Tree]) extends TreeSubstituter(from,to) {
-      override def transform(tree: Tree): Tree = tree match {
-        // Useful for substutite values like p._1 where 'p' is a pair
-        // Inherithed 'TreeSubstituter' cannot handle this
-	    case Select(Ident(_), name) =>
-          def subst(from: List[Symbol], to: List[Tree]): Tree =
-            if (from.isEmpty) tree
-            else if (tree.symbol == from.head) to.head
-            else subst(from.tail, to.tail);
-          subst(from, to)
-	    case _ =>
-          super.transform(tree)
-      }
-    }
-    
-  }
-  
-}
diff --git a/oldsrc/funcheck/scalacheck/GeneratorDefDefInjector.scala b/oldsrc/funcheck/scalacheck/GeneratorDefDefInjector.scala
deleted file mode 100644
index c10b26a4da803ac9339395559d2beccbdedce90d..0000000000000000000000000000000000000000
--- a/oldsrc/funcheck/scalacheck/GeneratorDefDefInjector.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-package funcheck.scalacheck
-
-import scala.tools.nsc.transform.TypingTransformers
-
-trait GeneratorDefDefInjector extends TypingTransformers { 
-   import global._
-  
-  def injectGenDefDefs(injecting: List[DefDef], unit: CompilationUnit): Unit = 
-    unit.body = new GenDefDefTransformer(injecting, unit).transform(unit.body)
-  
-  class GenDefDefTransformer(injecting: List[DefDef], unit: CompilationUnit) 
-    extends /*Code Injection*/ TypingTransformer(unit) 
-  { 
-    override def transform(tree: Tree): Tree = { 
-      curTree = tree
-      tree match {
-        
-        case impl @ Template(parents, self, body) => 
-          atOwner(currentOwner) {
-       	    val newBody: List[Tree] = body ::: (injecting.map(localTyper.typed(_)))  
-            val cd = copy.Template(impl, parents, self, newBody)
-            cd
-          }
-         
-        /** Delegates the recursive traversal of the tree. */
-       	case _ => super.transform(tree)
-      }
-    }
-       
-  }
-} 
-    
-   
\ No newline at end of file
diff --git a/oldsrc/funcheck/scalacheck/ScalaCheck.scala b/oldsrc/funcheck/scalacheck/ScalaCheck.scala
deleted file mode 100644
index 5fda350475928a39149fe31e90cd797e85fa18dc..0000000000000000000000000000000000000000
--- a/oldsrc/funcheck/scalacheck/ScalaCheck.scala
+++ /dev/null
@@ -1,786 +0,0 @@
-package funcheck.scalacheck
-
-import scala.tools.nsc.Global
-import scala.tools.nsc.util.NoPosition
-import funcheck.util.FreshNameCreator
-
-/**
- * Utilitarity class that is used as a factory for creating Tree nodes for method 
- * calls of classes and modules in the <code>org.scalacheck</code> package. 
- */
-trait ScalaCheck extends FreshNameCreator {
-  val global: Global
-  import global._
-  
-  trait GenericScalaCheckModule {
-    /** Symbol for a module definition. */
-    protected val moduleSym: Symbol
-    /** Symbol for the module's companion class definition. */
-    protected lazy val classSym = moduleSym.linkedClassOfModule
-  
-    /** 
-     * <p>
-     * Take a <code>symbol</code> and method <code>name</code> and return the associated 
-     * method's symbol.
-     * </p>
-     * <p>
-     * Note: if <code>symbol</code> does not contain a method named </code>name</code>, the 
-     * returned symbol will be a <code>NoSymbol</code>.
-     * </p>
-     * 
-     * @param symbol A module/class symbol,
-     * @param name   A name of the method that should be part of the declared members of the <code>symbol</code>.
-     * @return The symbol for the method 'symbol.name' or <code>NoSymbol</code> if the <code>symbol</code> does 
-     *         not have a member named <code>name</code>.
-     */
-    private def symDecl(symbol: Symbol, name: String) = symbol.tpe.decl(name)
-    
-    /** Identical to symDecl(symbol: Symbol, name: String), but uses a Name object 
-     * instead of a String for the <code>name</code>.*/
-    private def symDecl(symbol: Symbol, name: Name) = symbol.tpe.decl(name)
-  
-    /** Retrieve the constructor Symbol for the passes <code>cs</code> ClassSymbol. */
-    private def constructorDecl(cs: ClassSymbol) = symDecl(cs, nme.CONSTRUCTOR)
-    
-    /** 
-     * <p>
-     * Take a method <code>name</code> and return the associated module method's symbol.
-     * </p>
-     * <p>
-     * Note: if module does not contain a method named </code>name</code>, the 
-     * returned symbol will be a <code>NoSymbol</code>.
-     * </p>
-     * 
-     * @param name   A name of the method that should be part of the declared members of the module.
-     * @return The symbol for the method 'module.name' or <code>NoSymbol</code> if the module does 
-     *         not have a member named <code>name</code>.
-     */
-    protected def modDecl(method: String) = symDecl(moduleSym, method)
-    
-    /** 
-     * <p>
-     * Take a method <code>name</code> and return the associated (module's) companion class method's symbol.
-     * </p>
-     * <p>
-     * Note: if class does not contain a method named </code>name</code>, the 
-     * returned symbol will be a <code>NoSymbol</code>.
-     * </p>
-     * 
-     * @param name   A name of the method that should be part of the declared members of the class.
-     * @return The symbol for the method 'class.name' or <code>NoSymbol</code> if the class does 
-     *         not have a member named <code>name</code>.
-     */
-    protected def classDecl(method: String) = symDecl(classSym, method)
-    
-    /**
-     * <p>
-     * Take an <code>instance</code> symbol and a <code>method</code> name and return  
-     * valid Scala Tree node of the form 'instance.method'.
-     * </p>
-     * <p>
-     * The precondition for this method to execute is that the <code>instance</code> Symbol
-     * contains in its members the selected <code>method</code>, otherwise calling this routine
-     * will throw an exception.
-     * </p>
-     * 
-     * @param instance The Symbol for the instance whose <code>method</code> is selected.
-     * @param method   The name of the selected method.
-     * @return         A Scala valid Select Tree node of the form 'instance.method'.
-     * 
-     */
-    protected def select(instance: Symbol, method: String): Select = {
-      require(instance.tpe.decl(method) != NoSymbol)
-      Select(Ident(instance), symDecl(instance,method))
-    }
-    
-    /**
-     * <p>
-     * Apply <code>arg</code> to the passed <code>method</code> contained in the 
-     * <code>moduleSym</code> module and return a valid Scala Tree node of the 
-     * form 'module.method(arg)'.
-     * </p>
-     * <p>
-     * The precondition for this method to execute is that the module Symbol
-     * contains in its members the passed <code>method</code>, otherwise calling 
-     * this routine will throw an exception.
-     * </p>
-     * 
-     * @param method   The name of the selected method.
-     * @args           The arguments to which the <code>method</code> is applied to. 
-     * @return         A Scala valid Apply Tree node of the form 'moduleSym.method(arg)'.
-     * 
-     */
-    protected def moduleApply(method: String, args: List[Tree]): Apply = 
-      apply(select(moduleSym,method), args)
-    
-    /** Calls <code>moduleApply</code> and wraps the passed <code>arg</code> into a 
-     * List, i.e., moduleApply(method, List(arg).*/
-    protected def moduleApply(method: String, arg: Tree): Apply = moduleApply(method,List(arg))
-    
-    /** 
-     * <p>
-     * Generic apply. Applies <code>select</code> to the passed list of <code>arguments</code>.
-     * and return a valid Scala Tree Apply Node of the form 'select(arg1,arg2,...,argN)'.
-     * </p>
-     * <p>
-     * Note: No check is performed to ensure that <code>select</code> can accept 
-     * the passed list of <code>arguments</code>
-     * </p>
-     * 
-     * @param select    The left hand side of the application.
-     * @param arguments The arguments of the application.
-     * @return          A Scala valid Apply Tree node of the form 'select(arg1, arg32, ..., argN)'
-     */
-    protected def apply(select: Tree, arguments: List[Tree]): Apply = 
-      Apply(select, arguments)
-    
-    /** Calls <code>apply</code> and wraps the passed <code>arg</code> into a List,
-     * i.e., apply(select, List(arg)). */
-    protected def apply(select: Tree, argument: Tree): Apply = 
-      apply(select, List(argument))
-  }
-  
-  
-  /** Module for creating scalac Tree nodes for calling methods of the 
-   * <code>org.scalacheck.Gen</code> class and module.*/
-  object Gen extends GenericScalaCheckModule {
-  
-    /** Symbol for the <code>org.scalacheck.Gen</code> module definition. */
-    override protected lazy val moduleSym = definitions.getModule("org.scalacheck.Gen")
-    
-    /**
-     * Apply <code>polyTpe</code> to the polymorphic type <code>org.scalacheck.Gen</code>.
-     * 
-     * @param polyTpe the type to be applied to <code>org.scalacheck.Gen</code>.
-     * @return The polymorphic type resulting from applying <code>polyTpe</code> 
-     *         to the polymorphic type <code>org.scalacheck.Gen</code>, i.e., 
-     *         <code>Gen[polyTpe]</code>.
-     */
-    private def applyType(polyTpe: Type) = appliedType(classSym.tpe, List(polyTpe))
-    
-    
-    /**
-     * This creates a Tree node for the call <code>org.scalacheck.Gen.value[T](rhs)</code>, 
-     * where the polymorphic type <code>T</code> will be inferred during the next 
-     * typer phase (this usually means that the typer has to be called explictly, 
-     * so it is the developer duty to ensure that this happen at some point).
-     */
-    def value(rhs: Tree): Tree = moduleApply("value", rhs)
-    
-    
-    /**
-     * This creates a Tree node for the call <code>org.scalacheck.Gen.oneOf[T](generators)</code>, 
-     * where the polymorphic type <code>T</code> will be inferred during the next 
-     * typer phase (this usually means that the typer has to be called explictly, 
-     * so it is the developer duty to ensure that this happen at some point).
-     */
-    def oneOf(generators: List[Symbol]): Tree = 
-      moduleApply("oneOf", generators.map(Ident(_)))
-    
-    
-    def lzy(generator: Tree): Tree = moduleApply("lzy", generator)
-    
-    /**
-     * This creates a Tree node for the call <code>org.scalacheck.Gen.flatMap[T](body)</code>, 
-     * where the polymorphic type <code>T</code> will be inferred during the next 
-     * typer phase (this usually means that the typer has to be called explictly, 
-     * so it is the developer duty to ensure that this happen at some point).
-     */
-    def flatMap(qualifier: Tree, body: Tree): Tree = 
-      apply(Select(qualifier, classDecl("flatMap")), body)
-     
-    
-    /**
-     * This creates a Tree node for the call <code>org.scalacheck.Gen.map[T](rhs)</code>, 
-     * where the polymorphic type <code>T</code> will be inferred during the next 
-     * typer phase (this usually means that the typer has to be called explictly, 
-     * so it is the developer duty to ensure that this happen at some point).
-     */
-    def map(qualifier: Tree, body: Tree): Tree = 
-      apply(Select(qualifier, classDecl("map")), body)
-     
-    
-    
-    /**
-     * Utilitary method for creating a method symbol for a <code>org.scalacheck.Gen</codee>
-     * generator method. 
-     * 
-     * @param owner   The owner of the method (DefDef) which will use the returned method symbol.
-     * @param genName The name of the method symbol (which will also be the name of the method).
-     * @param retTpe  The method's returning type.
-     * @return The method symbol for a generator method.
-     */
-    def createGenDefSymbol(owner: Symbol, genName: String, retTpe: Type): Symbol = {
-      // returning type of the new method, i.e., Gen["retTpe"]
-      val genDefRetTpe = applyType(retTpe)
-      
-      // create a symbol for the generator method that will be created next
-      owner.newMethod(owner.pos,genName).setInfo(PolyType(List(), genDefRetTpe))
-    }
-    
-    
-    
-     /** 
-     * Map that stores for each @generator annotated ClassDef or DefDef the automatically  
-     * generated DefDef for creating instances of the <code>org.scalacheck.Gen</code> class.
-     * The <code>Type</code> that is associated to the DefDef is either the type of the 
-     * ClassDef or the returning type of the DefDef.
-     */
-    private val tpe2listGen = scala.collection.mutable.Map.empty[Type, List[DefDef]]
-    private val tpe2listGenSym = scala.collection.mutable.Map.empty[Type, List[Symbol]]
-    
-     /** 
-     * Add the <code>gen</code> generator DefDef declaration to the list of 
-     * generators for <code>tpe</code>.
-     * 
-     * @param tpe The type of elements generated by the <code>gen</code>.
-     * @param gen The DefDef declaration for the generator method.
-     */
-    def +[T](map: collection.mutable.Map[Type, List[T]], key: Type, value: T): Unit = map.get(key) match {
-      case None         => map += key -> List(value)
-      case Some(values) => map += key -> (value :: values)
-    }
-   
-    /** List of generator DefDef symbols for a given type <code>tpe</code>*/
-    def genSymbolsForType(tpe: Type): List[Symbol] = tpe2listGenSym.get(tpe) match {
-      case None => Nil
-      case Some(symbols) => symbols
-    } 
-    
-    /** 
-     * Second Pass: Create symbols for the generator DefDef that will be created
-     * durind the Third Pass.
-     */
-    def createGenDefDef(klasses: List[ClassDef], defs: List[DefDef]): List[DefDef] = {
-      val generable: List[(Symbol,Tree)] = createGenDefSyms(klasses, defs)
-      
-      for { (genSym, genTree) <- generable } genTree match {
-        case cd: ClassDef => 
-          val tpe = cd.symbol.tpe
-          Gen + (tpe2listGen, tpe, Gen.createGenDef(cd, genSym))
-        
-        case d: DefDef =>
-          val tpe = d.tpt.symbol.tpe
-          val generated = DefDef(genSym, Modifiers(0), List(), rhsGenDef(Ident(d.name))(d)(genSym))
-          Gen + (tpe2listGen, tpe, generated)
-      }
-      
-      // flatten into single list values of Gen.tpe2listGen
-      (List[DefDef]() /: Gen.tpe2listGen.values) {
-        case (xs, xss) => xs ::: xss
-      }
-    }
-    
-    
-    /** 
-     * Create method symbols for each <code>@generator</code> annotated ClassDef
-     * and DefDef.
-     */
-    private def createGenDefSyms(klasses: List[ClassDef], defs: List[DefDef]): List[(Symbol, Tree)] = {
-    
-      val genKlasses: List[(Symbol, ClassDef)] = for(klass <- klasses) yield {
-        val genName = fresh.newName(NoPosition, "gen"+klass.name)
-        val tpe = klass.symbol.tpe
-        val genSym = createGenDefSymbol(klass.symbol.enclClass.owner, genName, tpe)
-        
-        Gen + (tpe2listGenSym, tpe, genSym)
-        
-        (genSym, klass)
-      }
-    
-      val genDefs: List[(Symbol, DefDef)] = for(d <- defs) yield {
-        val genName = fresh.newName(NoPosition, "gen"+d.name)
-        val tpe = d.tpt.symbol.tpe
-        val genSym = createGenDefSymbol(d.symbol.owner, genName, tpe)
-        
-        Gen + (tpe2listGenSym, tpe, genSym)
-        
-        (genSym, d)
-      }
-    
-      genKlasses ::: genDefs
-    }
-    
-    
-    
-    def createGenDef(cd: ClassDef, genDef: Symbol): DefDef = {
-      val d: DefDef = getConstructorOf(cd)
-      val DefDef(_,_,_,vparamss,retTpe,_) = d 
-      assert(vparamss.size <= 1, "currying is not supported. Change signature of "+cd.symbol)
-      
-      
-      if(cd.symbol.hasFlag(scala.tools.nsc.symtab.Flags.ABSTRACT)) {
-        val generators = retTpe.symbol.children.toList.map(s => genSymbolsForType(s.tpe)).flatMap(v=>v)
-        DefDef(genDef, Modifiers(0), List(), Gen.lzy(Gen.oneOf(generators)))
-      } 
-      else {
-        
-        val constrObj = resetAttrs(d.tpt.duplicate)
-        val instance = Select(New(constrObj), nme.CONSTRUCTOR)
-        
-        assert(d.tpt.isInstanceOf[TypeTree])
-        
-        val body = rhsGenDef(instance)(d)(genDef)
-        DefDef(genDef, Modifiers(0), List(), body)
-      }
-    }
-    
-    
-     /** <code>base</code> is either 
-     *       - Select(New(tpe),constructor) [constructor] 
-     *       - Ident(name)   [method call]
-     */
-    private def rhsGenDef(base: Tree)(d: DefDef)(extOwner: Symbol): Tree = {
-      val DefDef(_,name,_,vparamss,retTpe,_) = d
-      assert(vparamss.size <= 1, "currying is not supported. Change signature of "+d.symbol)
-      // XXX: quick fix to force creation of arbitrary objects for each data type, this should be refactored!!
-      Arbitrary.arbitrary(retTpe.asInstanceOf[TypeTree])
-      
-      if(vparamss.head.isEmpty)
-        Gen.value(Apply(base, Nil))
-      
-      else {
-        var owner = extOwner
-      
-        val paramssTpe: List[ValDef] = vparamss.flatMap(v=>v).map(p => 
-          ValDef(Modifiers(0), fresh.newName(NoPosition, "v"), resetAttrs(p.tpt.duplicate), EmptyTree))
-      
-      
-        var last = true
-      
-      
-        val z :Tree = Apply(base, paramssTpe.map(p => Ident(p.name)))
-        val body = (paramssTpe :\ z) {
-          case (param,apply) => {
-            val body = Function(List(param), apply)
-            body.symbol.owner = owner
-            owner = body.symbol
-            //XXX: it is not flatMap in general. fix this!!
-            if(last) {
-              last = false
-              Gen.map(Arbitrary.arbitrary(param.tpt.asInstanceOf[TypeTree]), body)
-            } else
-              Gen.flatMap(Arbitrary.arbitrary(param.tpt.asInstanceOf[TypeTree]), body)
-          }
-        }
-      
-        
-        Gen.lzy(body)
-      }
-    }
-   
-    
-    
-    private def getConstructorOf(cd: ClassDef): DefDef = {
-      val Template(parents, self, body) = cd.impl
-      var dd: DefDef  = null
-      for { b <- body } b match {
-        case d @ DefDef(_, nme.CONSTRUCTOR, _, _, _, _) => dd = d
-        case _ => ;
-      }
-      dd
-    } ensuring (res => res != null)
-
-  
-    
-  }
-  
-  
-  
-  /** Module for creating scalac Tree nodes for calling methods of the 
-   * <code>org.scalacheck.Arbitrary</code> class and module.*/
-  object Arbitrary extends GenericScalaCheckModule {
-    
-    
-    /** Symbol for the <code>org.scalacheck.Arbitrary</code> module definition. */
-    override protected lazy val moduleSym = definitions.getModule("org.scalacheck.Arbitrary")
-    
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbInt</code> method definition. */
-    private val arbInt          =  select(moduleSym, "arbInt")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbBool</code> method definition. */
-    private val arbBool         =  select(moduleSym, "arbBool")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbLong</code> method definition. */
-    private val arbLong         =  select(moduleSym, "arbLong")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbThrowable</code> method definition. */
-    private val arbThrowable    =  select(moduleSym, "arbThrowable")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbDouble</code> method definition. */
-    private val arbDouble       =  select(moduleSym, "arbDouble")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbChar</code> method definition. */
-    private val arbChar         =  select(moduleSym, "arbChar")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbString</code> method definition. */
-    private val arbString       =  select(moduleSym, "arbString")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbOption</code> method definition. */
-    private val arbOption       =  select(moduleSym, "arbOption")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbImmutableMap</code> method definition. */
-    private val arbImmutableMap =  select(moduleSym, "arbImmutableMap")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbList</code> method definition. */
-    private val arbList         =  select(moduleSym, "arbList")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbArray</code> method definition. */
-    private val arbArray        =  select(moduleSym, "arbArray")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbSet</code> method definition. */
-    private val arbSet          =  select(moduleSym, "arbSet")
-    /** Symbol for the <code>org.scalacheck.Arbitrary.arbTuple2</code> method definition. */
-    private val arbTuple2       =  select(moduleSym, "arbTuple2")
-    
-    //[[TODO]]
-    //lazy val arbMultiSet       =  Select(Ident(arbitraryModule), arbitraryModule.tpe.decl("arbMultiSet"))
-    
-    
-    
-    /** Map that stores <code>org.scalacheck.Arbitrary.arbitrary[Type]</code> calls. */
-    protected val tpe2arbApp    = scala.collection.mutable.Map.empty[Type,Tree]
-    
-    
-    // initialize map with ScalaCheck built-in types that are part of our PureScala language
-    import definitions._
-    tpe2arbApp += IntClass.typeConstructor       -> arbInt
-    tpe2arbApp += BooleanClass.typeConstructor   -> arbBool
-    tpe2arbApp += LongClass.typeConstructor      -> arbLong
-    tpe2arbApp += ThrowableClass.typeConstructor -> arbThrowable
-    tpe2arbApp += DoubleClass.typeConstructor    -> arbDouble
-    tpe2arbApp += CharClass.typeConstructor      -> arbChar
-    tpe2arbApp += StringClass.typeConstructor    -> arbString  // XXX: NOT WORKING
-    tpe2arbApp += OptionClass.typeConstructor    -> arbOption
-    
-    //lazy val ImmutableMapClass: Symbol = definitions.getClass(newTypeName("scala.collection.immutable.Map"))
-    //lazy val ImmutableSetClass: Symbol = definitions.getClass(newTypeName("scala.collection.immutable.Set"))
-    
-    //tpe2arbApp += ImmutableMapClass.typeConstructor    -> arbImmutableMap
-    tpe2arbApp += ListClass.typeConstructor            -> arbList
-    tpe2arbApp += ArrayClass.typeConstructor           -> arbArray
-    //tpe2arbApp += ImmutableSetClass.typeConstructor    -> arbSet
-    tpe2arbApp += TupleClass(2).typeConstructor        -> arbTuple2 
-    
-    /**
-     * Apply <code>polyTpe</code> to the polymorphic type <code>org.scalacheck.Arbitrary</code>.
-     * 
-     * @param polyTpe the type to be applied to <code>org.scalacheck.Arbitrary</code>.
-     * @return The polymorphic type resulting from applying <code>polyTpe</code> 
-     *         to the polymorphic type <code>org.scalacheck.Arbitrary</code>, i.e., 
-     *         <code>Arbitrary[polyTpe]</code>.
-     */
-    private def applyType(tpe: Type) = appliedType(classSym.tpe, List(tpe))
-    
-    /**
-     * Creates a Tree node for the call <code>org.scalacheck.Arbitrary.apply[T](generator)</code>, 
-     * where the polymorphic type <code>T</code> will be inferred during the next 
-     * typer phase (this usually means that the typer has to be called explictly, 
-     * so it is the developer duty to ensure that this happen at some point).
-     */
-    def apply(generator: Tree): Tree = moduleApply("apply", generator)
-    
-    def arbitrary(tpe: Type): Tree = tpe2arbApp.get(tpe) match {
-      case Some(arbTree) => arbTree
-      case None =>
-        val TypeRef(_,sym,params) = tpe 
-        apply(arbitrary(sym.typeConstructor), params.map(arbitrary(_)))
-    }
-    
-    
-    /**
-     * 
-     */
-    def arbitrary(polyTpe: TypeTree): Apply = {
-      val symbol = polyTpe.symbol
-      val tpe = symbol.tpe
-      tpe2arbApp.get(tpe) match {
-        case Some(arb) => applyArbitrary(arb)
-        case None => arbitrary(symbol)
-      }
-    }
-    
-    /** Map that stores not built-in <code>org.scalacheck.Arbitrary</code> DefDef definitions. */
-    private val tpe2arbDefDef = scala.collection.mutable.Map.empty[Type,DefDef]
-    
-    def getArbitraryDefDefs: List[DefDef] = tpe2arbDefDef.values.toList
-    
-    def arbitrary(tpeSym: Symbol): Apply = {
-      require(tpe2arbApp.get(tpeSym.tpe).isEmpty, "Arbitrary.arbitrary["+tpeSym.tpe+"] is already in the map")
-      
-      val owner = tpeSym.toplevelClass
-      val arbName = fresh.newName(NoPosition,"arb"+tpeSym.name)
-      val tpe = tpeSym.tpe
-      
-      val arbDef = createArbitraryDefSymbol(owner, arbName, tpe)
-      
-            
-      val genNames = Gen.genSymbolsForType(tpe)
-      
-      
-      val generated = DefDef(arbDef, Modifiers(0), List(), Arbitrary(Gen.oneOf(genNames)))
-      tpe2arbDefDef += tpe -> generated  
-      
-      val result = applyArbitrary(Ident(arbDef))
-      tpe2arbApp += tpe -> Ident(arbDef)
-        
-      result
-            
-    }
-    
-                                  
-    protected def applyArbitrary(param: Tree): Apply = 
-      apply(select(moduleSym, "arbitrary"), param)
-    
-    
-    /**
-     * Utilitary method for creating a method symbol for a <code>org.scalacheck.Arbitrary</codee>
-     * generator method. 
-     * 
-     * @param owner   The owner of the method (DefDef) which will use the returned method symbol.
-     * @param arbName The name of the method symbol (which will also be the name of the method).
-     * @param retTpe  The method's returning type.
-     * @return The method symbol for a generator method.
-     */
-    def createArbitraryDefSymbol(owner: Symbol, arbName: String, retTpe: Type): Symbol = {
-      // returning type of the new method, i.e., Arbitrary["retTpe"]
-      val arbRetTpe = applyType(retTpe)
-      
-      // Create the DefDef for the new Arbitrary object
-      val arbDef = owner.newMethod(owner.pos, arbName).setInfo(PolyType(List(), arbRetTpe))
-      // Implicit only because of ScalaCheck rational (not really needed since we are injecting code)
-      arbDef.setFlag(scala.tools.nsc.symtab.Flags.IMPLICIT)
-      
-      arbDef
-    }
-  }
-  
-  object Prop extends GenericScalaCheckModule {
-                                               
-    /** Symbol for the <code>org.scalacheck.Prop</code> module definition. */
-    override protected lazy val moduleSym = definitions.getModule("org.scalacheck.Prop")
-   
-    
-    def forAll(props: List[Tree]): Apply = 
-      moduleApply("forAll", props)
-    
-    def forAll(prop: Tree): Apply = forAll(List(prop))
-    
-    def ==>(ifz: Tree, then: Tree): Apply = moduleApply("==>", List(ifz,propBoolean(then)))
-    
-    def propBoolean(prop: Tree): Apply = moduleApply("propBoolean", List(prop))
-    
-  }
-  
-  
-  object Shrink extends GenericScalaCheckModule {
-    
-    /** Symbol for the <code>org.scalacheck.Shrink</code> module definition. */
-    override protected lazy val moduleSym = definitions.getModule("org.scalacheck.Shrink")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkInt</code> method definition. */
-    private val shrinkInt          =  select(moduleSym, "shrinkInt")    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkString</code> method definition. */
-    private val shrinkString       =  select(moduleSym, "shrinkString")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkOption</code> method definition. */
-    private val shrinkOption       =  select(moduleSym, "shrinkOption")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkList</code> method definition. */
-    private val shrinkList         =  select(moduleSym, "shrinkList")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkSet</code> method definition. */
-    private val shrinkArray        =  select(moduleSym, "shrinkArray")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkSet</code> method definition. */
-    private val shrinkSet          =  select(moduleSym, "shrinkSet")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkTuple2</code> method definition. */
-    private val shrinkTuple2       =  select(moduleSym, "shrinkTuple2")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkTuple3</code> method definition. */
-    private val shrinkTuple3       =  select(moduleSym, "shrinkTuple3")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkTuple4</code> method definition. */
-    private val shrinkTuple4       =  select(moduleSym, "shrinkTuple4")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkTuple5</code> method definition. */
-    private val shrinkTuple5       =  select(moduleSym, "shrinkTuple5")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkTuple6</code> method definition. */
-    private val shrinkTuple6       =  select(moduleSym, "shrinkTuple6")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkTuple7</code> method definition. */
-    private val shrinkTuple7       =  select(moduleSym, "shrinkTuple7")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkTuple8</code> method definition. */
-    private val shrinkTuple8       =  select(moduleSym, "shrinkTuple8")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkTuple9</code> method definition. */
-    private val shrinkTuple9       =  select(moduleSym, "shrinkTuple9")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkIntList</code> method definition. */
-    private val shrinkIntList      =  select(moduleSym, "shrinkIntList")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkBooleanList</code> method definition. */
-    private val shrinkBooleanList  =  select(moduleSym, "shrinkBooleanList")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkDoubleList</code> method definition. */
-    private val shrinkDoubleList   =  select(moduleSym, "shrinkDoubleList")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkStringList</code> method definition. */
-    private val shrinkStringList   =  select(moduleSym, "shrinkStringList")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkIntArray</code> method definition. */
-    private val shrinkIntArray     =  select(moduleSym, "shrinkIntArray")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkBooleanArray</code> method definition. */
-    private val shrinkBooleanArray =  select(moduleSym, "shrinkBooleanArray")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkDoubleArray</code> method definition. */
-    private val shrinkDoubleArray  =  select(moduleSym, "shrinkDoubleArray")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkStringArray</code> method definition. */
-    private val shrinkStringArray  =  select(moduleSym, "shrinkStringArray")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkIntSet</code> method definition. */
-    private val shrinkIntSet       =  select(moduleSym, "shrinkIntSet")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkBooleanSet</code> method definition. */
-    private val shrinkBooleanSet   =  select(moduleSym, "shrinkBooleanSet")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkDoubleSet</code> method definition. */
-    private val shrinkDoubleSet    =  select(moduleSym, "shrinkDoubleSet")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkStringSet</code> method definition. */
-    private val shrinkStringSet    =  select(moduleSym, "shrinkStringSet")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkIntOption</code> method definition. */
-    private val shrinkIntOption    =  select(moduleSym, "shrinkIntOption")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkBooleanOption</code> method definition. */
-    private val shrinkBooleanOption=  select(moduleSym, "shrinkBooleanOption")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkDoubleOption</code> method definition. */
-    private val shrinkDoubleOption =  select(moduleSym, "shrinkDoubleOption")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkStringOption</code> method definition. */
-    private val shrinkStringOption =  select(moduleSym, "shrinkStringOption")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkIntTuple2</code> method definition. */
-    private val shrinkIntTuple2    =  select(moduleSym, "shrinkIntTuple2")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkBooleanTuple2</code> method definition. */
-    private val shrinkBooleanTuple2=  select(moduleSym, "shrinkBooleanTuple2")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkDoubleTuple2</code> method definition. */
-    private val shrinkDoubleTuple2 =  select(moduleSym, "shrinkDoubleTuple2")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkStringTuple2</code> method definition. */
-    private val shrinkStringTuple2 =  select(moduleSym, "shrinkStringTuple2")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkIntTuple3</code> method definition. */
-    private val shrinkIntTuple3    =  select(moduleSym, "shrinkIntTuple3")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkBooleanTuple3</code> method definition. */
-    private val shrinkBooleanTuple3=  select(moduleSym, "shrinkBooleanTuple3")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkDoubleTuple3</code> method definition. */
-    private val shrinkDoubleTuple3 =  select(moduleSym, "shrinkDoubleTuple3")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkStringTuple3</code> method definition. */
-    private val shrinkStringTuple3 =  select(moduleSym, "shrinkStringTuple3")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkIntTuple4</code> method definition. */
-    private val shrinkIntTuple4    =  select(moduleSym, "shrinkIntTuple4")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkBooleanTuple4</code> method definition. */
-    private val shrinkBooleanTuple4=  select(moduleSym, "shrinkBooleanTuple4")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkDoubleTuple4</code> method definition. */
-    private val shrinkDoubleTuple4 =  select(moduleSym, "shrinkDoubleTuple4")
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkStringTuple4</code> method definition. */
-    private val shrinkStringTuple4 =  select(moduleSym, "shrinkStringTuple4")
-    
-    /** Symbol for the <code>org.scalacheck.Shrink.shrinkAny</code> method definition.
-     *  This is a generic shrinker which does not shrink whatever object is passed to it.
-     */
-    private val shrinkAny          =  select(moduleSym, "shrinkAny")
-    
-    def shrinker(tpe: Type): Select = tpe2shrinker.getOrElse(tpe, shrinkAny)
-    
-    private val tpe2shrinker: Map[Type, Select] = {
-      import definitions._
-      val SetClass: Symbol = definitions.getClass("scala.collection.immutable.Set")
-      
-      def apply(container: Type)(parametric: Type): Type = 
-        appliedType(container, List(parametric))
-        
-      def listOf(tpe: Type): Type = apply(ListClass.typeConstructor)(tpe)
-      def arrayOf(tpe: Type): Type = apply(ArrayClass.typeConstructor)(tpe)
-      def setOf(tpe: Type): Type = apply(SetClass.typeConstructor)(tpe)
-      def optionOf(tpe: Type): Type = apply(OptionClass.typeConstructor)(tpe)
-      def tupleOf(arity: Int, tpe: Type): Type = apply(TupleClass(arity).typeConstructor)(tpe)
-      
-      val IntListTpe     = listOf(IntClass.typeConstructor)
-      val BooleanListTpe = listOf(BooleanClass.typeConstructor)
-      val DoubleListTpe  = listOf(DoubleClass.typeConstructor)
-      val StringListTpe  = listOf(StringClass.typeConstructor)
-      
-      val IntArrayTpe     = arrayOf(IntClass.typeConstructor)
-      val BooleanArrayTpe = arrayOf(BooleanClass.typeConstructor)
-      val DoubleArrayTpe  = arrayOf(DoubleClass.typeConstructor)
-      val StringArrayTpe  = arrayOf(StringClass.typeConstructor)
-      
-      val IntSetTpe      = setOf(IntClass.typeConstructor)
-      val BooleanSetTpe  = setOf(BooleanClass.typeConstructor)
-      val DoubleSetTpe   = setOf(DoubleClass.typeConstructor)
-      val StringSetTpe   = setOf(StringClass.typeConstructor)
-      
-      val IntOptionTpe     = optionOf(IntClass.typeConstructor)
-      val BooleanOptionTpe = optionOf(BooleanClass.typeConstructor)
-      val DoubleOptionTpe  = optionOf(DoubleClass.typeConstructor)
-      val StringOptionTpe  = optionOf(StringClass.typeConstructor)
-      
-      val IntTuple2Tpe     = tupleOf(2, IntClass.typeConstructor)
-      val BooleanTuple2Tpe = tupleOf(2, BooleanClass.typeConstructor)
-      val DoubleTuple2Tpe  = tupleOf(2, DoubleClass.typeConstructor)
-      val StringTuple2Tpe  = tupleOf(2, StringClass.typeConstructor)
-      
-      val IntTuple3Tpe     = tupleOf(3, IntClass.typeConstructor)
-      val BooleanTuple3Tpe = tupleOf(3, BooleanClass.typeConstructor)
-      val DoubleTuple3Tpe  = tupleOf(3, DoubleClass.typeConstructor)
-      val StringTuple3Tpe  = tupleOf(3, StringClass.typeConstructor)
-      
-      val IntTuple4Tpe     = tupleOf(4, IntClass.typeConstructor)
-      val BooleanTuple4Tpe = tupleOf(4, BooleanClass.typeConstructor)
-      val DoubleTuple4Tpe  = tupleOf(4, DoubleClass.typeConstructor)
-      val StringTuple4Tpe  = tupleOf(4, StringClass.typeConstructor)
-      
-      Map(
-          IntClass.typeConstructor        -> shrinkInt,
-          StringClass.typeConstructor     -> shrinkString, 
-          OptionClass.typeConstructor     -> shrinkOption,
-          ListClass.typeConstructor       -> shrinkList,
-          ArrayClass.typeConstructor      -> shrinkArray,
-          SetClass.typeConstructor        -> shrinkSet,
-          TupleClass(2).typeConstructor   -> shrinkTuple2,
-          TupleClass(3).typeConstructor   -> shrinkTuple3,
-          TupleClass(4).typeConstructor   -> shrinkTuple4,
-          TupleClass(5).typeConstructor   -> shrinkTuple5,
-          TupleClass(6).typeConstructor   -> shrinkTuple6,
-          TupleClass(7).typeConstructor   -> shrinkTuple7,
-          TupleClass(8).typeConstructor   -> shrinkTuple8,
-          TupleClass(9).typeConstructor   -> shrinkTuple9,
-          IntListTpe                      -> shrinkIntList,
-          BooleanListTpe                  -> shrinkBooleanList,
-          DoubleListTpe                   -> shrinkDoubleList,
-          StringListTpe                   -> shrinkStringList,
-          IntArrayTpe                     -> shrinkIntArray,
-          BooleanArrayTpe                 -> shrinkBooleanArray,
-          DoubleArrayTpe                  -> shrinkDoubleArray,
-          StringArrayTpe                  -> shrinkStringArray,
-          IntSetTpe                       -> shrinkIntSet,
-          BooleanSetTpe                   -> shrinkBooleanSet,
-          DoubleSetTpe                    -> shrinkDoubleSet,
-          StringSetTpe                    -> shrinkStringSet,
-          IntOptionTpe                    -> shrinkIntOption,
-          BooleanOptionTpe                -> shrinkBooleanOption,
-          DoubleOptionTpe                 -> shrinkDoubleOption,
-          StringOptionTpe                 -> shrinkStringOption,
-          IntTuple2Tpe                    -> shrinkIntTuple2,
-          BooleanTuple2Tpe                -> shrinkBooleanTuple2,
-          DoubleTuple2Tpe                 -> shrinkDoubleTuple2,
-          StringTuple2Tpe                 -> shrinkStringTuple2,
-          IntTuple3Tpe                    -> shrinkIntTuple3,
-          BooleanTuple3Tpe                -> shrinkBooleanTuple3,
-          DoubleTuple3Tpe                 -> shrinkDoubleTuple3,
-          StringTuple3Tpe                 -> shrinkStringTuple3,
-          IntTuple4Tpe                    -> shrinkIntTuple4,
-          BooleanTuple4Tpe                -> shrinkBooleanTuple4,
-          DoubleTuple4Tpe                 -> shrinkDoubleTuple4,
-          StringTuple4Tpe                 -> shrinkStringTuple4
-      )
-    }
-  }
-  
-  
-  object ConsoleReporter extends GenericScalaCheckModule {
-    /** Symbol for the <code>org.scalacheck.ConsoleReporter</code> module definition. */
-    override protected lazy val moduleSym = definitions.getModule("org.scalacheck.ConsoleReporter")
-    
-    def testStatsEx(testRes: Tree): Tree = testStatsEx("", testRes)
-                                                       
-    def testStatsEx(msg: String, testRes: Tree): Tree = 
-      Apply(select(moduleSym, "testStatsEx"), List(Literal(msg), testRes))
-  }
-  
-  object Test extends GenericScalaCheckModule {
-    /** Symbol for the <code>org.scalacheck.Test</code> module definition. */
-    override protected lazy val moduleSym = definitions.getModule("org.scalacheck.Test")
-    
-    def check(prop: Tree): Tree = moduleApply("check", prop)
-    
-    def isPassed(res: Tree): Tree = Select(res, "passed")
-  }
-  
-}
diff --git a/oldsrc/funcheck/scalacheck/ScalaCheckIntegrator.scala b/oldsrc/funcheck/scalacheck/ScalaCheckIntegrator.scala
deleted file mode 100644
index c212589ad9acaad69f4cf98d6f018c95a110db73..0000000000000000000000000000000000000000
--- a/oldsrc/funcheck/scalacheck/ScalaCheckIntegrator.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-package funcheck.scalacheck
-
-import scala.tools.nsc.{Global, SubComponent}
-
-
-trait ScalaCheckIntegrator extends ScalaCheck 
-  with FilterGeneratorAnnotations
-  with GeneratorDefDefInjector
-  with ForAllTransformer 
-{
-  val global: Global
-  import global._
-  
-  
-  def createGeneratorDefDefs(unit: CompilationUnit): (List[DefDef], List[DefDef]) = {
-    val filteredGenTree = new FilterTreeTraverser(filterTreesWithGeneratorAnnotation(unit))
-    filteredGenTree.traverse(unit.body)
-    
-    val klasses = collection.mutable.Set.empty[ClassDef]
-    val defs = collection.mutable.Set.empty[DefDef]
-    
-    for {tree <- filteredGenTree.hits} tree match {
-      case c: ClassDef => klasses + c
-      case d: DefDef => defs + d
-    }  
-    
-    (Gen.createGenDefDef(klasses.toList,defs.toList), Arbitrary.getArbitraryDefDefs)
-  }
-  
-  
-}
diff --git a/oldsrc/funcheck/util/FreshNameCreator.scala b/oldsrc/funcheck/util/FreshNameCreator.scala
deleted file mode 100644
index 3e51a5e4206c392a8bc92818f51f8df277dabcae..0000000000000000000000000000000000000000
--- a/oldsrc/funcheck/util/FreshNameCreator.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-package funcheck.util
-
-trait FreshNameCreator {
-  var fresh: scala.tools.nsc.util.FreshNameCreator
-}
diff --git a/oldsrc/scala/collection/Multiset.scala b/oldsrc/scala/collection/Multiset.scala
deleted file mode 100644
index 23c6255bbf986f683991e5f3682e3373909b26d9..0000000000000000000000000000000000000000
--- a/oldsrc/scala/collection/Multiset.scala
+++ /dev/null
@@ -1,81 +0,0 @@
-package scala.collection
-
-
-trait Multiset[A] extends (A => Int) with Collection[A]{
-  
-  /** Returns the number of elements in this multiset.
-   *
-   *  @return number of multiset elements.
-   */
-  def size: Int
-  
-  /** This method allows multisets to be interpreted as predicates.
-   *  It returns <code>0</code>, iff this multiset does not contain 
-   *  element <code>elem</code>, or <code>N</code> where <code>N</code>
-   *  is the number of occurences of <code>elem</code> in this multiset.
-   *
-   *  @param elem the element to check for membership.
-   *  @return     <code>0</code> iff <code>elem</code> is not contained in
-   *              this multiset, or <code>N</code> where <code>N</code>
-   *              is the number of occurences of <code>elem</code> in this 
-   *              multiset.
-   */
-  def apply(elem: A): Int  
-  
-  /** Checks if this set contains element <code>elem</code>.
-   *
-   *  @param elem the element to check for membership.
-   *  @return     <code>true</code> iff <code>elem</code> is not contained in
-   *              this multiset.
-   */
-  def contains(elem: A): Boolean = apply(elem) > 0
-  
-  /** Checks if this multiset is empty.
-   *
-   *  @return <code>true</code> iff there is no element in the multiset.
-   */
-  override def isEmpty: Boolean = size == 0
-  
-  /** Checks if this multiset is a subset of set <code>that</code>.
-   *
-   *  @param that another multiset.
-   *  @return     <code>true</code> iff the other multiset is a superset of
-   *              this multiset.
-   *  todo: rename to isSubsetOf 
-   */
-  def subsetOf(that: Multiset[A]): Boolean = 
-    forall(e => this(e) <= that(e))
-  
-  /** 
-   * This method is an alias for <code>intersect</code>. It computes an 
-   * intersection with set that. It removes all the elements 
-   * <code>that</code> are not present in that.
-   */                                                    
-  def ** (that: Multiset[A]): Multiset[A]
-  
-  /** @return this multiset as set. */
-  def asSet: Set[A]
-    
-  
-  //structural equality
-  /** Compares this multiset with another object and returns true, iff the
-   *  other object is also a multiset which contains the same elements as
-   *  this multiset, with the same cardinality.
-   *
-   *  @param that the other object
-   *  @note not necessarily run-time type safe.
-   *  @return     <code>true</code> iff this multiset and the other multiset
-   *              contain the same elements, with same cardinality.
-   */
-  override def equals(that: Any): Boolean = that match {
-    case other: Multiset[_] => other.size == this.size && subsetOf(other.asInstanceOf[Multiset[A]])
-    case _ => false
-  }
-  
-  /** Defines the prefix of this object's <code>toString</code> representation.
-   */
-  override protected def stringPrefix : String = "Multiset"
-  
-  
-  override def toString = elements.mkString(stringPrefix + "(", ", ", ")")
-}
diff --git a/oldsrc/scala/collection/immutable/EmptyMultiset.scala b/oldsrc/scala/collection/immutable/EmptyMultiset.scala
deleted file mode 100644
index c688a80f35626282b9dd2b8f9a01b4110a15a54c..0000000000000000000000000000000000000000
--- a/oldsrc/scala/collection/immutable/EmptyMultiset.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-package scala.collection.immutable
-
-class EmptyMultiset[A] extends Multiset[A] with Helper[A]{
-
-  def empty[C]: Multiset[C] = new EmptyMultiset[C]
-  
-  override def size: Int = 0
-  
-  override def apply(elem: A): Int = 0
-  
-  override def contains(elem: A): Boolean = false
-
-  override def intersect (that: collection.Multiset[A]): Multiset[A] = empty
-  
-  override def ++ (elems: Iterable[A]): Multiset[A] = iterable2multiset(elems)
-  
-  override def +++ (elems: Iterable[A]): Multiset[A] = this ++ elems
-  
-  override def --(elems: Iterable[A]): Multiset[A] = empty
-  
-  override def elements: Iterator[A] = Iterator.empty
-  
-  override def asSet: Set[A] = new EmptySet[A]
-}
diff --git a/oldsrc/scala/collection/immutable/HashMultiset.scala b/oldsrc/scala/collection/immutable/HashMultiset.scala
deleted file mode 100644
index ac53f935923a789ee37438cd830219c418e0e50b..0000000000000000000000000000000000000000
--- a/oldsrc/scala/collection/immutable/HashMultiset.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-package scala.collection.immutable
-
-object HashMultiset {
-  
-  /** The empty multiset of this type. */
-  def empty[A]: Multiset[A] = new EmptyMultiset[A]
-  
-  /** The canonical factory for this type */
-  def apply[A](elems: A*) = empty[A] ++ elems
-}
-
-class HashMultiset[A] private[immutable] (private val map: Map[A,Int]) extends Multiset[A] with Helper[A] {
-  
-  def empty[C]: Multiset[C] = new EmptyMultiset[C]
-  
-  override def size: Int = map.values.foldLeft(0)((a,b) => a+b)
-  
-  override def apply(elem: A): Int = map.getOrElse(elem,0)
-    
-  override def intersect (that: collection.Multiset[A]): Multiset[A] = {
-    def inner(entries: List[A], result: Map[A,Int]): Map[A,Int] = entries match {
-      case Nil => result
-      case elem :: rest => inner(rest, result.update(elem, min(this(elem),that(elem))))
-    }
-    
-    new HashMultiset[A](inner(asSet.toList,new HashMap[A,Int].empty))
-  }
-  
-  
-  override def ++ (elems: Iterable[A]): Multiset[A] = {
-    val that = iterable2multiset(elems)
-    
-    def inner(entries: List[A], result: Map[A,Int]): Map[A,Int] = entries match {
-      case Nil => result
-      case elem :: rest =>
-        inner(rest, result.update(elem,max(result.getOrElse(elem,0),that(elem))))
-    }
-    
-    new HashMultiset[A](inner(that.asSet.toList, map))
-  }
-  
-  
-  override def +++ (elems: Iterable[A]): Multiset[A] = {
-    def inner(entries: List[A], result: Map[A,Int]): Map[A,Int] = entries match {
-      case Nil => result
-      case elem :: rest => 
-        inner(rest, result.update(elem,result.getOrElse(elem,0)+1))
-    }
-    
-    new HashMultiset[A](inner(elems.toList,map))
-  }
-    
-  override def --(elems: Iterable[A]): Multiset[A] = {
-    val that = iterable2multiset(elems)
-    def inner(entries: List[A], result: Map[A,Int]): Map[A,Int] = entries match {
-      case Nil => result
-      case elem :: rest => 
-        val diff = result.getOrElse(elem,0) - that(elem)
-        if(diff > 0)
-          inner(rest, result.update(elem,diff))
-        else
-          inner(rest, result - elem)
-    }  
-    
-    new HashMultiset[A](inner(that.asSet.toList,map))
-  }
-  
-  override def elements: Iterator[A] = {
-    def inner(entries: List[A], result: List[A]): List[A] = entries match {
-      case Nil => result
-      case elem :: rest =>
-        inner(rest, result ::: int2list(elem, this(elem))) 
-    }
-    
-    inner(map.keys.toList, Nil).elements
-  }
-  
-  override def asSet: Set[A] = Set.empty[A] ++ map.keys
-}
diff --git a/oldsrc/scala/collection/immutable/Helper.scala b/oldsrc/scala/collection/immutable/Helper.scala
deleted file mode 100644
index 100c9772587891b1590c7eae12c60700ea0969f1..0000000000000000000000000000000000000000
--- a/oldsrc/scala/collection/immutable/Helper.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-package scala.collection.immutable
-
-private[immutable] trait Helper[A] {
-  
-  protected def int2list[C](elem: C, times: Int): List[C] = {
-    require(times >= 0)
-    if(times == 0)
-      Nil
-    else
-      elem :: int2list(elem,times-1)
-  } ensuring (res => res.size == times)
-  
-  protected def iterable2multiset(elems: Iterable[A]): Multiset[A] = {
-    def inner(elems: List[A], result: Map[A,Int]): Map[A,Int] = elems match {
-      case Nil => result
-      case elem :: tail => inner(tail, result.update(elem, result.getOrElse(elem,0) + 1)) 
-    }
-    new HashMultiset[A](inner(elems.toList,new scala.collection.immutable.HashMap[A,Int].empty))
-  } 
-  
-  protected def min(a: Int, b: Int): Int = if(a <= b) a else b
-  protected def max(a: Int, b: Int): Int = if(a < b) b else a
-
-}
diff --git a/oldsrc/scala/collection/immutable/Multiset.scala b/oldsrc/scala/collection/immutable/Multiset.scala
deleted file mode 100644
index 6a4c89d85c888a154179de29e7f6e0270d440126..0000000000000000000000000000000000000000
--- a/oldsrc/scala/collection/immutable/Multiset.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-package scala.collection.immutable
-
-
-object Multiset {
-   /** The empty set of this type */
-  def empty[A]: Multiset[A] = new EmptyMultiset[A]
-  
-  /** The canonical factory for this type */
-  def apply[A](elems: A*): Multiset[A] = empty[A] +++ elems
-  
-}
-
-trait Multiset[A] extends AnyRef with collection.Multiset[A]{
-  
-  /** This method is an alias for <code>intersect</code>.
-   *  It computes an intersection with multiset <code>that</code>.
-   *  It removes all the elements that are not present in <code>that</code>.
-   *
-   *  @param that the multiset to intersect with
-   */
-  final override def ** (that: collection.Multiset[A]): Multiset[A] = intersect(that)
-
-  /** 
-   * This method computes an intersection with multiset that. It removes all 
-   * the elements that are not present in that.
-   */
-  def intersect (that: collection.Multiset[A]): Multiset[A] 
-  
-  // A U elems (max)
-  def ++ (elems: Iterable[A]): Multiset[A]
-  
-  // A U elems (sum)
-  def +++ (elems: Iterable[A]): Multiset[A]
-  
-  // A \ {elems} 
-  def --(elems: Iterable[A]): Multiset[A]
-  
-  // A U {elems}
-  final def + (elems: A*): Multiset[A] = this ++ elems
-  
-  // A \ {elems}
-  final def - (elems: A*): Multiset[A] = this -- elems
-}
diff --git a/online-testcases/AmortizedQueue.scala b/online-testcases/AmortizedQueue.scala
deleted file mode 100644
index bdcd7ee6a1cdcb7ea170bd5c96d635b091fb2c5c..0000000000000000000000000000000000000000
--- a/online-testcases/AmortizedQueue.scala
+++ /dev/null
@@ -1,103 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Utils._
-import funcheck.Annotations._
-
-object AmortizedQueue {
-  sealed abstract class List
-  case class Cons(head : Int, tail : List) extends List
-  case class Nil() extends List
-
-  sealed abstract class AbsQueue
-  case class Queue(front : List, rear : List) extends AbsQueue
-
-  def size(list : List) : Int = (list match {
-    case Nil() => 0
-    case Cons(_, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def content(l: List) : Set[Int] = l match {
-    case Nil() => Set.empty[Int]
-    case Cons(x, xs) => Set(x) ++ content(xs)
-  }
-  
-  def asList(queue : AbsQueue) : List = queue match {
-    case Queue(front, rear) => concat(front, reverse(rear))
-  }
-
-  def concat(l1 : List, l2 : List) : List = (l1 match {
-    case Nil() => l2
-    case Cons(x,xs) => Cons(x, concat(xs, l2))
-  }) ensuring (res => size(res) == size(l1) + size(l2) && content(res) == content(l1) ++ content(l2))
-
-  def isAmortized(queue : AbsQueue) : Boolean = queue match {
-    case Queue(front, rear) => size(front) >= size(rear)
-  }
-
-  def isEmpty(queue : AbsQueue) : Boolean = queue match {
-    case Queue(Nil(), Nil()) => true
-    case _ => false
-  }
-
-  def reverse(l : List) : List = (l match {
-    case Nil() => Nil()
-    case Cons(x, xs) => concat(reverse(xs), Cons(x, Nil()))
-  }) ensuring (content(_) == content(l))
-
-  def amortizedQueue(front : List, rear : List) : AbsQueue = {
-    if (size(rear) <= size(front))
-      Queue(front, rear)
-    else
-      Queue(concat(front, reverse(rear)), Nil())
-  } ensuring(isAmortized(_))
-
-  def enqueue(queue : AbsQueue, elem : Int) : AbsQueue = (queue match {
-    case Queue(front, rear) => amortizedQueue(front, Cons(elem, rear))
-  }) ensuring(isAmortized(_))
-
-  def tail(queue : AbsQueue) : AbsQueue = {
-    require(isAmortized(queue) && !isEmpty(queue))
-    queue match {
-      case Queue(Cons(f, fs), rear) => amortizedQueue(fs, rear)
-    }
-  } ensuring (isAmortized(_))
-
-  def front(queue : AbsQueue) : Int = {
-    require(isAmortized(queue) && !isEmpty(queue))
-    queue match {
-      case Queue(Cons(f, _), _) => f
-    }
-  }
-
-  @induct
-  def propFront(queue : AbsQueue, list : List, elem : Int) : Boolean = {
-    require(!isEmpty(queue) && isAmortized(queue))
-    if (asList(queue) == list) {
-      list match {
-        case Cons(x, _) => front(queue) == x
-      }
-    } else
-      true
-  } holds
-
-  def enqueueAndFront(queue : AbsQueue, elem : Int) : Boolean = {
-    if (isEmpty(queue))
-      front(enqueue(queue, elem)) == elem
-    else
-      true
-  } holds
-
-  def enqueueDequeueThrice(queue : AbsQueue, e1 : Int, e2 : Int, e3 : Int) : Boolean = {
-    if (isEmpty(queue)) {
-      val q1 = enqueue(queue, e1)
-      val q2 = enqueue(q1, e2)
-      val q3 = enqueue(q2, e3)
-      val e1prime = front(q3)
-      val q4 = tail(q3)
-      val e2prime = front(q4)
-      val q5 = tail(q4)
-      val e3prime = front(q5)
-      e1 == e1prime && e2 == e2prime && e3 == e3prime
-    } else
-      true
-  } holds
-}
diff --git a/online-testcases/AssociativeList.scala b/online-testcases/AssociativeList.scala
deleted file mode 100644
index dc56e8fd4eb2c28c216e7191990a31084c5ec89a..0000000000000000000000000000000000000000
--- a/online-testcases/AssociativeList.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Utils._
-import funcheck.Annotations._
-
-object AssociativeList { 
-  sealed abstract class KeyValuePairAbs
-  case class KeyValuePair(key: Int, value: Int) extends KeyValuePairAbs
-
-  sealed abstract class List
-  case class Cons(head: KeyValuePairAbs, tail: List) extends List
-  case class Nil() extends List
-
-  sealed abstract class OptionInt
-  case class Some(i: Int) extends OptionInt
-  case class None() extends OptionInt
-
-  def domain(l: List): Set[Int] = l match {
-    case Nil() => Set.empty[Int]
-    case Cons(KeyValuePair(k,_), xs) => Set(k) ++ domain(xs)
-  }
-
-  def find(l: List, e: Int): OptionInt = l match {
-    case Nil() => None()
-    case Cons(KeyValuePair(k, v), xs) => if (k == e) Some(v) else find(xs, e)
-  }
-
-  def noDuplicates(l: List): Boolean = l match {
-    case Nil() => true
-    case Cons(KeyValuePair(k, v), xs) => find(xs, k) == None() && noDuplicates(xs)
-  }
-
-  def update(l1: List, l2: List): List = (l2 match {
-    case Nil() => l1
-    case Cons(x, xs) => update(updateElem(l1, x), xs)
-  }) ensuring(domain(_) == domain(l1) ++ domain(l2))
-
-  def updateElem(l: List, e: KeyValuePairAbs): List = (l match {
-    case Nil() => Cons(e, Nil())
-    case Cons(KeyValuePair(k, v), xs) => e match {
-      case KeyValuePair(ek, ev) => if (ek == k) Cons(KeyValuePair(ek, ev), xs) else Cons(KeyValuePair(k, v), updateElem(xs, e))
-    }
-  }) ensuring(res => e match {
-    case KeyValuePair(k, v) => domain(res) == domain(l) ++ Set[Int](k)
-  })
-
-  @induct
-  def readOverWrite(l: List, k1: Int, k2: Int, e: Int) : Boolean = {
-    find(updateElem(l, KeyValuePair(k2,e)), k1) == (if (k1 == k2) Some(e) else find(l, k1))
-  } holds
-}
diff --git a/online-testcases/InsertionSort.scala b/online-testcases/InsertionSort.scala
deleted file mode 100644
index 512b0d1d7c1b8b7c5fe8539666f9e70338fc2189..0000000000000000000000000000000000000000
--- a/online-testcases/InsertionSort.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Annotations._
-import funcheck.Utils._
-
-object InsertionSort {
-  sealed abstract class List
-  case class Cons(head:Int,tail:List) extends List
-  case class Nil() extends List
-
-  sealed abstract class OptInt
-  case class Some(value: Int) extends OptInt
-  case class None() extends OptInt
-
-  def size(l : List) : Int = (l match {
-    case Nil() => 0
-    case Cons(_, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def contents(l: List): Set[Int] = l match {
-    case Nil() => Set.empty
-    case Cons(x,xs) => contents(xs) ++ Set(x)
-  }
-
-  def isSorted(l: List): Boolean = l match {
-    case Nil() => true
-    case Cons(x, Nil()) => true
-    case Cons(x, Cons(y, ys)) => x <= y && isSorted(Cons(y, ys))
-  }   
-
-  /* Inserting element 'e' into a sorted list 'l' produces a sorted list with
-   * the expected content and size */
-  def sortedIns(e: Int, l: List): List = {
-    require(isSorted(l))
-    l match {
-      case Nil() => Cons(e,Nil())
-      case Cons(x,xs) => if (x <= e) Cons(x,sortedIns(e, xs)) else Cons(e, l)
-    } 
-  } ensuring(res => contents(res) == contents(l) ++ Set(e) 
-                    && isSorted(res)
-                    && size(res) == size(l) + 1
-            )
-
-  /* A counterexample is found when we forget to specify the precondition */
-  def buggySortedIns(e: Int, l: List): List = {
-    l match {
-      case Nil() => Cons(e,Nil())
-      case Cons(x,xs) => if (x <= e) Cons(x,buggySortedIns(e, xs)) else Cons(e, l)
-    } 
-  } ensuring(res => contents(res) == contents(l) ++ Set(e) 
-                    && isSorted(res)
-                    && size(res) == size(l) + 1
-            )
-
-  /* Insertion sort yields a sorted list of same size and content as the input
-   * list */
-  def sort(l: List): List = (l match {
-    case Nil() => Nil()
-    case Cons(x,xs) => sortedIns(x, sort(xs))
-  }) ensuring(res => contents(res) == contents(l) 
-                     && isSorted(res)
-                     && size(res) == size(l)
-             )
-
-  /* Merges one (unsorted) list into another, sorted, list. */
-  def mergeInto(l1 : List, l2 : List) : List = {
-    require(isSorted(l2))
-    l1 match {
-      case Nil() => l2
-      case Cons(x, xs) => mergeInto(xs, sortedIns(x, l2))
-    }
-  } ensuring(res => contents(res) == contents(l1) ++ contents(l2) && isSorted(res))
-
-  def main(args: Array[String]): Unit = {
-    val ls: List = Cons(5, Cons(2, Cons(4, Cons(5, Cons(1, Cons(8,Nil()))))))
-
-    println(ls)
-    println(sort(ls))
-  }
-}
diff --git a/online-testcases/ListOperations.scala b/online-testcases/ListOperations.scala
deleted file mode 100644
index 3a08ac8f916661e89e2455eeaa2edf0593765f7e..0000000000000000000000000000000000000000
--- a/online-testcases/ListOperations.scala
+++ /dev/null
@@ -1,107 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Annotations._
-import funcheck.Utils._
-
-object ListOperations {
-    sealed abstract class List
-    case class Cons(head: Int, tail: List) extends List
-    case class Nil() extends List
-
-    sealed abstract class IntPairList
-    case class IPCons(head: IntPair, tail: IntPairList) extends IntPairList
-    case class IPNil() extends IntPairList
-
-    sealed abstract class IntPair
-    case class IP(fst: Int, snd: Int) extends IntPair
-
-    def size(l: List) : Int = (l match {
-        case Nil() => 0
-        case Cons(_, t) => 1 + size(t)
-    }) ensuring(res => res >= 0)
-
-    def iplSize(l: IntPairList) : Int = (l match {
-      case IPNil() => 0
-      case IPCons(_, xs) => 1 + iplSize(xs)
-    }) ensuring(_ >= 0)
-
-    def zip(l1: List, l2: List) : IntPairList = {
-      // try to comment this and see how pattern-matching becomes
-      // non-exhaustive and post-condition fails
-      require(size(l1) == size(l2))
-
-      l1 match {
-        case Nil() => IPNil()
-        case Cons(x, xs) => l2 match {
-          case Cons(y, ys) => IPCons(IP(x, y), zip(xs, ys))
-        }
-      }
-    } ensuring(iplSize(_) == size(l1))
-
-    def sizeTailRec(l: List) : Int = sizeTailRecAcc(l, 0)
-    def sizeTailRecAcc(l: List, acc: Int) : Int = {
-     require(acc >= 0)
-     l match {
-       case Nil() => acc
-       case Cons(_, xs) => sizeTailRecAcc(xs, acc+1)
-     }
-    } ensuring(res => res == size(l) + acc)
-
-    def sizesAreEquiv(l: List) : Boolean = {
-      size(l) == sizeTailRec(l)
-    } holds
-
-    def content(l: List) : Set[Int] = l match {
-      case Nil() => Set.empty[Int]
-      case Cons(x, xs) => Set(x) ++ content(xs)
-    }
-
-    def sizeAndContent(l: List) : Boolean = {
-      size(l) == 0 || content(l) != Set.empty[Int]
-    } holds
-    
-    def drunk(l : List) : List = (l match {
-      case Nil() => Nil()
-      case Cons(x,l1) => Cons(x,Cons(x,drunk(l1)))
-    }) ensuring (size(_) == 2 * size(l))
-
-    def reverse(l: List) : List = reverse0(l, Nil()) ensuring(content(_) == content(l))
-    def reverse0(l1: List, l2: List) : List = (l1 match {
-      case Nil() => l2
-      case Cons(x, xs) => reverse0(xs, Cons(x, l2))
-    }) ensuring(content(_) == content(l1) ++ content(l2))
-
-    def append(l1 : List, l2 : List) : List = (l1 match {
-      case Nil() => l2
-      case Cons(x,xs) => Cons(x, append(xs, l2))
-    }) ensuring(content(_) == content(l1) ++ content(l2))
-
-    @induct
-    def nilAppend(l : List) : Boolean = (append(l, Nil()) == l) holds
-
-    @induct
-    def appendAssoc(xs : List, ys : List, zs : List) : Boolean =
-      (append(append(xs, ys), zs) == append(xs, append(ys, zs))) holds
-
-    def revAuxBroken(l1 : List, e : Int, l2 : List) : Boolean = {
-      (append(reverse(l1), Cons(e,l2)) == reverse0(l1, l2))
-    } holds
-
-    @induct
-    def sizeAppend(l1 : List, l2 : List) : Boolean =
-      (size(append(l1, l2)) == size(l1) + size(l2)) holds
-
-    @induct
-    def concat(l1: List, l2: List) : List = 
-      concat0(l1, l2, Nil()) ensuring(content(_) == content(l1) ++ content(l2))
-
-    @induct
-    def concat0(l1: List, l2: List, l3: List) : List = (l1 match {
-      case Nil() => l2 match {
-        case Nil() => reverse(l3)
-        case Cons(y, ys) => {
-          concat0(Nil(), ys, Cons(y, l3))
-        }
-      }
-      case Cons(x, xs) => concat0(xs, l2, Cons(x, l3))
-    }) ensuring(content(_) == content(l1) ++ content(l2) ++ content(l3))
-}
diff --git a/online-testcases/PropositionalLogic.scala b/online-testcases/PropositionalLogic.scala
deleted file mode 100644
index 8845c7fa1e6995233934f22af87b80fcae7939aa..0000000000000000000000000000000000000000
--- a/online-testcases/PropositionalLogic.scala
+++ /dev/null
@@ -1,101 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Utils._
-import funcheck.Annotations._
-
-object PropositionalLogic { 
-
-  sealed abstract class Formula
-  case class And(lhs: Formula, rhs: Formula) extends Formula
-  case class Or(lhs: Formula, rhs: Formula) extends Formula
-  case class Implies(lhs: Formula, rhs: Formula) extends Formula
-  case class Not(f: Formula) extends Formula
-  case class Literal(id: Int) extends Formula
-
-  def simplify(f: Formula): Formula = (f match {
-    case And(lhs, rhs) => And(simplify(lhs), simplify(rhs))
-    case Or(lhs, rhs) => Or(simplify(lhs), simplify(rhs))
-    case Implies(lhs, rhs) => Or(Not(simplify(lhs)), simplify(rhs))
-    case Not(f) => Not(simplify(f))
-    case Literal(_) => f
-  }) ensuring(isSimplified(_))
-
-  def isSimplified(f: Formula): Boolean = f match {
-    case And(lhs, rhs) => isSimplified(lhs) && isSimplified(rhs)
-    case Or(lhs, rhs) => isSimplified(lhs) && isSimplified(rhs)
-    case Implies(_,_) => false
-    case Not(f) => isSimplified(f)
-    case Literal(_) => true
-  }
-
-  def nnf(formula: Formula): Formula = (formula match {
-    case And(lhs, rhs) => And(nnf(lhs), nnf(rhs))
-    case Or(lhs, rhs) => Or(nnf(lhs), nnf(rhs))
-    case Implies(lhs, rhs) => Implies(nnf(lhs), nnf(rhs))
-    case Not(And(lhs, rhs)) => Or(nnf(Not(lhs)), nnf(Not(rhs)))
-    case Not(Or(lhs, rhs)) => And(nnf(Not(lhs)), nnf(Not(rhs)))
-    case Not(Implies(lhs, rhs)) => And(nnf(lhs), nnf(Not(rhs)))
-    case Not(Not(f)) => nnf(f)
-    case Not(Literal(_)) => formula
-    case Literal(_) => formula
-  }) ensuring(isNNF(_))
-
-  def isNNF(f: Formula): Boolean = f match {
-    case And(lhs, rhs) => isNNF(lhs) && isNNF(rhs)
-    case Or(lhs, rhs) => isNNF(lhs) && isNNF(rhs)
-    case Implies(lhs, rhs) => isNNF(lhs) && isNNF(rhs)
-    case Not(Literal(_)) => true
-    case Not(_) => false
-    case Literal(_) => true
-  }
-
-  def evalLit(id : Int) : Boolean = (id == 42) // could be any function
-  def eval(f: Formula) : Boolean = f match {
-    case And(lhs, rhs) => eval(lhs) && eval(rhs)
-    case Or(lhs, rhs) => eval(lhs) || eval(rhs)
-    case Implies(lhs, rhs) => !eval(lhs) || eval(rhs)
-    case Not(f) => !eval(f)
-    case Literal(id) => evalLit(id)
-  }
-  
-  @induct
-  def simplifySemantics(f: Formula) : Boolean = {
-    eval(f) == eval(simplify(f))
-  } holds
-
-  // Note that matching is exhaustive due to precondition.
-  def vars(f: Formula): Set[Int] = {
-    require(isNNF(f))
-    f match {
-      case And(lhs, rhs) => vars(lhs) ++ vars(rhs)
-      case Or(lhs, rhs) => vars(lhs) ++ vars(rhs)
-      case Implies(lhs, rhs) => vars(lhs) ++ vars(rhs)
-      case Not(Literal(i)) => Set[Int](i)
-      case Literal(i) => Set[Int](i)
-    }
-  }
-
-  def fv(f : Formula) = { vars(nnf(f)) }
-
-  @induct
-  def wrongCommutative(f: Formula) : Boolean = {
-    nnf(simplify(f)) == simplify(nnf(f))
-  } holds
-
-  @induct
-  def simplifyBreaksNNF(f: Formula) : Boolean = {
-    require(isNNF(f))
-    isNNF(simplify(f))
-  } holds
-
-  @induct
-  def nnfIsStable(f: Formula) : Boolean = {
-    require(isNNF(f))
-    nnf(f) == f
-  } holds
-  
-  @induct
-  def simplifyIsStable(f: Formula) : Boolean = {
-    require(isSimplified(f))
-    simplify(f) == f
-  } holds
-}
diff --git a/online-testcases/RedBlackTree.scala b/online-testcases/RedBlackTree.scala
deleted file mode 100644
index c7f364e4fd90892f889ba61a1a666180b62cc66d..0000000000000000000000000000000000000000
--- a/online-testcases/RedBlackTree.scala
+++ /dev/null
@@ -1,116 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Annotations._
-import funcheck.Utils._
-
-object RedBlackTree { 
-  sealed abstract class Color
-  case class Red() extends Color
-  case class Black() extends Color
- 
-  sealed abstract class Tree
-  case class Empty() extends Tree
-  case class Node(color: Color, left: Tree, value: Int, right: Tree) extends Tree
-
-  sealed abstract class OptionInt
-  case class Some(v : Int) extends OptionInt
-  case class None() extends OptionInt
-
-  def content(t: Tree) : Set[Int] = t match {
-    case Empty() => Set.empty
-    case Node(_, l, v, r) => content(l) ++ Set(v) ++ content(r)
-  }
-
-  def size(t: Tree) : Int = t match {
-    case Empty() => 0
-    case Node(_, l, v, r) => size(l) + 1 + size(r)
-  }
-
-  /* We consider leaves to be black by definition */
-  def isBlack(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(),_,_,_) => true
-    case _ => false
-  }
-
-  def redNodesHaveBlackChildren(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(), l, _, r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-    case Node(Red(), l, _, r) => isBlack(l) && isBlack(r) && redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-  }
-
-  def redDescHaveBlackChildren(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(_,l,_,r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-  }
-
-  def blackBalanced(t : Tree) : Boolean = t match {
-    case Node(_,l,_,r) => blackBalanced(l) && blackBalanced(r) && blackHeight(l) == blackHeight(r)
-    case Empty() => true
-  }
-
-  def blackHeight(t : Tree) : Int = t match {
-    case Empty() => 1
-    case Node(Black(), l, _, _) => blackHeight(l) + 1
-    case Node(Red(), l, _, _) => blackHeight(l)
-  }
-
-  // <<insert element x into the tree t>>
-  def ins(x: Int, t: Tree): Tree = {
-    require(redNodesHaveBlackChildren(t) && blackBalanced(t))
-    t match {
-      case Empty() => Node(Red(),Empty(),x,Empty())
-      case Node(c,a,y,b) =>
-        if      (x < y)  balance(c, ins(x, a), y, b)
-        else if (x == y) Node(c,a,y,b)
-        else             balance(c,a,y,ins(x, b))
-    }
-  } ensuring (res => content(res) == content(t) ++ Set(x) 
-                   && size(t) <= size(res) && size(res) <= size(t) + 1
-                   && redDescHaveBlackChildren(res)
-                   && blackBalanced(res))
-
-  def makeBlack(n: Tree): Tree = {
-    require(redDescHaveBlackChildren(n) && blackBalanced(n))
-    n match {
-      case Node(Red(),l,v,r) => Node(Black(),l,v,r)
-      case _ => n
-    }
-  } ensuring(res => redNodesHaveBlackChildren(res) && blackBalanced(res))
-
-  def add(x: Int, t: Tree): Tree = {
-    require(redNodesHaveBlackChildren(t) && blackBalanced(t))
-    makeBlack(ins(x, t))
-  } ensuring (res => content(res) == content(t) ++ Set(x) && redNodesHaveBlackChildren(res) && blackBalanced(res))
-  
-  def buggyAdd(x: Int, t: Tree): Tree = {
-    require(redNodesHaveBlackChildren(t))
-    ins(x, t)
-  } ensuring (res => content(res) == content(t) ++ Set(x) && redNodesHaveBlackChildren(res))
-  
-  def balance(c: Color, a: Tree, x: Int, b: Tree): Tree = {
-    Node(c,a,x,b) match {
-      case Node(Black(),Node(Red(),Node(Red(),a,xV,b),yV,c),zV,d) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),Node(Red(),a,xV,Node(Red(),b,yV,c)),zV,d) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),a,xV,Node(Red(),Node(Red(),b,yV,c),zV,d)) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),a,xV,Node(Red(),b,yV,Node(Red(),c,zV,d))) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(c,a,xV,b) => Node(c,a,xV,b)
-    }
-  } ensuring (res => content(res) == content(Node(c,a,x,b)))
-
-  def buggyBalance(c: Color, a: Tree, x: Int, b: Tree): Tree = {
-    Node(c,a,x,b) match {
-      case Node(Black(),Node(Red(),Node(Red(),a,xV,b),yV,c),zV,d) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),Node(Red(),a,xV,Node(Red(),b,yV,c)),zV,d) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),a,xV,Node(Red(),Node(Red(),b,yV,c),zV,d)) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-      case Node(Black(),a,xV,Node(Red(),b,yV,Node(Red(),c,zV,d))) => 
-        Node(Red(),Node(Black(),a,xV,b),yV,Node(Black(),c,zV,d))
-    }
-  } ensuring (res => content(res) == content(Node(c,a,x,b)))
-}
diff --git a/online-testcases/SearchLinkedList.scala b/online-testcases/SearchLinkedList.scala
deleted file mode 100644
index d14b9fee6c000c5cc703a6e3b97af4ee1eba5562..0000000000000000000000000000000000000000
--- a/online-testcases/SearchLinkedList.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-import scala.collection.immutable.Set
-import funcheck.Utils._
-import funcheck.Annotations._
-
-object SearchLinkedList {
-  sealed abstract class List
-  case class Cons(head : Int, tail : List) extends List
-  case class Nil() extends List
-
-  def size(list : List) : Int = (list match {
-    case Nil() => 0
-    case Cons(_, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def contains(list : List, elem : Int) : Boolean = (list match {
-    case Nil() => false
-    case Cons(x, xs) => x == elem || contains(xs, elem)
-  })
-
-  def firstZero(list : List) : Int = (list match {
-    case Nil() => 0
-    case Cons(x, xs) => if (x == 0) 0 else firstZero(xs) + 1
-  }) ensuring (res =>
-    res >= 0 && (if (contains(list, 0)) {
-      firstZeroAtPos(list, res)
-    } else {
-      res == size(list)
-    }))
-
-  def firstZeroAtPos(list : List, pos : Int) : Boolean = {
-    list match {
-      case Nil() => false
-      case Cons(x, xs) => if (pos == 0) x == 0 else x != 0 && firstZeroAtPos(xs, pos - 1)
-    }
-  } 
-
-  def goal(list : List, i : Int) : Boolean = {
-    if(firstZero(list) == i) {
-      if(contains(list, 0)) {
-        firstZeroAtPos(list, i)
-      } else {
-        i == size(list)
-      }
-    } else {
-      true
-    }
-  } holds
-}
diff --git a/online-testcases/SumAndMax.scala b/online-testcases/SumAndMax.scala
deleted file mode 100644
index c4265e25b6e1846a5a0b8e47f1d8f224229131c0..0000000000000000000000000000000000000000
--- a/online-testcases/SumAndMax.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-import funcheck.Utils._
-import funcheck.Annotations._
-
-object SumAndMax {
-  sealed abstract class List
-  case class Cons(head : Int, tail : List) extends List
-  case class Nil() extends List
-
-  def max(list : List) : Int = {
-    require(list != Nil())
-    list match {
-      case Cons(x, Nil()) => x
-      case Cons(x, xs) => {
-        val m2 = max(xs)
-        if(m2 > x) m2 else x
-      }
-    }
-  }
-
-  def sum(list : List) : Int = list match {
-    case Nil() => 0
-    case Cons(x, xs) => x + sum(xs)
-  }
-
-  def size(list : List) : Int = (list match {
-    case Nil() => 0
-    case Cons(_, xs) => 1 + size(xs)
-  }) ensuring(_ >= 0)
-
-  def allPos(list : List) : Boolean = list match {
-    case Nil() => true
-    case Cons(x, xs) => x >= 0 && allPos(xs)
-  }
-
-  def prop0(list : List) : Boolean = {
-    require(list != Nil())
-    !allPos(list) || max(list) >= 0
-  } holds
-
-  @induct
-  def property(list : List) : Boolean = {
-    // This precondition was given in the problem but isn't actually useful :D
-    // require(allPos(list))
-    sum(list) <= size(list) * (if(list == Nil()) 0 else max(list))
-  } holds
-}
diff --git a/plugintest/project/build/project.scala b/plugintest/project/build/project.scala
deleted file mode 100644
index 4fbe5b8a72d3dd57b0fab808cd20e109efeaaa53..0000000000000000000000000000000000000000
--- a/plugintest/project/build/project.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-import sbt._
-
-class PluginTestProject(info: ProjectInfo) extends DefaultProject(info) {
-}
diff --git a/plugintest/src/main/resources/scalac-plugin.xml b/plugintest/src/main/resources/scalac-plugin.xml
deleted file mode 100644
index ffaddb558fb598ffae0452f86aa03db9fd4ce9b8..0000000000000000000000000000000000000000
--- a/plugintest/src/main/resources/scalac-plugin.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<plugin>
-    <name>plugintest</name>
-    <classname>plugintest.TestPlugin</classname>
-</plugin>
diff --git a/plugintest/src/main/scala/plugintest/Plugin.scala b/plugintest/src/main/scala/plugintest/Plugin.scala
deleted file mode 100644
index a6ac054aeeed6b11b5288c1f3f134e2b7e416334..0000000000000000000000000000000000000000
--- a/plugintest/src/main/scala/plugintest/Plugin.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-package plugintest
-
-import scala.tools.nsc
-import scala.tools.nsc.{Global,Phase}
-import scala.tools.nsc.plugins._
-
-class TestPlugin(val global : Global) extends Plugin {
-  import global._
-
-  val name = "test!"
-  val description = "Mini plugin to toy with ``MyAny'' type of things"
-  
-  override val optionsHelp : Option[String] = None
-
-  val components = List[PluginComponent](new Component(global))
-  val descriptions : List[String] = List("tests with ``MyAny''")
-}
-
-class Component(val global : Global) extends PluginComponent {
-  import global._
-
-  override val runsRightAfter : Option[String] = None
-  override val runsAfter : List[String] = List("refchecks")
-
-  val phaseName = "test!"
-
-  def newPhase(previous : Phase) = new PluginPhase(previous)
-
-  class PluginPhase(previous : Phase) extends StdPhase(previous) {
-    def apply(unit : CompilationUnit) : Unit = {
-      println("Phase ran !")
-    }
-  }
-}
-
diff --git a/plugintest/src/main/scala/plugintest/package.scala b/plugintest/src/main/scala/plugintest/package.scala
deleted file mode 100644
index e1e92fda482f5d8574657463dc782c57e061ec95..0000000000000000000000000000000000000000
--- a/plugintest/src/main/scala/plugintest/package.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-package object plugintest {
-  trait MyAny
-
-  sealed trait IsMyAny[T] {
-    val manifest : ClassManifest[T]
-  }
-
-  implicit def isMyAny[T <: MyAny : ClassManifest] = new IsMyAny[T] {
-    val manifest = implicitly[ClassManifest[T]]
-  }
-
-  implicit object IntIsMyAny extends IsMyAny[Int] {
-    val manifest = implicitly[ClassManifest[Int]]
-  }
-
-  implicit object BooleanIsMyAny extends IsMyAny[Boolean] {
-    val manifest = implicitly[ClassManifest[Boolean]]
-  }
-}
diff --git a/project/build/funcheck.scala b/project/build/funcheck.scala
index 855456fc7c17d0f6a3dc44a52bb36534edd4bd5a..cd55cffde95a5373576dfcb987b91a86c235cd68 100644
--- a/project/build/funcheck.scala
+++ b/project/build/funcheck.scala
@@ -1,28 +1,20 @@
 import sbt._
 
 class FunCheckProject(info: ProjectInfo) extends DefaultProject(info) with FileTasks {
-  val scalatest = "org.scalatest" % "scalatest" % "1.2"
-
   override def outputDirectoryName = "bin"
   override def dependencyPath      = "lib"
   override def shouldCheckOutputDirectories = false
 
   lazy val purescala      = project(".", "PureScala Definitions", new PureScalaProject(_))
-  lazy val plugin         = project(".", "FunCheck Plugin", new PluginProject(_), purescala, multisetsLib)
-  lazy val cpPlugin       = project(".", "Constraint programming plugin", new CPPluginProject(_), purescala, multisetsLib, plugin)
-  lazy val multisetsLib   = project(".", "Multiset Placeholder Library", new MultisetsLibProject(_))
-  lazy val multisets      = project(".", "Multiset Solver", new MultisetsProject(_), plugin, purescala, multisetsLib)
-  lazy val orderedsets    = project(".", "Ordered Sets Solver", new OrderedSetsProject(_), plugin, purescala)
-  lazy val setconstraints = project(".", "Type inference with set constraints", new SetConstraintsProject(_), plugin, purescala)
+  lazy val plugin         = project(".", "FunCheck Plugin", new PluginProject(_), purescala)
 
-  lazy val extensionJars : List[Path] = multisetsLib.jarPath :: multisets.jarPath :: orderedsets.jarPath :: setconstraints.jarPath :: Nil
+  lazy val extensionJars : List[Path] = Nil
 
   val scriptPath: Path = "." / "funcheck"
-  val cpScriptPath: Path = "." / "scalac-cp"
 
-  lazy val all = task { None } dependsOn(generateScript, generateCpScript) describedAs("Compile everything and produce a script file.")
+  lazy val all = task { None } dependsOn(generateScript) describedAs("Compile everything and produce a script file.")
 
-  override def cleanAction = super.cleanAction dependsOn(cleanScript, cleanCpScript)
+  override def cleanAction = super.cleanAction dependsOn(cleanScript)
 
   lazy val generateScript = genScript
   def genScript = fileTask(scriptPath ::Nil)({
@@ -46,20 +38,12 @@ class FunCheckProject(info: ProjectInfo) extends DefaultProject(info) with FileT
       fw.write("  fi" + nl)
       fw.write("done" + nl + nl)
       fw.write("SCALACCLASSPATH=\"")
-      fw.write(multisetsLib.jarPath.absolutePath + ":")
       fw.write(plugin.jarPath.absolutePath + ":")
       fw.write(purescala.jarPath.absolutePath)
       fw.write("\"" + nl + nl)
       fw.write("LD_LIBRARY_PATH=" + ("." / "lib-bin").absolutePath + " \\" + nl)
       fw.write("scala -classpath ${FUNCHECKCLASSPATH}:${SCALACCLASSPATH}" + " \\" + nl)
       fw.write("funcheck.Main -cp " + plugin.jarPath.absolutePath + " $@" + nl)
-      // fw.write("java -Xmx1024M \\" + nl)
-      // // This is a hack :(
-      // val libStr = (buildLibraryJar.absolutePath).toString
-      // fw.write("    -Dscala.home=" + libStr.substring(0, libStr.length-21) + " \\" + nl)
-
-      // fw.write("    -classpath ${FUNCHECKCLASSPATH} \\" + nl)
-      // fw.write("  scala.tools.nsc.Main -Xplugin:" + plugin.jarPath.absolutePath + " -classpath ${SCALACCLASSPATH} $@" + nl)
       fw.close
       f.setExecutable(true)
       None
@@ -68,53 +52,6 @@ class FunCheckProject(info: ProjectInfo) extends DefaultProject(info) with FileT
     }
   }) dependsOn(plugin.`package`) describedAs("Produce the runner script.")
 
-  lazy val generateCpScript = genCPScript
-  def genCPScript = fileTask(cpScriptPath ::Nil)({
-    log.info("Generating runner script")
-    try {
-      val nl = System.getProperty("line.separator")
-      val buildDir = "out"
-      val f = cpScriptPath.asFile
-      val fw = new java.io.FileWriter(f)
-      fw.write("#!/bin/bash" + nl)
-      fw.write("FUNCHECKCLASSPATH=\"")
-      fw.write(buildLibraryJar.absolutePath + ":")
-      fw.write(buildCompilerJar.absolutePath + ":")
-      fw.write(purescala.jarPath.absolutePath + ":")
-      fw.write(plugin.jarPath.absolutePath + ":")
-      fw.write(("lib" / "z3.jar").absolutePath)
-      fw.write("\"" + nl + nl)
-      fw.write("for f in " + extensionJars.map(_.absolutePath).map(n => "\"" + n + "\"").mkString(" ") + "; do" + nl)
-      fw.write("  if [ -e ${f} ]" + nl)
-      fw.write("  then" + nl)
-      fw.write("    FUNCHECKCLASSPATH=${FUNCHECKCLASSPATH}:${f}" + nl)
-      fw.write("  fi" + nl)
-      fw.write("done" + nl + nl)
-      fw.write("SCALACCLASSPATH=\"")
-      fw.write(multisetsLib.jarPath.absolutePath + ":")
-      fw.write(plugin.jarPath.absolutePath + ":")
-      fw.write(purescala.jarPath.absolutePath + ":")
-      fw.write(cpPlugin.jarPath.absolutePath)
-      fw.write("\"" + nl + nl)
-      fw.write("mkdir -p " + buildDir + nl + nl)
-      fw.write("LD_LIBRARY_PATH=" + ("." / "lib-bin").absolutePath + " \\" + nl)
-      // fw.write("scala -classpath ${FUNCHECKCLASSPATH}:${SCALACCLASSPATH}" + " \\" + nl)
-      // fw.write("funcheck.Main -cp " + plugin.jarPath.absolutePath + " $@" + nl)
-      fw.write("java -Xmx1024M \\" + nl)
-      // This is a hack :(
-      val libStr = (buildLibraryJar.absolutePath).toString
-      fw.write("    -Dscala.home=" + libStr.substring(0, libStr.length-21) + " \\" + nl)
-
-      fw.write("    -classpath ${FUNCHECKCLASSPATH} \\" + nl)
-      fw.write("  scala.tools.nsc.Main -Xplugin:" + cpPlugin.jarPath.absolutePath + " -classpath ${SCALACCLASSPATH} -d " + buildDir + " $@" + nl)
-      fw.close
-      f.setExecutable(true)
-      None
-    } catch {
-      case e => Some("There was an error while generating the CP script file: " + e.getLocalizedMessage)
-    }
-  }) dependsOn(cpPlugin.`package`) describedAs("Produce the CP runner script.")
-
   lazy val cleanScript = clnScript
   def clnScript = task {
     log.info("Deleting runner script")
@@ -122,13 +59,6 @@ class FunCheckProject(info: ProjectInfo) extends DefaultProject(info) with FileT
     None
   }
 
-  lazy val cleanCpScript = clnCPScript
-  def clnCPScript = task {
-    log.info("Deleting CP runner script")
-    cpScriptPath.asFile.delete
-    None
-  }
-
   sealed abstract class PersonalizedProject(info: ProjectInfo) extends DefaultProject(info) {
     override def dependencyPath = "lib"
     override def outputDirectoryName = "bin" 
@@ -142,34 +72,7 @@ class FunCheckProject(info: ProjectInfo) extends DefaultProject(info) with FileT
   class PluginProject(info: ProjectInfo) extends PersonalizedProject(info) {
     override def outputPath = "bin" / "funcheck"
     override def mainScalaSourcePath = "src" / "funcheck"
-    override def unmanagedClasspath = super.unmanagedClasspath +++ purescala.jarPath +++ multisetsLib.jarPath
+    override def unmanagedClasspath = super.unmanagedClasspath +++ purescala.jarPath 
     override def mainResourcesPath   = "resources" / "funcheck"
   }
-  class CPPluginProject(info: ProjectInfo) extends PersonalizedProject(info) {
-    override def outputPath = "bin" / "cp"
-    override def mainScalaSourcePath = "src" / "cp"
-    override def unmanagedClasspath = super.unmanagedClasspath +++ purescala.jarPath +++ multisetsLib.jarPath +++ plugin.jarPath
-    override def mainResourcesPath   = "resources" / "cp"
-  }
-  class MultisetsLibProject(info: ProjectInfo) extends PersonalizedProject(info) {
-    override def outputPath = "bin" / "multisets-lib"
-    override def mainScalaSourcePath = "src" / "multisets-lib"
-    override def unmanagedClasspath = super.unmanagedClasspath 
-  }
-  class MultisetsProject(info: ProjectInfo) extends PersonalizedProject(info) {
-    override def outputPath = "bin" / "multisets"
-    override def mainScalaSourcePath = "src" / "multisets"
-    override def unmanagedClasspath = super.unmanagedClasspath +++ purescala.jarPath
-  }
-  class OrderedSetsProject(info: ProjectInfo) extends PersonalizedProject(info) {
-    override def outputPath = "bin" / "orderedsets"
-    override def mainScalaSourcePath = "src" / "orderedsets"
-    override def unmanagedClasspath = super.unmanagedClasspath +++ purescala.jarPath
-  }
-  class SetConstraintsProject(info: ProjectInfo) extends PersonalizedProject(info) {
-    override def outputPath = "bin" / "setconstraints"
-    override def mainScalaSourcePath = "src" / "setconstraints"
-    override def testScalaSourcePath = "src" / "setconstraints-tests"
-    override def unmanagedClasspath = super.unmanagedClasspath +++ purescala.jarPath
-  }
 }
diff --git a/resources/cp/scalac-plugin.xml b/resources/cp/scalac-plugin.xml
deleted file mode 100644
index 07dd1291e1119f5b1ddb86b0d1a2549fe218516c..0000000000000000000000000000000000000000
--- a/resources/cp/scalac-plugin.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<plugin>
-    <name>cp</name>
-    <classname>cp.CPPlugin</classname>
-</plugin>
diff --git a/scala-cp b/scala-cp
deleted file mode 100755
index 071fc0b892e45a2a3c3b3ae250140bf9030d226d..0000000000000000000000000000000000000000
--- a/scala-cp
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-FUNCHECKCLASSPATH="/home/psuter/git-guru/funcheck/project/boot/scala-2.9.0-1/lib/scala-library.jar:/home/psuter/git-guru/funcheck/project/boot/scala-2.9.0-1/lib/scala-compiler.jar:/home/psuter/git-guru/funcheck/bin/purescala/purescala-definitions_2.9.0-1-1.0.jar:/home/psuter/git-guru/funcheck/bin/funcheck/funcheck-plugin_2.9.0-1-1.0.jar:/home/psuter/git-guru/funcheck/lib/z3.jar"
-
-FUNCHECKCLASSPATH=${FUNCHECKCLASSPATH}:"/localhome/psuter/scala/scala-29/lib/jline.jar"
-
-for f in "/home/psuter/git-guru/funcheck/bin/multisets-lib/multiset-placeholder-library_2.9.0-1-1.0.jar" "/home/psuter/git-guru/funcheck/bin/multisets/multiset-solver_2.9.0-1-1.0.jar" "/home/psuter/git-guru/funcheck/bin/orderedsets/ordered-sets-solver_2.9.0-1-1.0.jar" "/home/psuter/git-guru/funcheck/bin/setconstraints/type-inference-with-set-constraints_2.9.0-1-1.0.jar"; do
-  if [ -e ${f} ]
-  then
-    FUNCHECKCLASSPATH=${FUNCHECKCLASSPATH}:${f}
-  fi
-done
-
-SCALACCLASSPATH="/home/psuter/git-guru/funcheck/bin/multisets-lib/multiset-placeholder-library_2.9.0-1-1.0.jar:/home/psuter/git-guru/funcheck/bin/funcheck/funcheck-plugin_2.9.0-1-1.0.jar:/home/psuter/git-guru/funcheck/bin/purescala/purescala-definitions_2.9.0-1-1.0.jar:/home/psuter/git-guru/funcheck/bin/cp/constraint-programming-plugin_2.9.0-1-1.0.jar"
-
-mkdir -p out
-
-LD_LIBRARY_PATH=/home/psuter/git-guru/funcheck/lib-bin \
-java -Xmx1024M \
-    -Dscala.home=/home/psuter/git-guru/funcheck/project/boot/scala-2.9.0-1/ \
-    -Djline.terminal=scala.tools.jline.UnixTerminal \
-    -classpath ${FUNCHECKCLASSPATH} \
-  scala.tools.nsc.MainGenericRunner -Xplugin:/home/psuter/git-guru/funcheck/bin/cp/constraint-programming-plugin_2.9.0-1-1.0.jar -classpath ${SCALACCLASSPATH} $@
diff --git a/scalacheck-testcases/RedBlackTree.scala b/scalacheck-testcases/RedBlackTree.scala
deleted file mode 100644
index 1a03cecd9f8b2dbd282a15e3b94bf1c2d51a1c07..0000000000000000000000000000000000000000
--- a/scalacheck-testcases/RedBlackTree.scala
+++ /dev/null
@@ -1,125 +0,0 @@
-import org.scalacheck._
-import Gen._
-import Arbitrary.arbitrary
-
-object Specs {
-  sealed abstract class Color
-  case class Red() extends Color
-  case class Black() extends Color
- 
-  sealed abstract class Tree
-  case class Empty() extends Tree
-  case class Node(color: Color, left: Tree, value: Int, right: Tree) extends Tree
-
-  sealed abstract class OptionInt
-  case class SomeInt(v : Int) extends OptionInt
-  case class NoneInt() extends OptionInt
-
-  def max(a: Int, b: Int) : Int = {
-    if (a >= b) a else b
-  } ensuring (res => res >= a && res >= b)
-
-  def size(t: Tree) : Int = (t match {
-    case Empty() => 0
-    case Node(_, l, v, r) => size(l) + 1 + size(r)
-  }) ensuring (_ >= 0)
-
-  def height(t: Tree) : Int = (t match {
-    case Empty() => 0
-    case Node(_,l,_,r) => max(height(l), height(r)) + 1
-  }) ensuring (_ >= 0)
-
-  def isBlack(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(),_,_,_) => true
-    case _ => false
-  }
-
-  def redNodesHaveBlackChildren(t: Tree) : Boolean = t match {
-    case Empty() => true
-    case Node(Black(), l, _, r) => redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-    case Node(Red(), l, _, r) => isBlack(l) && isBlack(r) && redNodesHaveBlackChildren(l) && redNodesHaveBlackChildren(r)
-  }
-
-  def blackBalanced(t : Tree) : Boolean = t match {
-    case Node(_,l,_,r) => blackBalanced(l) && blackBalanced(r) && blackHeight(l) == blackHeight(r)
-    case Empty() => true
-  }
-
-  def blackHeight(t : Tree) : Int = t match {
-    case Empty() => 0
-    case Node(Black(), l, _, _) => blackHeight(l) + 1
-    case Node(Red(), l, _, _) => blackHeight(l)
-  }
-
-  def valuesWithin(t : Tree, bound : Int) : Boolean = t match {
-    case Empty() => true
-    case Node(_,l,v,r) => 0 <= v && v <= bound && valuesWithin(l,bound) && valuesWithin(r,bound)
-  }
-
-  def orderedKeys(t : Tree) : Boolean = orderedKeys(t, NoneInt(), NoneInt())
-
-  def orderedKeys(t : Tree, min : OptionInt, max : OptionInt) : Boolean = t match {
-    case Empty() => true
-    case Node(c,a,v,b) =>
-      val minOK = 
-        min match {
-          case SomeInt(minVal) =>
-            v > minVal
-          case NoneInt() => true
-        }
-      val maxOK =
-        max match {
-          case SomeInt(maxVal) =>
-            v < maxVal
-          case NoneInt() => true
-        }
-      minOK && maxOK && orderedKeys(a, min, SomeInt(v)) && orderedKeys(b, SomeInt(v), max)
-  }
-
-  def isRedBlackTree(t : Tree) : Boolean = {
-    blackBalanced(t) && redNodesHaveBlackChildren(t) && orderedKeys(t) // && isBlack(t)
-  }
-}
-object RedBlackTree {
-  import Specs._
-
-  val genLeaf = value(Empty())
-
-  def genColor: Gen[Color] = oneOf(Black(), Red())
-
-  val genNode = for {
-    v <- Gen.choose(1, 10)
-    left <- genTree
-    right <- genTree
-    color <- genColor
-  } yield Node(color, left, v, right)
-
-  def genTree: Gen[Tree] = oneOf(genLeaf, genNode)
-
-  def main(args: Array[String]): Unit = {
-    val iter = (new Iterator[Tree] {
-      private var counter = 0
-      def hasNext : Boolean = counter < 1000
-      def next : Tree = { counter += 1; genTree.sample.get }
-    })
-
-    val sizes = scala.collection.mutable.Map[Int, Int]()
-    var totalCount = 0
-    var rbtCount = 0
-
-    for (t <- iter) {
-      totalCount += 1
-      if (isRedBlackTree(t)) {
-        rbtCount += 1
-        val s = size(t)
-        sizes += ((s, sizes.getOrElse(s, 0) + 1))
-      }
-      //println("Here is a tree : " + t)
-    }
-    println("rbt count: " + rbtCount)
-    println("total count: " + totalCount)
-    println("ratio of red-black trees: " + (rbtCount.toDouble / totalCount))
-    println("unique sizes of generated trees: " + sizes)
-  }
-}
diff --git a/src/cp/CPComponent.scala b/src/cp/CPComponent.scala
deleted file mode 100644
index ef4a3dc1742f796511b457579c52371577c7c81b..0000000000000000000000000000000000000000
--- a/src/cp/CPComponent.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-package cp
-
-import scala.tools.nsc._
-import scala.tools.nsc.plugins._
-
-class CPComponent(val global: Global, val pluginInstance: CPPlugin)
-  extends PluginComponent
-  with CodeExtraction
-  with CallTransformation
-{
-  import global._
-  import Serialization._
-
-  // This is how it works from 2.8 on..
-  override val runsRightAfter: Option[String] = None
-  override val runsAfter: List[String] = List("refchecks")
-
-  val phaseName = "constraint-programming"
-
-  /** this is initialized when the Funcheck phase starts*/
-  var fresh: scala.tools.nsc.util.FreshNameCreator = null 
-  
-  protected def stopIfErrors: Unit = {
-    if(reporter.hasErrors) {
-      throw new Exception("There were errors.")
-    }
-  }
-
-  def newPhase(prev: Phase) = new CPPhase(prev)
-
-  class CPPhase(prev: Phase) extends StdPhase(prev) {
-    def apply(unit: CompilationUnit): Unit = {
-      //global ref to freshName creator
-      fresh = unit.fresh
-
-      if (Settings.verbose)
-        println("Starting CP phase")
-
-      val prog: purescala.Definitions.Program = extractCode(unit)
-
-      if (Settings.verbose)
-        println("Analyzing specification functions")
-      val analysisReporter = 
-        if (Settings.verbose) new purescala.DefaultReporter 
-        else new purescala.QuietReporter
-      val analysis = new purescala.Analysis(prog, analysisReporter)
-      analysis.analyse
-
-      if (Settings.verbose)
-        println("Finished analysis, starting transformation")
-
-      val serializedProg = serialize(prog)
-
-      transformCalls(unit, prog, serializedProg)
-      if (Settings.verbose)
-        println("Finished transformation")
-    }
-  }
-}
diff --git a/src/cp/CPPlugin.scala b/src/cp/CPPlugin.scala
deleted file mode 100644
index f3d164c9fd826c4df15d32be36befcce3f8bec21..0000000000000000000000000000000000000000
--- a/src/cp/CPPlugin.scala
+++ /dev/null
@@ -1,62 +0,0 @@
-package cp
-
-import scala.tools.nsc
-import scala.tools.nsc.{Global,Phase}
-import scala.tools.nsc.plugins.{Plugin,PluginComponent}
-
-/** This class is the entry point for the plugin. */
-class CPPlugin(val global: Global) extends Plugin {
-  import global._
-
-  val name = "constraint-programming"
-  val description = "Constraint programming in Scala by LARA."
-
-  var silentlyTolerateNonPureBodies = false
-
-  /** The help message displaying the options for that plugin. */
-  override val optionsHelp: Option[String] = Some(
-    "  -P:constraint-programming:uniqid             When pretty-printing funcheck trees, show identifiers IDs" + "\n" +
-    "  -P:constraint-programming:extensions=ex1:... Specifies a list of qualified class names of extensions to be loaded" + "\n" +
-    "  -P:constraint-programming:nodefaults         Runs only the analyses provided by the extensions" + "\n" +
-    "  -P:constraint-programming:functions=fun1:... Only generates verification conditions for the specified functions" + "\n" +
-    "  -P:constraint-programming:unrolling=[0,1,2]  Unrolling depth for recursive functions" + "\n" + 
-    "  -P:constraint-programming:axioms             Generate simple forall axioms for recursive functions when possible" + "\n" + 
-    "  -P:constraint-programming:tolerant           Silently extracts non-pure function bodies as ''unknown''" + "\n" +
-    "  -P:constraint-programming:bapa               Use BAPA Z3 extension" + "\n" +
-    "  -P:constraint-programming:XP                 Enable weird transformations and other bug-producing features" + "\n" +
-    "  -P:constraint-programming:BV                 Use bit-vectors for integers" + "\n" +
-    "  -P:constraint-programming:prune              Use additional SMT queries to rule out some unrollings" + "\n" +
-    "  -P:constraint-programming:cores              Use UNSAT cores in the unrolling/refinement step" + "\n" +
-    "  -P:constraint-programming:noLuckyTests       Do not perform additional tests to potentially find models early" + "\n" +
-    "  -P:constraint-programming:scalaEval          Use functions stored in constraints to evaluate models" + "\n" +
-    "  -P:constraint-programming:templates          Use new ``FunctionTemplate'' technique" + "\n" +
-    "  -P:constraint-programming:verbose            Print solver output."
-  )
-
-  /** Processes the command-line options. */
-  private def splitList(lst: String) : Seq[String] = lst.split(':').map(_.trim).filter(!_.isEmpty)
-  override def processOptions(options: List[String], error: String => Unit) {
-    for(option <- options) {
-      option match {
-        case "uniqid"     =>                     purescala.Settings.showIDs = true
-        case "tolerant"   =>                     silentlyTolerateNonPureBodies = true
-        case "nodefaults" =>                     purescala.Settings.runDefaultExtensions = false
-        case "axioms"     =>                     purescala.Settings.noForallAxioms = false
-        case "bapa"     =>                       purescala.Settings.useBAPA = true
-        case "XP"         =>                     purescala.Settings.experimental = true
-        case "BV"         =>                     purescala.Settings.bitvectorBitwidth = Some(32)
-        case "prune"     =>                      purescala.Settings.pruneBranches = true
-        case "cores"     =>                      purescala.Settings.useCores = true
-        case "noLuckyTests" =>                   purescala.Settings.luckyTest = false
-        case "templates"  =>                     purescala.Settings.useTemplates = true
-        case "scalaEval" =>                      cp.Settings.useScalaEvaluator = true
-        case "verbose"   =>                      cp.Settings.verbose = true
-        case s if s.startsWith("extensions=") => purescala.Settings.extensionNames = splitList(s.substring("extensions=".length, s.length))
-        case s if s.startsWith("functions=") =>  purescala.Settings.functionsToAnalyse = Set(splitList(s.substring("functions=".length, s.length)): _*)
-        case s if s.startsWith("unrolling=") =>  purescala.Settings.unrollingLevel = try { s.substring("unrolling=".length, s.length).toInt } catch { case _ => 0 }
-        case _ => error("Invalid option: " + option)
-      }
-    }
-  }
-
-  val components = List[PluginComponent](new CPComponent(global, this))}
diff --git a/src/cp/CallTransformation.scala b/src/cp/CallTransformation.scala
deleted file mode 100644
index ff42189e706a61880cb69638d8a04dcd3cf1e52b..0000000000000000000000000000000000000000
--- a/src/cp/CallTransformation.scala
+++ /dev/null
@@ -1,221 +0,0 @@
-package cp
-
-import scala.tools.nsc.transform.TypingTransformers
-import scala.tools.nsc.ast.TreeDSL
-import purescala.Common.Identifier
-import purescala.Definitions._
-import purescala.Trees._
-
-import Serialization._
-import Terms._
-
-trait CallTransformation 
-  extends TypingTransformers
-  with CodeGeneration
-  with TreeDSL
-{
-  self: CPComponent =>
-  import global._
-  import CODE._
-
-  private lazy val cpPackage            = definitions.getModule("cp")
-  private lazy val cpDefinitionsModule  = definitions.getModule("cp.Definitions")
-  private lazy val lIteratorClass       = definitions.getClass("cp.LTrees.LIterator")
-  private lazy val withFilter2Function  = definitions.getMember(lIteratorClass, "withFilter2")
-  private lazy val lClassSym            = definitions.getClass("cp.LTrees.L")
-
-  private def isLSym(sym: Symbol): Boolean = {
-    sym == lClassSym
-  }
-
-  private def isLIterator(sym: Symbol): Boolean = {
-    sym == lIteratorClass
-  }
-
-  private def hasLIteratorType(tr: Tree): Boolean = tr.tpe match {
-    case TypeRef(_, sym, _) if isLIterator(sym) => true
-    case _ => false
-  }
-
-  val purescalaReporter = 
-    if (Settings.verbose) purescala.Settings.reporter 
-    else new purescala.QuietReporter
-
-  /** extract predicates and functions beforehand so the stored last used ID value is valid */
-  def funDefMap(unit: CompilationUnit) : Map[Position,FunDef] = {
-    val extracted = scala.collection.mutable.Map[Position,FunDef]()
-    def extractFunDefs(tree: Tree) = tree match {
-      case Apply(TypeApply(Select(Select(cpIdent, definitionsName), func2termName), typeTreeList), List(function: Function)) if 
-        (definitionsName.toString == "Definitions" && func2termName.toString.matches("func2term\\d")) => {
-        val Function(funValDefs, funBody) = function
-        extracted += (function.pos -> extractFunction(unit, funValDefs, funBody))
-      }
-      case Apply(TypeApply(Select(Select(cpIdent, definitionsName), func2termName), typeTreeList), List(Block(Nil, function: Function))) if 
-        (definitionsName.toString == "Definitions" && func2termName.toString.matches("func2term\\d")) => {
-        val Function(funValDefs, funBody) = function
-        extracted += (function.pos -> extractFunction(unit, funValDefs, funBody))
-      }
-      case Apply(Select(lhs, withFilterName), List(predicate: Function)) if withFilterName.toString == "withFilter" && hasLIteratorType(lhs) => {
-        val Function(funValDefs, funBody) = predicate
-        extracted += (predicate.pos -> extractWithFilterPredicate(unit, funValDefs, funBody))
-      }
-      case Apply(Select(lhs, boolean2constraint0Name), List(b: Tree)) if boolean2constraint0Name.toString == "boolean2constraint0" => {
-        extracted += (b.pos -> extractFunction(unit, Nil, b))
-      }
-      case _ => 
-    }
-    new ForeachTreeTraverser(extractFunDefs).traverse(unit.body)
-
-    extracted.toMap
-  }
-
-  def transformCalls(unit: CompilationUnit, prog: Program, serializedProg : Serialized) : Unit =
-    unit.body = new CallTransformer(unit, prog, serializedProg).transform(unit.body)
-  
-  class CallTransformer(unit: CompilationUnit, prog: Program, serializedProg : Serialized) extends TypingTransformer(unit) {
-    var exprToScalaSym : Symbol = null
-    var exprToScalaCastSym : Symbol = null
-    var scalaToExprSym : Symbol = null
-    val exprSeqToScalaSyms : scala.collection.mutable.Map[List[Tree],Symbol] = scala.collection.mutable.Map[List[Tree],Symbol]()
-
-    val extractedFunDefs : Map[Position,FunDef] = funDefMap(unit)
-
-    private def transformHelper(tree : Tree, function : Tree, codeGen : CodeGenerator) : Option[(Serialized, Serialized, Serialized, Serialized, Tree, Tree, Tree, Int)] = {
-      val fd = extractedFunDefs(function.pos)
-      val outputVars : Seq[Identifier] = fd.args.map(_.id)
-      
-      purescalaReporter.info("Considering function:") 
-      purescalaReporter.info(fd)
-
-      fd.body match {
-        case None => purescalaReporter.error("Could not extract : " + function); None
-        case Some(b) =>
-          // serialize expression
-          val serializedExpr = serialize(matchToIfThenElse(b))
-
-          // compute input variables
-          val nonOutputIdentifiers : Seq[Identifier] = variablesOf(b).filter(!outputVars.contains(_)).toSeq
-          val reverseLVars = reverseLvarSubsts
-          val (lvarIdentifiers, inputIdentifiers) = nonOutputIdentifiers.partition(id => reverseLVars.isDefinedAt(Variable(id)))
-
-          purescalaReporter.info("Input variables  : " + inputIdentifiers.mkString(", "))
-          purescalaReporter.info("Output variables : " + outputVars.mkString(", "))
-
-          // list of input "Variables" and list of L "Variables"
-          val inputVars = inputIdentifiers map (iv => Variable(iv))
-          val lVars     = lvarIdentifiers map (lv => Variable(lv))
-
-          // serialize the above
-          val serializedInputVarList  = serialize(inputVars)
-          val serializedLVarList      = serialize(lVars)
-
-          // serialize outputVars sequence
-          val serializedOutputVars = serialize(outputVars)
-
-          // sequence of input values
-          val inputVarValues : Tree = codeGen.inputVarValues(serializedInputVarList, inputIdentifiers, scalaToExprSym)
-          val lVarValues     : Tree = codeGen.lVarValues(serializedLVarList, lvarIdentifiers, scalaToExprSym)
-
-          val actualLVars    : Tree = codeGen.lVars(lvarIdentifiers)
-
-          Some((serializedInputVarList, serializedLVarList, serializedOutputVars, serializedExpr, inputVarValues, lVarValues, actualLVars, outputVars.size))
-      }
-    }
-
-    override def transform(tree: Tree) : Tree = {
-      tree match {
-        /** Transform implicit conversions to terms into instantiation of base terms */
-        case Apply(TypeApply(Select(Select(cpIdent, definitionsName), func2termName), typeTreeList), List(function: Tree)) if 
-          (definitionsName.toString == "Definitions" && func2termName.toString.matches("func2term\\d")) => {
-          val codeGen = new CodeGenerator(unit, currentOwner, tree.pos)
-
-          transformHelper(tree, function, codeGen) match {
-            case Some((serializedInputVarList, serializedLVarList, serializedOutputVars, serializedExpr, inputVarValues, lVarValues, actualLVars, arity)) => {
-              // create constraint instance
-              val code = codeGen.newBaseTerm(exprToScalaSym, serializedProg, serializedInputVarList, serializedLVarList, serializedOutputVars, serializedExpr, inputVarValues, lVarValues, actualLVars, function, typeTreeList, arity)
-
-              typer.typed(atOwner(currentOwner) {
-                code
-              })
-            }
-            case None => super.transform(tree)
-          }
-        }
-        case Apply(Select(Select(cpIdent, definitionsName), boolean2constraint0Name), List(function: Tree)) if 
-          (definitionsName.toString == "Definitions" && boolean2constraint0Name.toString.matches("boolean2constraint0")) => {
-          val codeGen = new CodeGenerator(unit, currentOwner, tree.pos)
-
-          transformHelper(tree, function, codeGen) match {
-            case Some((serializedInputVarList, serializedLVarList, serializedOutputVars, serializedExpr, inputVarValues, lVarValues, actualLVars, arity)) => {
-              // create constraint instance
-              val code = codeGen.newBaseTerm(exprToScalaSym, serializedProg, serializedInputVarList, serializedLVarList, serializedOutputVars, serializedExpr, inputVarValues, lVarValues, actualLVars, NULL, List(TypeTree(definitions.BooleanClass.tpe)), arity)
-
-              typer.typed(atOwner(currentOwner) {
-                code
-              })
-            }
-            case None => super.transform(tree)
-          }
-        }
-        case Apply(Select(lhs, withFilterName), List(predicate: Function)) if withFilterName.toString == "withFilter" && hasLIteratorType(lhs) => {
-          val codeGen = new CodeGenerator(unit, currentOwner, tree.pos)
-
-          val Function(funValDefs, _) = predicate
-          assert(funValDefs.size == 1)
-          val constraintParamType = TypeTree(funValDefs.head.tpt.tpe match {
-            case TypeRef(_, sym, List(paramTpe)) if isLSym(sym) => paramTpe
-            case errorType => sys.error("unexpected type for withFilter predicate parameter: " + errorType)
-          })
-          val typeTreeList = List(constraintParamType, TypeTree(definitions.BooleanClass.tpe))
-
-          transformHelper(tree, predicate, codeGen) match {
-            case Some((serializedInputVarList, serializedLVarList, serializedOutputVars, serializedExpr, inputVarValues, lVarValues, actualLVars, arity)) => {
-              // create constraint instance
-              val termCode = codeGen.newBaseTerm(exprToScalaSym, serializedProg, serializedInputVarList, serializedLVarList, serializedOutputVars, serializedExpr, inputVarValues, lVarValues, actualLVars, NULL, typeTreeList, arity)
-              val code = (lhs DOT withFilter2Function) APPLY (Function(funValDefs,termCode) setSymbol predicate.symbol)
-
-              typer.typed(atOwner(currentOwner) {
-                code
-              })
-            }
-            case None => super.transform(tree)
-          }
-        }
-
-        // Insert generated method definitions
-        case cd @ ClassDef(mods, name, tparams, impl) if (cd.symbol.isModuleClass && tparams.isEmpty && !cd.symbol.isSynthetic) => {
-          val codeGen = new CodeGenerator(unit, currentOwner, impl.pos)
-
-          val ((e2sSym, exprToScalaCode), (e2sCastSym,exprToScalaCastCode)) = codeGen.exprToScalaMethods(cd.symbol, prog)
-          exprToScalaSym      = e2sSym
-          exprToScalaCastSym  = e2sCastSym
-
-          val (scalaToExprCode, s2eSym)                                     = codeGen.scalaToExprMethod(cd.symbol, prog, serializedProg)
-          scalaToExprSym      = s2eSym
-
-          val skipCounter                                                   = codeGen.skipCounter(purescala.Common.FreshIdentifier.last)
-
-          val serializedSettings = serialize(new RuntimeSettings)
-          val copySettings                                                  = codeGen.copySettings(serializedSettings)
-
-          atOwner(tree.symbol) {
-            treeCopy.ClassDef(tree, transformModifiers(mods), name,
-                              transformTypeDefs(tparams), impl match {
-                                case Template(parents, self, body) =>
-                                  treeCopy.Template(impl, transformTrees(parents),
-                                    transformValDef(self), 
-                                      typer.typed(atOwner(currentOwner) {exprToScalaCode}) ::
-                                      typer.typed(atOwner(currentOwner) {exprToScalaCastCode}) :: 
-                                      typer.typed(atOwner(currentOwner) {scalaToExprCode}) :: 
-                                      typer.typed(atOwner(currentOwner) {skipCounter}) ::
-                                      typer.typed(atOwner(currentOwner) {copySettings}) ::
-                                      transformStats(body, tree.symbol))
-                              }) 
-          }
-        }
-
-        case _ => super.transform(tree)
-      }
-    }
-  }
-}
diff --git a/src/cp/CodeExtraction.scala b/src/cp/CodeExtraction.scala
deleted file mode 100644
index e948c49699e8f3bd431bc3d49e683a110790c7d4..0000000000000000000000000000000000000000
--- a/src/cp/CodeExtraction.scala
+++ /dev/null
@@ -1,1032 +0,0 @@
-package cp
-
-import scala.tools.nsc._
-import scala.tools.nsc.plugins._
-
-import purescala.Definitions._
-import purescala.Trees._
-import purescala.TypeTrees._
-import purescala.Common._
-
-trait CodeExtraction extends Extractors {
-  self: CPComponent =>
-
-  import global._
-  import global.definitions._
-  import StructuralExtractors._
-  import ExpressionExtractors._
-
-  private lazy val setTraitSym = definitions.getClass("scala.collection.immutable.Set")
-  private lazy val mapTraitSym = definitions.getClass("scala.collection.immutable.Map")
-  private lazy val multisetTraitSym = try {
-    definitions.getClass("scala.collection.immutable.Multiset")
-  } catch {
-    case _ => null
-  }
-  private lazy val optionClassSym     = definitions.getClass("scala.Option")
-  private lazy val someClassSym       = definitions.getClass("scala.Some")
-  private lazy val function1TraitSym  = definitions.getClass("scala.Function1")
-  private lazy val lClassSym          = definitions.getClass("cp.LTrees.L")
-
-  private def isLSym(sym: Symbol): Boolean = {
-    sym == lClassSym
-  }
-
-  def isSetTraitSym(sym: Symbol): Boolean = {
-    sym == setTraitSym || sym.tpe.toString.startsWith("scala.Predef.Set")
-  }
-
-  def isMapTraitSym(sym: Symbol): Boolean = {
-    sym == mapTraitSym || sym.tpe.toString.startsWith("scala.Predef.Map")
-  }
-
-  def isMultisetTraitSym(sym: Symbol): Boolean = {
-    sym == multisetTraitSym
-  }
-
-  def isOptionClassSym(sym: Symbol): Boolean = {
-    sym == optionClassSym || sym == someClassSym
-  }
-
-  def isFunction1TraitSym(sym: Symbol): Boolean = {
-    sym == function1TraitSym
-  }
-
-  private val varSubsts: scala.collection.mutable.Map[Symbol,Function0[Expr]] =
-    scala.collection.mutable.Map.empty[Symbol,Function0[Expr]]
-  private val classesToClasses: scala.collection.mutable.Map[Symbol,ClassTypeDef] =
-    scala.collection.mutable.Map.empty[Symbol,ClassTypeDef]
-  private val defsToDefs: scala.collection.mutable.Map[Symbol,FunDef] =
-    scala.collection.mutable.Map.empty[Symbol,FunDef]
-
-  /* Mapping from trees whose runtime values will be included in constraints to
-   * replace the corresponding fresh variable */
-  private val externalSubsts: scala.collection.mutable.Map[Tree,Function0[Expr]] =
-    scala.collection.mutable.Map.empty[Tree,Function0[Expr]]
-
-  /* Mapping from L[T] trees whose identifier will be included in constraints
-   * to replace the corresponding fresh variable */
-  private val lvarSubsts: scala.collection.mutable.Map[Tree,Function0[Expr]] =
-    scala.collection.mutable.Map.empty[Tree,Function0[Expr]]
-
-  def reverseVarSubsts: scala.collection.immutable.Map[Expr,Symbol] =
-    varSubsts.toMap.map{ case (a, b) => (b(), a) }
-
-  def reverseClassesToClasses: scala.collection.immutable.Map[ClassTypeDef,Symbol] =
-    classesToClasses.toMap.map{ case (a, b) => (b, a) }
-
-  def reverseExternalSubsts: scala.collection.immutable.Map[Expr,Tree] =
-    externalSubsts.toMap.map{ case (a, b) => (b(), a) }
-
-  def reverseLvarSubsts: scala.collection.immutable.Map[Expr, Tree] =
-    lvarSubsts.toMap.map{ case (a, b) => (b(), a) }
-
-  def variablesToTrees: scala.collection.immutable.Map[Expr,Tree] =
-    reverseExternalSubsts ++ (reverseVarSubsts.map{ case (a, b) => (a, Ident(b)) })
-  
-  def extractCode(unit: CompilationUnit): Program = { 
-    import scala.collection.mutable.HashMap
-
-    def s2ps(tree: Tree): Expr = toPureScala(unit)(tree) match {
-      case Some(ex) => ex
-      case None => stopIfErrors; scala.sys.error("unreachable error.")
-    }
-
-    def st2ps(tree: Type): purescala.TypeTrees.TypeTree = toPureScalaType(unit)(tree) match {
-      case Some(tt) => tt
-      case None => stopIfErrors; scala.sys.error("unreachable error.")
-    }
-
-
-    def extractTopLevelDef: ObjectDef = {
-      val top = unit.body match {
-        case p @ PackageDef(name, lst) if lst.size == 0 => {
-          unit.error(p.pos, "No top-level definition found.")
-          None
-        }
-
-        case PackageDef(name, lst) if lst.size > 1 => {
-          unit.error(lst(1).pos, "Too many top-level definitions.")
-          None
-        }
-
-        case PackageDef(name, lst) => {
-          assert(lst.size == 1)
-          lst(0) match {
-            case ExObjectDef(n, templ) => Some(extractObjectDef(n.toString))
-            case other @ _ => unit.error(other.pos, "Expected: top-level single object.")
-            None
-          }
-        }
-      }
-
-      stopIfErrors
-      top.get
-    }
-
-    def extractObjectDef(nameStr: String): ObjectDef = {
-
-      var classDefs: List[ClassTypeDef] = Nil
-      var objectDefs: List[ObjectDef] = Nil
-      var funDefs: List[FunDef] = Nil
-
-      val scalaClassSyms: scala.collection.mutable.Map[Symbol,Identifier] =
-        scala.collection.mutable.Map.empty[Symbol,Identifier]
-      val scalaClassArgs: scala.collection.mutable.Map[Symbol,Seq[(String,Tree)]] =
-        scala.collection.mutable.Map.empty[Symbol,Seq[(String,Tree)]]
-      val scalaClassNames: scala.collection.mutable.Set[String] = 
-        scala.collection.mutable.Set.empty[String]
-
-      // We first traverse for collecting type definitions
-      def collectTypeDefinitions(inSpecObject: Boolean)(tree: Tree): Unit = tree match {
-        case cd @ ExAbstractClass(o2, sym) if inSpecObject || cd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-          if(scalaClassNames.contains(o2)) {
-            unit.error(tree.pos, "A class with the same name already exists.")
-          } else {
-            scalaClassSyms += (sym -> FreshIdentifier(o2))
-            scalaClassNames += o2
-          }
-        }
-        case cd @ ExCaseClass(o2, sym, args) if inSpecObject || cd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-          if(scalaClassNames.contains(o2)) {
-            unit.error(tree.pos, "A class with the same name already exists.")
-          } else {
-            scalaClassSyms  += (sym -> FreshIdentifier(o2))
-            scalaClassNames += o2
-            scalaClassArgs  += (sym -> args)
-          }
-        }
-        case cd @ ExObjectDef(n, templ) if cd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-          templ.body.foreach(collectTypeDefinitions(true)(_))
-        }
-        case _ => ;
-      }
-      new ForeachTreeTraverser(collectTypeDefinitions(false)).traverse(unit.body)
-
-      stopIfErrors
-
-      scalaClassSyms.foreach(p => {
-          if(p._1.isAbstractClass) {
-            classesToClasses += (p._1 -> new AbstractClassDef(p._2))
-          } else if(p._1.isCase) {
-            classesToClasses += (p._1 -> new CaseClassDef(p._2))
-          }
-      })
-
-      classesToClasses.foreach(p => {
-        val superC: List[ClassTypeDef] = p._1.tpe.baseClasses.filter(bcs => scalaClassSyms.exists(pp => pp._1 == bcs) && bcs != p._1).map(s => classesToClasses(s)).toList
-
-        val superAC: List[AbstractClassDef] = superC.map(c => {
-            if(!c.isInstanceOf[AbstractClassDef]) {
-                unit.error(p._1.pos, "Class is inheriting from non-abstract class.")
-                null
-            } else {
-                c.asInstanceOf[AbstractClassDef]
-            }
-        }).filter(_ != null)
-
-        if(superAC.length > 1) {
-            unit.error(p._1.pos, "Multiple inheritance.")
-        }
-
-        if(superAC.length == 1) {
-            p._2.setParent(superAC.head)
-        }
-
-        if(p._2.isInstanceOf[CaseClassDef]) {
-          // this should never fail
-          val ccargs = scalaClassArgs(p._1)
-          p._2.asInstanceOf[CaseClassDef].fields = ccargs.map(cca => {
-            val cctpe = st2ps(cca._2.tpe)
-            VarDecl(FreshIdentifier(cca._1).setType(cctpe), cctpe)
-          })
-        }
-      })
-
-      classDefs = classesToClasses.valuesIterator.toList
-      
-      // end of class (type) extraction
-
-      // Let us now collect function signatures
-      def collectFunctionSignatures(inSpecObject: Boolean)(tree: Tree): Unit = tree match {
-        case dd @ ExFunctionDef(n,p,t,b) if inSpecObject || dd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-          val mods = dd.mods
-          val funDef = extractFunSig(n, p, t).setPosInfo(dd.pos.line, dd.pos.column)
-          if(mods.isPrivate) funDef.addAnnotation("private")
-          for(a <- dd.symbol.annotations) {
-            a.atp.safeToString match {
-              case "funcheck.Annotations.induct" => funDef.addAnnotation("induct")
-              case _ => ;
-            }
-          }
-          defsToDefs += (dd.symbol -> funDef)
-        }
-        case cd @ ExObjectDef(n, templ) if cd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-          templ.body.foreach(collectFunctionSignatures(true)(_))
-        }
-        case _ => ;
-      }
-      new ForeachTreeTraverser(collectFunctionSignatures(false)).traverse(unit.body)
-
-      // And finally extract function bodies
-      def extractFunctionBodies(inSpecObject: Boolean)(tree: Tree): Unit = tree match {
-        case dd @ ExFunctionDef(n,p,t,b) if inSpecObject || dd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-          val fd = defsToDefs(dd.symbol)
-          defsToDefs(dd.symbol) = extractFunDef(fd, b)
-        }
-        case cd @ ExObjectDef(n, templ) if cd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-          templ.body.foreach(extractFunctionBodies(true)(_))
-        }
-        case _ => ;
-      }
-      new ForeachTreeTraverser(extractFunctionBodies(false)).traverse(unit.body)
-
-      funDefs = defsToDefs.valuesIterator.toList
-
-      val name: Identifier = FreshIdentifier(nameStr)
-      val theDef = new ObjectDef(name, objectDefs.reverse ::: classDefs ::: funDefs, Nil)
-      
-      theDef
-    }
-
-    def extractFunSig(nameStr: String, params: Seq[ValDef], tpt: Tree): FunDef = {
-      val newParams = params.map(p => {
-        val ptpe = st2ps(p.tpt.tpe)
-        val newID = FreshIdentifier(p.name.toString).setType(ptpe)
-        varSubsts(p.symbol) = (() => Variable(newID))
-        VarDecl(newID, ptpe)
-      })
-      new FunDef(FreshIdentifier(nameStr), st2ps(tpt.tpe), newParams)
-    }
-
-    def extractFunDef(funDef: FunDef, body: Tree): FunDef = {
-      var realBody = body
-      var reqCont: Option[Expr] = None
-      var ensCont: Option[Expr] = None
-
-      realBody match {
-        case ExEnsuredExpression(body2, resSym, contract) => {
-          varSubsts(resSym) = (() => ResultVariable().setType(funDef.returnType))
-          val c1 = s2ps(contract)
-          // varSubsts.remove(resSym)
-          realBody = body2
-          ensCont = Some(c1)
-        }
-        case ExHoldsExpression(body2) => {
-          realBody = body2
-          ensCont = Some(ResultVariable().setType(BooleanType))
-        }
-        case _ => ;
-      }
-
-      realBody match {
-        case ExRequiredExpression(body3, contract) => {
-          realBody = body3
-          reqCont = Some(s2ps(contract))
-        }
-        case _ => ;
-      }
-      
-      val extractedBody = scala2PureScala(unit, pluginInstance.silentlyTolerateNonPureBodies, false, false)(realBody)
-
-      funDef.body = Some(extractedBody)
-      funDef.precondition = reqCont
-      funDef.postcondition = ensCont
-
-      // We need to make sure that functions don't use outer variables
-      val argIDs: Set[Identifier] = funDef.args.map(_.id).toSet
-      if (!(variablesOf(extractedBody) subsetOf argIDs)) {
-        unit.error(body.pos, "Function uses variables that are not among its arguments")
-        throw new ImpureCodeEncounteredException(body)
-      }
-
-      funDef
-    }
-
-    stopIfErrors
-
-    // THE EXTRACTION CODE STARTS HERE
-    val programName: Identifier = unit.body match {
-      case PackageDef(name, _) => FreshIdentifier(name.toString)
-      case _ => FreshIdentifier("<program>")
-    }
-
-    val objectName: Identifier = FreshIdentifier("<object>")
-
-    val topLevelObjDef: ObjectDef = extractObjectDef(objectName.name)
-
-    stopIfErrors
-
-    Program(programName, topLevelObjDef)
-  }
-
-  /** Old method for extracting one object definition */
-  // def extractWellStructuredCode(unit: CompilationUnit): Program = {
-  //   import scala.collection.mutable.HashMap
-
-  //   def s2ps(tree: Tree): Expr = toPureScala(unit)(tree) match {
-  //     case Some(ex) => ex
-  //     case None => stopIfErrors; scala.sys.error("unreachable error.")
-  //   }
-
-  //   def st2ps(tree: Type): purescala.TypeTrees.TypeTree = toPureScalaType(unit)(tree) match {
-  //     case Some(tt) => tt
-  //     case None => stopIfErrors; scala.sys.error("unreachable error.")
-  //   }
-
-  //   def extractTopLevelDef: ObjectDef = {
-  //     val top = unit.body match {
-  //       case p @ PackageDef(name, lst) if lst.size == 0 => {
-  //         unit.error(p.pos, "No top-level definition found.")
-  //         None
-  //       }
-
-  //       case PackageDef(name, lst) if lst.size > 1 => {
-  //         unit.error(lst(1).pos, "Too many top-level definitions.")
-  //         None
-  //       }
-
-  //       case PackageDef(name, lst) => {
-  //         assert(lst.size == 1)
-  //         lst(0) match {
-  //           case ExObjectDef(n, templ) => Some(extractObjectDef(n.toString, templ))
-  //           case other @ _ => unit.error(other.pos, "Expected: top-level single object.")
-  //           None
-  //         }
-  //       }
-  //     }
-
-  //     stopIfErrors
-  //     top.get
-  //   }
-
-  //   def extractObjectDef(nameStr: String, tmpl: Template): ObjectDef = {
-  //     // we assume that the template actually corresponds to an object
-  //     // definition. Typically it should have been obtained from the proper
-  //     // extractor (ExObjectDef)
-
-  //     var classDefs: List[ClassTypeDef] = Nil
-  //     var objectDefs: List[ObjectDef] = Nil
-  //     var funDefs: List[FunDef] = Nil
-
-  //     val scalaClassSyms: scala.collection.mutable.Map[Symbol,Identifier] =
-  //       scala.collection.mutable.Map.empty[Symbol,Identifier]
-  //     val scalaClassArgs: scala.collection.mutable.Map[Symbol,Seq[(String,Tree)]] =
-  //       scala.collection.mutable.Map.empty[Symbol,Seq[(String,Tree)]]
-  //     val scalaClassNames: scala.collection.mutable.Set[String] = 
-  //       scala.collection.mutable.Set.empty[String]
-
-  //     // we need the new type definitions before we can do anything...
-  //     tmpl.body.foreach(t =>
-  //       t match {
-  //         case cd @ ExAbstractClass(o2, sym) if cd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-  //           if(scalaClassNames.contains(o2)) {
-  //             unit.error(t.pos, "A class with the same name already exists.")
-  //           } else {
-  //             scalaClassSyms += (sym -> FreshIdentifier(o2))
-  //             scalaClassNames += o2
-  //           }
-  //         }
-  //         case cd @ ExCaseClass(o2, sym, args) if cd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-  //           if(scalaClassNames.contains(o2)) {
-  //             unit.error(t.pos, "A class with the same name already exists.")
-  //           } else {
-  //             scalaClassSyms  += (sym -> FreshIdentifier(o2))
-  //             scalaClassNames += o2
-  //             scalaClassArgs  += (sym -> args)
-  //           }
-  //         }
-  //         case _ => ;
-  //       }
-  //     )
-
-  //     stopIfErrors
-
-
-  //     scalaClassSyms.foreach(p => {
-  //         if(p._1.isAbstractClass) {
-  //           classesToClasses += (p._1 -> new AbstractClassDef(p._2))
-  //         } else if(p._1.isCase) {
-  //           classesToClasses += (p._1 -> new CaseClassDef(p._2))
-  //         }
-  //     })
-
-  //     classesToClasses.foreach(p => {
-  //       val superC: List[ClassTypeDef] = p._1.tpe.baseClasses.filter(bcs => scalaClassSyms.exists(pp => pp._1 == bcs) && bcs != p._1).map(s => classesToClasses(s)).toList
-
-  //       val superAC: List[AbstractClassDef] = superC.map(c => {
-  //           if(!c.isInstanceOf[AbstractClassDef]) {
-  //               unit.error(p._1.pos, "Class is inheriting from non-abstract class.")
-  //               null
-  //           } else {
-  //               c.asInstanceOf[AbstractClassDef]
-  //           }
-  //       }).filter(_ != null)
-
-  //       if(superAC.length > 1) {
-  //           unit.error(p._1.pos, "Multiple inheritance.")
-  //       }
-
-  //       if(superAC.length == 1) {
-  //           p._2.setParent(superAC.head)
-  //       }
-
-  //       if(p._2.isInstanceOf[CaseClassDef]) {
-  //         // this should never fail
-  //         val ccargs = scalaClassArgs(p._1)
-  //         p._2.asInstanceOf[CaseClassDef].fields = ccargs.map(cca => {
-  //           val cctpe = st2ps(cca._2.tpe)
-  //           VarDecl(FreshIdentifier(cca._1).setType(cctpe), cctpe)
-  //         })
-  //       }
-  //     })
-
-  //     classDefs = classesToClasses.valuesIterator.toList
-  //     
-  //     // end of class (type) extraction
-
-  //     // we now extract the function signatures.
-  //     tmpl.body.foreach(
-  //       _ match {
-  //         case ExMainFunctionDef() => ;
-  //         case dd @ ExFunctionDef(n,p,t,b) if dd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-  //           val mods = dd.mods
-  //           val funDef = extractFunSig(n, p, t).setPosInfo(dd.pos.line, dd.pos.column)
-  //           if(mods.isPrivate) funDef.addAnnotation("private")
-  //           for(a <- dd.symbol.annotations) {
-  //             a.atp.safeToString match {
-  //               case "funcheck.Annotations.induct" => funDef.addAnnotation("induct")
-  //               case "funcheck.Annotations.axiomatize" => funDef.addAnnotation("axiomatize")
-  //               case _ => ;
-  //             }
-  //           }
-  //           defsToDefs += (dd.symbol -> funDef)
-  //         }
-  //         case _ => ;
-  //       }
-  //     )
-
-  //     // then their bodies.
-  //     tmpl.body.foreach(
-  //       _ match {
-  //         case ExMainFunctionDef() => ;
-  //         case dd @ ExFunctionDef(n,p,t,b) if dd.symbol.annotations.exists(_.atp.safeToString == "cp.Definitions.spec") => {
-  //           val fd = defsToDefs(dd.symbol)
-  //           defsToDefs(dd.symbol) = extractFunDef(fd, b)
-  //         }
-  //         case _ => ;
-  //       }
-  //     )
-
-  //     funDefs = defsToDefs.valuesIterator.toList
-
-  //     /*
-  //     // we check nothing else is polluting the object.
-  //     tmpl.body.foreach(
-  //       _ match {
-  //         case ExCaseClassSyntheticJunk() => ;
-  //         // case ExObjectDef(o2, t2) => { objectDefs = extractObjectDef(o2, t2) :: objectDefs }
-  //         case ExAbstractClass(_,_) => ; 
-  //         case ExCaseClass(_,_,_) => ; 
-  //         case ExConstructorDef() => ;
-  //         case ExMainFunctionDef() => ;
-  //         case ExFunctionDef(_,_,_,_) => ;
-  //         case tree => { unit.error(tree.pos, "Don't know what to do with this. Not purescala?"); println(tree) }
-  //       }
-  //     )
-  //     */
-
-  //     val name: Identifier = FreshIdentifier(nameStr)
-  //     val theDef = new ObjectDef(name, objectDefs.reverse ::: classDefs ::: funDefs, Nil)
-  //     
-  //     theDef
-  //   }
-
-  //   def extractFunSig(nameStr: String, params: Seq[ValDef], tpt: Tree): FunDef = {
-  //     val newParams = params.map(p => {
-  //       val ptpe = st2ps(p.tpt.tpe)
-  //       val newID = FreshIdentifier(p.name.toString).setType(ptpe)
-  //       varSubsts(p.symbol) = (() => Variable(newID))
-  //       VarDecl(newID, ptpe)
-  //     })
-  //     new FunDef(FreshIdentifier(nameStr), st2ps(tpt.tpe), newParams)
-  //   }
-
-  //   def extractFunDef(funDef: FunDef, body: Tree): FunDef = {
-  //     var realBody = body
-  //     var reqCont: Option[Expr] = None
-  //     var ensCont: Option[Expr] = None
-
-  //     realBody match {
-  //       case ExEnsuredExpression(body2, resSym, contract) => {
-  //         varSubsts(resSym) = (() => ResultVariable().setType(funDef.returnType))
-  //         val c1 = s2ps(contract)
-  //         // varSubsts.remove(resSym)
-  //         realBody = body2
-  //         ensCont = Some(c1)
-  //       }
-  //       case ExHoldsExpression(body2) => {
-  //         realBody = body2
-  //         ensCont = Some(ResultVariable().setType(BooleanType))
-  //       }
-  //       case _ => ;
-  //     }
-
-  //     realBody match {
-  //       case ExRequiredExpression(body3, contract) => {
-  //         realBody = body3
-  //         reqCont = Some(s2ps(contract))
-  //       }
-  //       case _ => ;
-  //     }
-  //     
-  //     val bodyAttempt = try {
-  //       Some(scala2PureScala(unit, pluginInstance.silentlyTolerateNonPureBodies, false)(realBody))
-  //     } catch {
-  //       case e: ImpureCodeEncounteredException => None
-  //     }
-
-  //     funDef.body = bodyAttempt
-  //     funDef.precondition = reqCont
-  //     funDef.postcondition = ensCont
-  //     funDef
-  //   }
-
-  //   // THE EXTRACTION CODE STARTS HERE
-  //   val topLevelObjDef: ObjectDef = extractTopLevelDef
-
-  //   stopIfErrors
-
-  //   val programName: Identifier = unit.body match {
-  //     case PackageDef(name, _) => FreshIdentifier(name.toString)
-  //     case _ => FreshIdentifier("<program>")
-  //   }
-
-  //   //Program(programName, ObjectDef("Object", Nil, Nil))
-  //   Program(programName, topLevelObjDef)
-  // }
-
-  /* Extract an anonymous function that can contain L variables */
-  def extractFunction(unit: CompilationUnit, params: Seq[ValDef], body: Tree): FunDef = {
-    def st2ps(tree: Type): purescala.TypeTrees.TypeTree = {
-      try {
-        scalaType2PureScala(unit, false)(tree)
-      } catch {
-        case ImpureCodeEncounteredException(_) => stopIfErrors; scala.sys.error("unreachable error.")
-      }
-    }
-
-    var realBody: Tree = body
-
-    val newParams = params.map(p => {
-      val ptpe = st2ps(p.tpt.tpe)
-      val newID = FreshIdentifier(p.name.toString).setType(ptpe)
-      varSubsts(p.symbol) = (() => Variable(newID))
-      VarDecl(newID, ptpe)
-    })
-    val fd = new FunDef(FreshIdentifier("function"), BooleanType, newParams)
-
-    stopIfErrors
-
-    val bodyAttempt = try { Some(scala2PureScala(unit, false, true, true)(realBody)) } catch { case ImpureCodeEncounteredException(_) => None }
-    fd.body = bodyAttempt
-
-    fd
-  }
-
-  /* Extract the predicate in a `withFilter' call */
-  def extractWithFilterPredicate(unit: CompilationUnit, params: Seq[ValDef], body: Tree): FunDef = {
-    def st2ps(tree: Type): purescala.TypeTrees.TypeTree = {
-      try {
-        scalaType2PureScala(unit, false)(tree)
-      } catch {
-        case ImpureCodeEncounteredException(_) => stopIfErrors; scala.sys.error("unreachable error.")
-      }
-    }
-
-    val newParams = params.map(p => {
-      val ptpe = st2ps(p.tpt.tpe match {
-        case TypeRef(_, sym, List(paramTpe)) if isLSym(sym) => paramTpe
-        case errorType => sys.error("unexpected type for withFilter predicate parameter: " + errorType)
-      })
-      val newID = FreshIdentifier(p.name.toString).setType(ptpe)
-      varSubsts(p.symbol) = (() => Variable(newID))
-      VarDecl(newID, ptpe)
-    })
-    val fd = new FunDef(FreshIdentifier("function"), BooleanType, newParams)
-
-    stopIfErrors
-    
-    val bodyAttempt = try { Some(scala2PureScala(unit, false, true, true)(body)) } catch { case ImpureCodeEncounteredException(_) => None }
-    fd.body = bodyAttempt
-
-    fd
-  }
-
-  /** An exception thrown when non-purescala compatible code is encountered. */
-  sealed case class ImpureCodeEncounteredException(tree: Tree) extends Exception
-
-  /** Attempts to convert a scalac AST to a pure scala AST. */
-  def toPureScala(unit: CompilationUnit)(tree: Tree): Option[Expr] = {
-    try {
-      Some(scala2PureScala(unit, false, false, false)(tree))
-    } catch {
-      case ImpureCodeEncounteredException(_) => None
-    }
-  }
-
-  def toPureScalaType(unit: CompilationUnit)(typeTree: Type): Option[purescala.TypeTrees.TypeTree] = {
-    try {
-      Some(scalaType2PureScala(unit, false)(typeTree))
-    } catch {
-      case ImpureCodeEncounteredException(_) => None
-    }
-  }
-
-  /** Forces conversion from scalac AST to purescala AST, throws an Exception
-   * if impossible. If not in 'silent mode', non-pure AST nodes are reported as
-   * errors. */
-  private def scala2PureScala(unit: CompilationUnit, silent: Boolean, tolerant: Boolean, convertForced: Boolean)(tree: Tree): Expr = {
-    def rewriteCaseDef(cd: CaseDef): MatchCase = {
-      def pat2pat(p: Tree): Pattern = p match {
-        case Ident(nme.WILDCARD) => WildcardPattern(None)
-        case b @ Bind(name, Ident(nme.WILDCARD)) => {
-          val newID = FreshIdentifier(name.toString).setType(scalaType2PureScala(unit,silent)(b.symbol.tpe))
-          varSubsts(b.symbol) = (() => Variable(newID))
-          WildcardPattern(Some(newID))
-        }
-        case a @ Apply(fn, args) if fn.isType && a.tpe.typeSymbol.isCase && classesToClasses.keySet.contains(a.tpe.typeSymbol) => {
-          val cd = classesToClasses(a.tpe.typeSymbol).asInstanceOf[CaseClassDef]
-          assert(args.size == cd.fields.size)
-          CaseClassPattern(None, cd, args.map(pat2pat(_)))
-        }
-        case b @ Bind(name, a @ Apply(fn, args)) if fn.isType && a.tpe.typeSymbol.isCase && classesToClasses.keySet.contains(a.tpe.typeSymbol) => {
-          val newID = FreshIdentifier(name.toString).setType(scalaType2PureScala(unit,silent)(b.symbol.tpe))
-          varSubsts(b.symbol) = (() => Variable(newID))
-          val cd = classesToClasses(a.tpe.typeSymbol).asInstanceOf[CaseClassDef]
-          assert(args.size == cd.fields.size)
-          CaseClassPattern(Some(newID), cd, args.map(pat2pat(_)))
-        }
-        case _ => {
-          if(!silent)
-            unit.error(p.pos, "Unsupported pattern.")
-          throw ImpureCodeEncounteredException(p)
-        }
-      }
-
-      if(cd.guard == EmptyTree) {
-        SimpleCase(pat2pat(cd.pat), rec(cd.body))
-      } else {
-        GuardedCase(pat2pat(cd.pat), rec(cd.guard), rec(cd.body))
-      }
-    }
-
-    def rec(tr: Tree): Expr = tr match {
-      case ExLTyped(tpe, ltree) => {
-        val pstpe = scalaType2PureScala(unit, silent)(tpe)
-        val newID = FreshIdentifier("lvar", true).setType(pstpe)
-        lvarSubsts(ltree) = (() => Variable(newID))
-        Variable(newID)
-      }
-      case ExValDef(vs, tpt, bdy, rst) => {
-        val binderTpe = scalaType2PureScala(unit, silent)(tpt.tpe)
-        val newID = FreshIdentifier(vs.name.toString).setType(binderTpe)
-        val oldSubsts = varSubsts
-        val valTree = rec(bdy)
-        varSubsts(vs) = (() => Variable(newID))
-        val restTree = rec(rst)
-        varSubsts.remove(vs)
-        Let(newID, valTree, restTree)
-      }
-      case ExInt32Literal(v) => IntLiteral(v).setType(Int32Type)
-      case ExBooleanLiteral(v) => BooleanLiteral(v).setType(BooleanType)
-      case ExTyped(e,tpt) => rec(e).setType(scalaType2PureScala(unit,silent)(tpt.tpe))
-      case ExIdentifier(sym,tpt) => varSubsts.get(sym) match {
-        case Some(fun) => fun()
-        case None => {
-          if (tolerant) {
-            val varTpe = scalaType2PureScala(unit, silent)(sym.tpe)
-            val newID = FreshIdentifier(sym.name.toString).setType(varTpe)
-            varSubsts(sym) = (() => Variable(newID))
-            Variable(newID)
-          } else {
-            unit.error(tr.pos, "Unidentified variable.")
-            throw ImpureCodeEncounteredException(tr)
-          }
-        }
-      }
-      case ExCaseClassConstruction(tpt, args) => {
-        val cctype = scalaType2PureScala(unit, silent)(tpt.tpe)
-        if(!cctype.isInstanceOf[CaseClassType]) {
-          if(!silent) {
-            unit.error(tr.pos, "Construction of a non-case class.")
-          }
-          throw ImpureCodeEncounteredException(tree)
-        }
-        val nargs = args.map(rec(_))
-        val cct = cctype.asInstanceOf[CaseClassType]
-        CaseClass(cct.classDef, nargs).setType(cct)
-      }
-      case ExAnd(l, r) => And(rec(l), rec(r)).setType(BooleanType)
-      case ExOr(l, r) => Or(rec(l), rec(r)).setType(BooleanType)
-      case ExNot(e) => Not(rec(e)).setType(BooleanType)
-      case ExUMinus(e) => UMinus(rec(e)).setType(Int32Type)
-      case ExPlus(l, r) => Plus(rec(l), rec(r)).setType(Int32Type)
-      case ExMinus(l, r) => Minus(rec(l), rec(r)).setType(Int32Type)
-      case ExTimes(l, r) => Times(rec(l), rec(r)).setType(Int32Type)
-      case ExDiv(l, r) => Division(rec(l), rec(r)).setType(Int32Type)
-      case ExEquals(l, r) => {
-        val rl = rec(l)
-        val rr = rec(r)
-        ((rl.getType,rr.getType) match {
-          case (SetType(_), SetType(_)) => SetEquals(rl, rr)
-          case (BooleanType, BooleanType) => Iff(rl, rr)
-          case (_, _) => Equals(rl, rr)
-        }).setType(BooleanType) 
-      }
-      case ExNotEquals(l, r) => Not(Equals(rec(l), rec(r)).setType(BooleanType)).setType(BooleanType)
-      case ExGreaterThan(l, r) => GreaterThan(rec(l), rec(r)).setType(BooleanType)
-      case ExGreaterEqThan(l, r) => GreaterEquals(rec(l), rec(r)).setType(BooleanType)
-      case ExLessThan(l, r) => LessThan(rec(l), rec(r)).setType(BooleanType)
-      case ExLessEqThan(l, r) => LessEquals(rec(l), rec(r)).setType(BooleanType)
-      case ExFiniteSet(tt, args) => {
-        val underlying = scalaType2PureScala(unit, silent)(tt.tpe)
-        FiniteSet(args.map(rec(_))).setType(SetType(underlying))
-      }
-      case ExFiniteMultiset(tt, args) => {
-        val underlying = scalaType2PureScala(unit, silent)(tt.tpe)
-        FiniteMultiset(args.map(rec(_))).setType(MultisetType(underlying))
-      }
-      case ExEmptySet(tt) => {
-        val underlying = scalaType2PureScala(unit, silent)(tt.tpe)
-        EmptySet(underlying).setType(SetType(underlying))          
-      }
-      case ExEmptyMultiset(tt) => {
-        val underlying = scalaType2PureScala(unit, silent)(tt.tpe)
-        EmptyMultiset(underlying).setType(MultisetType(underlying))          
-      }
-      case ExEmptyMap(ft, tt) => {
-        val fromUnderlying = scalaType2PureScala(unit, silent)(ft.tpe)
-        val toUnderlying   = scalaType2PureScala(unit, silent)(tt.tpe)
-        EmptyMap(fromUnderlying, toUnderlying).setType(MapType(fromUnderlying, toUnderlying))
-      }
-      case ExSetMin(t) => {
-        val set = rec(t)
-        if(!set.getType.isInstanceOf[SetType]) {
-          if(!silent) unit.error(t.pos, "Min should be computed on a set.")
-          throw ImpureCodeEncounteredException(tree)
-        }
-        SetMin(set).setType(set.getType.asInstanceOf[SetType].base)
-      }
-      case ExSetMax(t) => {
-        val set = rec(t)
-        if(!set.getType.isInstanceOf[SetType]) {
-          if(!silent) unit.error(t.pos, "Max should be computed on a set.")
-          throw ImpureCodeEncounteredException(tree)
-        }
-        SetMax(set).setType(set.getType.asInstanceOf[SetType].base)
-      }
-      case ExUnion(t1,t2) => {
-        val rl = rec(t1)
-        val rr = rec(t2)
-        rl.getType match {
-          case s @ SetType(_) => SetUnion(rl, rr).setType(s)
-          case m @ MultisetType(_) => MultisetUnion(rl, rr).setType(m)
-          case _ => {
-            if(!silent) unit.error(tree.pos, "Union of non set/multiset expressions.")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      }
-      case ExIntersection(t1,t2) => {
-        val rl = rec(t1)
-        val rr = rec(t2)
-        rl.getType match {
-          case s @ SetType(_) => SetIntersection(rl, rr).setType(s)
-          case m @ MultisetType(_) => MultisetIntersection(rl, rr).setType(m)
-          case _ => {
-            if(!silent) unit.error(tree.pos, "Intersection of non set/multiset expressions.")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      }
-      case ExSetContains(t1,t2) => {
-        val rl = rec(t1)
-        val rr = rec(t2)
-        rl.getType match {
-          case s @ SetType(_) => ElementOfSet(rr, rl)
-          case _ => {
-            if(!silent) unit.error(tree.pos, ".contains on non set expression.")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      }
-      case ExSetSubset(t1,t2) => {
-        val rl = rec(t1)
-        val rr = rec(t2)
-        rl.getType match {
-          case s @ SetType(_) => SubsetOf(rl, rr)
-          case _ => {
-            if(!silent) unit.error(tree.pos, "Subset on non set expression.")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      }
-      case ExSetMinus(t1,t2) => {
-        val rl = rec(t1)
-        val rr = rec(t2)
-        rl.getType match {
-          case s @ SetType(_) => SetDifference(rl, rr).setType(s)
-          case m @ MultisetType(_) => MultisetDifference(rl, rr).setType(m)
-          case _ => {
-            if(!silent) unit.error(tree.pos, "Difference of non set/multiset expressions.")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      } 
-      case ExSetCard(t) => {
-        val rt = rec(t)
-        rt.getType match {
-          case s @ SetType(_) => SetCardinality(rt)
-          case m @ MultisetType(_) => MultisetCardinality(rt)
-          case _ => {
-            if(!silent) unit.error(tree.pos, "Cardinality of non set/multiset expressions.")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      }
-      case ExMultisetToSet(t) => {
-        val rt = rec(t)
-        rt.getType match {
-          case m @ MultisetType(u) => MultisetToSet(rt).setType(SetType(u))
-          case _ => {
-            if(!silent) unit.error(tree.pos, "toSet can only be applied to multisets.")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      }
-      case ExMapUpdated(m,f,t) => {
-        val rm = rec(m)
-        val rf = rec(f)
-        val rt = rec(t)
-        val newSingleton = SingletonMap(rf, rt).setType(rm.getType)
-        rm.getType match {
-          case MapType(ft, tt) =>
-            MapUnion(rm, FiniteMap(Seq(newSingleton)).setType(rm.getType)).setType(rm.getType)
-          case _ => {
-            if (!silent) unit.error(tree.pos, "updated can only be applied to maps.")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      }
-      case ExMapIsDefinedAt(m,k) => {
-        val rm = rec(m)
-        val rk = rec(k)
-        MapIsDefinedAt(rm, rk)
-      }
-
-      case ExPlusPlusPlus(t1,t2) => {
-        val rl = rec(t1)
-        val rr = rec(t2)
-        MultisetPlus(rl, rr).setType(rl.getType)
-      }
-      case ExApply(lhs,args) => {
-        val rlhs = rec(lhs)
-        val rargs = args map rec
-        rlhs.getType match {
-          case MapType(_,tt) => 
-            assert(rargs.size == 1)
-            MapGet(rlhs, rargs.head).setType(tt)
-          case FunctionType(fts, tt) => {
-            rlhs match {
-              case Variable(id) =>
-                AnonymousFunctionInvocation(id, rargs).setType(tt)
-              case _ => {
-                if (!silent) unit.error(tree.pos, "apply on non-variable or non-map expression")
-                throw ImpureCodeEncounteredException(tree)
-              }
-            }
-          }
-          case _ => {
-            if (!silent) unit.error(tree.pos, "apply on unexpected type")
-            throw ImpureCodeEncounteredException(tree)
-          }
-        }
-      }
-      case ExIfThenElse(t1,t2,t3) => {
-        val r1 = rec(t1)
-        val r2 = rec(t2)
-        val r3 = rec(t3)
-        IfExpr(r1, r2, r3).setType(leastUpperBound(r2.getType, r3.getType))
-      }
-      case ExDistinctCall(tt,args) => {
-        val tpe = scalaType2PureScala(unit, silent)(tt.tpe)
-        Distinct(args.map(rec(_))).setType(BooleanType)
-      }
-      case ExForceCall(tt, arg) if convertForced => {
-        val tpe = scalaType2PureScala(unit, silent)(tt.tpe)
-        val newID = FreshIdentifier("lvar", true).setType(tpe)
-        lvarSubsts(arg) = (() => Variable(newID))
-        Variable(newID)
-      }
-      case lc @ ExMethodCall(sy,nm,ar) => {
-        if(defsToDefs.keysIterator.find(_ == sy).isEmpty && !tolerant) {
-          if(!silent)
-            unit.error(tr.pos, "Invoking an invalid function.")
-          throw ImpureCodeEncounteredException(tr)
-        } else if (defsToDefs.keysIterator.find(_ == sy).isEmpty && tolerant) {
-            val varTpe = scalaType2PureScala(unit, silent)(lc.tpe)
-            val newID = FreshIdentifier(nm).setType(varTpe)
-            externalSubsts(tr) = (() => Variable(newID))
-            // println("new mapping: " + tr + " --> " + newID)
-            Variable(newID)
-        } else {
-          val fd = defsToDefs(sy)
-          FunctionInvocation(fd, ar.map(rec(_))).setType(fd.returnType).setPosInfo(lc.pos.line,lc.pos.column) 
-        }
-      }
-      case pm @ ExPatternMatching(sel, cses) => {
-        val rs = rec(sel)
-        val rc = cses.map(rewriteCaseDef(_))
-        val rt: purescala.TypeTrees.TypeTree = rc.map(_.rhs.getType).reduceLeft(leastUpperBound(_,_))
-        MatchExpr(rs, rc).setType(rt).setPosInfo(pm.pos.line,pm.pos.column)
-      }
-
-      // this one should stay after all others, cause it also catches UMinus
-      // and Not, for instance.
-      case ExParameterlessMethodCall(t,n) => {
-        val selector = rec(t)
-        val selType = selector.getType
-
-        if(!selType.isInstanceOf[CaseClassType]) {
-          if(!silent)
-            unit.error(tr.pos, "Invalid method or field invocation (not purescala?)")
-          throw ImpureCodeEncounteredException(tr)
-        }
-
-        val selDef: CaseClassDef = selType.asInstanceOf[CaseClassType].classDef
-
-        val fieldID = selDef.fields.find(_.id.name == n.toString) match {
-          case None => {
-            if(!silent)
-              unit.error(tr.pos, "Invalid method or field invocation (not a case class arg?)")
-            throw ImpureCodeEncounteredException(tr)
-          }
-          case Some(vd) => vd.id
-        }
-
-        CaseClassSelector(selDef, selector, fieldID).setType(fieldID.getType)
-      }
-  
-      // default behaviour is to complain :)
-      case _ => {
-        if(tolerant) {
-          val varTpe = scalaType2PureScala(unit, silent)(tr.tpe)
-          val newID = FreshIdentifier("fresh").setType(varTpe)
-          externalSubsts(tr) = (() => Variable(newID))
-          Variable(newID)
-        } else {
-          if(!silent) {
-            println(tr)
-            reporter.info(tr.pos, "Could not extract as PureScala.", true)
-          }
-          throw ImpureCodeEncounteredException(tree)
-        }
-      }
-    }
-    rec(tree)
-  }
-
-  private def scalaType2PureScala(unit: CompilationUnit, silent: Boolean)(tree: Type): purescala.TypeTrees.TypeTree = {
-
-    def rec(tr: Type): purescala.TypeTrees.TypeTree = tr match {
-      case tpe if tpe == IntClass.tpe => Int32Type
-      case tpe if tpe == BooleanClass.tpe => BooleanType
-      case TypeRef(_, sym, btt :: Nil) if isSetTraitSym(sym) => SetType(rec(btt))
-      case TypeRef(_, sym, btt :: Nil) if isMultisetTraitSym(sym) => MultisetType(rec(btt))
-      case TypeRef(_, sym, btt :: Nil) if isOptionClassSym(sym) => OptionType(rec(btt))
-      case TypeRef(_, sym, List(ftt,ttt)) if isMapTraitSym(sym) => MapType(rec(ftt),rec(ttt))
-      case TypeRef(_, sym, ftt :: ttt :: Nil) if isFunction1TraitSym(sym) => FunctionType(List(rec(ftt)), rec(ttt))
-      case TypeRef(_, sym, Nil) if classesToClasses.keySet.contains(sym) => classDefToClassType(classesToClasses(sym))
-      case _ => {
-        if(!silent) {
-          unit.error(NoPosition, "Could not extract type as PureScala. [" + tr + "]")
-          throw new Exception("aouch")
-        }
-        throw ImpureCodeEncounteredException(null)
-      }
-      // case tt => {
-      //   if(!silent) {
-      //     unit.error(tree.pos, "This does not appear to be a type tree: [" + tt + "]")
-      //   }
-      //   throw ImpureCodeEncounteredException(tree)
-      // }
-    }
-
-    rec(tree)
-  }
-
-  def mkPosString(pos: scala.tools.nsc.util.Position): String = {
-    pos.line + "," + pos.column
-  }
-}
diff --git a/src/cp/CodeGeneration.scala b/src/cp/CodeGeneration.scala
deleted file mode 100644
index 0b6027feaeb2c6cfd95406f56f9d7a28ae80665d..0000000000000000000000000000000000000000
--- a/src/cp/CodeGeneration.scala
+++ /dev/null
@@ -1,329 +0,0 @@
-package cp
-
-import purescala.Trees._
-import purescala.TypeTrees.classDefToClassType
-import purescala.Definitions._
-import purescala.Common.Identifier
-
-import Serialization._
-
-trait CodeGeneration {
-  self: CPComponent =>
-  import global._
-  import CODE._
-
-  private lazy val scalaPackage                   = definitions.ScalaPackage
-
-  private lazy val exceptionClass                 = definitions.getClass("java.lang.Exception")
-
-  private lazy val collectionModule               = definitions.getModule("scala.collection")
-  private lazy val immutableModule                = definitions.getModule("scala.collection.immutable")
-  private lazy val listMapFunction                = definitions.getMember(definitions.ListClass, "map")
-  private lazy val listClassApplyFunction         = definitions.getMember(definitions.ListClass, "apply")
-  private lazy val listModuleApplyFunction        = definitions.getMember(definitions.ListModule, "apply")
-  private lazy val canBuildFromFunction           = definitions.getMember(definitions.ListModule, "canBuildFrom")
-
-  private lazy val iteratorClass                  = definitions.getClass("scala.collection.Iterator")
-  private lazy val iteratorMapFunction            = definitions.getMember(iteratorClass, "map")
-
-  private lazy val setClass                       = definitions.getClass("scala.collection.immutable.Set")
-  private lazy val setToSeqFunction               = definitions.getMember(setClass, "toSeq")
-
-  private lazy val seqMapFunction                 = definitions.getMember(definitions.SeqClass, "map")
-
-  private lazy val optionClass                    = definitions.getClass("scala.Option")
-  private lazy val optionMapFunction              = definitions.getMember(optionClass, "map")
-
-  private lazy val cpPackage                      = definitions.getModule("cp")
-
-  private lazy val runtimeMethodsModule           = definitions.getModule("cp.RuntimeMethods")
-  private lazy val inputVarFunction               = definitions.getMember(runtimeMethodsModule, "inputVar")
-  private lazy val skipCounterFunction            = definitions.getMember(runtimeMethodsModule, "skipCounter")
-  private lazy val copySettingsFunction           = definitions.getMember(runtimeMethodsModule, "copySettings")
-  private lazy val variableFromLFunction          = definitions.getMember(runtimeMethodsModule, "variableFromL")
-  private lazy val isSetFunction                  = definitions.getMember(runtimeMethodsModule, "isSet")
-  private lazy val toScalaMapFunction             = definitions.getMember(runtimeMethodsModule, "toScalaMap")
-  private lazy val toScalaSetFunction             = definitions.getMember(runtimeMethodsModule, "toScalaSet")
-  private lazy val toScalaFunctionFunction        = definitions.getMember(runtimeMethodsModule, "toScalaFunction")
-
-  private lazy val converterClass                 = definitions.getClass("cp.Converter")
-
-  private lazy val serializationModule            = definitions.getModule("cp.Serialization")
-  private lazy val getProgramFunction             = definitions.getMember(serializationModule, "getProgram")
-  private lazy val getInputVarListFunction        = definitions.getMember(serializationModule, "getInputVarList")
-  private lazy val serializedClass                = definitions.getClass("cp.Serialization.Serialized")
-
-  private lazy val purescalaPackage               = definitions.getModule("purescala")
-
-  private lazy val definitionsModule              = definitions.getModule("purescala.Definitions")
-  private lazy val programClass                   = definitions.getClass("purescala.Definitions.Program")
-  private lazy val caseClassDefFunction           = definitions.getMember(programClass, "caseClassDef")
-  private lazy val caseClassDefClass              = definitions.getClass("purescala.Definitions.CaseClassDef")
-  private lazy val idField                        = definitions.getMember(caseClassDefClass, "id")
-
-  private lazy val commonModule                   = definitions.getModule("purescala.Common")
-  private lazy val identifierClass                = definitions.getClass("purescala.Common.Identifier")
-  private lazy val nameField                      = definitions.getMember(identifierClass, "name")
-
-  private lazy val treesModule                    = definitions.getModule("purescala.Trees")
-  private lazy val exprClass                      = definitions.getClass("purescala.Trees.Expr")
-  private lazy val intLiteralModule               = definitions.getModule("purescala.Trees.IntLiteral")
-  private lazy val intLiteralClass                = definitions.getClass("purescala.Trees.IntLiteral")
-  private lazy val booleanLiteralModule           = definitions.getModule("purescala.Trees.BooleanLiteral")
-  private lazy val booleanLiteralClass            = definitions.getClass("purescala.Trees.BooleanLiteral")
-  private lazy val caseClassModule                = definitions.getModule("purescala.Trees.CaseClass")
-  private lazy val caseClassClass                 = definitions.getClass("purescala.Trees.CaseClass")
-  private lazy val andClass                       = definitions.getClass("purescala.Trees.And")
-  private lazy val equalsClass                    = definitions.getClass("purescala.Trees.Equals")
-  private lazy val finiteSetClass                 = definitions.getClass("purescala.Trees.FiniteSet")
-  private lazy val finiteSetModule                = definitions.getModule("purescala.Trees.FiniteSet")
-  private lazy val finiteMapClass                 = definitions.getClass("purescala.Trees.FiniteMap")
-  private lazy val finiteMapModule                = definitions.getModule("purescala.Trees.FiniteMap")
-  private lazy val singletonMapClass              = definitions.getClass("purescala.Trees.SingletonMap")
-
-  private def termModules(arity : Int)            = definitions.getModule("cp.Terms.Term" + arity)
-
-  class CodeGenerator(unit : CompilationUnit, owner : Symbol, defaultPos : Position) {
-
-    private def newSerialized(serialized : Serialized) : Tree = {
-      NEW(ID(serializedClass), LIT(serialized.string), LIT(serialized.id))
-    }
-
-    def exprSeqToScalaMethod(owner : Symbol, exprToScalaCastSym : Symbol, signature : List[Tree]) : (Tree, Symbol) = {
-      val returnType = if (signature.size == 1) signature.head.tpe else definitions.tupleType(signature.map(_.tpe))
-
-      val methodSym = owner.newMethod(NoPosition, unit.fresh.newName("exprSeqToScala"))
-      methodSym setInfo (MethodType(methodSym newSyntheticValueParams (List(typeRef(NoPrefix, definitions.SeqClass, List(exprClass.tpe)))), returnType))
-
-      owner.info.decls.enter(methodSym)
-      val arg = methodSym ARG 0
-      val returnExpressions = (for ((typeTree, idx) <- signature.zipWithIndex) yield {
-        val argExpr = ((arg DOT listClassApplyFunction) APPLY LIT(idx)) AS (exprClass.tpe)
-        Apply(TypeApply(Ident(exprToScalaCastSym), List(typeTree)), List(argExpr))
-      })
-
-      val returnExpr : Tree = if (signature.size == 1) returnExpressions.head else {
-        val tupleTypeTree = TypeTree(returnType)
-        New(tupleTypeTree,List(returnExpressions))
-      }
-
-      (DEF(methodSym) === returnExpr, methodSym)
-    }
-
-    /* Generate the two methods required for converting funcheck expressions to
-     * Scala terms, and return the method symbols and method definitions
-     * respectively */
-    def exprToScalaMethods(owner : Symbol, prog : Program) : ((Symbol, Tree), (Symbol, Tree)) = {
-      // `method` is the one that matches expressions and converts them
-      // recursively, `castMethod` invokes `method` and casts the results.
-      val methodSym     = owner.newMethod(NoPosition, unit.fresh.newName("exprToScala"))
-      val castMethodSym = owner.newMethod(NoPosition, unit.fresh.newName("exprToScalaCast"))
-
-      // PS: Changed the following for 2.9.0.1 :
-      // val parametricType = castMethodSym.newTypeParameter(NoPosition, unit.fresh.newName("A"))
-      val parametricType = castMethodSym.newTypeParameter(NoPosition, global.newTypeName("A"))
-      parametricType setInfo (TypeBounds(definitions.NothingClass.typeConstructor, definitions.AnyClass.typeConstructor))
-
-      methodSym      setInfo (MethodType(methodSym     newSyntheticValueParams (List(exprClass.tpe)), definitions.AnyClass.tpe))
-      castMethodSym  setInfo (PolyType(List(parametricType), MethodType(castMethodSym newSyntheticValueParams (List(exprClass.tpe)), parametricType.tpe)))
-
-      owner.info.decls.enter(methodSym)
-      owner.info.decls.enter(castMethodSym)
-
-      // the following is for the recursive method
-      val intSym        = methodSym.newValue(NoPosition, unit.fresh.newName("value")).setInfo(definitions.IntClass.tpe)
-      val booleanSym    = methodSym.newValue(NoPosition, unit.fresh.newName("value")).setInfo(definitions.BooleanClass.tpe)
-      val finiteMapSym  = methodSym.newValue(NoPosition, unit.fresh.newName("map")).setInfo(finiteMapClass.tpe)
-      val finiteSetSym  = methodSym.newValue(NoPosition, unit.fresh.newName("set")).setInfo(finiteSetClass.tpe)
-
-      val ccdBinderSym  = methodSym.newValue(NoPosition, unit.fresh.newName("ccd")).setInfo(caseClassDefClass.tpe)
-      val argsBinderSym = methodSym.newValue(NoPosition, unit.fresh.newName("args")).setInfo(typeRef(NoPrefix, definitions.SeqClass, List(exprClass.tpe)))
-
-      val definedCaseClasses : Seq[CaseClassDef] = prog.definedClasses.filter(_.isInstanceOf[CaseClassDef]).map(_.asInstanceOf[CaseClassDef])
-      val dccSyms = definedCaseClasses map (reverseClassesToClasses(_))
-
-      val caseClassMatchCases : List[CaseDef] = ((definedCaseClasses zip dccSyms) map {
-        case (ccd, scalaSym) =>
-          (CASE(caseClassModule APPLY ((ccdBinderSym BIND WILD()), (argsBinderSym BIND WILD()))) IF ((ccdBinderSym DOT idField DOT nameField).setPos(defaultPos) ANY_== LIT(ccd.id.name).setPos(defaultPos))) ==>
-            New(TypeTree(scalaSym.tpe), List({
-              (ccd.fields.zipWithIndex map {
-                case (VarDecl(id, tpe), idx) =>
-                  def typeArg(t: purescala.TypeTrees.TypeTree): Type = t match {
-                    case purescala.TypeTrees.BooleanType => definitions.BooleanClass.tpe
-                    case purescala.TypeTrees.Int32Type => definitions.IntClass.tpe
-                    case c : purescala.TypeTrees.ClassType => reverseClassesToClasses(c.classDef).tpe
-                    case purescala.TypeTrees.SetType(dt) => {
-                      typeRef(NoPrefix, setClass, List(typeArg(dt)))
-                    }
-                    case _ => scala.sys.error("Cannot generate method using type : " + t)
-                  }
-                  Apply(
-                    TypeApply(
-                      Ident(castMethodSym), 
-                      List(TypeTree(typeArg(tpe)))
-                    ), 
-                    List(
-                       // cast hack to make typer happy :(
-                       ((argsBinderSym DOT listClassApplyFunction) APPLY LIT(idx)) AS (exprClass.tpe)
-                    )
-                  )
-              }).toList
-            }))
-      }).toList
-
-      def anonymousFunctionFromMethod(methodSymbol: Symbol, argType: Type): Tree = {
-        val anonFunSym = methodSymbol.newValue(NoPosition, nme.ANON_FUN_NAME) setInfo (methodSymbol.tpe)
-        val argValue = anonFunSym.newValue(NoPosition, unit.fresh.newName("x")) setInfo (argType)
-        val anonFun = Function(
-          List(ValDef(argValue, EmptyTree)),
-          methodSym APPLY ID(argValue)
-        ) setSymbol anonFunSym 
-        anonFun
-      }
-
-      val matchExpr = (methodSym ARG 0) MATCH ( List(
-        CASE((intLiteralModule) APPLY (intSym BIND WILD()))         ==> ID(intSym),
-        CASE((booleanLiteralModule) APPLY (booleanSym BIND WILD())) ==> ID(booleanSym),
-        CASE(finiteMapSym BIND ((finiteMapModule) APPLY (WILD())))  ==> (toScalaMapFunction APPLY (ID(finiteMapSym), anonymousFunctionFromMethod(methodSym, exprClass.tpe))),
-        CASE(finiteSetSym BIND ((finiteSetModule) APPLY (WILD())))  ==> (toScalaSetFunction APPLY (ID(finiteSetSym), anonymousFunctionFromMethod(methodSym, exprClass.tpe)))) :::
-        caseClassMatchCases :::
-        List(DEFAULT                                                ==> THROW(exceptionClass, LIT("Cannot convert FunCheck expression to Scala term"))) : _*
-      )
-
-      // the following is for the casting method
-      val castBody = (methodSym APPLY (castMethodSym ARG 0)) AS (parametricType.tpe)
-
-      ((methodSym, DEF(methodSym) === matchExpr), (castMethodSym, DEF(castMethodSym) === castBody))
-    }
-
-    /* Generate the method for converting ground Scala terms into funcheck
-     * expressions */
-    def scalaToExprMethod(owner : Symbol, prog : Program, serializedProg : Serialized) : (Tree, Symbol) = {
-      val methodSym = owner.newMethod(NoPosition, unit.fresh.newName("scalaToExpr"))
-      methodSym setInfo (MethodType(methodSym newSyntheticValueParams (List(definitions.AnyClass.tpe)), exprClass.tpe))
-      owner.info.decls.enter(methodSym)
-
-      val intSym        = methodSym.newValue(NoPosition, unit.fresh.newName("value")).setInfo(definitions.IntClass.tpe)
-      val booleanSym    = methodSym.newValue(NoPosition, unit.fresh.newName("value")).setInfo(definitions.BooleanClass.tpe)
-
-      // TODO how to declare this type Set[_] 
-      val setType     = typeRef(NoPrefix, setClass, List(WildcardType))
-      val setSym     = methodSym.newValue(NoPosition, unit.fresh.newName("value")).setInfo(setType)
-      val setSymAlt = methodSym.newValue(NoPosition, unit.fresh.newName("set")).setInfo(definitions.AnyClass.tpe)
-
-      // anonymous function for mapping set to FiniteSet expression
-      // val anonFunSym = methodSym.newValue(NoPosition, nme.ANON_FUN_NAME) setInfo (methodSym.tpe)
-      // val argValue = anonFunSym.newValue(NoPosition, unit.fresh.newName("x")) setInfo (definitions.AnyClass.tpe)
-      // val anonFun = Function(
-      //   List(ValDef(argValue, EmptyTree)),
-      //   methodSym APPLY ID(argValue)
-      // ) setSymbol anonFunSym 
-
-      val definedCaseClasses : Seq[CaseClassDef] = prog.definedClasses.filter(_.isInstanceOf[CaseClassDef]).map(_.asInstanceOf[CaseClassDef])
-      val dccSyms = definedCaseClasses map (reverseClassesToClasses(_))
-
-      val caseClassMatchCases = ((definedCaseClasses zip dccSyms) map {
-        case (ccd, scalaSym) =>
-          /*
-          val binderSyms = (ccd.fields.map {
-            case VarDecl(id, tpe) =>
-              methodSym.newValue(NoPosition, unit.fresh.newName(id.name)).setInfo(definitions.AnyClass.tpe)
-          }).toList
-          */
-
-          val scalaBinderSym = methodSym.newValue(NoPosition, unit.fresh.newName("cc")).setInfo(scalaSym.tpe)
-
-          val memberSyms = (ccd.fields.map {
-            case VarDecl(id, tpe) =>
-              scalaSym.info.member(id.name)
-          }).toList
-
-          // CASE(scalaSym APPLY (binderSyms map (_ BIND WILD()))) ==>
-          CASE(scalaBinderSym BIND Typed(WILD(), TypeTree(scalaSym.tpe))) ==>
-            New(
-              TypeTree(caseClassClass.tpe),
-              List(
-                List(
-                  (((cpPackage DOT serializationModule DOT getProgramFunction) APPLY (newSerialized(serializedProg))) DOT caseClassDefFunction) APPLY LIT(scalaSym.nameString),
-                  (scalaPackage DOT collectionModule DOT immutableModule DOT definitions.ListModule DOT listModuleApplyFunction) APPLY (memberSyms map {
-                    case ms => methodSym APPLY (scalaBinderSym DOT ms)
-                  })
-                )
-              )
-            )
-      }).toList
-
-      val matchExpr = (methodSym ARG 0) MATCH ( List(
-        CASE(intSym     BIND Typed(WILD(), TypeTree(definitions.IntClass.tpe)))     ==> NEW(ID(intLiteralClass), ID(intSym)) ,
-        CASE(booleanSym BIND Typed(WILD(), TypeTree(definitions.BooleanClass.tpe))) ==> NEW(ID(booleanLiteralClass), ID(booleanSym))
-        //(CASE(setSymAlt) IF (isSetFunction APPLY (ID(setSymAlt))))                  ==> NEW(ID(finiteSetClass), 
-        /*,
-        CASE(setSym     BIND Typed(WILD(), TypeTree(setType)))                      ==> NEW(ID(finiteSetClass), NEW(ID(intLiteralClass), LIT(42)), TypeApply(setSym DOT setToSeqFunction DOT seqMapFunction, List(TypeTree(exprClass.tpe))) APPLY anonFun)*/) :::
-        caseClassMatchCases :::
-        List(DEFAULT                                                                ==> THROW(exceptionClass, LIT("Cannot convert Scala term to FunCheck expression"))) : _*
-      )
-
-      (DEF(methodSym) === matchExpr, methodSym)
-    }
-
-    /* Generates list of values that will replace the specified serialized input variables in a constraint */
-    def inputVarValues(serializedInputVarList : Serialized, inputVars : Seq[Identifier], scalaToExprSym : Symbol) : Tree = {
-      val inputVarTrees = inputVars.map((iv: Identifier) => scalaToExprSym APPLY variablesToTrees(Variable(iv)))
-      listFromElements(inputVarTrees)
-    }
-
-    /* Generates list of values that will replace the specified serialized L variables in a constraint */
-    def lVarValues(serializedLVarList : Serialized, lVars : Seq[Identifier], scalaToExprSym : Symbol) : Tree = {
-      val lvarConversionTrees = lVars.map((lid: Identifier) => variableFromLFunction APPLY reverseLvarSubsts(Variable(lid)))
-      listFromElements(lvarConversionTrees)
-    }
-
-    def lVars(ids: Seq[Identifier]) : Tree = {
-      val lvarTrees = ids.map(id => reverseLvarSubsts(Variable(id)))
-      listFromElements(lvarTrees)
-    }
-
-    def listFromElements(elems: Seq[Tree]): Tree = {
-      (scalaPackage DOT collectionModule DOT immutableModule DOT definitions.ListModule DOT listModuleApplyFunction) APPLY (elems.toList)
-    }
-
-    def newBaseTerm(exprToScalaSym : Symbol, serializedProg : Serialized, serializedInputVarList : Serialized, serializedLVarList : Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Tree, lVarValues : Tree, lVars : Tree, function : Tree, typeTreeList : List[Tree], arity : Int) : Tree = {
-      TypeApply(
-        Ident(termModules(arity)), typeTreeList) APPLY(
-        newConverter(exprToScalaSym),
-        newSerialized(serializedProg),
-        newSerialized(serializedInputVarList),
-        newSerialized(serializedLVarList),
-        newSerialized(serializedOutputVars),
-        newSerialized(serializedExpr),
-        inputVarValues,
-        lVarValues,
-        lVars,
-        function
-      )
-    }
-
-    def newConverter(exprToScalaSym : Symbol) : Tree = {
-      val anonFunSym = owner.newValue(NoPosition, nme.ANON_FUN_NAME) setInfo (exprToScalaSym.tpe)
-      val argValue = anonFunSym.newValue(NoPosition, unit.fresh.newName("x")) setInfo (exprClass.tpe)
-
-      val anonFun = Function(
-        List(ValDef(argValue, EmptyTree)),
-        exprToScalaSym APPLY ID(argValue)
-      ) setSymbol anonFunSym 
-
-      NEW(
-        ID(converterClass),
-        anonFun
-      )
-    }
-
-    def skipCounter(i : Int) : Tree = {
-      (cpPackage DOT runtimeMethodsModule DOT skipCounterFunction) APPLY LIT(i)
-    }
-
-    def copySettings(serializedSettings : Serialized) : Tree = {
-      (cpPackage DOT runtimeMethodsModule DOT copySettingsFunction) APPLY (newSerialized(serializedSettings))
-    }
-  }
-}
diff --git a/src/cp/ConstraintSolving.scala b/src/cp/ConstraintSolving.scala
deleted file mode 100644
index 9d161de2c7b9260866ab3093554dfa8bc0cc8dca..0000000000000000000000000000000000000000
--- a/src/cp/ConstraintSolving.scala
+++ /dev/null
@@ -1,405 +0,0 @@
-package cp
-
-import Terms._
-import Definitions.{UnsatisfiableConstraintException,UnknownConstraintException}
-
-import purescala.{QuietReporter,DefaultReporter}
-import purescala.Trees._
-import purescala.TypeTrees._
-import purescala.Definitions._
-import purescala.Common._
-import purescala.FairZ3Solver
-import purescala.Stopwatch
-
-object ConstraintSolving {
-  private val silent = ! Settings.verbose
-  private def newReporter() = if (silent) new QuietReporter() else new DefaultReporter()
-  private def newSolver(program : Program) = {
-    val s = new FairZ3Solver(newReporter())
-    s.setProgram(program)
-    s.restartZ3
-    s
-  }
-
-  private val DEBUG = false
-  private def printDebug(msg: String): Unit = if (DEBUG) println(msg)
-
-  object GlobalContext {
-    private var solver: FairZ3Solver = null
-    private var lastModel: Map[Identifier,Expr] = null
-
-    private var liveSet: Set[Identifier] = Set.empty
-    private var toAssertQueue: Seq[Expr] = Seq.empty
-
-    private var guards: Map[Seq[Identifier],Identifier] = Map.empty
-    def getGuard(ids: Seq[Identifier]): Identifier = guards(ids)
-    def addGuard(ids: Seq[Identifier], guard: Identifier): Unit = {
-      guards = guards + (ids -> guard)
-      addLive(guard)
-    }
-
-    def kill(id: Identifier): Unit = {
-      printDebug("  - Removing from live set: " + id)
-      liveSet = liveSet - id
-    }
-
-    def isAlive(id: Identifier): Boolean = {
-      liveSet.contains(id)
-    }
-
-    def addLive(id: Identifier): Unit = {
-      printDebug("  - Adding to live set: " + id)
-      liveSet = liveSet + id
-    }
-
-    def initializeIfNeeded(p: Program): Unit = {
-      if (solver == null)
-        solver = newSolver(p)
-    }
-
-    def checkAssumptions(expr: Expr) : Boolean = checkAssumptions(expr, liveSet map (Variable(_)))
-    private def checkAssumptions(expr: Expr, assumptions: Set[Expr]): Boolean = {
-      printDebug("  - Checking assumptions: " + expr)
-      printDebug("  - live set: " + liveSet)
-      if (! toAssertQueue.isEmpty)
-        printDebug("  - Will also assert enqueued expressions: " + toAssertQueue)
-
-      val toCheck = And(expr +: toAssertQueue)
-      toAssertQueue = Seq.empty
-      printDebug("  - To check: " + toCheck)
-
-      solver.decideWithModel(toCheck, false, assumptions = Some(assumptions)) match {
-        case (Some(false), model) =>
-          printDebug("  - SAT: " + model)
-          lastModel = model
-          true
-        case _ =>
-          printDebug("  - UNSAT")
-          false
-      }
-    }
-
-    // def restart(): Unit = {
-    //   // println("restart called")
-    //   solver.restartZ3
-    //   lastModel = None
-    //   isInconsistent = false
-    //   alreadyAsserted = Set.empty[Expr]
-    //   toNegateForNextModel = Seq.empty
-    // }
-
-    def assertConstraint(expr: Expr): Boolean = {
-      printDebug("  - Asserting constraint: " +expr)
-      if (! toAssertQueue.isEmpty)
-        printDebug("  - Will also assert enqueued expressions: " + toAssertQueue)
-
-      val toAssert = And(expr +: toAssertQueue)
-      toAssertQueue = Seq.empty
-
-      solver.decideWithModel(expr, false) match {
-        case (Some(false), model) =>
-          lastModel = model
-          true
-        case _ =>
-          println("UNSAT encountered in global context.")
-          lastModel = null
-          false
-      }
-    }
-
-    def enqueueAssert(expr: Expr): Unit = {
-      toAssertQueue = expr +: toAssertQueue
-    }
-
-    /** Returns true iff the solver did not already return UNSAT and there is
-     * still a model */
-    // def checkConsistency(): Boolean = {
-    //   !isInconsistent && (lastModel match {
-    //     case Some(m) => true
-    //     case None =>
-    //       assertConstraint(BooleanLiteral(true))
-    //   })
-    // }
-
-    def findValues(ids: Seq[Identifier]): Seq[Expr] = {
-      if (lastModel == null)
-        sys.error("Attempting to find values for " + ids.mkString(", ") + " while model is null.")
-      ids.map(modelValue(_, lastModel))
-    }
-
-    // def registerAsForced(ids: Seq[Identifier], values: Seq[Expr]): Unit = {
-    //   toNegateForNextModel = (ids, values) +: toNegateForNextModel
-    // }
-
-    // def assertModelNegation(): Unit = {
-    //   if (!toNegateForNextModel.isEmpty) {
-    //     val equalities: Seq[Expr] = toNegateForNextModel.flatMap{
-    //       case (ids, values) => ((ids map (i => Variable(i))) zip values) map { case (i, v) => Equals(i, v) }
-    //     }
-    //     toNegateForNextModel = Seq.empty
-    //     assertConstraint(Not(And(equalities)))
-    //   }
-    // }
-  }
-
-  /** Return interpretation of the constant in model if it exists, the simplest
-   * value otherwise */
-  private def modelValue(varId: Identifier, model: Map[Identifier, Expr]) : Expr = model.get(varId) match {
-    case Some(value) => value
-    case None => simplestValue(varId.getType)
-  }
-
-  private def evaluator(constraint : Term[_,Boolean], ids : Seq[Identifier]) : Option[(Map[Identifier,Expr])=>Boolean] = {
-    if (cp.Settings.useScalaEvaluator && constraint.evaluator != null) {
-      Some((m : Map[Identifier,Expr]) => constraint.evaluator(ids.map(modelValue(_, m))))
-    } else None
-  }
-
-  /** Return a solution as a sequence of expressions */
-  def solveExprSeq(constraint : Term[_,Boolean]) : Seq[Expr] = {
-    val solver = newSolver(programOf(constraint))
-
-    val (freshOutputIDs, expr) = combineConstraint(constraint)
-
-    val (outcome, model) = solver.decideWithModel(expr, false, evaluator(constraint, freshOutputIDs))
-
-    outcome match {
-      case Some(false) =>
-        freshOutputIDs.map(id => modelValue(id, model))
-      case Some(true) =>
-        throw new UnsatisfiableConstraintException()
-      case None =>
-        throw new UnknownConstraintException()
-    }
-  }
-
-  /** Return a solution that minimizes the given term, as a sequence of expressions */
-  def solveMinimizingExprSeq(constraint : Constraint[_], minFunc : IntTerm[_]) : Seq[Expr] = {
-    val program = programOf(constraint)
-    val (freshOutputIDs, expr) = combineConstraint(constraint)
-    val minExprWithIndices = exprOf(minFunc)
-
-    val funcSignature = typesOf(minFunc)
-    val deBruijnIndices = funcSignature.zipWithIndex.map{ case (t, idx) => DeBruijnIndex(idx).setType(t) }
-    val minExprWithIDs = replace((deBruijnIndices zip (freshOutputIDs map (Variable(_)))).toMap, minExprWithIndices)
-
-    val (model, value) = minimizingModelAndValue(program, expr, freshOutputIDs, minExprWithIDs)
-    model
-  }
-
-  /** Return an iterator of solutions as sequences of expressions */
-  def findAllExprSeq(constraint : Term[_,Boolean]) : Iterator[Seq[Expr]] = {
-    val program = programOf(constraint)
-    val (freshOutputIDs, expr) = combineConstraint(constraint)
-
-    val modelIterator = solutionsIterator(program, expr, freshOutputIDs, evaluator(constraint, freshOutputIDs))
-    val exprIterator  = modelIterator.map(model => freshOutputIDs.map(id => model(id)))
-
-    exprIterator
-  }
-
-  /** Enumerate all solutions ordered by the term to minimize, as sequences of expressions */
-  def findAllMinimizingExprSeq(constraint : Constraint[_], minFunc : IntTerm[_]) : Iterator[Seq[Expr]] = {
-    val program = programOf(constraint)
-    val (freshOutputIDs, expr) = combineConstraint(constraint)
-    val minExprWithIndices = exprOf(minFunc)
-
-    val funcSignature = typesOf(minFunc)
-    val deBruijnIndices = funcSignature.zipWithIndex.map{ case (t, idx) => DeBruijnIndex(idx).setType(t) }
-    val minExprWithIDs = replace((deBruijnIndices zip (freshOutputIDs map (Variable(_)))).toMap, minExprWithIndices)
-
-    findAllMinimizingExprSeq(program, expr, freshOutputIDs, minExprWithIDs, None)
-  }
-
-  private def findAllMinimizingExprSeq(program : Program, expr : Expr, outputVars : Seq[Identifier], minExpr : Expr, minExprBound : Option[Int]) : Iterator[Seq[Expr]] = {
-    try {
-      val toCheck = minExprBound match {
-        case None => expr
-        case Some(b) => And(expr, GreaterThan(minExpr, IntLiteral(b)))
-      }
-      // purescala.Settings.reporter.info("Now calling findAllMinimizing with " + toCheck)
-      val minValue = minimizingModelAndValue(program, toCheck, outputVars, minExpr)._2
-
-      val minValConstraint    = And(expr, Equals(minExpr, IntLiteral(minValue)))
-      val minValModelIterator = solutionsIterator(program, minValConstraint, outputVars)
-      val minValExprIterator  = minValModelIterator.map(model => outputVars.map(id => model(id)))
-
-      minValExprIterator ++ findAllMinimizingExprSeq(program, expr, outputVars, minExpr, Some(minValue))
-    } catch {
-      case e: UnsatisfiableConstraintException  => Iterator[Seq[Expr]]()
-      case e: UnknownConstraintException        => Iterator[Seq[Expr]]()
-    }
-  }
-
-
-  private def minimizingModelAndValue(program : Program, expr : Expr, outputVars : Seq[Identifier], minExpr : Expr) : (Seq[Expr], Int) = {
-    def stop(lo : Option[Int], hi : Int) : Boolean = lo match {
-      case Some(l) => hi - l <= 2
-      case None => false
-    }
-    
-    val solver = newSolver(program)
-
-    /* invariant : lo is always stricly less than any sat. minExpr assignment,
-     * and there is always a sat. assignment less than hi */
-    def minAux(pivot : Int, lo : Option[Int], hi : Int) : (Map[Identifier, Expr], Int) = {
-      // println("Iterating:")
-      // println("  lo     : " + (lo match { case Some(l) => l; case None => "-inf"}))
-      // println("  pivot  : " + pivot)
-      // println("  hi     : " + hi)
-      // println
-      val toCheck = expr :: LessEquals(minExpr, IntLiteral(pivot)) :: Nil
-      solver.restartZ3
-      val (outcome, model) = solver.decideWithModel(And(toCheck), false)
-
-      outcome match {
-        case Some(false) =>
-          // there is a satisfying assignment
-          if (stop(lo, hi)) {
-            (model, pivot)
-          } else {
-            lo match {
-              case None =>
-                // lower bound is -inf
-                minAux(
-                  if (pivot >= 0) -1 else pivot * 2,
-                  None,
-                  pivot + 1
-                )
-              case Some(lv) =>
-                minAux(
-                  lv + (pivot + 1 - lv) / 2,
-                  lo,
-                  pivot + 1
-                )
-            }
-          }
-        case _ =>
-          // new lo is pivot
-          minAux(
-            pivot + (hi - pivot) / 2,
-            Some(pivot),
-            hi
-          )
-      }
-    }
-
-    // We declare a variable to hold the value to minimize:
-    val minExprID = purescala.Common.FreshIdentifier("minExpr").setType(purescala.TypeTrees.Int32Type)
-
-    solver.restartZ3
-    solver.decideWithModel(And(expr :: Equals(minExpr, Variable(minExprID)) :: Nil), false) match {
-      case (Some(false), model) =>
-        // there is a satisfying assignment
-        val minExprVal = modelValue(minExprID, model) match {
-          case IntLiteral(i) => i
-          case e => scala.sys.error("Unexpected value for term to minimize : " + e)
-        }
-
-        val (optimalModel, optimalValue) = minAux(minExprVal - 1, None, minExprVal + 1)
-        (outputVars.map(v => modelValue(v, optimalModel)), optimalValue)
-      case (Some(true), _) =>
-        throw new UnsatisfiableConstraintException()
-      case _ =>
-        throw new UnknownConstraintException()
-    }
-  }
-  /** Returns an iterator of interpretations for each identifier in the specified set */
-  private def solutionsIterator(program : Program, predicate : Expr, outputVariables : Seq[Identifier], evaluator : Option[(Map[Identifier,Expr]) => Boolean] = None) : Iterator[Map[Identifier, Expr]] = {
-    val solver = newSolver(program)
-
-    new Iterator[Map[Identifier, Expr]] {
-
-      // If nextModel is None, we do not know yet whether there is a next element
-      var nextModel: Option[Option[Map[Identifier, Expr]]] = None
-
-      // We add after finding each model the negation of the previous one
-      var addedNegations: Expr = BooleanLiteral(true)
-
-      var toCheck: Expr = predicate
-      var toUseAsEvaluator : Option[(Map[Identifier,Expr]) => Boolean] = evaluator
-
-      override def hasNext : Boolean = nextModel match {
-        case None => 
-          // Check whether there are any more models
-          val stopwatch = new Stopwatch("hasNext", false).start
-          val (outcome, model) = solver.decideWithModel(toCheck, false, toUseAsEvaluator)
-          stopwatch.stop
-          stopwatch.writeToSummary
-          val toReturn = (outcome match {
-            case Some(false) =>
-              // there is a solution, we need to complete model for nonmentioned variables
-              val completeModel = outputVariables.foldLeft(model){
-                case (modelSoFar, ov) => modelSoFar.get(ov) match {
-                  case None =>
-                    // model has to be augmented for ov
-                    modelSoFar + (ov -> simplestValue(ov.getType))
-                  case _ =>
-                    modelSoFar
-                }
-              }
-              nextModel = Some(Some(completeModel))
-              val newModelEqualities = And(outputVariables.map(ov => Equals(Variable(ov), completeModel(ov))))
-              toCheck = negate(newModelEqualities)
-              // toCheck = And(toCheck, negate(newModelEqualities))
-              // accumulate negations of models in evaluator
-              // toUseAsEvaluator = toUseAsEvaluator.map(e => ((m : Map[Identifier,Expr]) => e(m) && !m.forall{ case (k,v) => completeModel.get(k) == Some(v) }))
-              true
-            case Some(true) =>
-              // there are definitely no more solutions
-              nextModel = Some(None)
-              false
-            case None =>
-              // unknown
-              nextModel = Some(None)
-              false
-          })
-          toReturn
-        case Some(None) =>
-          // There are no more models
-          false
-        case Some(Some(map)) =>
-          true
-      }
-
-      override def next() : Map[Identifier, Expr] = nextModel match {
-        case None => {
-          // Let's compute the next model
-          val (outcome, model) = solver.decideWithModel(toCheck, false)
-          val toReturn = (outcome match {
-            case Some(false) =>
-              // there is a solution, we need to complete model for nonmentioned variables
-              val completeModel = outputVariables.foldLeft(model){
-                case (modelSoFar, ov) => modelSoFar.get(ov) match {
-                  case None =>
-                    // model has to be augmented for ov
-                    modelSoFar + (ov -> simplestValue(ov.getType))
-                  case _ =>
-                    modelSoFar
-                }
-              }
-
-              val newModelEqualities = And(outputVariables.map(ov => Equals(Variable(ov), completeModel(ov))))
-              toCheck = negate(newModelEqualities)
-              // toCheck = And(toCheck, negate(newModelEqualities))
-              // accumulate negations of models in evaluator
-              // toUseAsEvaluator = toUseAsEvaluator.map(e => ((m : Map[Identifier,Expr]) => e(m) && !m.forall(p => completeModel.get(p._1) == Some(p._2))))
-              completeModel
-            case Some(true) =>
-              // Definitely no more solutions
-              throw new Exception("Requesting a new model while there are no more")
-            case None =>
-              // Unknown
-              throw new Exception("Requesting a new model while there are no more")
-          })
-          toReturn
-        }
-        case Some(Some(m)) =>
-          nextModel = None
-          m
-        case Some(None) =>
-          throw new Exception("Requesting a new model while the last result was unknown")
-      }
-    }
-  }
-}
diff --git a/src/cp/Converter.scala b/src/cp/Converter.scala
deleted file mode 100644
index aa2644b93ecb1e15e3c6b65bfeb1fec6dcf03b8e..0000000000000000000000000000000000000000
--- a/src/cp/Converter.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-package cp
-
-import purescala.Trees._
-
-/** A converter has functions for converting FunCheck expressions into Scala
- * values */
-class Converter(val expr2scala : (Expr => Any)) {
-  def exprSeq2scala0(exprs : Seq[Expr]) : Unit =
-    () 
-
-  def exprSeq2scala1[T1](exprs : Seq[Expr]) : (T1) =
-    (expr2scala(exprs(0)).asInstanceOf[T1])
-
-  def exprSeq2scala2[T1,T2](exprs : Seq[Expr]) : (T1,T2) =
-    (expr2scala(exprs(0)).asInstanceOf[T1],expr2scala(exprs(1)).asInstanceOf[T2])
-
-  def exprSeq2scala3[T1,T2,T3](exprs : Seq[Expr]) : (T1,T2,T3) =
-    (expr2scala(exprs(0)).asInstanceOf[T1],expr2scala(exprs(1)).asInstanceOf[T2],expr2scala(exprs(2)).asInstanceOf[T3])
-
-  def exprSeq2scala4[T1,T2,T3,T4](exprs : Seq[Expr]) : (T1,T2,T3,T4) =
-    (expr2scala(exprs(0)).asInstanceOf[T1],expr2scala(exprs(1)).asInstanceOf[T2],expr2scala(exprs(2)).asInstanceOf[T3],expr2scala(exprs(3)).asInstanceOf[T4])
-
-  def exprSeq2scala5[T1,T2,T3,T4,T5](exprs : Seq[Expr]) : (T1,T2,T3,T4,T5) =
-    (expr2scala(exprs(0)).asInstanceOf[T1],expr2scala(exprs(1)).asInstanceOf[T2],expr2scala(exprs(2)).asInstanceOf[T3],expr2scala(exprs(3)).asInstanceOf[T4],expr2scala(exprs(4)).asInstanceOf[T5])
-
-  def exprSeq2scala6[T1,T2,T3,T4,T5,T6](exprs : Seq[Expr]) : (T1,T2,T3,T4,T5,T6) =
-    (expr2scala(exprs(0)).asInstanceOf[T1],expr2scala(exprs(1)).asInstanceOf[T2],expr2scala(exprs(2)).asInstanceOf[T3],expr2scala(exprs(3)).asInstanceOf[T4],expr2scala(exprs(4)).asInstanceOf[T5],expr2scala(exprs(5)).asInstanceOf[T6])
-
-  def exprSeq2scala7[T1,T2,T3,T4,T5,T6,T7](exprs : Seq[Expr]) : (T1,T2,T3,T4,T5,T6,T7) =
-    (expr2scala(exprs(0)).asInstanceOf[T1],expr2scala(exprs(1)).asInstanceOf[T2],expr2scala(exprs(2)).asInstanceOf[T3],expr2scala(exprs(3)).asInstanceOf[T4],expr2scala(exprs(4)).asInstanceOf[T5],expr2scala(exprs(5)).asInstanceOf[T6],expr2scala(exprs(6)).asInstanceOf[T7])
-
-  def exprSeq2scala8[T1,T2,T3,T4,T5,T6,T7,T8](exprs : Seq[Expr]) : (T1,T2,T3,T4,T5,T6,T7,T8) =
-    (expr2scala(exprs(0)).asInstanceOf[T1],expr2scala(exprs(1)).asInstanceOf[T2],expr2scala(exprs(2)).asInstanceOf[T3],expr2scala(exprs(3)).asInstanceOf[T4],expr2scala(exprs(4)).asInstanceOf[T5],expr2scala(exprs(5)).asInstanceOf[T6],expr2scala(exprs(6)).asInstanceOf[T7],expr2scala(exprs(7)).asInstanceOf[T8])
-
-  def exprSeq2scala9[T1,T2,T3,T4,T5,T6,T7,T8,T9](exprs : Seq[Expr]) : (T1,T2,T3,T4,T5,T6,T7,T8,T9) =
-    (expr2scala(exprs(0)).asInstanceOf[T1],expr2scala(exprs(1)).asInstanceOf[T2],expr2scala(exprs(2)).asInstanceOf[T3],expr2scala(exprs(3)).asInstanceOf[T4],expr2scala(exprs(4)).asInstanceOf[T5],expr2scala(exprs(5)).asInstanceOf[T6],expr2scala(exprs(6)).asInstanceOf[T7],expr2scala(exprs(7)).asInstanceOf[T8],expr2scala(exprs(8)).asInstanceOf[T9])
-
-}
diff --git a/src/cp/Definitions.scala b/src/cp/Definitions.scala
deleted file mode 100644
index ff91c55018710de486b2d62bc5cdd7bf8ae72c85..0000000000000000000000000000000000000000
--- a/src/cp/Definitions.scala
+++ /dev/null
@@ -1,92 +0,0 @@
-package cp
-
-object Definitions {
-  import Terms._
-  import LTrees._
-
-  class spec extends StaticAnnotation
-
-  final class NotImplementedException extends Exception
-
-  final class UnsatisfiableConstraintException extends Exception
-  final class UnknownConstraintException extends Exception
-
-  def assuming(cond: Constraint0)(block: => Unit): Unit = {
-    for (u <- cond.lazyFindAll) {
-      block
-    }
-  }
-
-  def when[A](cond: Constraint0)(block: => A): When[A] = {
-    var v: Option[A] = None
-    for (i <- cond.lazyFindAll)
-      v = Some(block)
-    new When(v)
-  }
-
-  final class When[A](val thenResult: Option[A]) {
-    def otherwise(elseBlock: => A): A = thenResult match {
-      case None => elseBlock
-      case Some(tr) => tr
-    }
-  }
-
-  implicit def when2value[A](w: When[A]): A = w.thenResult match {
-    case Some(tr) => tr
-    case None => throw new Exception("Cannot find value for result of `when'")
-  }
-
-  def cif[A](cond: Constraint0)(block: => A): CIf[A] = new CIf(cond, block)
-
-  final class CIf[A](cond: Constraint0, ifBlock: => A) {
-    def celse(elseBlock: => A): A = {
-      var enteredIf = false
-      for (u <- cond.lazyFindAll) {
-        enteredIf = true
-      }
-      if (enteredIf)
-        ifBlock
-      else
-        elseBlock
-    }
-  }
-
-  implicit def boolean2constraint0(b: Boolean): Constraint0 = throw new NotImplementedException
-  implicit def func2term0[R](func: () => R): Term0[R] = throw new NotImplementedException
-  implicit def func2term1[T1,R](func: T1 => R): Term1[T1,R] = throw new NotImplementedException
-  implicit def func2term2[T1,T2,R](func: (T1,T2) => R): Term2[T1,T2,R] = throw new NotImplementedException
-  implicit def func2term3[T1,T2,T3,R](func: (T1,T2,T3) => R): Term3[T1,T2,T3,R] = throw new NotImplementedException
-  implicit def func2term4[T1,T2,T3,T4,R](func: (T1,T2,T3,T4) => R): Term4[T1,T2,T3,T4,R] = throw new NotImplementedException
-  implicit def func2term5[T1,T2,T3,T4,T5,R](func: (T1,T2,T3,T4,T5) => R): Term5[T1,T2,T3,T4,T5,R] = throw new NotImplementedException
-  implicit def func2term6[T1,T2,T3,T4,T5,T6,R](func: (T1,T2,T3,T4,T5,T6) => R): Term6[T1,T2,T3,T4,T5,T6,R] = throw new NotImplementedException
-  implicit def func2term7[T1,T2,T3,T4,T5,T6,T7,R](func: (T1,T2,T3,T4,T5,T6,T7) => R): Term7[T1,T2,T3,T4,T5,T6,T7,R] = throw new NotImplementedException
-  implicit def func2term8[T1,T2,T3,T4,T5,T6,T7,T8,R](func: (T1,T2,T3,T4,T5,T6,T7,T8) => R): Term8[T1,T2,T3,T4,T5,T6,T7,T8,R] = throw new NotImplementedException
-  implicit def func2term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,R](func: (T1,T2,T3,T4,T5,T6,T7,T8,T9) => R): Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,R] = throw new NotImplementedException
-
-  implicit def force[T](l: L[T]): T = {
-    l.value
-  }
-
-  implicit def forceTuple2OfL[T1,T2](tuple: (L[T1],L[T2])): (T1,T2) = tuple.value
-  implicit def forceTuple3OfL[T1,T2,T3](tuple: (L[T1],L[T2],L[T3])): (T1,T2,T3) = tuple.value
-  implicit def forceTuple4OfL[T1,T2,T3,T4](tuple: (L[T1],L[T2],L[T3],L[T4])): (T1,T2,T3,T4) = tuple.value
-  implicit def forceTuple5OfL[T1,T2,T3,T4,T5](tuple: (L[T1],L[T2],L[T3],L[T4],L[T5])): (T1,T2,T3,T4,T5) = tuple.value
-  implicit def forceTuple6OfL[T1,T2,T3,T4,T5,T6](tuple: (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6])): (T1,T2,T3,T4,T5,T6) = tuple.value
-  implicit def forceTuple7OfL[T1,T2,T3,T4,T5,T6,T7](tuple: (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7])): (T1,T2,T3,T4,T5,T6,T7) = tuple.value
-  implicit def forceTuple8OfL[T1,T2,T3,T4,T5,T6,T7,T8](tuple: (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7],L[T8])): (T1,T2,T3,T4,T5,T6,T7,T8) = tuple.value
-  implicit def forceTuple9OfL[T1,T2,T3,T4,T5,T6,T7,T8,T9](tuple: (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7],L[T8],L[T9])): (T1,T2,T3,T4,T5,T6,T7,T8,T9) = tuple.value
-
-  implicit def tupleOfL2lTuple1[T1](lt: L[T1]): LTuple1[T1] = new LTuple1(lt)
-  implicit def tupleOfL2lTuple2[T1,T2](lt: (L[T1],L[T2])): LTuple2[T1,T2] = new LTuple2(lt._1,lt._2)
-  implicit def tupleOfL2lTuple3[T1,T2,T3](lt: (L[T1],L[T2],L[T3])): LTuple3[T1,T2,T3] = new LTuple3(lt._1,lt._2,lt._3)
-  implicit def tupleOfL2lTuple4[T1,T2,T3,T4](lt: (L[T1],L[T2],L[T3],L[T4])): LTuple4[T1,T2,T3,T4] = new LTuple4(lt._1,lt._2,lt._3,lt._4)
-  implicit def tupleOfL2lTuple5[T1,T2,T3,T4,T5](lt: (L[T1],L[T2],L[T3],L[T4],L[T5])): LTuple5[T1,T2,T3,T4,T5] = new LTuple5(lt._1,lt._2,lt._3,lt._4,lt._5)
-  implicit def tupleOfL2lTuple6[T1,T2,T3,T4,T5,T6](lt: (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6])): LTuple6[T1,T2,T3,T4,T5,T6] = new LTuple6(lt._1,lt._2,lt._3,lt._4,lt._5,lt._6)
-  implicit def tupleOfL2lTuple7[T1,T2,T3,T4,T5,T6,T7](lt: (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7])): LTuple7[T1,T2,T3,T4,T5,T6,T7] = new LTuple7(lt._1,lt._2,lt._3,lt._4,lt._5,lt._6,lt._7)
-  implicit def tupleOfL2lTuple8[T1,T2,T3,T4,T5,T6,T7,T8](lt: (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7],L[T8])): LTuple8[T1,T2,T3,T4,T5,T6,T7,T8] = new LTuple8(lt._1,lt._2,lt._3,lt._4,lt._5,lt._6,lt._7,lt._8)
-  implicit def tupleOfL2lTuple9[T1,T2,T3,T4,T5,T6,T7,T8,T9](lt: (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7],L[T8],L[T9])): LTuple9[T1,T2,T3,T4,T5,T6,T7,T8,T9] = new LTuple9(lt._1,lt._2,lt._3,lt._4,lt._5,lt._6,lt._7,lt._8,lt._9)
-
-  def distinct[A](args: A*): Boolean = {
-    args.toList.distinct.size == args.size
-  }
-}
diff --git a/src/cp/Extractors.scala b/src/cp/Extractors.scala
deleted file mode 100644
index 0fe539602a2d5f260c48412a2e788fe314cd1292..0000000000000000000000000000000000000000
--- a/src/cp/Extractors.scala
+++ /dev/null
@@ -1,572 +0,0 @@
-package cp
-
-import scala.tools.nsc._
-
-/** Contains extractors to pull-out interesting parts of the Scala ASTs. */
-trait Extractors {
-  val global: Global
-  val pluginInstance: CPPlugin
-
-  import global._
-  import global.definitions._
-
-  private lazy val setTraitSym = definitions.getClass("scala.collection.immutable.Set")
-  private lazy val mapTraitSym = definitions.getClass("scala.collection.immutable.Map")
-  private lazy val multisetTraitSym = definitions.getClass("scala.collection.immutable.Multiset")
-  private lazy val optionClassSym = definitions.getClass("scala.Option")
-  private lazy val lClassSym = definitions.getClass("cp.LTrees.L")
-
-  object StructuralExtractors {
-    object ScalaPredef {
-      /** Extracts method calls from scala.Predef. */
-      def unapply(tree: Select): Option[String] = tree match {
-        case Select(Select(This(scalaName),predefName),symName)
-          if("scala".equals(scalaName.toString) && "Predef".equals(predefName.toString)) =>
-            Some(symName.toString)
-        case _ => None
-      }
-    }
-
-    object ExEnsuredExpression {
-      /** Extracts the 'ensuring' contract from an expression. */
-      def unapply(tree: Apply): Option[(Tree,Symbol,Tree)] = tree match {
-        case Apply(
-          Select(
-            Apply(
-              TypeApply(
-                ScalaPredef("any2Ensuring"),
-                TypeTree() :: Nil),
-              body :: Nil),
-            ensuringName),
-          (Function((vd @ ValDef(_, _, _, EmptyTree)) :: Nil, contractBody)) :: Nil)
-          if("ensuring".equals(ensuringName.toString)) => Some((body, vd.symbol, contractBody))
-        case _ => None
-      }
-    }
-
-    object ExHoldsExpression {
-      def unapply(tree: Select) : Option[Tree] = tree match {
-        case Select(Apply(Select(Select(funcheckIdent, utilsName), any2IsValidName), realExpr :: Nil), holdsName) if (
-          utilsName.toString == "Utils" &&
-          any2IsValidName.toString == "any2IsValid" &&
-          holdsName.toString == "holds") => Some(realExpr)
-        case _ => None
-      }        
-    }
-
-    /*
-    object ExMinimizingExpression {
-      def unapply(tree: Apply) : Option[(Tree,Tree)] = tree match {
-        case Apply(Select(Apply(Select(Select(cpIdent, definitionsName), any2OptimizableName), realExpr :: Nil), minimizingName), minimizingTerm :: Nil) if (
-          definitionsName.toString == "Definitions" &&
-          any2OptimizableName.toString == "any2Optimizable" &&
-          minimizingName.toString == "minimizing") => Some((realExpr, minimizingTerm))
-        case _ => None
-      }        
-    }
-
-    object ExMaximizingExpression {
-      def unapply(tree: Apply) : Option[(Tree,Tree)] = tree match {
-        case Apply(Select(Apply(Select(Select(cpIdent, definitionsName), any2OptimizableName), realExpr :: Nil), maximizingName), maximizingTerm :: Nil) if (
-          definitionsName.toString == "Definitions" &&
-          any2OptimizableName.toString == "any2Optimizable" &&
-          maximizingName.toString == "maximizing") => Some((realExpr, maximizingTerm))
-        case _ => None
-      }        
-    }
-    */
-
-    object ExRequiredExpression {
-      /** Extracts the 'require' contract from an expression (only if it's the
-       * first call in the block). */
-      def unapply(tree: Block): Option[(Tree,Tree)] = tree match {
-        case Block(Apply(ScalaPredef("require"), contractBody :: Nil) :: rest, body) =>
-          if(rest.isEmpty)
-            Some((body,contractBody))
-          else
-            Some((Block(rest,body),contractBody))
-        case _ => None
-      }
-    }
-
-    object ExValDef {
-      /** Extracts val's in the head of blocks. */
-      def unapply(tree: Block): Option[(Symbol,Tree,Tree,Tree)] = tree match {
-        case Block((vd @ ValDef(_, _, tpt, rhs)) :: rest, expr) => 
-          if(rest.isEmpty)
-            Some((vd.symbol, tpt, rhs, expr))
-          else
-            Some((vd.symbol, tpt, rhs, Block(rest, expr)))
-        case _ => None
-      }
-    }
-
-    object ExObjectDef {
-      /** Matches an object with no type parameters, and regardless of its
-       * visibility. Does not match on the automatically generated companion
-       * objects of case classes (or any synthetic class). */
-      def unapply(cd: ClassDef): Option[(String,Template)] = cd match {
-        case ClassDef(_, name, tparams, impl) if (cd.symbol.isModuleClass && tparams.isEmpty && !cd.symbol.isSynthetic) => {
-          Some((name.toString, impl))
-        }
-        case _ => None
-      }
-    }
-
-    object ExAbstractClass {
-      /** Matches an abstract class or a trait with no type parameters, no
-       * constrctor args (in the case of a class), no implementation details,
-       * no abstract members. */
-      def unapply(cd: ClassDef): Option[(String,Symbol)] = cd match {
-        // abstract class
-        case ClassDef(_, name, tparams, impl) if (cd.symbol.isAbstractClass && tparams.isEmpty && impl.body.size == 1) => Some((name.toString, cd.symbol))
-
-        case _ => None
-      }
-    }
-
-    object ExCaseClass {
-      def unapply(cd: ClassDef): Option[(String,Symbol,Seq[(String,Tree)])] = cd match {
-        case ClassDef(_, name, tparams, impl) if (cd.symbol.isCase && !cd.symbol.isAbstractClass && tparams.isEmpty && impl.body.size >= 8) => {
-          val constructor: DefDef = impl.children.find(child => child match {
-            case ExConstructorDef() => true
-            case _ => false
-          }).get.asInstanceOf[DefDef]
-
-          val args = constructor.vparamss(0).map(vd => (vd.name.toString, vd.tpt))
-
-          Some((name.toString, cd.symbol, args))
-        }
-        case _ => None
-      }
-    }
-
-    object ExCaseClassSyntheticJunk {
-      def unapply(cd: ClassDef): Boolean = cd match {
-        case ClassDef(_, _, _, _) if (cd.symbol.isSynthetic && cd.symbol.isFinal) => true
-        case _ => false
-      }
-    }
-
-    object ExConstructorDef {
-      def unapply(dd: DefDef): Boolean = dd match {
-        case DefDef(_, name, tparams, vparamss, tpt, rhs) if(name == nme.CONSTRUCTOR && tparams.isEmpty && vparamss.size == 1) => true
-        case _ => false
-      }
-    }
-
-    object ExMainFunctionDef {
-      def unapply(dd: DefDef): Boolean = dd match {
-        case DefDef(_, name, tparams, vparamss, tpt, rhs) if(name.toString == "main" && tparams.isEmpty && vparamss.size == 1 && vparamss(0).size == 1) => {
-          true
-        }
-        case _ => false
-      }
-    }
-
-    object ExFunctionDef {
-      /** Matches a function with a single list of arguments, no type
-       * parameters and regardless of its visibility. */
-      def unapply(dd: DefDef): Option[(String,Seq[ValDef],Tree,Tree)] = dd match {
-        case DefDef(_, name, tparams, vparamss, tpt, rhs) if(tparams.isEmpty && vparamss.size == 1 && name != nme.CONSTRUCTOR) => Some((name.toString, vparamss(0), tpt, rhs))
-        case _ => None
-      }
-    }
-  }
-
-  object ExpressionExtractors {
-    object ExIfThenElse {
-      def unapply(tree: If): Option[(Tree,Tree,Tree)] = tree match {
-        case If(t1,t2,t3) => Some((t1,t2,t3))
-        case _ => None
-      }
-    }
-
-    object ExBooleanLiteral {
-      def unapply(tree: Literal): Option[Boolean] = tree match {
-        case Literal(Constant(true)) => Some(true)
-        case Literal(Constant(false)) => Some(false)
-        case _ => None
-      }
-    }
-
-    object ExInt32Literal {
-      def unapply(tree: Literal): Option[Int] = tree match {
-        case Literal(c @ Constant(i)) if c.tpe == IntClass.tpe => Some(c.intValue)
-        case _ => None
-      }
-    }
-
-    object ExSomeConstruction {
-      def unapply(tree: Apply) : Option[(Type,Tree)] = tree match {
-        case Apply(s @ Select(New(tpt), n), arg) if (arg.size == 1 && n == nme.CONSTRUCTOR && tpt.symbol.name.toString == "Some") => tpt.tpe match {
-          case TypeRef(_, sym, tpe :: Nil) => Some((tpe, arg(0)))
-          case _ => None
-        }
-        case _ => None
-      }
-    }
-
-    object ExCaseClassConstruction {
-      def unapply(tree: Apply): Option[(Tree,Seq[Tree])] = tree match {
-        case Apply(s @ Select(New(tpt), n), args) if (n == nme.CONSTRUCTOR) => {
-          Some((tpt, args))
-        }
-        case _ => None
-      }
-    }
-
-    object ExIdentifier {
-      def unapply(tree: Ident): Option[(Symbol,Tree)] = tree match {
-        case i: Ident => Some((i.symbol, i))
-        case _ => None
-      }
-    }
-
-    object ExTyped {
-      def unapply(tree : Typed): Option[(Tree,Tree)] = tree match {
-        case Typed(e,t) => Some((e,t))
-        case _ => None
-      }
-    }
-
-    object ExIntIdentifier {
-      def unapply(tree: Ident): Option[String] = tree match {
-        case i: Ident if i.symbol.tpe == IntClass.tpe => Some(i.symbol.name.toString)
-        case _ => None
-      }
-    }
-
-    object ExAnd {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(s @ Select(lhs, _), List(rhs)) if (s.symbol == Boolean_and) =>
-          Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExOr {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(s @ Select(lhs, _), List(rhs)) if (s.symbol == Boolean_or) =>
-          Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExNot {
-      def unapply(tree: Select): Option[Tree] = tree match {
-        case Select(t, n) if (n == nme.UNARY_!) => Some(t)
-        case _ => None
-      }
-    }
-  
-    object ExEquals {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.EQ) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExNotEquals {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.NE) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExLessThan {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.LT) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExLessEqThan {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.LE) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExGreaterThan {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.GT) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExGreaterEqThan {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.GE) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExUMinus {
-      def unapply(tree: Select): Option[Tree] = tree match {
-        case Select(t, n) if (n == nme.UNARY_-) => Some(t)
-        case _ => None
-      }
-    }
-
-    object ExPlus {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.ADD) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExMinus {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.SUB) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExTimes {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.MUL) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExDiv {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == nme.DIV) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExLocalCall {
-      def unapply(tree: Apply): Option[(Symbol,String,List[Tree])] = tree match {
-        case a @ Apply(Select(This(_), nme), args) => Some((a.symbol, nme.toString, args))
-        case _ => None
-      }
-    }
-
-    object ExMethodCall {
-      def unapply(tree: Apply): Option[(Symbol,String,List[Tree])] = tree match {
-        case a @ Apply(Select(_, nme), args) => Some((a.symbol, nme.toString, args))
-        case _ => None
-      }
-    }
-
-    object ExDistinctCall {
-      def unapply(tree: Apply): Option[(Tree,List[Tree])] = tree match {
-        case Apply(
-          TypeApply(Select(Select(cpIdent, definitionsName), distinctName), typeTree :: Nil),
-          args) if definitionsName.toString == "Definitions" && 
-                   distinctName.toString == "distinct" =>
-            Some((typeTree, args))
-        case _ => None
-      }
-    }
-
-    object ExForceCall {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(
-          TypeApply(Select(Select(cpIdent, definitionsName), forceName), List(typeTree)),
-          List(arg)) if definitionsName.toString == "Definitions" && 
-                        forceName.toString == "force" =>
-            Some((typeTree, arg))
-        case _ => None
-      }
-    }
-
-    // extracts a tree typed as L, returns parameter type tree and tree itself
-    object ExLTyped {
-      def unapply(tree: Tree): Option[(Type,Tree)] = {
-        val tpe = if (tree.symbol == null) tree.tpe else tree.symbol.tpe
-        tpe match {
-          case TypeRef(_, sym, List(t)) if sym == lClassSym =>
-            Some((t, tree))
-          case _ => None
-        }
-      }
-    }
-
-    // used for case classes selectors.
-    object ExParameterlessMethodCall {
-      def unapply(tree: Select): Option[(Tree,Name)] = tree match {
-        case Select(lhs, n) => Some((lhs, n))
-        case _ => None
-      }
-    }
-
-    object ExPatternMatching {
-      def unapply(tree: Match): Option[(Tree,List[CaseDef])] =
-        if(tree != null) Some((tree.selector, tree.cases)) else None
-    }
-
-    object ExSetMin {
-      def unapply(tree: Apply) : Option[Tree] = tree match {
-        case Apply(
-          TypeApply(Select(setTree, minName), typeTree :: Nil),
-          ordering :: Nil) if minName.toString == "min" && typeTree.tpe == IntClass.tpe => Some(setTree)
-        case _ => None
-      }
-    }
-
-    object ExSetMax {
-      def unapply(tree: Apply) : Option[Tree] = tree match {
-        case Apply(
-          TypeApply(Select(setTree, maxName), typeTree :: Nil),
-          ordering :: Nil) if maxName.toString == "max" && typeTree.tpe == IntClass.tpe => Some(setTree)
-        case _ => None
-      }
-    }
-
-    object ExEmptySet {
-      def unapply(tree: TypeApply): Option[Tree] = tree match {
-        case TypeApply(
-          Select(
-            Select(
-              Select(
-                Select(Ident(s), collectionName),
-                immutableName),
-              setName),
-            emptyName),  theTypeTree :: Nil) if (
-            collectionName.toString == "collection" && immutableName.toString == "immutable" && setName.toString == "Set" && emptyName.toString == "empty"
-          ) => Some(theTypeTree)
-        case TypeApply(Select(Select(Select(This(scalaName), predefName), setname), applyName), theTypeTree :: Nil)  if ("scala".equals(scalaName.toString) && "Predef".equals(predefName.toString) && "empty".equals(applyName.toString)) => Some(theTypeTree)
-        case _ => None
-      }
-    }
-
-    object ExEmptyMultiset {
-      def unapply(tree: TypeApply): Option[Tree] = tree match {
-        case TypeApply(
-          Select(
-            Select(
-              Select(
-                Select(Ident(s), collectionName),
-                immutableName),
-              setName),
-            emptyName),  theTypeTree :: Nil) if (
-            collectionName.toString == "collection" && immutableName.toString == "immutable" && setName.toString == "Multiset" && emptyName.toString == "empty"
-          ) => Some(theTypeTree)
-        case _ => None
-      }
-    }
-
-    object ExEmptyMap {
-      def unapply(tree: TypeApply): Option[(Tree,Tree)] = tree match {
-        case TypeApply(
-          Select(
-            Select(
-              Select(
-                Select(Ident(s), collectionName),
-                immutableName),
-              mapName),
-            emptyName), fromTypeTree :: toTypeTree :: Nil) if (
-            collectionName.toString == "collection" && immutableName.toString == "immutable" && mapName.toString == "Map" && emptyName.toString == "empty"
-          ) => Some((fromTypeTree, toTypeTree))
-        case TypeApply(Select(Select(Select(This(scalaName), predefName), mapName), emptyName), fromTypeTree :: toTypeTree :: Nil) if (scalaName.toString == "scala" && predefName.toString == "Predef" && emptyName.toString == "empty") => Some((fromTypeTree, toTypeTree))
-        case _ => None
-      }
-    }
-
-    object ExFiniteSet {
-      def unapply(tree: Apply): Option[(Tree,List[Tree])] = tree match {
-        case Apply(TypeApply(Select(Select(Select(Select(Ident(s), collectionName), immutableName), setName), applyName), theTypeTree :: Nil), args) if (collectionName.toString == "collection" && immutableName.toString == "immutable" && setName.toString == "Set" && applyName.toString == "apply") => Some((theTypeTree, args))
-        case Apply(TypeApply(Select(Select(Select(This(scalaName), predefName), setName), applyName), theTypeTree :: Nil), args) if ("scala".equals(scalaName.toString) && "Predef".equals(predefName.toString) && setName.toString == "Set" && "apply".equals(applyName.toString)) => Some((theTypeTree, args))
-        case _ => None
-      }
-    }
-
-    object ExFiniteMultiset {
-      def unapply(tree: Apply): Option[(Tree,List[Tree])] = tree match {
-        case Apply(
-          TypeApply(
-            Select(
-              Select(
-                Select(
-                  Select(Ident(s), collectionName),
-                  immutableName),
-                setName),
-              emptyName),  theTypeTree :: Nil), args) if (
-              collectionName.toString == "collection" && immutableName.toString == "immutable" && setName.toString == "Multiset" && emptyName.toString == "apply"
-            )=> Some(theTypeTree, args)
-        case _ => None
-      }
-    }
-
-    object ExUnion {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == encode("++")/*nme.PLUSPLUS*/) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExPlusPlusPlus {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n.toString == "$plus$plus$plus") => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExIntersection {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == encode("**")) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExSetContains {
-      def unapply(tree: Apply) : Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n.toString == "contains") => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExSetSubset {
-      def unapply(tree: Apply) : Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n.toString == "subsetOf") => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-  
-    object ExSetMinus {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n == encode("--")) => Some((lhs,rhs))
-        case _ => None
-      }
-    }
-
-    object ExSetCard {
-      def unapply(tree: Select): Option[Tree] = tree match {
-        case Select(t, n) if (n.toString == "size") => Some(t)
-        case _ => None
-      }
-    }
-
-    object ExMultisetToSet {
-      def unapply(tree: Select): Option[Tree] = tree match {
-        case Select(t, n) if (n.toString == "toSet") => Some(t)
-        case _ => None
-      }
-    }
-
-    object ExMapUpdated {
-      def unapply(tree: Apply): Option[(Tree,Tree,Tree)] = tree match {
-        case Apply(TypeApply(Select(lhs, n), typeTreeList), List(from, to)) if (n.toString == "updated") => 
-          Some((lhs, from, to))
-        case _ => None
-      }
-    }
-
-    object ExApply {
-      def unapply(tree: Apply): Option[(Tree,List[Tree])] = tree match {
-        case Apply(Select(lhs, n), rhs) if (n.toString == "apply") => Some((lhs, rhs))
-        case _ => None
-      }
-    }
-
-    object ExMapIsDefinedAt {
-      def unapply(tree: Apply): Option[(Tree,Tree)] = tree match {
-        case Apply(Select(lhs, n), List(rhs)) if (n.toString == "isDefinedAt") => Some((lhs, rhs))
-        case _ => None
-      }
-    }
-  }
-}
diff --git a/src/cp/LTrees.scala b/src/cp/LTrees.scala
deleted file mode 100644
index a17832738c99d70bac9b6d9a7fe4993a068f8d31..0000000000000000000000000000000000000000
--- a/src/cp/LTrees.scala
+++ /dev/null
@@ -1,274 +0,0 @@
-package cp
-
-import Terms._
-import ConstraintSolving._
-
-import purescala.Definitions._
-import purescala.Trees._
-import purescala.TypeTrees._
-import purescala.Common._
-
-import scala.collection.generic.FilterMonadic
-import scala.collection.generic.CanBuildFrom
-import scala.collection.GenTraversableOnce
-
-object LTrees {
-  /** Handler for converting values from Expr to Scala and reporting forced
-   * values */
-  trait LHandler[T] {
-    def convert(s: Seq[Expr]): T
-    def enqueueAsForced(ids: Seq[Identifier], values: Seq[Expr]): Unit
-  }
-
-  /* Symbolic variables */
-  object L {
-    def unapply(l: L[_]): Option[Seq[Identifier]] = {
-      if (l == null) None else Some(l.ids)
-    }
-  }
-
-  class L[T](handler: LHandler[T], val ids: Seq[Identifier]) extends {
-    import ConstraintSolving.GlobalContext
-
-    var cache: Option[T] = None
-
-    def value: T = cache match {
-      case Some(value) => value
-      case None =>
-        val model = GlobalContext.findValues(ids)
-        val toRet = handler.convert(model)
-        handler.enqueueAsForced(ids, model)
-        cache = Some(toRet)
-        toRet
-    }
-
-    override def toString: String = cache match {
-      case Some(v) => "L[" + v.toString + "]"
-      case None => "L[" + ids.mkString(",") + "]"
-    }
-  }
-
-  trait LTuple[T] {
-    /* Forces this tuple to have a value */
-    def value: T
-  }
-
-  /** GENERATED CODE ***/
-
-  class LTuple1[T1](l1: L[T1]) extends LTuple[(T1)] {
-    def _1: L[T1] = l1
-    def value: (T1) = (_1.value)
-  }
-  
-  class LTuple2[T1,T2](l1: L[T1],l2: L[T2]) extends LTuple[(T1,T2)] {
-    def _1: L[T1] = l1
-    def _2: L[T2] = l2
-    def value: (T1,T2) = (_1.value,_2.value)
-  }
-  
-  class LTuple3[T1,T2,T3](l1: L[T1],l2: L[T2],l3: L[T3]) extends LTuple[(T1,T2,T3)] {
-    def _1: L[T1] = l1
-    def _2: L[T2] = l2
-    def _3: L[T3] = l3
-    def value: (T1,T2,T3) = (_1.value,_2.value,_3.value)
-  }
-  
-  class LTuple4[T1,T2,T3,T4](l1: L[T1],l2: L[T2],l3: L[T3],l4: L[T4]) extends LTuple[(T1,T2,T3,T4)] {
-    def _1: L[T1] = l1
-    def _2: L[T2] = l2
-    def _3: L[T3] = l3
-    def _4: L[T4] = l4
-    def value: (T1,T2,T3,T4) = (_1.value,_2.value,_3.value,_4.value)
-  }
-  
-  class LTuple5[T1,T2,T3,T4,T5](l1: L[T1],l2: L[T2],l3: L[T3],l4: L[T4],l5: L[T5]) extends LTuple[(T1,T2,T3,T4,T5)] {
-    def _1: L[T1] = l1
-    def _2: L[T2] = l2
-    def _3: L[T3] = l3
-    def _4: L[T4] = l4
-    def _5: L[T5] = l5
-    def value: (T1,T2,T3,T4,T5) = (_1.value,_2.value,_3.value,_4.value,_5.value)
-  }
-  
-  class LTuple6[T1,T2,T3,T4,T5,T6](l1: L[T1],l2: L[T2],l3: L[T3],l4: L[T4],l5: L[T5],l6: L[T6]) extends LTuple[(T1,T2,T3,T4,T5,T6)] {
-    def _1: L[T1] = l1
-    def _2: L[T2] = l2
-    def _3: L[T3] = l3
-    def _4: L[T4] = l4
-    def _5: L[T5] = l5
-    def _6: L[T6] = l6
-    def value: (T1,T2,T3,T4,T5,T6) = (_1.value,_2.value,_3.value,_4.value,_5.value,_6.value)
-  }
-  
-  class LTuple7[T1,T2,T3,T4,T5,T6,T7](l1: L[T1],l2: L[T2],l3: L[T3],l4: L[T4],l5: L[T5],l6: L[T6],l7: L[T7]) extends LTuple[(T1,T2,T3,T4,T5,T6,T7)] {
-    def _1: L[T1] = l1
-    def _2: L[T2] = l2
-    def _3: L[T3] = l3
-    def _4: L[T4] = l4
-    def _5: L[T5] = l5
-    def _6: L[T6] = l6
-    def _7: L[T7] = l7
-    def value: (T1,T2,T3,T4,T5,T6,T7) = (_1.value,_2.value,_3.value,_4.value,_5.value,_6.value,_7.value)
-  }
-  
-  class LTuple8[T1,T2,T3,T4,T5,T6,T7,T8](l1: L[T1],l2: L[T2],l3: L[T3],l4: L[T4],l5: L[T5],l6: L[T6],l7: L[T7],l8: L[T8]) extends LTuple[(T1,T2,T3,T4,T5,T6,T7,T8)] {
-    def _1: L[T1] = l1
-    def _2: L[T2] = l2
-    def _3: L[T3] = l3
-    def _4: L[T4] = l4
-    def _5: L[T5] = l5
-    def _6: L[T6] = l6
-    def _7: L[T7] = l7
-    def _8: L[T8] = l8
-    def value: (T1,T2,T3,T4,T5,T6,T7,T8) = (_1.value,_2.value,_3.value,_4.value,_5.value,_6.value,_7.value,_8.value)
-  }
-  
-  class LTuple9[T1,T2,T3,T4,T5,T6,T7,T8,T9](l1: L[T1],l2: L[T2],l3: L[T3],l4: L[T4],l5: L[T5],l6: L[T6],l7: L[T7],l8: L[T8],l9: L[T9]) extends LTuple[(T1,T2,T3,T4,T5,T6,T7,T8,T9)] {
-    def _1: L[T1] = l1
-    def _2: L[T2] = l2
-    def _3: L[T3] = l3
-    def _4: L[T4] = l4
-    def _5: L[T5] = l5
-    def _6: L[T6] = l6
-    def _7: L[T7] = l7
-    def _8: L[T8] = l8
-    def _9: L[T9] = l9
-    def value: (T1,T2,T3,T4,T5,T6,T7,T8,T9) = (_1.value,_2.value,_3.value,_4.value,_5.value,_6.value,_7.value,_8.value,_9.value)
-  }
-  /** END OF GENERATED CODE ***/
-
-  /** A stream for symbolic variables */
-  class LIterator[T](val constraint: (L[T]) => Constraint[T]) extends Iterator[L[T]] {
-
-    import ConstraintSolving.GlobalContext
-    private var previouslyReturned: Seq[Seq[Identifier]] = Seq.empty
-
-    private var forcedQueue: Seq[Seq[Identifier]] = Seq.empty
-
-    // we don't have this until we first instantiate a constraint
-    private var convertingFunction: (Seq[Expr]) => T = null
-
-    def enqueueAsForcedInStream(ids: Seq[Identifier], values: Seq[Expr]): Unit = {
-      // assert value
-      val haveValues = And((ids zip values) map {
-        case (i, v) => Equals(Variable(i), v)
-      })
-
-      GlobalContext.enqueueAssert(haveValues)
-      forcedQueue = ids +: forcedQueue
-    }
-
-    def removeGuard(ids: Seq[Identifier]): Unit = {
-      val guard = GlobalContext.getGuard(ids)
-
-      // remove from live set
-      assert(GlobalContext.isAlive(guard))
-      GlobalContext.kill(guard)
-
-      // assert not live
-      val noMoreLive = Not(Variable(guard))
-
-      GlobalContext.enqueueAssert(noMoreLive)
-    }
-
-    private def isStillSat(newConsts: Seq[Identifier], newExpr: Expr, otherGuards: Set[Identifier]): Boolean = {
-      // println("in isStillSat: ")
-      // println("newConsts: " + newConsts)
-      // println("newExpr: " + newExpr)
-      // println("otherGuards: " + otherGuards)
-      
-      for (ids <- forcedQueue) {
-        // println("removing from forced queue: " + ids)
-        removeGuard(ids)
-      }
-      forcedQueue = Seq.empty
-
-      val newGuard = FreshIdentifier("live", true).setType(BooleanType)
-
-      GlobalContext.addGuard(newConsts, newGuard)
-
-      val allGuardsForConstraint = (otherGuards ++ Set(newGuard)).toList
-
-      // for all previous sequences of returned identifiers, assert that the new sequence is distinct from them
-      val differentFromPrevious = And(previouslyReturned map (ps => Not(And((ps zip newConsts) map { case (p, n) => Equals(Variable(p), Variable(n)) }))))
-      val toAssert = Implies(Variable(newGuard), And(newExpr, differentFromPrevious))
-      // val toAssert = Implies(Or(allGuardsForConstraint map (Variable(_))), And(newExpr, differentFromPrevious))
-      // println("will assert: " + toAssert)
-      if (GlobalContext.checkAssumptions(toAssert)) {
-        if (!previouslyReturned.isEmpty)
-          assert(GlobalContext.assertConstraint(differentFromPrevious))
-        previouslyReturned = newConsts +: previouslyReturned
-        GlobalContext.enqueueAssert(Implies(Or(allGuardsForConstraint map (Variable(_))), And(newExpr, differentFromPrevious)))
-        true
-      } else {
-        removeGuard(newConsts)
-        false
-      }
-    }
-
-    private def handler(): LHandler[T] = new LHandler[T] {
-      def convert(s: Seq[Expr]): T = convertingFunction(s)
-      def enqueueAsForced(ids: Seq[Identifier], values: Seq[Expr]): Unit =
-        enqueueAsForcedInStream(ids, values)
-    }
-
-    private var underlying: Stream[L[T]] = null
-
-    private def underlyingStream(): Stream[L[T]] = {
-
-      // set of tricks to overcome circular dependency between creation of L's
-      // and Constraints
-
-      val placeHolders = Seq(FreshIdentifier("placeholder", true).setType(BottomType))
-      val candidateL = new L[T](handler(), placeHolders)
-      val instantiatedCnstr = constraint(candidateL)
-
-      // now that we have a Constraint, we can perform some actions such as:
-      GlobalContext.initializeIfNeeded(instantiatedCnstr.program)
-      convertingFunction = instantiatedCnstr.convertingFunction
-
-      val (newConsts, newExpr) = combineConstraint(instantiatedCnstr)
-      val typedPlaceHolders = newConsts map {
-        case cst => FreshIdentifier("?", true).setType(cst.getType)
-      }
-      // println("types : " + typedPlaceHolders.map(_.getType))
-      val subst1 = ((newConsts map (Variable(_))) zip (typedPlaceHolders map (Variable(_)))).toMap
-      val subst2 = ((placeHolders map (Variable(_))) zip (typedPlaceHolders map (Variable(_)))).toMap
-      val replacedExpr = replace(subst1 ++ subst2, newExpr)
-
-      // println("l vars in constraint: " + (instantiatedCnstr.lVars map (_.ids)))
-      val nonSyntheticLVars = instantiatedCnstr.lVars.map(_.ids) -- Set(placeHolders)
-      // println("non-synthetic l vars: " + nonSyntheticLVars)
-      val otherGuards = nonSyntheticLVars.map(ids => GlobalContext.getGuard(ids))
-
-      if (isStillSat(typedPlaceHolders, replacedExpr, otherGuards)) {
-          Stream.cons(new L[T](handler(), typedPlaceHolders), underlyingStream())
-      } else {
-          Stream.empty
-      }
-    }
-
-    private var needEvaluation = true
-    def hasNext: Boolean = { 
-      if (underlying == null) {
-        underlying = underlyingStream()
-        needEvaluation = false
-      }
-      if (needEvaluation) {
-        needEvaluation = false
-        underlying = underlying.tail
-      }
-      val toRet = !underlying.isEmpty
-      toRet
-    }
-    def next: L[T] = {
-      needEvaluation = true
-      underlying.head
-    }
-
-    def withFilter2(p: (L[T]) => Constraint[T]): LIterator[T] = {
-      new LIterator[T]((l: L[T]) => this.constraint(l).asInstanceOf[Constraint1[T]] && p(l).asInstanceOf[Constraint1[T]])
-    }
-  }
-
-}
diff --git a/src/cp/RuntimeMethods.scala b/src/cp/RuntimeMethods.scala
deleted file mode 100644
index 7630866d11d6b95a8454864e40ca39129d8f600a..0000000000000000000000000000000000000000
--- a/src/cp/RuntimeMethods.scala
+++ /dev/null
@@ -1,150 +0,0 @@
-package cp
-
-/** A collection of methods that are called on runtime */
-object RuntimeMethods {
-  import Serialization._
-  import Terms._
-  import Definitions.UnsatisfiableConstraintException
-  import Definitions.UnknownConstraintException
-  import LTrees._
-
-  import purescala.Definitions._
-  import purescala.Trees._
-  import purescala.TypeTrees._
-  import purescala.Common._
-  import purescala.{DefaultReporter,QuietReporter}
-  import purescala.FairZ3Solver
-
-  import purescala.Stopwatch
-  
-  /* WILL BE PORTED TO Terms.scala
-  private def chooseMaximizingExec(program : Program, expr : Expr, outputVars : Seq[Identifier], maxExpr : Expr, inputConstraints : Expr) : Seq[Expr] = {
-    def stop(lo : Int, hi : Option[Int]) : Boolean = hi match {
-      case Some(h) => h - lo <= 2
-      case None => false
-    }
-
-    val solver = newSolver()
-    solver.setProgram(program)
-
-    // invariant : hi is always strictly greater than any sat. maxExpr assignment,
-    // and there is always a sat. assignment >= lo 
-    def maxAux(pivot : Int, lo : Int, hi : Option[Int]) : Map[Identifier, Expr] = {
-      // println("Iterating:")
-      // println("  lo     : " + lo)
-      // println("  pivot  : " + pivot)
-      // println("  hi     : " + (hi match { case Some(h) => h; case None => "+inf"}))
-      // println
-      val toCheck = expr :: inputConstraints :: GreaterEquals(maxExpr, IntLiteral(pivot)) :: Nil
-      val (outcome, model) = solver.restartAndDecideWithModel(And(toCheck), false)
-
-      outcome match {
-        case Some(false) =>
-          // there is a satisfying assignment
-          if (stop(lo, hi)) {
-            model
-          } else {
-            hi match {
-              case None =>
-                // upper bound is +inf
-                maxAux(
-                  if (pivot <= 0) 1 else pivot * 2,
-                  pivot,
-                  None
-                )
-              case Some(hv) =>
-                maxAux(
-                  pivot + (hv - pivot) / 2,
-                  pivot,
-                  hi
-                )
-            }
-          }
-        case _ =>
-          // new hi is pivot
-          maxAux(
-            lo + (pivot - lo) / 2,
-            lo,
-            Some(pivot)
-          )
-      }
-    }
-
-    val maxExprID = purescala.Common.FreshIdentifier("maxExpr").setType(purescala.TypeTrees.Int32Type)
-
-    solver.restartAndDecideWithModel(And(expr :: inputConstraints :: Equals(maxExpr, Variable(maxExprID)) :: Nil), false) match {
-      case (Some(false), model) =>
-        // there is a satisfying assignment
-        val maxExprVal = modelValue(maxExprID, model) match {
-          case IntLiteral(i) => i
-          case e => scala.sys.error("Unexpected value for term to maximize : " + e)
-        }
-
-        val optimalModel = maxAux(maxExprVal, maxExprVal - 1, None)
-        outputVars.map(v => modelValue(v, optimalModel))
-      case (Some(true),_) =>
-        throw new UnsatisfiableConstraintException()
-      case _ =>
-        throw new UnknownConstraintException()
-    }
-  }
-  */
-
-  def skipCounter(i : Int) : Unit = {
-    purescala.Common.FreshIdentifier.forceSkip(i)
-  }
-
-  def copySettings(serializedSettings : Serialized) : Unit = {
-    val recovered = deserialize[RuntimeSettings](serializedSettings)
-  
-    purescala.Settings.experimental         = recovered.experimental
-    purescala.Settings.showIDs              = recovered.showIDs
-    purescala.Settings.noForallAxioms       = recovered.noForallAxioms
-    purescala.Settings.unrollingLevel       = recovered.unrollingLevel
-    purescala.Settings.zeroInlining         = recovered.zeroInlining
-    purescala.Settings.useBAPA              = recovered.useBAPA
-    purescala.Settings.useInstantiator      = recovered.useInstantiator
-    purescala.Settings.useFairInstantiator  = recovered.useFairInstantiator
-    purescala.Settings.useCores             = recovered.useCores
-    purescala.Settings.pruneBranches        = recovered.pruneBranches
-    purescala.Settings.solverTimeout        = recovered.solverTimeout
-    purescala.Settings.bitvectorBitwidth    = recovered.bitvectorBitwidth
-    purescala.Settings.useTemplates         = recovered.useTemplates
-
-    Settings.useScalaEvaluator              = recovered.useScalaEvaluator
-    Settings.verbose                        = recovered.verbose
-  }
-  
-  def inputVar(inputVarList : List[Variable], varName : String) : Variable = {
-    inputVarList.find(_.id.name == varName).getOrElse(scala.sys.error("Could not find input variable '" + varName + "' in list " + inputVarList))
-  }
-
-  def variableFromL[T](l: L[T]): Variable = {
-    val ids = l.ids
-    assert(ids.size == 1)
-    Variable(ids.head)
-  }
-
-  def isSet(a: Any): Boolean = a.isInstanceOf[Set[_]]
-  def isMap(a: Any): Boolean = a.isInstanceOf[Map[_,_]]
-  def isFunction(a: Any): Boolean = a.isInstanceOf[Function1[_,_]]
-
-  def toScalaMap(e: Expr, e2s: (Expr) => Any): Map[_,_] = e match {
-    case FiniteMap(ss) => (ss.map{
-      case SingletonMap(k, v) => (e2s(k), e2s(v))
-    }).toMap
-    case _ => sys.error("Trying to convert " + e + " to a Scala map")
-  }
-
-  def toScalaSet(e: Expr, e2s: (Expr) => Any): Set[_] = e match {
-    case FiniteSet(es) => es.map(e => e2s(e)).toSet
-    case _ => sys.error("Trying to convert " + e + " to a Scala set")
-  }
-
-  def toScalaFunction(e: Expr, e2s: (Expr) => Any): Any = (e, e.getType) match {
-    case (AnonymousFunction(es, ev), FunctionType(fts, tt)) => {
-      throw new Exception("TODO")
-    }
-    case _ => sys.error("Trying to convert " + e + " to a Scala set")
-  }
-}
diff --git a/src/cp/RuntimeSettings.scala b/src/cp/RuntimeSettings.scala
deleted file mode 100644
index 2d800d0d44d80168fce98483a5785827f4088695..0000000000000000000000000000000000000000
--- a/src/cp/RuntimeSettings.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-package cp
-
-class RuntimeSettings extends Serializable {
-  var experimental : Boolean = purescala.Settings.experimental 
-  var showIDs: Boolean = purescala.Settings.showIDs
-  var noForallAxioms: Boolean = purescala.Settings.noForallAxioms
-  var unrollingLevel: Int = purescala.Settings.unrollingLevel
-  var zeroInlining : Boolean = purescala.Settings.zeroInlining 
-  var useBAPA: Boolean = purescala.Settings.useBAPA
-  var useInstantiator: Boolean = purescala.Settings.useInstantiator
-  var useFairInstantiator: Boolean = purescala.Settings.useFairInstantiator
-  var useCores : Boolean = purescala.Settings.useCores 
-  var pruneBranches : Boolean = purescala.Settings.pruneBranches 
-  var solverTimeout : Option[Int] = purescala.Settings.solverTimeout 
-  var luckyTest : Boolean = purescala.Settings.luckyTest 
-  var bitvectorBitwidth : Option[Int] = purescala.Settings.bitvectorBitwidth
-  var useTemplates : Boolean = purescala.Settings.useTemplates
-
-  /* when you add a new parameter here, remember to add it to copySettings in
-   * RuntimeMethods */
-  var useScalaEvaluator : Boolean = Settings.useScalaEvaluator
-  var verbose : Boolean = Settings.verbose
-}
-
-object Settings {
-  var useScalaEvaluator : Boolean = false
-  var verbose : Boolean = false
-}
diff --git a/src/cp/Serialization.scala b/src/cp/Serialization.scala
deleted file mode 100644
index 18c1ecb9524f4e589fc9c965f8b2505a84dc85f9..0000000000000000000000000000000000000000
--- a/src/cp/Serialization.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-package cp
-
-object Serialization {
-  import java.io.{ByteArrayInputStream,ByteArrayOutputStream,ObjectInputStream,ObjectOutputStream}
-  import purescala.Definitions._
-  import purescala.Trees._
-  import purescala.Common.Identifier
-
-  private val cache = new scala.collection.mutable.HashMap[Int,Any]()
-  private val encoding = "Latin1"
-
-  private object UniqueCounter {
-    private var soFar: Int = -1
-
-    def next: Int = {
-      soFar = soFar + 1
-      soFar
-    }
-  }
-
-  case class Serialized(string : String, id : Int)
-
-  def serialize(obj : Any) : Serialized = {
-    val bos = new ByteArrayOutputStream()
-    val oos = new ObjectOutputStream(bos)
-
-    oos.writeObject(obj)
-    oos.flush()
-    bos.close()
-
-    val array = bos.toByteArray
-    val string = new String(array, encoding)
-
-    Serialized(string, UniqueCounter.next)
-  }
-
-  def deserialize[A](serialized : Serialized) : A = {
-    val Serialized(string, id) = serialized
-    cache.get(id) match {
-      case Some(cached) =>
-        cached.asInstanceOf[A]
-      case None =>
-        val bis = new ByteArrayInputStream(string.getBytes(encoding))
-        val ois = new ObjectInputStream(bis)
-
-        val recovered : A = ois.readObject().asInstanceOf[A]
-        bis.close()
-        
-        cache += (id -> recovered)
-        recovered
-    }
-  }
-
-  def getProgram(serialized : Serialized) : Program =
-    deserialize[Program](serialized)
-
-  def getInputVarList(serialized : Serialized) : List[Variable] =
-    deserialize[List[Variable]](serialized)
-}
diff --git a/src/cp/Terms.scala b/src/cp/Terms.scala
deleted file mode 100644
index e0d6fb1c0ca41d4ed8d6f37a1bb842fdfb85ef51..0000000000000000000000000000000000000000
--- a/src/cp/Terms.scala
+++ /dev/null
@@ -1,1731 +0,0 @@
-package cp
-
-import Serialization._
-import Definitions.{UnsatisfiableConstraintException,UnknownConstraintException}
-import ConstraintSolving._
-import LTrees._
-
-import purescala.Definitions._
-import purescala.Trees._
-import purescala.TypeTrees._
-import purescala.Common._
-
-object Terms {
-  /** Terms are functions with domain T (which can be a tuple) and range R */
-  abstract class Term[T,R](val program : Program, val expr : Expr, val types : Seq[TypeTree], val converter : Converter, val lVars: Set[L[_]]) {
-    self => 
-    /** The converting function defines how Expr values returned by the solver
-     * will be converted back to Scala values */
-    val convertingFunction : (Seq[Expr] => T)
-    val evaluator : (Seq[Expr]) => R
-
-    def solve(implicit asConstraint: (Term[T,R]) => Term[T,Boolean]) : T = {
-      convertingFunction(solveExprSeq(asConstraint(this)))
-    }
-
-    def find(implicit asConstraint: (Term[T,R]) => Term[T,Boolean]) : Option[T] = {
-      try {
-        Some(this.solve)
-      } catch {
-        case e: UnsatisfiableConstraintException => None
-        case e: UnknownConstraintException => None
-      }
-    }
-
-    def findAll(implicit asConstraint: (Term[T,R]) => Term[T,Boolean]) : Iterator[T] = {
-      findAllExprSeq(asConstraint(this)).map(convertingFunction(_))
-    }
-
-    def lazyFindAll(implicit asConstraint: (Term[T,R]) => Constraint[T]): LIterator[T] = {
-      new LIterator((l: L[T]) => asConstraint(this))
-    }
-
-    def c(implicit isBoolean : R =:= Boolean) : self.type = this
-    def i(implicit isInt : R =:= Int) : self.type = this
-  }
-
-  def removeGuard(g: Identifier): Unit = {
-    GlobalContext.kill(g)
-    val noMoreLive = Not(Variable(g))
-    GlobalContext.enqueueAssert(noMoreLive)
-  }
-
-  def createL[T](constraint: Constraint[_], constant: Identifier, guard: Identifier): L[T] = {
-    val handler = new LHandler[T] {
-      def convert(s: Seq[Expr]): T = constraint.converter.exprSeq2scala1[T](s)
-      def enqueueAsForced(ids: Seq[Identifier], values: Seq[Expr]): Unit = {
-        val haveValues = And((ids zip values) map {
-          case (i, v) => Equals(Variable(i), v)
-        })
-        GlobalContext.enqueueAssert(haveValues)
-        removeGuard(guard)
-      }
-    }
-    new L[T](handler, Seq(constant))
-  }
-
-  def constantsAndGuards[T](constraint: Constraint[T]): (Seq[Identifier], Seq[Identifier]) = {
-    val (newConsts, newExpr) = combineConstraint(constraint)
-
-    GlobalContext.initializeIfNeeded(constraint.program)
-
-    val newGuards = newConsts map (nc => FreshIdentifier("live", true).setType(BooleanType))
-    (newConsts zip newGuards) map { case (nc, ng) => GlobalContext.addGuard(List(nc), ng) }
-
-    val toAssert = Implies(Or(newGuards map (ng => Variable(ng))), newExpr)
-    if (GlobalContext.checkAssumptions(toAssert)) {
-      // we can return variables and their guards
-      (newConsts, newGuards)
-    } else {
-      // constraint is not satisfiable, remove guard from context
-      newGuards foreach removeGuard
-      throw new UnsatisfiableConstraintException
-    }
-  }
-
-
-  /** This construct represents a constraint with an expression to minimize */
-  abstract class MinConstraint[T](cons : Constraint[_], minFunc : IntTerm[_]) {
-    val convertingFunction : (Seq[Expr] => T)
-
-    def solve : T = {
-      convertingFunction(solveMinimizingExprSeq(cons, minFunc))
-    }
-
-    def find : Option[T] = {
-      try {
-        Some(this.solve)
-      } catch {
-        case e: UnsatisfiableConstraintException => None
-        case e: UnknownConstraintException => None
-      }
-    }
-
-    def findAll : Iterator[T] = {
-      findAllMinimizingExprSeq(cons, minFunc).map(convertingFunction(_))
-    } 
-  }
-
-  /** Contains helper methods for constructing base terms */
-  object Term {
-    // def processArgs(converter : Converter, serializedProg : Serialized, serializedInputVars : Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr]) : (Converter,Program,Expr,Seq[TypeTree],Seq[Identifier]) = {
-    def processArgs(converter : Converter, serializedProg : Serialized, serializedInputVars : Serialized, serializedLVars : Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr]) : (Converter,Program,Expr,Seq[TypeTree]) = {
-      val program : Program             = deserialize[Program](serializedProg)
-      val inputVars : Seq[Variable]     = deserialize[Seq[Variable]](serializedInputVars)
-      val lVars     : Seq[Variable]     = deserialize[Seq[Variable]](serializedLVars)
-      val outputVars : Seq[Identifier]  = deserialize[Seq[Identifier]](serializedOutputVars)
-      val initialExpr : Expr            = deserialize[Expr](serializedExpr)
-
-      val inputVarEnv : Map[Expr,Expr]                 = (inputVars zip inputVarValues).toMap
-      val lVarEnv     : Map[Expr,Expr]                 = (lVars zip lVarValues).toMap
-      val env         : Map[Expr,Expr]                 = inputVarEnv ++ lVarEnv
-      val deBruijnIndices: Seq[DeBruijnIndex]  = outputVars.zipWithIndex.map{ case (v, idx) => DeBruijnIndex(idx).setType(v.getType) }
-      val exprWithIndices: Expr                = replace(((outputVars map (Variable(_))) zip deBruijnIndices).toMap, initialExpr)
-
-      val expr : Expr                          = replace(env, exprWithIndices)
-      val types : Seq[TypeTree]                = outputVars.map(_.getType)
-      (converter, program, expr, types)
-    }
-  }
-
-  /*  this is for Constraint2[A,B]
-  def proj0 : Constraint1[A] = this.asInstanceOf[Constraint] match {
-    case BaseTerm(conv,pr,ex,ts) => {
-      val deBruijnIndices = ts.zipWithIndex.map{ case (t,idx) => DeBruijnIndex(idx).setType(t) }
-      val freshIDs = deBruijnIndices.tail.zipWithIndex.map{ case (dbi, i) => FreshIdentifier("x" + i).setType(dbi.getType) }
-      val subst = deBruijnIndices.tail.zip(freshIDs map (Variable)).toMap[Expr,Expr]
-      new BaseTerm[Boolean](conv, pr, replace(subst, ex), ts.take(1)) with Constraint1[A]
-    }
-    case NotConstraint2(c) => NotConstraint1[A](c.asInstanceOf[Constraint2[A,B]].proj0)
-    case OrConstraint2(cs) => OrConstraint1[A](cs map (c => c.asInstanceOf[Constraint2[A,B]].proj0))
-    case AndConstraint2(cs) => AndConstraint1[A](cs map (c => c.asInstanceOf[Constraint2[A,B]].proj0))
-    case _ => error("Cannot reach this")
-  }
-  */
-
-  // TODO trait and object of arity 0 to be generated too
-  trait Term0[R] extends Term[Unit,R] with Function0[R] {
-    val convertingFunction = converterOf(this).exprSeq2scala0 _
-    type t2c = (Term0[R]) => Term0[Boolean]
-    val scalaFunction : () => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction()
-
-    override def apply() : R = scalaFunction()
-  }
-  
-  object Term0 {
-    def apply[R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized,                serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : () => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr,                inputVarValues, lVarValues)
-      new Term[Unit,R](program, expr, types, converter, lVars.toSet) with Term0[R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-  
-    def apply[R](program : Program, expr : Expr, scalaExpr : () => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[Unit,R](program, expr, types, converter, lVars) with Term0[R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-
-  /** GENERATED CODE: */
-  /** Type aliases for terms with boolean and integer range */
-  type Constraint[T] = Term[T,Boolean]
-  type Constraint0 = Term0[Boolean]
-  type Constraint1[T1] = Term1[T1,Boolean]
-  type Constraint2[T1,T2] = Term2[T1,T2,Boolean]
-  type Constraint3[T1,T2,T3] = Term3[T1,T2,T3,Boolean]
-  type Constraint4[T1,T2,T3,T4] = Term4[T1,T2,T3,T4,Boolean]
-  type Constraint5[T1,T2,T3,T4,T5] = Term5[T1,T2,T3,T4,T5,Boolean]
-  type Constraint6[T1,T2,T3,T4,T5,T6] = Term6[T1,T2,T3,T4,T5,T6,Boolean]
-  type Constraint7[T1,T2,T3,T4,T5,T6,T7] = Term7[T1,T2,T3,T4,T5,T6,T7,Boolean]
-  type Constraint8[T1,T2,T3,T4,T5,T6,T7,T8] = Term8[T1,T2,T3,T4,T5,T6,T7,T8,Boolean]
-  type Constraint9[T1,T2,T3,T4,T5,T6,T7,T8,T9] = Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Boolean]
-  type IntTerm[T] = Term[T,Int]
-  type IntTerm0 = Term0[Int]
-  type IntTerm1[T1] = Term1[T1,Int]
-  type IntTerm2[T1,T2] = Term2[T1,T2,Int]
-  type IntTerm3[T1,T2,T3] = Term3[T1,T2,T3,Int]
-  type IntTerm4[T1,T2,T3,T4] = Term4[T1,T2,T3,T4,Int]
-  type IntTerm5[T1,T2,T3,T4,T5] = Term5[T1,T2,T3,T4,T5,Int]
-  type IntTerm6[T1,T2,T3,T4,T5,T6] = Term6[T1,T2,T3,T4,T5,T6,Int]
-  type IntTerm7[T1,T2,T3,T4,T5,T6,T7] = Term7[T1,T2,T3,T4,T5,T6,T7,Int]
-  type IntTerm8[T1,T2,T3,T4,T5,T6,T7,T8] = Term8[T1,T2,T3,T4,T5,T6,T7,T8,Int]
-  type IntTerm9[T1,T2,T3,T4,T5,T6,T7,T8,T9] = Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Int]
-  
-  trait Term1[T1,R] extends Term[(T1),R] with Function1[T1,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala1[T1] _
-    type t2c = (Term1[T1,R]) => Term1[T1,Boolean]
-    val scalaFunction : (T1) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1])
-  
-    override def apply(x_0 : T1) : R = scalaFunction(x_0)
-  
-    def ||(other : Term1[T1,Boolean])(implicit asBoolean : (R) => Boolean) : Term1[T1,Boolean] = 
-      Term1(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1) => this.scalaFunction(x_0) || other.scalaFunction(x_0), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term1[T1,Boolean])(implicit asBoolean : (R) => Boolean) : Term1[T1,Boolean] = 
-      Term1(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1) => this.scalaFunction(x_0) && other.scalaFunction(x_0), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term1[T1,Boolean] = 
-      Term1(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1) => ! this.scalaFunction(x_0), this.types, this.converter, this.lVars)
-  
-    def +(other : Term1[T1,Int])(implicit asInt : (R) => Int) : Term1[T1,Int] =
-      Term1(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1) => this.scalaFunction(x_0) + other.scalaFunction(x_0), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term1[T1,Int])(implicit asConstraint : t2c) : MinConstraint1[T1] = {
-      MinConstraint1[T1](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term1[T1,R]) => Constraint1[T1]): (L[T1]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term1[A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 1)
-      Term1(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1) => this.scalaFunction(other.scalaFunction(x_0)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2](other : Term2[A1, A2, T1]) : Term2[A1, A2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 2, 1)
-      Term2(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2) => this.scalaFunction(other.scalaFunction(x_0, x_1)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3](other : Term3[A1, A2, A3, T1]) : Term3[A1, A2, A3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 3, 1)
-      Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T1]) : Term4[A1, A2, A3, A4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 4, 1)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T1]) : Term5[A1, A2, A3, A4, A5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 5, 1)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T1]) : Term6[A1, A2, A3, A4, A5, A6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 6, 1)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6, A7](other : Term7[A1, A2, A3, A4, A5, A6, A7, T1]) : Term7[A1, A2, A3, A4, A5, A6, A7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 7, 1)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : A7) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6, A7, A8](other : Term8[A1, A2, A3, A4, A5, A6, A7, A8, T1]) : Term8[A1, A2, A3, A4, A5, A6, A7, A8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 8, 1)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : A7, x_7 : A8) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6, A7, A8, A9](other : Term9[A1, A2, A3, A4, A5, A6, A7, A8, A9, T1]) : Term9[A1, A2, A3, A4, A5, A6, A7, A8, A9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 9, 1)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : A7, x_7 : A8, x_8 : A9) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term2[T1,A1,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term2(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1) => this.scalaFunction(x_0) && other.scalaFunction(x_1), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term3[T1,A1,A2,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,A1,A2,A3,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,A1,A2,A3,A4,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,A1,A2,A3,A4,A5,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,A1,A2,A3,A4,A5,A6,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5,A6,A7](other: Term7[A1,A2,A3,A4,A5,A6,A7,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,A1,A2,A3,A4,A5,A6,A7,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : A7) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5,A6,A7,A8](other: Term8[A1,A2,A3,A4,A5,A6,A7,A8,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,A1,A2,A3,A4,A5,A6,A7,A8,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : A7, x_8 : A8) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  }
-  
-  trait Term2[T1,T2,R] extends Term[(T1,T2),R] with Function2[T1,T2,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala2[T1,T2] _
-    type t2c = (Term2[T1,T2,R]) => Term2[T1,T2,Boolean]
-    val scalaFunction : (T1,T2) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1],converter.expr2scala(s(1)).asInstanceOf[T2])
-  
-    override def apply(x_0 : T1, x_1 : T2) : R = scalaFunction(x_0, x_1)
-  
-    def ||(other : Term2[T1,T2,Boolean])(implicit asBoolean : (R) => Boolean) : Term2[T1,T2,Boolean] = 
-      Term2(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2) => this.scalaFunction(x_0,x_1) || other.scalaFunction(x_0,x_1), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term2[T1,T2,Boolean])(implicit asBoolean : (R) => Boolean) : Term2[T1,T2,Boolean] = 
-      Term2(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2) => this.scalaFunction(x_0,x_1) && other.scalaFunction(x_0,x_1), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term2[T1,T2,Boolean] = 
-      Term2(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1,x_1 : T2) => ! this.scalaFunction(x_0,x_1), this.types, this.converter, this.lVars)
-  
-    def +(other : Term2[T1,T2,Int])(implicit asInt : (R) => Int) : Term2[T1,T2,Int] =
-      Term2(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2) => this.scalaFunction(x_0,x_1) + other.scalaFunction(x_0,x_1), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term2[T1,T2,Int])(implicit asConstraint : t2c) : MinConstraint2[T1,T2] = {
-      MinConstraint2[T1,T2](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term2[T1,T2,R]) => Constraint2[T1,T2]): (L[T1],L[T2]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)),createL[T2](constraint, constants(1), guards(1)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term2[A1, T2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 2)
-      Term2(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : T2) => this.scalaFunction(other.scalaFunction(x_0), x_1), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1](other : Term1[A1, T2]) : Term2[T1, A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 1, 2)
-      Term2(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1) => this.scalaFunction(x_0, other.scalaFunction(x_1)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2](other : Term2[A1, A2, T1]) : Term3[A1, A2, T2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 2, 2)
-      Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : T2) => this.scalaFunction(other.scalaFunction(x_0, x_1), x_2), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2](other : Term2[A1, A2, T2]) : Term3[T1, A1, A2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 2, 2)
-      Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3](other : Term3[A1, A2, A3, T1]) : Term4[A1, A2, A3, T2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 3, 2)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : T2) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2), x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3](other : Term3[A1, A2, A3, T2]) : Term4[T1, A1, A2, A3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 3, 2)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T1]) : Term5[A1, A2, A3, A4, T2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 4, 2)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : T2) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3), x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T2]) : Term5[T1, A1, A2, A3, A4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 4, 2)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T1]) : Term6[A1, A2, A3, A4, A5, T2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 5, 2)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : T2) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4), x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T2]) : Term6[T1, A1, A2, A3, A4, A5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 5, 2)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T1]) : Term7[A1, A2, A3, A4, A5, A6, T2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 6, 2)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : T2) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5), x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T2]) : Term7[T1, A1, A2, A3, A4, A5, A6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 6, 2)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6, A7](other : Term7[A1, A2, A3, A4, A5, A6, A7, T1]) : Term8[A1, A2, A3, A4, A5, A6, A7, T2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 7, 2)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : A7, x_7 : T2) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6), x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5, A6, A7](other : Term7[A1, A2, A3, A4, A5, A6, A7, T2]) : Term8[T1, A1, A2, A3, A4, A5, A6, A7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 7, 2)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : A7) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6, x_7)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6, A7, A8](other : Term8[A1, A2, A3, A4, A5, A6, A7, A8, T1]) : Term9[A1, A2, A3, A4, A5, A6, A7, A8, T2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 8, 2)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : A7, x_7 : A8, x_8 : T2) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7), x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5, A6, A7, A8](other : Term8[A1, A2, A3, A4, A5, A6, A7, A8, T2]) : Term9[T1, A1, A2, A3, A4, A5, A6, A7, A8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 8, 2)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : A7, x_8 : A8) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term3[T1,T2,A1,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,T2,A1,A2,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,A1,A2,A3,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,A1,A2,A3,A4,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,A1,A2,A3,A4,A5,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,A1,A2,A3,A4,A5,A6,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : A6) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5,A6,A7](other: Term7[A1,A2,A3,A4,A5,A6,A7,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,A1,A2,A3,A4,A5,A6,A7,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : A6, x_8 : A7) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  }
-  
-  trait Term3[T1,T2,T3,R] extends Term[(T1,T2,T3),R] with Function3[T1,T2,T3,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala3[T1,T2,T3] _
-    type t2c = (Term3[T1,T2,T3,R]) => Term3[T1,T2,T3,Boolean]
-    val scalaFunction : (T1,T2,T3) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1],converter.expr2scala(s(1)).asInstanceOf[T2],converter.expr2scala(s(2)).asInstanceOf[T3])
-  
-    override def apply(x_0 : T1, x_1 : T2, x_2 : T3) : R = scalaFunction(x_0, x_1, x_2)
-  
-    def ||(other : Term3[T1,T2,T3,Boolean])(implicit asBoolean : (R) => Boolean) : Term3[T1,T2,T3,Boolean] = 
-      Term3(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3) => this.scalaFunction(x_0,x_1,x_2) || other.scalaFunction(x_0,x_1,x_2), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term3[T1,T2,T3,Boolean])(implicit asBoolean : (R) => Boolean) : Term3[T1,T2,T3,Boolean] = 
-      Term3(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3) => this.scalaFunction(x_0,x_1,x_2) && other.scalaFunction(x_0,x_1,x_2), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term3[T1,T2,T3,Boolean] = 
-      Term3(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3) => ! this.scalaFunction(x_0,x_1,x_2), this.types, this.converter, this.lVars)
-  
-    def +(other : Term3[T1,T2,T3,Int])(implicit asInt : (R) => Int) : Term3[T1,T2,T3,Int] =
-      Term3(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3) => this.scalaFunction(x_0,x_1,x_2) + other.scalaFunction(x_0,x_1,x_2), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term3[T1,T2,T3,Int])(implicit asConstraint : t2c) : MinConstraint3[T1,T2,T3] = {
-      MinConstraint3[T1,T2,T3](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term3[T1,T2,T3,R]) => Constraint3[T1,T2,T3]): (L[T1],L[T2],L[T3]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)),createL[T2](constraint, constants(1), guards(1)),createL[T3](constraint, constants(2), guards(2)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term3[A1, T2, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 3)
-      Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : T2, x_2 : T3) => this.scalaFunction(other.scalaFunction(x_0), x_1, x_2), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1](other : Term1[A1, T2]) : Term3[T1, A1, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 1, 3)
-      Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : T3) => this.scalaFunction(x_0, other.scalaFunction(x_1), x_2), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1](other : Term1[A1, T3]) : Term3[T1, T2, A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 1, 3)
-      Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2](other : Term2[A1, A2, T1]) : Term4[A1, A2, T2, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 2, 3)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : T2, x_3 : T3) => this.scalaFunction(other.scalaFunction(x_0, x_1), x_2, x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2](other : Term2[A1, A2, T2]) : Term4[T1, A1, A2, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 2, 3)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : T3) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2), x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2](other : Term2[A1, A2, T3]) : Term4[T1, T2, A1, A2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 2, 3)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3](other : Term3[A1, A2, A3, T1]) : Term5[A1, A2, A3, T2, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 3, 3)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : T2, x_4 : T3) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2), x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3](other : Term3[A1, A2, A3, T2]) : Term5[T1, A1, A2, A3, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 3, 3)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : T3) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3), x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3](other : Term3[A1, A2, A3, T3]) : Term5[T1, T2, A1, A2, A3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 3, 3)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T1]) : Term6[A1, A2, A3, A4, T2, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 4, 3)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : T2, x_5 : T3) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3), x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T2]) : Term6[T1, A1, A2, A3, A4, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 4, 3)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : T3) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4), x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T3]) : Term6[T1, T2, A1, A2, A3, A4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 4, 3)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T1]) : Term7[A1, A2, A3, A4, A5, T2, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 5, 3)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : T2, x_6 : T3) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4), x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T2]) : Term7[T1, A1, A2, A3, A4, A5, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 5, 3)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : T3) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5), x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T3]) : Term7[T1, T2, A1, A2, A3, A4, A5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 5, 3)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5, x_6)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T1]) : Term8[A1, A2, A3, A4, A5, A6, T2, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 6, 3)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : T2, x_7 : T3) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5), x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T2]) : Term8[T1, A1, A2, A3, A4, A5, A6, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 6, 3)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : T3) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6), x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T3]) : Term8[T1, T2, A1, A2, A3, A4, A5, A6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 6, 3)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : A6) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5, x_6, x_7)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6, A7](other : Term7[A1, A2, A3, A4, A5, A6, A7, T1]) : Term9[A1, A2, A3, A4, A5, A6, A7, T2, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 7, 3)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : A7, x_7 : T2, x_8 : T3) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6), x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5, A6, A7](other : Term7[A1, A2, A3, A4, A5, A6, A7, T2]) : Term9[T1, A1, A2, A3, A4, A5, A6, A7, T3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 7, 3)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : A7, x_8 : T3) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6, x_7), x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4, A5, A6, A7](other : Term7[A1, A2, A3, A4, A5, A6, A7, T3]) : Term9[T1, T2, A1, A2, A3, A4, A5, A6, A7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 7, 3)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : A6, x_8 : A7) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,T2,T3,A1,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,T3,A1,A2,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,A1,A2,A3,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,A1,A2,A3,A4,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,A1,A2,A3,A4,A5,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : A5) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,A1,A2,A3,A4,A5,A6,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : A5, x_8 : A6) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  }
-  
-  trait Term4[T1,T2,T3,T4,R] extends Term[(T1,T2,T3,T4),R] with Function4[T1,T2,T3,T4,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala4[T1,T2,T3,T4] _
-    type t2c = (Term4[T1,T2,T3,T4,R]) => Term4[T1,T2,T3,T4,Boolean]
-    val scalaFunction : (T1,T2,T3,T4) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1],converter.expr2scala(s(1)).asInstanceOf[T2],converter.expr2scala(s(2)).asInstanceOf[T3],converter.expr2scala(s(3)).asInstanceOf[T4])
-  
-    override def apply(x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4) : R = scalaFunction(x_0, x_1, x_2, x_3)
-  
-    def ||(other : Term4[T1,T2,T3,T4,Boolean])(implicit asBoolean : (R) => Boolean) : Term4[T1,T2,T3,T4,Boolean] = 
-      Term4(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4) => this.scalaFunction(x_0,x_1,x_2,x_3) || other.scalaFunction(x_0,x_1,x_2,x_3), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term4[T1,T2,T3,T4,Boolean])(implicit asBoolean : (R) => Boolean) : Term4[T1,T2,T3,T4,Boolean] = 
-      Term4(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4) => this.scalaFunction(x_0,x_1,x_2,x_3) && other.scalaFunction(x_0,x_1,x_2,x_3), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term4[T1,T2,T3,T4,Boolean] = 
-      Term4(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4) => ! this.scalaFunction(x_0,x_1,x_2,x_3), this.types, this.converter, this.lVars)
-  
-    def +(other : Term4[T1,T2,T3,T4,Int])(implicit asInt : (R) => Int) : Term4[T1,T2,T3,T4,Int] =
-      Term4(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4) => this.scalaFunction(x_0,x_1,x_2,x_3) + other.scalaFunction(x_0,x_1,x_2,x_3), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term4[T1,T2,T3,T4,Int])(implicit asConstraint : t2c) : MinConstraint4[T1,T2,T3,T4] = {
-      MinConstraint4[T1,T2,T3,T4](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term4[T1,T2,T3,T4,R]) => Constraint4[T1,T2,T3,T4]): (L[T1],L[T2],L[T3],L[T4]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)),createL[T2](constraint, constants(1), guards(1)),createL[T3](constraint, constants(2), guards(2)),createL[T4](constraint, constants(3), guards(3)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term4[A1, T2, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 4)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : T2, x_2 : T3, x_3 : T4) => this.scalaFunction(other.scalaFunction(x_0), x_1, x_2, x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1](other : Term1[A1, T2]) : Term4[T1, A1, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 1, 4)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : T3, x_3 : T4) => this.scalaFunction(x_0, other.scalaFunction(x_1), x_2, x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1](other : Term1[A1, T3]) : Term4[T1, T2, A1, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 1, 4)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : T4) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2), x_3), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1](other : Term1[A1, T4]) : Term4[T1, T2, T3, A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 1, 4)
-      Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2](other : Term2[A1, A2, T1]) : Term5[A1, A2, T2, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 2, 4)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : T2, x_3 : T3, x_4 : T4) => this.scalaFunction(other.scalaFunction(x_0, x_1), x_2, x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2](other : Term2[A1, A2, T2]) : Term5[T1, A1, A2, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 2, 4)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : T3, x_4 : T4) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2), x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2](other : Term2[A1, A2, T3]) : Term5[T1, T2, A1, A2, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 2, 4)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : T4) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3), x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2](other : Term2[A1, A2, T4]) : Term5[T1, T2, T3, A1, A2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 2, 4)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3](other : Term3[A1, A2, A3, T1]) : Term6[A1, A2, A3, T2, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 3, 4)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : T2, x_4 : T3, x_5 : T4) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2), x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3](other : Term3[A1, A2, A3, T2]) : Term6[T1, A1, A2, A3, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 3, 4)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : T3, x_5 : T4) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3), x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3](other : Term3[A1, A2, A3, T3]) : Term6[T1, T2, A1, A2, A3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 3, 4)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : T4) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4), x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3](other : Term3[A1, A2, A3, T4]) : Term6[T1, T2, T3, A1, A2, A3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 3, 4)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T1]) : Term7[A1, A2, A3, A4, T2, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 4, 4)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : T2, x_5 : T3, x_6 : T4) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3), x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T2]) : Term7[T1, A1, A2, A3, A4, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 4, 4)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : T3, x_6 : T4) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4), x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T3]) : Term7[T1, T2, A1, A2, A3, A4, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 4, 4)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : T4) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5), x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T4]) : Term7[T1, T2, T3, A1, A2, A3, A4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 4, 4)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5, x_6)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T1]) : Term8[A1, A2, A3, A4, A5, T2, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 5, 4)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : T2, x_6 : T3, x_7 : T4) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4), x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T2]) : Term8[T1, A1, A2, A3, A4, A5, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 5, 4)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : T3, x_7 : T4) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5), x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T3]) : Term8[T1, T2, A1, A2, A3, A4, A5, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 5, 4)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : T4) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5, x_6), x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T4]) : Term8[T1, T2, T3, A1, A2, A3, A4, A5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 5, 4)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : A5) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5, x_6, x_7)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T1]) : Term9[A1, A2, A3, A4, A5, A6, T2, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 6, 4)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : T2, x_7 : T3, x_8 : T4) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5), x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T2]) : Term9[T1, A1, A2, A3, A4, A5, A6, T3, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 6, 4)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : T3, x_8 : T4) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6), x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T3]) : Term9[T1, T2, A1, A2, A3, A4, A5, A6, T4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 6, 4)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : A6, x_8 : T4) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5, x_6, x_7), x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3, A4, A5, A6](other : Term6[A1, A2, A3, A4, A5, A6, T4]) : Term9[T1, T2, T3, A1, A2, A3, A4, A5, A6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 6, 4)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : A5, x_8 : A6) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,T3,T4,A1,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,T4,A1,A2,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,A1,A2,A3,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,A1,A2,A3,A4,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : A4) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,A1,A2,A3,A4,A5,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : A4, x_8 : A5) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  }
-  
-  trait Term5[T1,T2,T3,T4,T5,R] extends Term[(T1,T2,T3,T4,T5),R] with Function5[T1,T2,T3,T4,T5,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala5[T1,T2,T3,T4,T5] _
-    type t2c = (Term5[T1,T2,T3,T4,T5,R]) => Term5[T1,T2,T3,T4,T5,Boolean]
-    val scalaFunction : (T1,T2,T3,T4,T5) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1],converter.expr2scala(s(1)).asInstanceOf[T2],converter.expr2scala(s(2)).asInstanceOf[T3],converter.expr2scala(s(3)).asInstanceOf[T4],converter.expr2scala(s(4)).asInstanceOf[T5])
-  
-    override def apply(x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5) : R = scalaFunction(x_0, x_1, x_2, x_3, x_4)
-  
-    def ||(other : Term5[T1,T2,T3,T4,T5,Boolean])(implicit asBoolean : (R) => Boolean) : Term5[T1,T2,T3,T4,T5,Boolean] = 
-      Term5(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4) || other.scalaFunction(x_0,x_1,x_2,x_3,x_4), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term5[T1,T2,T3,T4,T5,Boolean])(implicit asBoolean : (R) => Boolean) : Term5[T1,T2,T3,T4,T5,Boolean] = 
-      Term5(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4) && other.scalaFunction(x_0,x_1,x_2,x_3,x_4), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term5[T1,T2,T3,T4,T5,Boolean] = 
-      Term5(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5) => ! this.scalaFunction(x_0,x_1,x_2,x_3,x_4), this.types, this.converter, this.lVars)
-  
-    def +(other : Term5[T1,T2,T3,T4,T5,Int])(implicit asInt : (R) => Int) : Term5[T1,T2,T3,T4,T5,Int] =
-      Term5(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4) + other.scalaFunction(x_0,x_1,x_2,x_3,x_4), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term5[T1,T2,T3,T4,T5,Int])(implicit asConstraint : t2c) : MinConstraint5[T1,T2,T3,T4,T5] = {
-      MinConstraint5[T1,T2,T3,T4,T5](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term5[T1,T2,T3,T4,T5,R]) => Constraint5[T1,T2,T3,T4,T5]): (L[T1],L[T2],L[T3],L[T4],L[T5]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)),createL[T2](constraint, constants(1), guards(1)),createL[T3](constraint, constants(2), guards(2)),createL[T4](constraint, constants(3), guards(3)),createL[T5](constraint, constants(4), guards(4)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term5[A1, T2, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 5)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5) => this.scalaFunction(other.scalaFunction(x_0), x_1, x_2, x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1](other : Term1[A1, T2]) : Term5[T1, A1, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 1, 5)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : T3, x_3 : T4, x_4 : T5) => this.scalaFunction(x_0, other.scalaFunction(x_1), x_2, x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1](other : Term1[A1, T3]) : Term5[T1, T2, A1, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 1, 5)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : T4, x_4 : T5) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2), x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1](other : Term1[A1, T4]) : Term5[T1, T2, T3, A1, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 1, 5)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : T5) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3), x_4), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1](other : Term1[A1, T5]) : Term5[T1, T2, T3, T4, A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 1, 5)
-      Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2](other : Term2[A1, A2, T1]) : Term6[A1, A2, T2, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 2, 5)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : T2, x_3 : T3, x_4 : T4, x_5 : T5) => this.scalaFunction(other.scalaFunction(x_0, x_1), x_2, x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2](other : Term2[A1, A2, T2]) : Term6[T1, A1, A2, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 2, 5)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : T3, x_4 : T4, x_5 : T5) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2), x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2](other : Term2[A1, A2, T3]) : Term6[T1, T2, A1, A2, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 2, 5)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : T4, x_5 : T5) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3), x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2](other : Term2[A1, A2, T4]) : Term6[T1, T2, T3, A1, A2, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 2, 5)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : T5) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4), x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2](other : Term2[A1, A2, T5]) : Term6[T1, T2, T3, T4, A1, A2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 2, 5)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3](other : Term3[A1, A2, A3, T1]) : Term7[A1, A2, A3, T2, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 3, 5)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : T2, x_4 : T3, x_5 : T4, x_6 : T5) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2), x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3](other : Term3[A1, A2, A3, T2]) : Term7[T1, A1, A2, A3, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 3, 5)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : T3, x_5 : T4, x_6 : T5) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3), x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3](other : Term3[A1, A2, A3, T3]) : Term7[T1, T2, A1, A2, A3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 3, 5)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : T4, x_6 : T5) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4), x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3](other : Term3[A1, A2, A3, T4]) : Term7[T1, T2, T3, A1, A2, A3, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 3, 5)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : T5) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5), x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2, A3](other : Term3[A1, A2, A3, T5]) : Term7[T1, T2, T3, T4, A1, A2, A3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 3, 5)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5, x_6)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T1]) : Term8[A1, A2, A3, A4, T2, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 4, 5)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : T2, x_5 : T3, x_6 : T4, x_7 : T5) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3), x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T2]) : Term8[T1, A1, A2, A3, A4, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 4, 5)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : T3, x_6 : T4, x_7 : T5) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4), x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T3]) : Term8[T1, T2, A1, A2, A3, A4, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 4, 5)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : T4, x_7 : T5) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5), x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T4]) : Term8[T1, T2, T3, A1, A2, A3, A4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 4, 5)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : T5) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5, x_6), x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T5]) : Term8[T1, T2, T3, T4, A1, A2, A3, A4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 4, 5)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : A4) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5, x_6, x_7)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T1]) : Term9[A1, A2, A3, A4, A5, T2, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 5, 5)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : T2, x_6 : T3, x_7 : T4, x_8 : T5) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4), x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T2]) : Term9[T1, A1, A2, A3, A4, A5, T3, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 5, 5)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : T3, x_7 : T4, x_8 : T5) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5), x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T3]) : Term9[T1, T2, A1, A2, A3, A4, A5, T4, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 5, 5)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : T4, x_8 : T5) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5, x_6), x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T4]) : Term9[T1, T2, T3, A1, A2, A3, A4, A5, T5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 5, 5)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : A5, x_8 : T5) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5, x_6, x_7), x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2, A3, A4, A5](other : Term5[A1, A2, A3, A4, A5, T5]) : Term9[T1, T2, T3, T4, A1, A2, A3, A4, A5, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 5, 5)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : A4, x_8 : A5) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,T4,T5,A1,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4) && other.scalaFunction(x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,T5,A1,A2,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4) && other.scalaFunction(x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,A1,A2,A3,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4) && other.scalaFunction(x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,A1,A2,A3,A4,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : A3, x_8 : A4) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4) && other.scalaFunction(x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  }
-  
-  trait Term6[T1,T2,T3,T4,T5,T6,R] extends Term[(T1,T2,T3,T4,T5,T6),R] with Function6[T1,T2,T3,T4,T5,T6,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala6[T1,T2,T3,T4,T5,T6] _
-    type t2c = (Term6[T1,T2,T3,T4,T5,T6,R]) => Term6[T1,T2,T3,T4,T5,T6,Boolean]
-    val scalaFunction : (T1,T2,T3,T4,T5,T6) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1],converter.expr2scala(s(1)).asInstanceOf[T2],converter.expr2scala(s(2)).asInstanceOf[T3],converter.expr2scala(s(3)).asInstanceOf[T4],converter.expr2scala(s(4)).asInstanceOf[T5],converter.expr2scala(s(5)).asInstanceOf[T6])
-  
-    override def apply(x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6) : R = scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5)
-  
-    def ||(other : Term6[T1,T2,T3,T4,T5,T6,Boolean])(implicit asBoolean : (R) => Boolean) : Term6[T1,T2,T3,T4,T5,T6,Boolean] = 
-      Term6(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5) || other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term6[T1,T2,T3,T4,T5,T6,Boolean])(implicit asBoolean : (R) => Boolean) : Term6[T1,T2,T3,T4,T5,T6,Boolean] = 
-      Term6(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5) && other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term6[T1,T2,T3,T4,T5,T6,Boolean] = 
-      Term6(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6) => ! this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5), this.types, this.converter, this.lVars)
-  
-    def +(other : Term6[T1,T2,T3,T4,T5,T6,Int])(implicit asInt : (R) => Int) : Term6[T1,T2,T3,T4,T5,T6,Int] =
-      Term6(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5) + other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term6[T1,T2,T3,T4,T5,T6,Int])(implicit asConstraint : t2c) : MinConstraint6[T1,T2,T3,T4,T5,T6] = {
-      MinConstraint6[T1,T2,T3,T4,T5,T6](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term6[T1,T2,T3,T4,T5,T6,R]) => Constraint6[T1,T2,T3,T4,T5,T6]): (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)),createL[T2](constraint, constants(1), guards(1)),createL[T3](constraint, constants(2), guards(2)),createL[T4](constraint, constants(3), guards(3)),createL[T5](constraint, constants(4), guards(4)),createL[T6](constraint, constants(5), guards(5)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term6[A1, T2, T3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 6)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6) => this.scalaFunction(other.scalaFunction(x_0), x_1, x_2, x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1](other : Term1[A1, T2]) : Term6[T1, A1, T3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 1, 6)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6) => this.scalaFunction(x_0, other.scalaFunction(x_1), x_2, x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1](other : Term1[A1, T3]) : Term6[T1, T2, A1, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 1, 6)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : T4, x_4 : T5, x_5 : T6) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2), x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1](other : Term1[A1, T4]) : Term6[T1, T2, T3, A1, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 1, 6)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : T5, x_5 : T6) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3), x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1](other : Term1[A1, T5]) : Term6[T1, T2, T3, T4, A1, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 1, 6)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : T6) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4), x_5), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1](other : Term1[A1, T6]) : Term6[T1, T2, T3, T4, T5, A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 1, 6)
-      Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2](other : Term2[A1, A2, T1]) : Term7[A1, A2, T2, T3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 2, 6)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : T2, x_3 : T3, x_4 : T4, x_5 : T5, x_6 : T6) => this.scalaFunction(other.scalaFunction(x_0, x_1), x_2, x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2](other : Term2[A1, A2, T2]) : Term7[T1, A1, A2, T3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 2, 6)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : T3, x_4 : T4, x_5 : T5, x_6 : T6) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2), x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2](other : Term2[A1, A2, T3]) : Term7[T1, T2, A1, A2, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 2, 6)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : T4, x_5 : T5, x_6 : T6) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3), x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2](other : Term2[A1, A2, T4]) : Term7[T1, T2, T3, A1, A2, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 2, 6)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : T5, x_6 : T6) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4), x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2](other : Term2[A1, A2, T5]) : Term7[T1, T2, T3, T4, A1, A2, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 2, 6)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : T6) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5), x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1, A2](other : Term2[A1, A2, T6]) : Term7[T1, T2, T3, T4, T5, A1, A2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 2, 6)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5, x_6)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3](other : Term3[A1, A2, A3, T1]) : Term8[A1, A2, A3, T2, T3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 3, 6)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : T2, x_4 : T3, x_5 : T4, x_6 : T5, x_7 : T6) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2), x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3](other : Term3[A1, A2, A3, T2]) : Term8[T1, A1, A2, A3, T3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 3, 6)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : T3, x_5 : T4, x_6 : T5, x_7 : T6) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3), x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3](other : Term3[A1, A2, A3, T3]) : Term8[T1, T2, A1, A2, A3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 3, 6)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : T4, x_6 : T5, x_7 : T6) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4), x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3](other : Term3[A1, A2, A3, T4]) : Term8[T1, T2, T3, A1, A2, A3, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 3, 6)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : T5, x_7 : T6) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5), x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2, A3](other : Term3[A1, A2, A3, T5]) : Term8[T1, T2, T3, T4, A1, A2, A3, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 3, 6)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : T6) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5, x_6), x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1, A2, A3](other : Term3[A1, A2, A3, T6]) : Term8[T1, T2, T3, T4, T5, A1, A2, A3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 3, 6)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5, x_6, x_7)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T1]) : Term9[A1, A2, A3, A4, T2, T3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 4, 6)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : T2, x_5 : T3, x_6 : T4, x_7 : T5, x_8 : T6) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3), x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T2]) : Term9[T1, A1, A2, A3, A4, T3, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 4, 6)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : T3, x_6 : T4, x_7 : T5, x_8 : T6) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4), x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T3]) : Term9[T1, T2, A1, A2, A3, A4, T4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 4, 6)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : T4, x_7 : T5, x_8 : T6) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5), x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T4]) : Term9[T1, T2, T3, A1, A2, A3, A4, T5, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 4, 6)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : T5, x_8 : T6) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5, x_6), x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T5]) : Term9[T1, T2, T3, T4, A1, A2, A3, A4, T6, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 4, 6)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : A4, x_8 : T6) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5, x_6, x_7), x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1, A2, A3, A4](other : Term4[A1, A2, A3, A4, T6]) : Term9[T1, T2, T3, T4, T5, A1, A2, A3, A4, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 4, 6)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : A3, x_8 : A4) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,T5,T6,A1,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5) && other.scalaFunction(x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,T6,A1,A2,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5) && other.scalaFunction(x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,A1,A2,A3,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : A2, x_8 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5) && other.scalaFunction(x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  }
-  
-  trait Term7[T1,T2,T3,T4,T5,T6,T7,R] extends Term[(T1,T2,T3,T4,T5,T6,T7),R] with Function7[T1,T2,T3,T4,T5,T6,T7,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala7[T1,T2,T3,T4,T5,T6,T7] _
-    type t2c = (Term7[T1,T2,T3,T4,T5,T6,T7,R]) => Term7[T1,T2,T3,T4,T5,T6,T7,Boolean]
-    val scalaFunction : (T1,T2,T3,T4,T5,T6,T7) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1],converter.expr2scala(s(1)).asInstanceOf[T2],converter.expr2scala(s(2)).asInstanceOf[T3],converter.expr2scala(s(3)).asInstanceOf[T4],converter.expr2scala(s(4)).asInstanceOf[T5],converter.expr2scala(s(5)).asInstanceOf[T6],converter.expr2scala(s(6)).asInstanceOf[T7])
-  
-    override def apply(x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7) : R = scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6)
-  
-    def ||(other : Term7[T1,T2,T3,T4,T5,T6,T7,Boolean])(implicit asBoolean : (R) => Boolean) : Term7[T1,T2,T3,T4,T5,T6,T7,Boolean] = 
-      Term7(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6) || other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term7[T1,T2,T3,T4,T5,T6,T7,Boolean])(implicit asBoolean : (R) => Boolean) : Term7[T1,T2,T3,T4,T5,T6,T7,Boolean] = 
-      Term7(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6) && other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term7[T1,T2,T3,T4,T5,T6,T7,Boolean] = 
-      Term7(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7) => ! this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6), this.types, this.converter, this.lVars)
-  
-    def +(other : Term7[T1,T2,T3,T4,T5,T6,T7,Int])(implicit asInt : (R) => Int) : Term7[T1,T2,T3,T4,T5,T6,T7,Int] =
-      Term7(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6) + other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term7[T1,T2,T3,T4,T5,T6,T7,Int])(implicit asConstraint : t2c) : MinConstraint7[T1,T2,T3,T4,T5,T6,T7] = {
-      MinConstraint7[T1,T2,T3,T4,T5,T6,T7](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term7[T1,T2,T3,T4,T5,T6,T7,R]) => Constraint7[T1,T2,T3,T4,T5,T6,T7]): (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)),createL[T2](constraint, constants(1), guards(1)),createL[T3](constraint, constants(2), guards(2)),createL[T4](constraint, constants(3), guards(3)),createL[T5](constraint, constants(4), guards(4)),createL[T6](constraint, constants(5), guards(5)),createL[T7](constraint, constants(6), guards(6)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term7[A1, T2, T3, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 7)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7) => this.scalaFunction(other.scalaFunction(x_0), x_1, x_2, x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1](other : Term1[A1, T2]) : Term7[T1, A1, T3, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 1, 7)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7) => this.scalaFunction(x_0, other.scalaFunction(x_1), x_2, x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1](other : Term1[A1, T3]) : Term7[T1, T2, A1, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 1, 7)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2), x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1](other : Term1[A1, T4]) : Term7[T1, T2, T3, A1, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 1, 7)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : T5, x_5 : T6, x_6 : T7) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3), x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1](other : Term1[A1, T5]) : Term7[T1, T2, T3, T4, A1, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 1, 7)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : T6, x_6 : T7) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4), x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1](other : Term1[A1, T6]) : Term7[T1, T2, T3, T4, T5, A1, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 1, 7)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : T7) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5), x_6), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose6[A1](other : Term1[A1, T7]) : Term7[T1, T2, T3, T4, T5, T6, A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 6, 1, 7)
-      Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, other.scalaFunction(x_6)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2](other : Term2[A1, A2, T1]) : Term8[A1, A2, T2, T3, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 2, 7)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : T2, x_3 : T3, x_4 : T4, x_5 : T5, x_6 : T6, x_7 : T7) => this.scalaFunction(other.scalaFunction(x_0, x_1), x_2, x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2](other : Term2[A1, A2, T2]) : Term8[T1, A1, A2, T3, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 2, 7)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : T3, x_4 : T4, x_5 : T5, x_6 : T6, x_7 : T7) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2), x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2](other : Term2[A1, A2, T3]) : Term8[T1, T2, A1, A2, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 2, 7)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : T4, x_5 : T5, x_6 : T6, x_7 : T7) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3), x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2](other : Term2[A1, A2, T4]) : Term8[T1, T2, T3, A1, A2, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 2, 7)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : T5, x_6 : T6, x_7 : T7) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4), x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2](other : Term2[A1, A2, T5]) : Term8[T1, T2, T3, T4, A1, A2, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 2, 7)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : T6, x_7 : T7) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5), x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1, A2](other : Term2[A1, A2, T6]) : Term8[T1, T2, T3, T4, T5, A1, A2, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 2, 7)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : T7) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5, x_6), x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose6[A1, A2](other : Term2[A1, A2, T7]) : Term8[T1, T2, T3, T4, T5, T6, A1, A2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 6, 2, 7)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, other.scalaFunction(x_6, x_7)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2, A3](other : Term3[A1, A2, A3, T1]) : Term9[A1, A2, A3, T2, T3, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 3, 7)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : T2, x_4 : T3, x_5 : T4, x_6 : T5, x_7 : T6, x_8 : T7) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2), x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2, A3](other : Term3[A1, A2, A3, T2]) : Term9[T1, A1, A2, A3, T3, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 3, 7)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : T3, x_5 : T4, x_6 : T5, x_7 : T6, x_8 : T7) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3), x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2, A3](other : Term3[A1, A2, A3, T3]) : Term9[T1, T2, A1, A2, A3, T4, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 3, 7)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : T4, x_6 : T5, x_7 : T6, x_8 : T7) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4), x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2, A3](other : Term3[A1, A2, A3, T4]) : Term9[T1, T2, T3, A1, A2, A3, T5, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 3, 7)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : T5, x_7 : T6, x_8 : T7) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5), x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2, A3](other : Term3[A1, A2, A3, T5]) : Term9[T1, T2, T3, T4, A1, A2, A3, T6, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 3, 7)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : T6, x_8 : T7) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5, x_6), x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1, A2, A3](other : Term3[A1, A2, A3, T6]) : Term9[T1, T2, T3, T4, T5, A1, A2, A3, T7, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 3, 7)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : A3, x_8 : T7) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5, x_6, x_7), x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose6[A1, A2, A3](other : Term3[A1, A2, A3, T7]) : Term9[T1, T2, T3, T4, T5, T6, A1, A2, A3, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 6, 3, 7)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : A2, x_8 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, other.scalaFunction(x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,T6,T7,A1,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6) && other.scalaFunction(x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    
-    def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,T7,A1,A2,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : A1, x_8 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6) && other.scalaFunction(x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  }
-  
-  trait Term8[T1,T2,T3,T4,T5,T6,T7,T8,R] extends Term[(T1,T2,T3,T4,T5,T6,T7,T8),R] with Function8[T1,T2,T3,T4,T5,T6,T7,T8,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala8[T1,T2,T3,T4,T5,T6,T7,T8] _
-    type t2c = (Term8[T1,T2,T3,T4,T5,T6,T7,T8,R]) => Term8[T1,T2,T3,T4,T5,T6,T7,T8,Boolean]
-    val scalaFunction : (T1,T2,T3,T4,T5,T6,T7,T8) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1],converter.expr2scala(s(1)).asInstanceOf[T2],converter.expr2scala(s(2)).asInstanceOf[T3],converter.expr2scala(s(3)).asInstanceOf[T4],converter.expr2scala(s(4)).asInstanceOf[T5],converter.expr2scala(s(5)).asInstanceOf[T6],converter.expr2scala(s(6)).asInstanceOf[T7],converter.expr2scala(s(7)).asInstanceOf[T8])
-  
-    override def apply(x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8) : R = scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7)
-  
-    def ||(other : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Boolean])(implicit asBoolean : (R) => Boolean) : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Boolean] = 
-      Term8(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7,x_7 : T8) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7) || other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Boolean])(implicit asBoolean : (R) => Boolean) : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Boolean] = 
-      Term8(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7,x_7 : T8) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7) && other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Boolean] = 
-      Term8(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7,x_7 : T8) => ! this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7), this.types, this.converter, this.lVars)
-  
-    def +(other : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Int])(implicit asInt : (R) => Int) : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Int] =
-      Term8(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7,x_7 : T8) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7) + other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Int])(implicit asConstraint : t2c) : MinConstraint8[T1,T2,T3,T4,T5,T6,T7,T8] = {
-      MinConstraint8[T1,T2,T3,T4,T5,T6,T7,T8](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term8[T1,T2,T3,T4,T5,T6,T7,T8,R]) => Constraint8[T1,T2,T3,T4,T5,T6,T7,T8]): (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7],L[T8]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)),createL[T2](constraint, constants(1), guards(1)),createL[T3](constraint, constants(2), guards(2)),createL[T4](constraint, constants(3), guards(3)),createL[T5](constraint, constants(4), guards(4)),createL[T6](constraint, constants(5), guards(5)),createL[T7](constraint, constants(6), guards(6)),createL[T8](constraint, constants(7), guards(7)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term8[A1, T2, T3, T4, T5, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 8)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8) => this.scalaFunction(other.scalaFunction(x_0), x_1, x_2, x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1](other : Term1[A1, T2]) : Term8[T1, A1, T3, T4, T5, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 1, 8)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8) => this.scalaFunction(x_0, other.scalaFunction(x_1), x_2, x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1](other : Term1[A1, T3]) : Term8[T1, T2, A1, T4, T5, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 1, 8)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2), x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1](other : Term1[A1, T4]) : Term8[T1, T2, T3, A1, T5, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 1, 8)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3), x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1](other : Term1[A1, T5]) : Term8[T1, T2, T3, T4, A1, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 1, 8)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : T6, x_6 : T7, x_7 : T8) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4), x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1](other : Term1[A1, T6]) : Term8[T1, T2, T3, T4, T5, A1, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 1, 8)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : T7, x_7 : T8) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5), x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose6[A1](other : Term1[A1, T7]) : Term8[T1, T2, T3, T4, T5, T6, A1, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 6, 1, 8)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : T8) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, other.scalaFunction(x_6), x_7), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose7[A1](other : Term1[A1, T8]) : Term8[T1, T2, T3, T4, T5, T6, T7, A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 7, 1, 8)
-      Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, other.scalaFunction(x_7)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose0[A1, A2](other : Term2[A1, A2, T1]) : Term9[A1, A2, T2, T3, T4, T5, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 2, 8)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : T2, x_3 : T3, x_4 : T4, x_5 : T5, x_6 : T6, x_7 : T7, x_8 : T8) => this.scalaFunction(other.scalaFunction(x_0, x_1), x_2, x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1, A2](other : Term2[A1, A2, T2]) : Term9[T1, A1, A2, T3, T4, T5, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 2, 8)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : T3, x_4 : T4, x_5 : T5, x_6 : T6, x_7 : T7, x_8 : T8) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2), x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1, A2](other : Term2[A1, A2, T3]) : Term9[T1, T2, A1, A2, T4, T5, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 2, 8)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : T4, x_5 : T5, x_6 : T6, x_7 : T7, x_8 : T8) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3), x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1, A2](other : Term2[A1, A2, T4]) : Term9[T1, T2, T3, A1, A2, T5, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 2, 8)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : T5, x_6 : T6, x_7 : T7, x_8 : T8) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4), x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1, A2](other : Term2[A1, A2, T5]) : Term9[T1, T2, T3, T4, A1, A2, T6, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 2, 8)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : T6, x_7 : T7, x_8 : T8) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5), x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1, A2](other : Term2[A1, A2, T6]) : Term9[T1, T2, T3, T4, T5, A1, A2, T7, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 2, 8)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : T7, x_8 : T8) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5, x_6), x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose6[A1, A2](other : Term2[A1, A2, T7]) : Term9[T1, T2, T3, T4, T5, T6, A1, A2, T8, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 6, 2, 8)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : A2, x_8 : T8) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, other.scalaFunction(x_6, x_7), x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose7[A1, A2](other : Term2[A1, A2, T8]) : Term9[T1, T2, T3, T4, T5, T6, T7, A1, A2, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 7, 2, 8)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : A1, x_8 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, other.scalaFunction(x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,T7,T8,A1,Boolean] = {
-      val (newExpr, newTypes) = Terms.product(this, other)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7) && other.scalaFunction(x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  }
-  
-  trait Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,R] extends Term[(T1,T2,T3,T4,T5,T6,T7,T8,T9),R] with Function9[T1,T2,T3,T4,T5,T6,T7,T8,T9,R] {
-    val convertingFunction = converterOf(this).exprSeq2scala9[T1,T2,T3,T4,T5,T6,T7,T8,T9] _
-    type t2c = (Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,R]) => Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Boolean]
-    val scalaFunction : (T1,T2,T3,T4,T5,T6,T7,T8,T9) => R
-    lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(converter.expr2scala(s(0)).asInstanceOf[T1],converter.expr2scala(s(1)).asInstanceOf[T2],converter.expr2scala(s(2)).asInstanceOf[T3],converter.expr2scala(s(3)).asInstanceOf[T4],converter.expr2scala(s(4)).asInstanceOf[T5],converter.expr2scala(s(5)).asInstanceOf[T6],converter.expr2scala(s(6)).asInstanceOf[T7],converter.expr2scala(s(7)).asInstanceOf[T8],converter.expr2scala(s(8)).asInstanceOf[T9])
-  
-    override def apply(x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : T9) : R = scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8)
-  
-    def ||(other : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Boolean])(implicit asBoolean : (R) => Boolean) : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Boolean] = 
-      Term9(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7,x_7 : T8,x_8 : T9) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8) || other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def &&(other : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Boolean])(implicit asBoolean : (R) => Boolean) : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Boolean] = 
-      Term9(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7,x_7 : T8,x_8 : T9) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8) && other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def unary_!(implicit asBoolean : (R) => Boolean) : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Boolean] = 
-      Term9(this.program, Not(this.expr), if (this.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7,x_7 : T8,x_8 : T9) => ! this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8), this.types, this.converter, this.lVars)
-  
-    def +(other : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Int])(implicit asInt : (R) => Int) : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Int] =
-      Term9(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1,x_1 : T2,x_2 : T3,x_3 : T4,x_4 : T5,x_5 : T6,x_6 : T7,x_7 : T8,x_8 : T9) => this.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8) + other.scalaFunction(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8), this.types, this.converter, this.lVars ++ other.lVars)
-  
-    def minimizing(minFunc : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Int])(implicit asConstraint : t2c) : MinConstraint9[T1,T2,T3,T4,T5,T6,T7,T8,T9] = {
-      MinConstraint9[T1,T2,T3,T4,T5,T6,T7,T8,T9](asConstraint(this), minFunc)
-    }
-  
-    def lazySolve(implicit asConstraint: (Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,R]) => Constraint9[T1,T2,T3,T4,T5,T6,T7,T8,T9]): (L[T1],L[T2],L[T3],L[T4],L[T5],L[T6],L[T7],L[T8],L[T9]) = {
-      val constraint = asConstraint(this)
-      val (constants, guards) = constantsAndGuards(constraint)
-      (createL[T1](constraint, constants(0), guards(0)),createL[T2](constraint, constants(1), guards(1)),createL[T3](constraint, constants(2), guards(2)),createL[T4](constraint, constants(3), guards(3)),createL[T5](constraint, constants(4), guards(4)),createL[T6](constraint, constants(5), guards(5)),createL[T7](constraint, constants(6), guards(6)),createL[T8](constraint, constants(7), guards(7)),createL[T9](constraint, constants(8), guards(8)))
-    }
-  
-    def compose0[A1](other : Term1[A1, T1]) : Term9[A1, T2, T3, T4, T5, T6, T7, T8, T9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 0, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : T9) => this.scalaFunction(other.scalaFunction(x_0), x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose1[A1](other : Term1[A1, T2]) : Term9[T1, A1, T3, T4, T5, T6, T7, T8, T9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 1, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : T9) => this.scalaFunction(x_0, other.scalaFunction(x_1), x_2, x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose2[A1](other : Term1[A1, T3]) : Term9[T1, T2, A1, T4, T5, T6, T7, T8, T9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 2, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : T9) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2), x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose3[A1](other : Term1[A1, T4]) : Term9[T1, T2, T3, A1, T5, T6, T7, T8, T9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 3, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : T9) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3), x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose4[A1](other : Term1[A1, T5]) : Term9[T1, T2, T3, T4, A1, T6, T7, T8, T9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 4, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : T9) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4), x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose5[A1](other : Term1[A1, T6]) : Term9[T1, T2, T3, T4, T5, A1, T7, T8, T9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 5, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : T7, x_7 : T8, x_8 : T9) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5), x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose6[A1](other : Term1[A1, T7]) : Term9[T1, T2, T3, T4, T5, T6, A1, T8, T9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 6, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : T8, x_8 : T9) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, other.scalaFunction(x_6), x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose7[A1](other : Term1[A1, T8]) : Term9[T1, T2, T3, T4, T5, T6, T7, A1, T9, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 7, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : A1, x_8 : T9) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, other.scalaFunction(x_7), x_8), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-    
-    def compose8[A1](other : Term1[A1, T9]) : Term9[T1, T2, T3, T4, T5, T6, T7, T8, A1, R] = {
-      val (newExpr, newTypes) = Terms.compose(other, this, 8, 1, 9)
-      Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, other.scalaFunction(x_8)), newTypes, this.converter, this.lVars ++ other.lVars)
-    }
-  
-    
-  }
-
-  object Term1 {
-    def apply[T1,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1),R](program, expr, types, converter, lVars.toSet) with Term1[T1,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,R](program : Program, expr : Expr, scalaExpr : (T1) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1),R](program, expr, types, converter, lVars) with Term1[T1,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  object Term2 {
-    def apply[T1,T2,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1,T2) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1,T2),R](program, expr, types, converter, lVars.toSet) with Term2[T1,T2,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,T2,R](program : Program, expr : Expr, scalaExpr : (T1,T2) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1,T2),R](program, expr, types, converter, lVars) with Term2[T1,T2,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  object Term3 {
-    def apply[T1,T2,T3,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1,T2,T3) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1,T2,T3),R](program, expr, types, converter, lVars.toSet) with Term3[T1,T2,T3,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,T2,T3,R](program : Program, expr : Expr, scalaExpr : (T1,T2,T3) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1,T2,T3),R](program, expr, types, converter, lVars) with Term3[T1,T2,T3,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  object Term4 {
-    def apply[T1,T2,T3,T4,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1,T2,T3,T4) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1,T2,T3,T4),R](program, expr, types, converter, lVars.toSet) with Term4[T1,T2,T3,T4,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,T2,T3,T4,R](program : Program, expr : Expr, scalaExpr : (T1,T2,T3,T4) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1,T2,T3,T4),R](program, expr, types, converter, lVars) with Term4[T1,T2,T3,T4,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  object Term5 {
-    def apply[T1,T2,T3,T4,T5,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1,T2,T3,T4,T5) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1,T2,T3,T4,T5),R](program, expr, types, converter, lVars.toSet) with Term5[T1,T2,T3,T4,T5,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,T2,T3,T4,T5,R](program : Program, expr : Expr, scalaExpr : (T1,T2,T3,T4,T5) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1,T2,T3,T4,T5),R](program, expr, types, converter, lVars) with Term5[T1,T2,T3,T4,T5,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  object Term6 {
-    def apply[T1,T2,T3,T4,T5,T6,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1,T2,T3,T4,T5,T6) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1,T2,T3,T4,T5,T6),R](program, expr, types, converter, lVars.toSet) with Term6[T1,T2,T3,T4,T5,T6,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,T2,T3,T4,T5,T6,R](program : Program, expr : Expr, scalaExpr : (T1,T2,T3,T4,T5,T6) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1,T2,T3,T4,T5,T6),R](program, expr, types, converter, lVars) with Term6[T1,T2,T3,T4,T5,T6,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  object Term7 {
-    def apply[T1,T2,T3,T4,T5,T6,T7,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1,T2,T3,T4,T5,T6,T7) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1,T2,T3,T4,T5,T6,T7),R](program, expr, types, converter, lVars.toSet) with Term7[T1,T2,T3,T4,T5,T6,T7,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,T2,T3,T4,T5,T6,T7,R](program : Program, expr : Expr, scalaExpr : (T1,T2,T3,T4,T5,T6,T7) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1,T2,T3,T4,T5,T6,T7),R](program, expr, types, converter, lVars) with Term7[T1,T2,T3,T4,T5,T6,T7,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  object Term8 {
-    def apply[T1,T2,T3,T4,T5,T6,T7,T8,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1,T2,T3,T4,T5,T6,T7,T8) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1,T2,T3,T4,T5,T6,T7,T8),R](program, expr, types, converter, lVars.toSet) with Term8[T1,T2,T3,T4,T5,T6,T7,T8,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,T2,T3,T4,T5,T6,T7,T8,R](program : Program, expr : Expr, scalaExpr : (T1,T2,T3,T4,T5,T6,T7,T8) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1,T2,T3,T4,T5,T6,T7,T8),R](program, expr, types, converter, lVars) with Term8[T1,T2,T3,T4,T5,T6,T7,T8,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  object Term9 {
-    def apply[T1,T2,T3,T4,T5,T6,T7,T8,T9,R](conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : (T1,T2,T3,T4,T5,T6,T7,T8,T9) => R) = {
-      val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-      new Term[(T1,T2,T3,T4,T5,T6,T7,T8,T9),R](program, expr, types, converter, lVars.toSet) with Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,R] {
-        val scalaFunction = scalaExpr
-      }
-    }
-    
-    def apply[T1,T2,T3,T4,T5,T6,T7,T8,T9,R](program : Program, expr : Expr, scalaExpr : (T1,T2,T3,T4,T5,T6,T7,T8,T9) => R, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-      new Term[(T1,T2,T3,T4,T5,T6,T7,T8,T9),R](program, expr, types, converter, lVars) with Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,R] {
-        val scalaFunction = scalaExpr
-      }
-  }
-  
-  case class MinConstraint1[T1](cons : Term1[T1,Boolean], minFunc : Term1[T1,Int]) extends MinConstraint[(T1)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala1[T1] _
-  }
-  
-  case class MinConstraint2[T1,T2](cons : Term2[T1,T2,Boolean], minFunc : Term2[T1,T2,Int]) extends MinConstraint[(T1,T2)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala2[T1,T2] _
-  }
-  
-  case class MinConstraint3[T1,T2,T3](cons : Term3[T1,T2,T3,Boolean], minFunc : Term3[T1,T2,T3,Int]) extends MinConstraint[(T1,T2,T3)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala3[T1,T2,T3] _
-  }
-  
-  case class MinConstraint4[T1,T2,T3,T4](cons : Term4[T1,T2,T3,T4,Boolean], minFunc : Term4[T1,T2,T3,T4,Int]) extends MinConstraint[(T1,T2,T3,T4)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala4[T1,T2,T3,T4] _
-  }
-  
-  case class MinConstraint5[T1,T2,T3,T4,T5](cons : Term5[T1,T2,T3,T4,T5,Boolean], minFunc : Term5[T1,T2,T3,T4,T5,Int]) extends MinConstraint[(T1,T2,T3,T4,T5)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala5[T1,T2,T3,T4,T5] _
-  }
-  
-  case class MinConstraint6[T1,T2,T3,T4,T5,T6](cons : Term6[T1,T2,T3,T4,T5,T6,Boolean], minFunc : Term6[T1,T2,T3,T4,T5,T6,Int]) extends MinConstraint[(T1,T2,T3,T4,T5,T6)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala6[T1,T2,T3,T4,T5,T6] _
-  }
-  
-  case class MinConstraint7[T1,T2,T3,T4,T5,T6,T7](cons : Term7[T1,T2,T3,T4,T5,T6,T7,Boolean], minFunc : Term7[T1,T2,T3,T4,T5,T6,T7,Int]) extends MinConstraint[(T1,T2,T3,T4,T5,T6,T7)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala7[T1,T2,T3,T4,T5,T6,T7] _
-  }
-  
-  case class MinConstraint8[T1,T2,T3,T4,T5,T6,T7,T8](cons : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Boolean], minFunc : Term8[T1,T2,T3,T4,T5,T6,T7,T8,Int]) extends MinConstraint[(T1,T2,T3,T4,T5,T6,T7,T8)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala8[T1,T2,T3,T4,T5,T6,T7,T8] _
-  }
-  
-  case class MinConstraint9[T1,T2,T3,T4,T5,T6,T7,T8,T9](cons : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Boolean], minFunc : Term9[T1,T2,T3,T4,T5,T6,T7,T8,T9,Int]) extends MinConstraint[(T1,T2,T3,T4,T5,T6,T7,T8,T9)](cons, minFunc) {
-    val convertingFunction = converterOf(cons).exprSeq2scala9[T1,T2,T3,T4,T5,T6,T7,T8,T9] _
-  }
-  /** END OF GENERATED CODE. */
-
-  /** Compute composed expression for g∘f */
-  private def compose(f : Term[_,_], g : Term[_,_], index : Int, nf : Int, ng : Int) : (Expr, Seq[TypeTree]) = {
-    val deBruijnF = f.types.zipWithIndex.map{ case (t,i) => DeBruijnIndex(i).setType(t) }
-    val deBruijnG = g.types.zipWithIndex.map{ case (t,i) => DeBruijnIndex(i).setType(t) }
-    assert(deBruijnF.size == nf && deBruijnG.size == ng)
-
-    val substG : Map[Expr,Expr] = deBruijnG.drop(index + 1).map{ case d @ DeBruijnIndex(i) => (d, DeBruijnIndex(i + nf - 1).setType(d.getType)) }.toMap
-    val substF : Map[Expr,Expr] = deBruijnF.map{ case d @ DeBruijnIndex(i) => (d, DeBruijnIndex(i + index).setType(d.getType)) }.toMap
-
-    val renamedExprF = replace(substF, f.expr)
-    val renamedExprG = replace(substG, g.expr)
-
-    val indexToReplace = deBruijnG(index)
-    val newExpr   = replace(Map(indexToReplace -> renamedExprF), renamedExprG)
-    val newTypes  = g.types.take(index) ++ f.types ++ g.types.drop(index + 1)
-    assert(newTypes.size == nf + ng - 1)
-    (newExpr, newTypes)
-  }
-
-  /** Compute the product expression for f x g */
-  private def product(f: Term[_,_], g: Term[_,_]): (Expr, Seq[TypeTree]) = {
-    val deBruijnF = f.types.zipWithIndex.map{ case (t,i) => DeBruijnIndex(i).setType(t) }
-    val deBruijnG = g.types.zipWithIndex.map{ case (t,i) => DeBruijnIndex(i).setType(t) }
-
-    val nf = deBruijnF.size
-    val ng = deBruijnG.size
-
-    val substG: Map[Expr,Expr] = deBruijnG.map{ case d @ DeBruijnIndex(i) => (d, DeBruijnIndex(i + nf).setType(d.getType)) }.toMap
-
-    val renamedExprG = replace(substG, g.expr)
-    
-    val newExpr = And(f.expr, renamedExprG)
-    val newTypes = f.types ++ g.types
-
-    (newExpr, newTypes)
-  }
-
-  def converterOf(term : Term[_,_]) : Converter = term.converter
-
-  def typesOf(term : Term[_,_]) : Seq[TypeTree] = term.types
-
-  def exprOf(term : Term[_,_]) : Expr = term.expr
-
-  def programOf(term : Term[_,_]) : Program = term.program
-
-  /** Compute a fresh sequence of output variables and the combined expression
-   * containing those */
-  def combineConstraint(constraint : Constraint[_]) : (Seq[Identifier], Expr) = {
-    val expr = exprOf(constraint)
-
-    val outputVarTypes = typesOf(constraint)
-
-    val freshOutputIDs = outputVarTypes.zipWithIndex.map{ case (t, idx) => FreshIdentifier("x" + idx, true).setType(t) }
-    val deBruijnIndices = outputVarTypes.zipWithIndex.map{ case (t, idx) => DeBruijnIndex(idx).setType(t) }
-    val exprWithFreshIDs = replace((deBruijnIndices zip (freshOutputIDs map (Variable(_)))).toMap, expr)
-
-    (freshOutputIDs, exprWithFreshIDs)
-  }
-
-}
diff --git a/src/cp/Utils.scala b/src/cp/Utils.scala
deleted file mode 100644
index 07451698ec553a7568f756e7c6168ae2a4af5335..0000000000000000000000000000000000000000
--- a/src/cp/Utils.scala
+++ /dev/null
@@ -1,291 +0,0 @@
-package cp
-
-object Utils {
-
-  private def indent(s : String) : String = s.split("\n").mkString("  ", "\n  ", "")
-
-  object GenerateTerms {
-    def apply(maxArity : Int) : String = {
-      val termTraits = for (arity <- 1 to maxArity) yield {
-        val traitArgParams = (1 to arity) map ("T" + _)
-        val traitArgParamsString = traitArgParams.mkString(",")
-        val traitParams = traitArgParams ++ Seq("R")
-        val traitParamsString = traitParams.mkString("[", ",", "]")
-        val termClassParamTuple = traitArgParams.mkString("(", ",", ")")
-        val traitName = "Term%d%s" format (arity, traitParamsString)
-        val booleanTraitName = "Term%d%s" format (arity, (traitArgParams ++ Seq("Boolean")).mkString("[", ",", "]"))
-        val intTraitName = "Term%d%s" format (arity, (traitArgParams ++ Seq("Int")).mkString("[", ",", "]"))
-        val curriedImplicit2Boolean = "(implicit asBoolean : (R) => Boolean)"
-        val curriedImplicit2Int = "(implicit asInt : (R) => Int)"
-        val curriedImplicit2Constraint = "(implicit asConstraint : t2c)"
-        val anonFunParams = traitArgParams.zipWithIndex.map{ case (p, i) => "x_%d : %s" format (i, p) }
-        val anonFunParamString = anonFunParams.mkString(",")
-        val anonFunArgs = (0 until arity).map(i => "x_%d" format (i))
-        val anonFunArgsString = anonFunArgs.mkString(",")
-        val orMethod = """def ||(other : %s)%s : %s = 
-  Term%d(this.program, Or(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (%s) => this.scalaFunction(%s) || other.scalaFunction(%s), this.types, this.converter, this.lVars ++ other.lVars)""" format (booleanTraitName, curriedImplicit2Boolean, booleanTraitName, arity, anonFunParamString, anonFunArgsString, anonFunArgsString)
-        val andMethod = """def &&(other : %s)%s : %s = 
-  Term%d(this.program, And(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (%s) => this.scalaFunction(%s) && other.scalaFunction(%s), this.types, this.converter, this.lVars ++ other.lVars)""" format (booleanTraitName, curriedImplicit2Boolean, booleanTraitName, arity, anonFunParamString, anonFunArgsString, anonFunArgsString)
-        val notMethod = """def unary_!%s : %s = 
-  Term%d(this.program, Not(this.expr), if (this.scalaFunction == null) null else (%s) => ! this.scalaFunction(%s), this.types, this.converter, this.lVars)""" format (curriedImplicit2Boolean, booleanTraitName, arity, anonFunParamString, anonFunArgsString)
-        val plusMethod = """def +(other : %s)%s : %s =
-  Term%d(this.program, Plus(this.expr, other.expr), if (this.scalaFunction == null || other.scalaFunction == null) null else (%s) => this.scalaFunction(%s) + other.scalaFunction(%s), this.types, this.converter, this.lVars ++ other.lVars)""" format (intTraitName, curriedImplicit2Int, intTraitName, arity, anonFunParamString, anonFunArgsString, anonFunArgsString)
-        
-        val minimizingMethod = 
-"""def minimizing(minFunc : %s)%s : MinConstraint%d[%s] = {
-  MinConstraint%d[%s](asConstraint(this), minFunc)
-}""" format (intTraitName, curriedImplicit2Constraint, arity, traitArgParamsString, arity, traitArgParamsString)
-
-        val createLCalls = (1 to arity) map (i => """createL[T%d](constraint, constants(%d), guards(%d))""" format (i, i - 1, i - 1))
-        val createLCallsString = createLCalls.mkString(",")
-        val lvarTypes = traitArgParams map ("L[" + _ + "]")
-        val lvarTypeString = lvarTypes.mkString(",")
-        val lazySolveMethod =
-"""def lazySolve(implicit asConstraint: (%s) => Constraint%d[%s]): (%s) = {
-  val constraint = asConstraint(this)
-  val (constants, guards) = constantsAndGuards(constraint)
-  (%s)
-}""" format (traitName, arity, traitArgParamsString, lvarTypeString, createLCallsString)
-
-        val composeMethods = (for (arityF <- 1 to (maxArity - arity + 1)) yield {
-          for (index <- 0 until arity) yield {
-            val fParams = (1 to arityF).map("A" + _)
-            val thisParams = (1 to arity).map("T" + _)
-            val fTermParams = fParams ++ Seq("T" + (index + 1))
-
-            val resultParams = thisParams.take(index) ++ fParams ++ thisParams.drop(index + 1)
-            val resultTermArity = arity + arityF - 1
-            val resultTermParams = resultParams ++ Seq("R")
-
-            val scalaFunctionParams = resultParams.zipWithIndex.map{ case (p, i) => "x_%d : %s" format (i, p) }
-            val scalaFunctionArgs = (0 until resultParams.size).map("x_" + _)
-            val fApplication = "other.scalaFunction(%s)" format (scalaFunctionArgs.drop(index).take(arityF).mkString(", "))
-            val thisFunctionParams = scalaFunctionArgs.take(index) ++ Seq(fApplication) ++ scalaFunctionArgs.drop(index + arityF)
-            val s2 =
-"""def compose%d[%s](other : Term%d[%s]) : Term%d[%s] = {
-  val (newExpr, newTypes) = Terms.compose(other, this, %d, %d, %d)
-  Term%d(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (%s) => this.scalaFunction(%s), newTypes, this.converter, this.lVars ++ other.lVars)
-}""" format (index, fParams.mkString(", "), arityF, fTermParams.mkString(", "), resultTermArity, resultTermParams.mkString(", "), index, arityF, arity, resultTermArity, scalaFunctionParams.mkString(", "), thisFunctionParams.mkString(", "))
-
-            s2
-          }
-        }).flatten.mkString("\n\n")
-
-        val productMethods = (for (otherArity <- 1 to (maxArity - arity)) yield {
-          val productArity = arity + otherArity
-
-          val thisParams = (1 to arity).map("T" + _)
-
-          val otherParams = (1 to otherArity).map("A" + _)
-          val otherParamsString = otherParams.mkString(",")
-
-          val otherTermParams = otherParams ++ Seq("Boolean")
-          val otherTermParamsString = otherTermParams.mkString(",")
-
-          val resultParams = thisParams ++ otherParams
-          val resultTermParams = resultParams ++ Seq("Boolean")
-          val resultTermParamsString = resultTermParams.mkString(",")
-
-          val scalaFunctionParams = resultParams.zipWithIndex.map{ case (p, i) => "x_%d : %s" format (i, p) }
-          val scalaFunctionParamsString = scalaFunctionParams.mkString(", ")
-
-          val thisScalaFunctionArgs = (0 until arity).map("x_" + _)
-          val thisScalaFunctionArgsString = thisScalaFunctionArgs.mkString(", ")
-
-          val otherScalaFunctionArgs = (arity until productArity).map("x_" + _)
-          val otherScalaFunctionArgsString = otherScalaFunctionArgs.mkString(", ")
-
-          val thisApplication = "this.scalaFunction(%s)" format (thisScalaFunctionArgsString)
-          val otherApplication = "other.scalaFunction(%s)" format (otherScalaFunctionArgsString)
-
-          val scalaFunction = "(%s) => %s && %s" format (scalaFunctionParamsString, thisApplication, otherApplication)
-
-          val methodString =
-"""def product[%s](other: Term%d[%s])(implicit isBoolean: R =:= Boolean): Term%d[%s] = {
-  val (newExpr, newTypes) = Terms.product(this, other)
-  Term%d(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else %s, newTypes, this.converter, this.lVars ++ other.lVars)
-}
-""" format (otherParamsString, otherArity, otherTermParamsString, productArity, resultTermParamsString, productArity, scalaFunction)
-
-          methodString
-        }).mkString("\n\n")
-
-        val (applyParams, applyArgs) = traitArgParams.zipWithIndex.map{ case (p, i) => ("x_%d : %s" format (i, p), "x_%d" format (i)) }.unzip
-
-        val evaluatorArgs = traitArgParams.zipWithIndex.map{ case (p, i) => "converter.expr2scala(s(%d)).asInstanceOf[%s]" format (i, p) }
-        val termTraitString =
-"""trait %s extends Term[%s,%s] with Function%d[%s] {
-  val convertingFunction = converterOf(this).exprSeq2scala%d[%s] _
-  type t2c = (%s) => %s
-  val scalaFunction : %s => %s
-  lazy val evaluator : (Seq[Expr]) => R = (s : Seq[Expr]) => scalaFunction(%s)
-
-  override def apply(%s) : R = scalaFunction(%s)
-
-%s
-
-%s
-
-%s
-
-%s
-
-%s
-
-%s
-
-%s
-
-%s
-}""" format (traitName, termClassParamTuple, "R", arity, traitParams.mkString(","), 
-  arity, traitArgParamsString, 
-  traitName, booleanTraitName, 
-  termClassParamTuple, "R", 
-  evaluatorArgs.mkString(","),
-  applyParams.mkString(", "), applyArgs.mkString(", "), 
-  indent(orMethod), indent(andMethod), indent(notMethod), indent(plusMethod), indent(minimizingMethod), indent(lazySolveMethod), indent(composeMethods), indent(productMethods))
-        
-        termTraitString
-      }
-
-      termTraits.mkString("\n\n")
-    }
-  }
-
-  object GenerateTermObjects {
-    def apply(maxArity : Int) : String = {
-      val objectStrings = for (arity <- 1 to maxArity) yield {
-        val argParams = (1 to arity) map ("T" + _)
-        val argParamsString = argParams.mkString("[", ",", "]")
-        val applyParamString = (argParams ++ Seq("R")).mkString("[", ",", "]")
-        val argParamTuple = argParams.mkString("(", ",", ")")
-        val termClassName = "Term[%s,%s]" format (argParamTuple, "R")
-        val booleanTermClassName = "Term[%s,%s]" format (argParamTuple, "Boolean")
-        val termTraitName = "Term%d%s" format (arity, applyParamString)
-        val booleanTermTraitName = "Term%d%s" format (arity, (argParams ++ Seq("Boolean")).mkString("[", ",", "]"))
-        val objectString =
-"""object Term%d {
-  def apply%s(conv : Converter, serializedProg : Serialized, serializedInputVars: Serialized, serializedLVars: Serialized, serializedOutputVars : Serialized, serializedExpr : Serialized, inputVarValues : Seq[Expr], lVarValues : Seq[Expr], lVars : Seq[L[_]], scalaExpr : %s => %s) = {
-    val (converter, program, expr, types) = Term.processArgs(conv, serializedProg, serializedInputVars, serializedLVars, serializedOutputVars, serializedExpr, inputVarValues, lVarValues)
-    new %s(program, expr, types, converter, lVars.toSet) with %s {
-      val scalaFunction = scalaExpr
-    }
-  }
-  
-  def apply%s(program : Program, expr : Expr, scalaExpr : %s => %s, types : Seq[TypeTree], converter : Converter, lVars: Set[L[_]]) =
-    new %s(program, expr, types, converter, lVars) with %s {
-      val scalaFunction = scalaExpr
-    }
-}""" format (arity, applyParamString, argParamTuple, "R", termClassName, termTraitName, applyParamString, argParamTuple, "R", termClassName, termTraitName)
-
-        objectString
-      }
-
-      objectStrings.mkString("\n\n")
-    }
-  }
-
-  object GenerateMinConstraintClasses {
-    def apply(maxArity : Int) : String = {
-      val classes = for (arity <- 1 to maxArity) yield {
-        val params = (1 to arity) map ("T" + _)
-        val paramString = params.mkString("[", ",", "]")
-        val paramTupleString = params.mkString("(", ",", ")")
-        val booleanTermParams = (params ++ Seq("Boolean")).mkString("[", ",", "]")
-        val intTermParams = (params ++ Seq("Int")).mkString("[", ",", "]")
-        val booleanTermName = "Term%d%s" format (arity, booleanTermParams)
-        val intTermName = "Term%d%s" format (arity, intTermParams)
-        val classString =
-"""case class MinConstraint%d%s(cons : %s, minFunc : %s) extends MinConstraint[%s](cons, minFunc) {
-  val convertingFunction = converterOf(cons).exprSeq2scala%d%s _
-}""" format (arity, paramString, booleanTermName, intTermName, paramTupleString, arity, paramString)
-
-        classString
-      }
-
-      classes.mkString("\n\n")
-    }
-  }
-
-  object GenerateTypeAliases {
-    def apply(maxArity : Int) : String = {
-      var booleanTerms = List[String]()
-      var intTerms = List[String]()
-
-      booleanTerms = "type Constraint[T] = Term[T,Boolean]" :: booleanTerms
-      intTerms = "type IntTerm[T] = Term[T,Int]" :: intTerms
-
-      for (arity <- 0 to maxArity) {
-        val params = (1 to arity) map ("T" + _)
-        val paramWithBooleanString = (params ++ Seq("Boolean")).mkString("[", ",", "]")
-        val paramWithIntString = (params ++ Seq("Int")).mkString("[", ",", "]")
-        val paramString = if (arity == 0) "" else params.mkString("[", ",", "]")
-        val boolType = "type Constraint%d%s = Term%d%s" format (arity, paramString, arity, paramWithBooleanString)
-        val intType = "type IntTerm%d%s = Term%d%s" format (arity, paramString, arity, paramWithIntString)
-
-        booleanTerms = boolType :: booleanTerms
-        intTerms = intType :: intTerms
-      }
-
-      val comment = """/** Type aliases for terms with boolean and integer range */"""
-      (Seq(comment) ++ booleanTerms.reverse ++ intTerms.reverse).mkString("\n")
-    }
-  }
-
-  object GenerateConverterMethods {
-    def apply(maxArity : Int) : String = {
-      val methods = for (arity <- 1 to maxArity) yield {
-        val params = (1 to arity) map ("T" + _)
-        val paramsBrackets = params.mkString("[", ",", "]")
-        val paramsParen    = params.mkString("(", ",", ")")
-        val tuple = params.zipWithIndex.map{ case (p, i) => "expr2scala(exprs(%d)).asInstanceOf[%s]" format (i, p) }.mkString("(", ",", ")")
-        val methodString =
-"""def exprSeq2scala%d%s(exprs : Seq[Expr]) : %s =
-  %s""" format (arity, paramsBrackets, paramsParen, tuple)
-
-        methodString
-      }
-
-      methods.mkString("\n\n")
-    }
-  }
-
-  object GenerateLTuples {
-    def apply(maxArity: Int): String = {
-      val classes = for (arity <- 1 to maxArity) yield {
-        val typeParams = (1 to arity) map ("T" + _)
-        val typeParamString = typeParams.mkString(",")
-        val arguments = (1 to arity) map (i => "l%d: L[T%d]" format (i, i))
-        val argumentString = arguments.mkString(",")
-        val componentMethods = (1 to arity) map (i => "def _%d: L[T%d] = l%d" format (i, i, i))
-        val componentMethodString = componentMethods.mkString("\n")
-        val valueMethodParams = (1 to arity) map (i => "_%d.value" format (i))
-        val valueMethodParamString = valueMethodParams.mkString(",")
-        val valueMethod = "def value: (%s) = (%s)" format (typeParamString, valueMethodParamString)
-"""class LTuple%d[%s](%s) extends LTuple[(%s)] {
-%s
-%s
-}""" format (arity, typeParamString, argumentString, typeParamString, indent(componentMethodString), indent(valueMethod))
-      }
-
-      classes.mkString("\n\n")
-    }
-  }
-
-  def main(args: Array[String]) : Unit = {
-    if (args.size != 1)
-      throw new Exception("Enter an arity for code generation")
-    val termTraits = GenerateTerms(args(0).toInt)
-    val termObjects = GenerateTermObjects(args(0).toInt)
-    val minConstraintsClasses = GenerateMinConstraintClasses(args(0).toInt)
-    val typeAliases = GenerateTypeAliases(args(0).toInt)
-
-    val converterMethods = GenerateConverterMethods(args(0).toInt)
-
-    val ltupleClasses = GenerateLTuples(args(0).toInt)
-
-    val everything = Seq(typeAliases, termTraits, termObjects, minConstraintsClasses).mkString("\n\n")
-    println(indent(everything))
-    // println(indent(ltupleClasses))
-  }
-}
diff --git a/src/multisets-lib/Multiset.scala b/src/multisets-lib/Multiset.scala
deleted file mode 100644
index 91624ed2f6cdca171ada8c9145994f38051e99ae..0000000000000000000000000000000000000000
--- a/src/multisets-lib/Multiset.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-package scala.collection.immutable
-
-case class UnimplementedFeatureException() extends Exception
-
-object Multiset {
-  def empty[A] : Multiset[A] = throw UnimplementedFeatureException()
-  def apply[A](elems: A*) : Multiset[A] = throw UnimplementedFeatureException()
-}
-
-trait Multiset[A] {
-  def ** (that: Multiset[A]) : Multiset[A] = throw UnimplementedFeatureException()
-  def ++ (that: Multiset[A]) : Multiset[A] = throw UnimplementedFeatureException()
-  def +++ (that: Multiset[A]) : Multiset[A] = throw UnimplementedFeatureException()
-  def -- (that: Multiset[A]) : Multiset[A] = throw UnimplementedFeatureException()
-  def toSet : scala.collection.immutable.Set[A] = throw UnimplementedFeatureException()
-  def size : Int = throw UnimplementedFeatureException()
-}
diff --git a/src/multisets/ASTMapaFun.scala b/src/multisets/ASTMapaFun.scala
deleted file mode 100644
index 74ed0240a1d0e69b8c704af374b30960329cb122..0000000000000000000000000000000000000000
--- a/src/multisets/ASTMapaFun.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-package mapaFun
-
-  sealed abstract class MAPAFunInt
-  case class MFIntVar(val i: String) extends MAPAFunInt
-  case class MFIntConst (val c: Int) extends MAPAFunInt
-  case class MFIPlus(val i1: MAPAFunInt, val i2: MAPAFunInt) extends MAPAFunInt
-  case class MFITimes(val c: Int, val i2: MAPAFunInt) extends MAPAFunInt
-  case class MFSCard(val s: MAPAFunSet) extends MAPAFunInt
-  case class MFMCard(val m: MAPAFunMultiset) extends MAPAFunInt
-
-  sealed abstract class MAPAFunMultiset
-  case class MFMSetVar(val m: String) extends MAPAFunMultiset
-  case object MFEmptyMSet extends MAPAFunMultiset
-  case class MFMUnion(val m1: MAPAFunMultiset, val m2: MAPAFunMultiset) extends MAPAFunMultiset
-  case class MFMIntersec(val m1: MAPAFunMultiset, val m2: MAPAFunMultiset) extends MAPAFunMultiset
-  case class MFMPlus(val m1: MAPAFunMultiset, val m2: MAPAFunMultiset) extends MAPAFunMultiset
-  case class MFMMinus(val m1: MAPAFunMultiset, val m2: MAPAFunMultiset) extends MAPAFunMultiset
-  case class MFSetMinus(val m1: MAPAFunMultiset, val m2: MAPAFunMultiset) extends MAPAFunMultiset
-  case class MFSSetOf(val m:MAPAFunMultiset) extends MAPAFunMultiset
-  case class MFFunction(val f: String, val s: MAPAFunSet) extends MAPAFunMultiset
-
-  sealed abstract class MAPAFunSet
-  case class MFSetVar(val s:String) extends MAPAFunSet
-  case object MFEmptySet extends MAPAFunSet
-  case object MFUnivSet extends MAPAFunSet
-  case class MFSUnion(val s1:MAPAFunSet, val s2:MAPAFunSet) extends MAPAFunSet
-  case class MFSIntersec(val s1:MAPAFunSet, val s2:MAPAFunSet) extends MAPAFunSet
-  case class MFSCompl(val s:MAPAFunSet) extends MAPAFunSet
-
-  sealed abstract class MAPAFunAtom
-  case class MFSetEqual(val s1:MAPAFunSet, val s2:MAPAFunSet) extends MAPAFunAtom
-  case class MFSetSubset(val s1:MAPAFunSet, val s2:MAPAFunSet) extends MAPAFunAtom
-  case class MFMSetEqual(val m1:MAPAFunMultiset, val m2:MAPAFunMultiset) extends MAPAFunAtom
-  case class MFMSetSubset(val m1:MAPAFunMultiset, val m2:MAPAFunMultiset) extends MAPAFunAtom
-  case class MFIntEqual(val i1:MAPAFunInt, val i2:MAPAFunInt) extends MAPAFunAtom
-  case class MFIntLessEqual(val i1:MAPAFunInt, val i2:MAPAFunInt) extends MAPAFunAtom
-  case class MFIntDivides(val c:Int, val i:MAPAFunInt) extends MAPAFunAtom
-
-  sealed abstract class MAPAFunFormula
-  case class MFAnd(val f1: MAPAFunFormula, val f2: MAPAFunFormula) extends MAPAFunFormula
-  case class MFOr(val f1: MAPAFunFormula, val f2: MAPAFunFormula) extends MAPAFunFormula
-  case class MFNot(val f: MAPAFunFormula) extends MAPAFunFormula
-  case class MFAtom(val a: MAPAFunAtom) extends MAPAFunFormula
diff --git a/src/multisets/ASTMultisets.scala b/src/multisets/ASTMultisets.scala
deleted file mode 100644
index 891961b5002ee39598cc038c19edc9005f1a7d3c..0000000000000000000000000000000000000000
--- a/src/multisets/ASTMultisets.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-package multisets
-
-  sealed abstract class Multiset
-  case class MVariable(val v: String) extends Multiset
-  case object MEmpty extends Multiset
-  case class MUnion(val m1: Multiset, val m2: Multiset) extends Multiset
-  case class MIntersection(val m1: Multiset, val m2: Multiset) extends Multiset
-  case class MPlus(val m1: Multiset, val m2: Multiset) extends Multiset
-  case class MMinus(val m1: Multiset, val m2: Multiset) extends Multiset
-  case class MSetMinus(val m1: Multiset, val m2: Multiset) extends Multiset
-  case class MSetOf(val m: Multiset) extends Multiset
-
-  sealed abstract class TermIn
-  case class TIMultiplicity(val v: String) extends TermIn
-  case class TIConstant(val c: Int) extends TermIn
-  case class TIPlus(val t1: TermIn, val t2: TermIn) extends TermIn
-  case class TITimes(val c: Int, val t: TermIn) extends TermIn
-  case class TIIte(val f: FormulaIn, val t1: TermIn, val t2: TermIn) extends TermIn
-
-  sealed abstract class AtomIn
-  case class AILeq(val t1: TermIn, t2: TermIn) extends AtomIn
-  case class AIEq(val t1: TermIn, t2: TermIn) extends AtomIn
-
-  sealed abstract class FormulaIn
-  case class FIAtom(val a: AtomIn) extends FormulaIn
-  case class FIAnd(val f1: FormulaIn, val f2: FormulaIn) extends FormulaIn
-  case class FIOr(val f1: FormulaIn, val f2: FormulaIn) extends FormulaIn
-  case class FINot(val f: FormulaIn) extends FormulaIn
-  case object FITrue extends FormulaIn
-  case object FIFalse extends FormulaIn
-
-
-  sealed abstract class TermOut
-  case class TOConstant(val c: Int) extends TermOut
-  case class TOVariable(val v: String) extends TermOut
-  case class TOCard(val m: Multiset) extends TermOut
-  case class TOPlus(val t1: TermOut, val t2: TermOut) extends TermOut
-  case class TOTimes(val c: Int, val t: TermOut) extends TermOut
-  case class TOIte(val f: FormulaOut, val t1: TermOut, val t2: TermOut) extends TermOut
-
-  sealed abstract class AtomOut
-  case class AOLeq(val t1: TermOut, t2: TermOut) extends AtomOut
-  case class AOEq(val t1: TermOut, t2: TermOut) extends AtomOut
-  case class AOSum(val v1: List[TermOut], val f: FormulaIn, val v2: List[TermIn]) extends AtomOut
-
-  sealed abstract class FormulaOut
-  case class FOAtom(val a: AtomOut) extends FormulaOut
-  case class FOAnd(val f1: FormulaOut, val f2: FormulaOut) extends FormulaOut
-  case class FOOr(val f1: FormulaOut, val f2: FormulaOut) extends FormulaOut
-  case class FONot(val f: FormulaOut) extends FormulaOut
-  case object FOTrue extends FormulaOut
-  case object FOFalse extends FormulaOut
-
-  sealed abstract class Atom
-  case class AEqual(val m1:Multiset, val m2:Multiset) extends Atom
-  case class ASubset(val m1:Multiset, val m2:Multiset) extends Atom
-  case class AForAllElem(val f:FormulaIn) extends Atom
-  case class AAtomOut(val a:AtomOut) extends Atom
-
-  sealed abstract class Formula
-  case class FAnd(val f1: Formula, val f2: Formula) extends Formula
-  case class FOr(val f1: Formula, val f2: Formula) extends Formula
-  case class FNot(val f: Formula) extends Formula
-  case class FAtom(val a: Atom) extends Formula
-  case object FTrue extends Formula
-  case object FFalse extends Formula
diff --git a/src/multisets/ASTStars.scala b/src/multisets/ASTStars.scala
deleted file mode 100644
index 81fcd4be953d81942099be0b4f9e285945c072d2..0000000000000000000000000000000000000000
--- a/src/multisets/ASTStars.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-package multisets
-
-  sealed abstract class TermQFPA
-  case class TVariable(val v: String) extends TermQFPA
-  case class TConstant(val c: Int) extends TermQFPA
-  case class TPlus(val t1: TermQFPA, val t2: TermQFPA) extends TermQFPA
-  case class TTimes(val c: Int, val t: TermQFPA) extends TermQFPA
-  case class TIte(val f: QFPAFormula, val t1: TermQFPA, val t2: TermQFPA) extends TermQFPA
-
-  sealed abstract class AtomQFPA
-  case class ALeq(val t1: TermQFPA, val t2: TermQFPA) extends AtomQFPA
-  case class AEq(val t1: TermQFPA, val t2: TermQFPA) extends AtomQFPA
-
-  sealed abstract class QFPAFormula
-  case class QFPAAnd(val f1: QFPAFormula, val f2: QFPAFormula) extends QFPAFormula
-  case class QFPAOr(val f1: QFPAFormula, val f2: QFPAFormula) extends QFPAFormula
-  case class QFPANot(val f: QFPAFormula) extends QFPAFormula
-  case class QFPAAtom(val a: AtomQFPA) extends QFPAFormula
-  case object QFPAFalse extends QFPAFormula
-  case object QFPATrue extends QFPAFormula
-
-  // f1 & l1 \in {l2 | f2}*
-  case class StarFormula(val f1: QFPAFormula, val l1: List[TermQFPA], val l2: List[TermQFPA], val f2: QFPAFormula)
diff --git a/src/multisets/BuildingModels.scala b/src/multisets/BuildingModels.scala
deleted file mode 100644
index b9e050953f4151127dc4203f6c888ceeca35ce8f..0000000000000000000000000000000000000000
--- a/src/multisets/BuildingModels.scala
+++ /dev/null
@@ -1,355 +0,0 @@
-package multisets
-
-
-import scala.collection.mutable.Map
-import java.lang.Integer
-
-
-
-object reconstructingModels {
-
-  def addNewValuestoMap(l:List[String], i: Int, m: Map[String, Int]): Map[String, Int] = {
-    var mt = m
-    l.foreach(s => mt += (s -> i))
-    mt
-  }
-
-  def getIntValueFromString(s: String): Int = {
-   val s1 = s.replaceAll(":int", "")
-   val n = Integer.parseInt(s1)
-   n
-  }
-
-  def getAllVariablesFromString(s: String): List[String] = {
-    val i1 = s.indexOf('{') 
-    val i2 = s.indexOf('}')
-    val s1 = s.substring(i1 + 1, i2)
-    val vars = s1.split(" ")
-    val l1 = vars.toList 
-    l1
-  }
-
-
-  def extractModelAndAddtoMap(s: String, m: Map[String, Int]): Map[String, Int] = {
-    if (s.startsWith("*"))  {
-      val strings = s.split (" -> ");
-      val l = getAllVariablesFromString(strings(0))
-      val n = getIntValueFromString(strings(1))
-      val m1 = addNewValuestoMap(l, n, m)
-      m1
-    } else m
-  }
-
-  def createSatisfyingAssignmentforQFPA(ls: List[String]): Map[String, Int] = {
-    var tm = Map[String, Int]()
-    ls.foreach(s => {
-       tm = extractModelAndAddtoMap(s, tm)
-    })
-    tm
-  }
-
-// ======================
-
-
-  def replaceVectorsStartingWithSomeStringWithValuesinTerm(t: TermQFPA, m: Map[String, Int], s: String): TermQFPA = t match {
-    case TConstant(c) => t
-    case TVariable(v) => {
-      if (v.contains(s)) {
-        val nv = m(v)
-        TConstant(nv)
-      } else t
-    }
-    case TPlus(t1, t2) => {
-      val t1n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t1, m, s)
-      val t2n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t2, m, s)
-      TPlus(t1n, t2n)
-    }
-    case TTimes(c, t1) => {
-      val t1n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t1, m, s)
-      TTimes(c, t1n)
-    }
-    case TIte(f, t1, t2) => {
-      val fn = replaceVectorsStartingWithSomeStringWithValues(f, m, s)
-      val t1n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t1, m, s)
-      val t2n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t2, m, s)
-      TIte(fn, t1n, t2n)
-    }
-  }
-
-
-  def replaceVectorsStartingWithSomeStringWithValuesinAtom(a: AtomQFPA, m: Map[String, Int], s: String): AtomQFPA = a match {
-    case ALeq(t1,t2) => {
-      val t1n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t1, m, s)
-      val t2n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t2, m, s)
-      ALeq(t1n, t2n)
-    }
-    case AEq(t1,t2) => {
-      val t1n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t1, m, s)
-      val t2n = replaceVectorsStartingWithSomeStringWithValuesinTerm(t2, m, s)
-      AEq(t1n, t2n)
-    }
-  }
-
-  def replaceVectorsStartingWithSomeStringWithValues(f: QFPAFormula, m: Map[String, Int], s: String): QFPAFormula = f match {
-    case QFPAAnd(f1,f2) => {
-      val f1n = replaceVectorsStartingWithSomeStringWithValues(f1, m, s)
-      val f2n = replaceVectorsStartingWithSomeStringWithValues(f2, m, s)
-      QFPAAnd(f1n, f2n)
-    }
-    case QFPAOr(f1,f2) => {
-      val f1n = replaceVectorsStartingWithSomeStringWithValues(f1, m, s)
-      val f2n = replaceVectorsStartingWithSomeStringWithValues(f2, m, s)
-      QFPAOr(f1n, f2n)
-    }
-    case QFPANot(f1)  => {
-      val f1n = replaceVectorsStartingWithSomeStringWithValues(f1, m, s)
-      QFPANot(f1n)
-    }
-    case QFPAAtom(a)  => {
-      val a1 = replaceVectorsStartingWithSomeStringWithValuesinAtom(a, m, s)
-      QFPAAtom(a1)
-    }
-    case QFPAFalse => f
-    case QFPATrue  => f
-  }
-
-  def isNumericalTerm(t: TermQFPA): (Boolean, Int) = t match {
-    case TConstant(c) => (true, c)
-    case TVariable(v) => (false, 0)
-    case TPlus(t1, t2) => {
-      val (b1, c1) = isNumericalTerm(t1)
-      val (b2, c2) = isNumericalTerm(t2)
-      (b1 && b2, c1 + c2)
-    }
-    case TTimes(c, t1) => {
-      val (b1, c1) = isNumericalTerm(t1)
-      (b1, c * c1)
-    }
-    case TIte(f, t1, t2) => {
-      val f1 = evaluatePureNumericalExpressions(f)
-      val (b1, c1) = isNumericalTerm(t1)
-      val (b2, c2) = isNumericalTerm(t2)
-      val f2 = evaluatePureBooleanExpressions(f1)
-      if (f2 == QFPATrue) (b1, c1) else 
-        if (f2 == QFPANot(QFPATrue)) (b2, c2) else
-          (false, 0)
-    }
-  }
-
-  def evaluatePureNumericalExpressioninTerm(t: TermQFPA): TermQFPA = t match {
-    case TConstant(c) => t
-    case TVariable(v) => t
-    case TPlus(t1, t2) => {
-      val t1n = evaluatePureNumericalExpressioninTerm(t1)
-      val t2n = evaluatePureNumericalExpressioninTerm(t2)
-      val (b1, c1) = isNumericalTerm(t1n)
-      val (b2, c2) = isNumericalTerm(t2n)
-      if (b1 && b2) {
-        val c = c1 + c2
-        TConstant(c)
-      } else { if (b1 && c1 == 0) t2n
-          else if (b2 && c2 == 0) t1n else TPlus(t1n, t2n)
-      }
-    }
-    case TTimes(c, t1) => {
-      val t1n = evaluatePureNumericalExpressioninTerm(t1)
-      val (b1, c1) = isNumericalTerm(t1n)
-      if (b1) {
-        val cf = c * c1
-        TConstant(cf)
-      } else TTimes(c, t1n)
-    }
-    case TIte(f, t1, t2) => {
-      val f1 = evaluatePureNumericalExpressions(f)
-      val t1n = evaluatePureNumericalExpressioninTerm(t1)
-      val t2n = evaluatePureNumericalExpressioninTerm(t2)
-      val f2 = evaluatePureBooleanExpressions(f1)
-      if (f2 == QFPATrue) t1n else 
-        if (f2 == QFPANot(QFPATrue)) t2n else
-          TIte(f2, t1n, t2n)
-    }
-  }
-
-  def evaluatePureNumericalExpressioninAtom(a: AtomQFPA): AtomQFPA = a match {
-    case ALeq(t1,t2) => {
-      val t1n = evaluatePureNumericalExpressioninTerm(t1)
-      val t2n = evaluatePureNumericalExpressioninTerm(t2)
-      ALeq(t1n, t2n)
-    }
-    case AEq(t1,t2) => {
-      val t1n = evaluatePureNumericalExpressioninTerm(t1)
-      val t2n = evaluatePureNumericalExpressioninTerm(t2)
-      AEq(t1n, t2n)
-    }
-  }
-
-  def evaluatePureNumericalExpressions(f: QFPAFormula): QFPAFormula = f match {
-    case QFPAAnd(f1,f2) => {
-      val f1n = evaluatePureNumericalExpressions(f1)
-      val f2n = evaluatePureNumericalExpressions(f2)
-      QFPAAnd(f1n, f2n)
-    }
-    case QFPAOr(f1,f2) => {
-      val f1n = evaluatePureNumericalExpressions(f1)
-      val f2n = evaluatePureNumericalExpressions(f2)
-      QFPAOr(f1n, f2n)
-    }
-    case QFPANot(f1)  => {
-      val f1n = evaluatePureNumericalExpressions(f1)
-      QFPANot(f1n)
-    }
-    case QFPAAtom(a)  => {
-      val a1 = evaluatePureNumericalExpressioninAtom(a)
-      QFPAAtom(a1)
-    }
-    case QFPAFalse => f
-    case QFPATrue  => f
-  }
-
-
-
-  def evaluatePureBooleanExpressionsinAtom(a: AtomQFPA): QFPAFormula = a match {
-    case ALeq(t1, t2) => {
-      if (t1 == t2) QFPATrue else {
-        val (b1, c1) = isNumericalTerm(t1)
-        val (b2, c2) = isNumericalTerm(t2)
-        if (b1 && b2) {
-          if (c1 <= c2) QFPATrue else QFPANot(QFPATrue)
-        } else QFPAAtom(a)
-      }
-    }
-    case AEq(t1,t2) => {
-      if (t1 == t2) QFPATrue else {
-        val (b1, c1) = isNumericalTerm(t1)
-        val (b2, c2) = isNumericalTerm(t2)
-        if (b1 && b2) {
-          if (c1 == c2) QFPATrue else QFPANot(QFPATrue)
-        } else QFPAAtom(a)
-      }
-    }
-  }
-
-
-  def evaluatePureBooleanExpressions(f: QFPAFormula): QFPAFormula = f match {
-    case QFPAAnd(f1,f2) => {
-      val f1n = evaluatePureBooleanExpressions(f1)
-      val f2n = evaluatePureBooleanExpressions(f2)
-      if (f1n == QFPANot(QFPATrue) || f2n == QFPANot(QFPATrue)) QFPANot(QFPATrue) else
-        if (f1n == QFPATrue) f2n else
-          if (f2n == QFPATrue) f1n else
-            QFPAAnd(f1n, f2n)
-    }
-    case QFPAOr(f1,f2) => {
-      val f1n = evaluatePureBooleanExpressions(f1)
-      val f2n = evaluatePureBooleanExpressions(f2)
-      if (f1n == QFPATrue || f2n == QFPATrue) QFPATrue else
-        if (f1n == QFPANot(QFPATrue)) f2n else
-          if (f2n == QFPANot(QFPATrue)) f1n else
-            QFPAOr(f1n, f2n)
-    }
-    case QFPANot(f1)  => {
-      val f1n = evaluatePureBooleanExpressions(f1)
-      val f2n = f1n match {
-        case QFPANot(f3n) => f3n
-        case _ => QFPANot(f1n)
-      }
-      f2n
-    }
-    case QFPAAtom(a)  => evaluatePureBooleanExpressionsinAtom(a)
-    case QFPAFalse => f
-    case QFPATrue  => f
-  }
-
-
-  def simplifyArithmeticExpressionsInQFPA(f: QFPAFormula): QFPAFormula = {
-    val f1 = evaluatePureNumericalExpressions(f)
-    val f2 = evaluatePureBooleanExpressions(f1)
-    f2
- }
-
-
-  def evaluateFormulaForVariablesStartingWith(f: QFPAFormula, m: Map[String, Int], s: String): QFPAFormula = {
-    val f1 = replaceVectorsStartingWithSomeStringWithValues(f, m, s)
-    val f2 = simplifyArithmeticExpressionsInQFPA(f1)
-    f2
-  }
-
-
-// ===========================
-
-  def deriveValueofVarTermInModel(t: TermQFPA, m: Map[String, Int]): Int  = t match {
-    case TConstant(c) => c
-    case TVariable(v) => m(v)
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def isNulVectorinGivenModel(t: List[TermQFPA], m: Map[String, Int]): Boolean = {
-    val t1 = t.map(tm => deriveValueofVarTermInModel(tm, m))
-    t1.forall(tm => (tm == 0))
-  }
-
-
-
-  def replaceAllTermsWithZeroinTerm(t: TermQFPA, l: List[TermQFPA]): TermQFPA = t match {
-    case TConstant(c) => t
-    case TVariable(v) => if (l.contains(t)) TConstant(0) else t
-    case TPlus(t1, t2) => {
-      val t1n = replaceAllTermsWithZeroinTerm(t1, l)
-      val t2n = replaceAllTermsWithZeroinTerm(t2, l)
-      TPlus(t1n, t2n)
-    }
-    case TTimes(c, t1) => {
-      val t1n = replaceAllTermsWithZeroinTerm(t1, l)
-      TTimes(c, t1n)
-    }
-    case TIte(f, t1, t2) => {
-      val fn = replaceAllTermsWithZero(f, l)
-      val t1n = replaceAllTermsWithZeroinTerm(t1, l)
-      val t2n = replaceAllTermsWithZeroinTerm(t2, l)
-      TIte(fn, t1n, t2n)
-    }
-  }
-
-  def replaceAllTermsWithZeroinAtom(a: AtomQFPA, t: List[TermQFPA]): AtomQFPA = a match {
-    case ALeq(t1,t2) => {
-      val t1n =  replaceAllTermsWithZeroinTerm(t1, t)
-      val t2n =  replaceAllTermsWithZeroinTerm(t2, t)
-      ALeq(t1n, t2n)
-    }
-    case AEq(t1,t2) => {
-      val t1n =  replaceAllTermsWithZeroinTerm(t1, t)
-      val t2n =  replaceAllTermsWithZeroinTerm(t2, t)
-      AEq(t1n, t2n)
-    }
-  }
-
-  def replaceAllTermsWithZero(f: QFPAFormula, t: List[TermQFPA]): QFPAFormula = f match {
-    case QFPAAnd(f1,f2) => {
-      val f1n = replaceAllTermsWithZero(f1, t)
-      val f2n = replaceAllTermsWithZero(f2, t)
-      QFPAAnd(f1n, f2n)
-    }
-    case QFPAOr(f1,f2) => {
-      val f1n = replaceAllTermsWithZero(f1, t)
-      val f2n = replaceAllTermsWithZero(f2, t)
-      QFPAOr(f1n, f2n)
-    }
-    case QFPANot(f1)  => {
-      val f1n = replaceAllTermsWithZero(f1, t)
-      QFPANot(f1n)
-    }
-    case QFPAAtom(a)  => {
-      val a1 = replaceAllTermsWithZeroinAtom(a, t)
-      QFPAAtom(a1)
-    }
-    case QFPAFalse => f
-    case QFPATrue  => f
-  }
-
-  def removeZeroVectorInFormula(f: QFPAFormula, t: List[TermQFPA]): QFPAFormula = {
-    val f1 = replaceAllTermsWithZero(f, t)
-    val f2 = simplifyArithmeticExpressionsInQFPA(f1) 
-    f2
-  }
-}
-
diff --git a/src/multisets/CheckingConsistency.scala b/src/multisets/CheckingConsistency.scala
deleted file mode 100644
index cc2c2733f36fda18a45bbdb0014ce217838efb5e..0000000000000000000000000000000000000000
--- a/src/multisets/CheckingConsistency.scala
+++ /dev/null
@@ -1,357 +0,0 @@
-package multisets
-import scala.collection.mutable.Map
-import scala.collection.mutable.Set
-//import java.io._
-
-import z3.scala._
-
-object CheckingConsistency {
-
-
-
-
-/*
-
-
-
-  def createVariableString(va:Array[String]):String = {
-   var s = ""
-   va.foreach(v => s = s + "(" + v + " Int) ")
-   s
-  }
-
-
-  def createSMTRepresentationOfTerm(t:TermQFPA):String = t match {
-    case TVariable(v) => v
-    case TConstant(c) =>  c.toString
-    case TPlus(t1, t2) => {
-      val s1 = createSMTRepresentationOfTerm(t1)
-      val s2 = createSMTRepresentationOfTerm(t2)
-      "(+ " + s1 + " " + s2 + ")"
-    }
-    case TTimes(c, t1) => {
-      val s1 = createSMTRepresentationOfTerm(t1)
-      "(* " + c.toString + " " + s1 + ")"
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def createSMTRepresentationOfAtom(a:AtomQFPA):String = a match {
-    case ALeq(t1, t2) => {
-      val s1 = createSMTRepresentationOfTerm(t1)
-      val s2 = createSMTRepresentationOfTerm(t2)
-      "(<= " + s1 + " " + s2 + ")"
-    }
-    case AEq(t1, t2) => {
-      val s1 = createSMTRepresentationOfTerm(t1)
-      val s2 = createSMTRepresentationOfTerm(t2)
-      "(= " + s1 + " " + s2 + ")"
-    }
-  }
-
-  def createSMTRepresentationOfFormula(f:QFPAFormula):String = {
-    val s = f match {
-      case QFPAAnd(f1, f2) => {
-        val s1 = createSMTRepresentationOfFormula(f1)
-        val s2 = createSMTRepresentationOfFormula(f2)
-        "and " + s1 + " " + s2
-      }
-      case QFPAOr(f1, f2) => {
-        val s1 = createSMTRepresentationOfFormula(f1)
-        val s2 = createSMTRepresentationOfFormula(f2)
-        "or " + s1 + " " + s2
-      }
-      case QFPANot(f1) => {
-        val s1 = createSMTRepresentationOfFormula(f1)
-        "not " + s1
-      }
-      case QFPAAtom(a) => createSMTRepresentationOfAtom(a)
-      case _ => " "
-    }
-    "( " + s + " )"
-  }
-
-
-  def callZ3toDetermineConsistency(c:List[QFPAFormula]):String = {
-    val smtfile = File.createTempFile("iteremove", ".smt");
-    val smtfileName = smtfile.getAbsolutePath
-
-    val vars = getAllVariablesFromListofFormulas(c)
-    val s1 = createVariableString(vars)
-
-    val out = new BufferedWriter(new FileWriter(smtfile))
-    out.write("(benchmark example")
-    out.newLine()
-    out.write(":logic QF_LIA")
-    out.newLine()
-    out.write(":extrafuns (")
-    out.write(s1)
-    out.write(")")
-    out.newLine()
-    out.write(":formula (and")
-    out.newLine()
-    vars.foreach (v => {
-      out.write("(<=  0 " + v + " )" )
-      out.newLine()
-    })
-    c.foreach(g => {
-      val sg = createSMTRepresentationOfFormula(g)
-      out.write(sg)
-      out.newLine()
-    })
-    out.write(")")
-    out.newLine()
-    out.write(")")
-    out.newLine()
-    out.close
-
-    val cmd =  Array("z3.exe.linux", smtfileName)
-    val p: Process = Runtime.getRuntime.exec(cmd)
-    val input: BufferedReader = new BufferedReader(new InputStreamReader(p.getInputStream()))
-    val line: String = input.readLine
-    p.waitFor
-    input.close
-
-    smtfile.deleteOnExit
-    line
-  }
-
-
-  def checkConsistencyofOneFormula(f:QFPAFormula): List[String] = {
-    val smtfile = File.createTempFile("finalFormula", ".smt");
-    val smtfileName = smtfile.getAbsolutePath
-
-    val vars = getAllVariablesFromOneFormula(f)
-    val s1 = createVariableString(vars)
-
-    val out = new BufferedWriter(new FileWriter(smtfile))
-    out.write("(benchmark example")
-    out.newLine()
-    out.write(":logic QF_LIA")
-    out.newLine()
-    out.write(":extrafuns (")
-    out.write(s1)
-    out.write(")")
-    out.newLine()
-    out.write(":formula (and")
-    out.newLine()
-    vars.foreach (v => {
-      out.write("(<=  0 " + v + " )" )
-      out.newLine()
-    })
-    val sg = createSMTRepresentationOfFormula(f)
-    out.write(sg)
-    out.newLine()
-    out.write(")")
-    out.newLine()
-    out.write(")")
-    out.newLine()
-    out.close
-
-    val cmd =  Array("z3", "-m", smtfileName)
-    val p: Process = Runtime.getRuntime.exec(cmd)
-    val input: BufferedReader = new BufferedReader(new InputStreamReader(p.getInputStream()))
-    var line = input.readLine()
-    var l: List[String] = Nil
-    while (line != null) {
-      l = line :: l
-      line = input.readLine()
-    }
-    p.waitFor
-    input.close
-
-    smtfile.deleteOnExit
-    l
-  }  */
-
-
-// start: getting out all variables
-
-  def getAllVariablesAndConstsFromTerm(t:TermQFPA):(Set[String], Set[Int]) = t match {
-    case TVariable(v) => (Set(v), Set[Int]())
-    case TConstant(c) =>  (Set[String](), Set(c))
-    case TPlus(t1, t2) => {
-      val p1 = getAllVariablesAndConstsFromTerm(t1)
-      val p2 = getAllVariablesAndConstsFromTerm(t2)
-      (p1._1 ++ p2._1, p1._2 ++ p2._2)
-    }
-    case TTimes(c, t1) => {
-      val p1 = getAllVariablesAndConstsFromTerm(t1)
-      (p1._1, p1._2 ++ Set(c))
-    }
-    case TIte(f, t1, t2) => {
-      val p0 = getAllVariablesAndConstsFromFormula(f)
-      val p1 = getAllVariablesAndConstsFromTerm(t1)
-      val p2 = getAllVariablesAndConstsFromTerm(t2)
-      (p0._1 ++ p1._1 ++ p2._1, p0._2 ++ p1._2 ++ p2._2)
-    }
-  }
-
-  def getAllVariablesAndConstsFromAtom(a:AtomQFPA):(Set[String], Set[Int]) = a match {
-    case ALeq(t1, t2) => {
-      val p1 = getAllVariablesAndConstsFromTerm(t1)
-      val p2 = getAllVariablesAndConstsFromTerm(t2)
-      (p1._1 ++ p2._1, p1._2 ++ p2._2)
-    }
-    case AEq(t1, t2) => {
-      val p1 = getAllVariablesAndConstsFromTerm(t1)
-      val p2 = getAllVariablesAndConstsFromTerm(t2)
-      (p1._1 ++ p2._1, p1._2 ++ p2._2)
-    }
-  }
-
-  def getAllVariablesAndConstsFromFormula(f:QFPAFormula):(Set[String], Set[Int]) = f match {
-    case QFPAAnd(f1, f2) => {
-      val p1 = getAllVariablesAndConstsFromFormula(f1)
-      val p2 = getAllVariablesAndConstsFromFormula(f2)
-      (p1._1 ++ p2._1, p1._2 ++ p2._2)
-    }
-    case QFPAOr(f1, f2) => {
-      val p1 = getAllVariablesAndConstsFromFormula(f1)
-      val p2 = getAllVariablesAndConstsFromFormula(f2)
-      (p1._1 ++ p2._1, p1._2 ++ p2._2)
-    }
-    case QFPANot(f1) => getAllVariablesAndConstsFromFormula(f1)
-    case QFPAAtom(a) => getAllVariablesAndConstsFromAtom(a)
-    case QFPAFalse => (Set[String](), Set[Int]())
-    case QFPATrue => (Set[String](), Set[Int]())
-  }
-
-
-  def getAllVariablesAndConstsFromListofFormulas(c:List[QFPAFormula]): (Set[String], Set[Int]) = {
-    var p = (Set[String](), Set[Int]())
-    c.foreach(g => {
-      val p1 = getAllVariablesAndConstsFromFormula(g)
-      p = (p._1 ++ p1._1, p._2 ++ p1._2) 
-    })
-    p
-  }
-
-// end
-
-
-
-  def mkASTTerm(t:TermQFPA, s: Z3Sort, z3: Z3Context): (Z3AST, Z3Sort, Z3Context) = t match {
-    case TConstant(c) => (z3.mkInt(c, s), s, z3)
-    case TVariable(v) => (z3.mkConst(z3.mkStringSymbol(v), s), s, z3)
-    case TPlus(t1, t2) =>  {
-      val t1N = mkASTTerm(t1, s, z3)._1
-      val t2N = mkASTTerm(t2, s, z3)._1
-      (z3.mkAdd(t1N, t2N), s, z3)
-    }
-    case TTimes(c, t1)=> {
-      val cN = z3.mkInt(c, s)
-      val t1N = mkASTTerm(t1, s, z3)._1
-      (z3.mkMul(cN, t1N), s, z3)
-    }
-    case TIte(f, t1, t2)=> {
-      val fN = mkAST(f, s, z3)._1
-      val t1N = mkASTTerm(t1, s, z3)._1
-      val t2N = mkASTTerm(t2, s, z3)._1
-      (z3.mkITE(fN, t1N, t2N), s, z3)
-    }
-  }
-
-  def mkASTAtom(a:AtomQFPA, s: Z3Sort, z3: Z3Context): (Z3AST, Z3Sort, Z3Context) = a match {
-    case ALeq(t1,t2) => {
-      val t1N = mkASTTerm(t1, s, z3)._1
-      val t2N = mkASTTerm(t2, s, z3)._1
-      (z3.mkLE(t1N, t2N), s, z3)
-    }
-    case AEq(t1,t2) => {
-      val t1N = mkASTTerm(t1, s, z3)._1
-      val t2N = mkASTTerm(t2, s, z3)._1
-      (z3.mkEq(t1N, t2N), s, z3)
-    }
-  }
-
-  def mkAST(f: QFPAFormula, s: Z3Sort, z3: Z3Context): (Z3AST, Z3Sort, Z3Context) = f match {
-    case QFPAAnd(f1,f2) => {
-      val f1N = mkAST(f1, s, z3)._1
-      val f2N = mkAST(f2, s, z3)._1
-      (z3.mkAnd(f1N, f2N), s, z3)
-    }
-    case QFPAOr(f1,f2) => {
-      val f1N = mkAST(f1, s, z3)._1
-      val f2N = mkAST(f2, s, z3)._1
-      (z3.mkOr(f1N, f2N), s, z3)
-    }
-    case QFPANot(f1)  => (z3.mkNot(mkAST(f1, s, z3)._1), s, z3)
-    case QFPAAtom(a)  => mkASTAtom(a, s, z3)
-    case QFPAFalse => (z3.mkFalse, s, z3)
-    case QFPATrue  => (z3.mkTrue, s, z3)
-  }
-
-
-  def callZ3NewWaytoDetermineConsistency(c:List[QFPAFormula]): Boolean = {
-    val z3 = new Z3Context((new Z3Config).setParamValue("MODEL", "false"))
-    val i = z3.mkIntSort
-
-    val z3formulasPairs = c.map(f => mkAST(f, i, z3))
-    val z3formulas = z3formulasPairs.map(f => f._1)
-    z3formulas.foreach(f => z3.assertCnstr(f))
-
-    val b = z3.check() match {
-      case Some(x) => x
-      case None => error("There was an error with Z3.")
-    }
-    z3.delete
-    b
-  }
-
-
-/////////
-
-
-  def callZ3NewWaytoCheckConsistencyofOneFormula(f:QFPAFormula):(Boolean, Map[String, Int]) = {
-    val z3 = new Z3Context((new Z3Config).setParamValue("MODEL", "true"))
-    val i = z3.mkIntSort
-
-    val vars = getAllVariablesAndConstsFromFormula(f)._1
-    val varMap = Map.empty[String,Z3AST]
-
-    vars.foreach(v => {
-      if(!varMap.keySet.contains(v)) {
-        val ast = z3.mkConst(z3.mkStringSymbol(v), i)
-        varMap(v) = ast
-        }
-    })
-
-    val z3formulaTuple = mkAST(f, i, z3)
-    val z3formula = z3formulaTuple._1
-    z3.assertCnstr(z3formula)
-
-    val (res, model) = z3.checkAndGetModel()
-
-    val out = res match {
-      case Some(false) => (false, Map.empty[String,Int]) 
-      case Some(true) => (true, Map.empty[String,Int] ++ varMap.map(p => (p._1, model.evalAs[Int](p._2).get)))
-      case None => error("There was an error with Z3.")
-    }
-    out
-  }
-
-
-
-
-//------------------------------------------
-// old names keep consistency with old calls
-//------------------------------------------
-
-
-// calls Z3 on list of formulas and returns "sat" or "unsat"
-  def callZ3toDetermineConsistency(c:List[QFPAFormula]):String = {
-     val b = callZ3NewWaytoDetermineConsistency(c)
-     val s = if (b == true) "sat" else "unsat"
-     s
-  }
-
-
-// calls z3 on One formula and return a model and "sat" or "unsat"
-  def checkConsistencyofOneFormula(f:QFPAFormula): (String, Map[String, Int]) = {
-    val p = callZ3NewWaytoCheckConsistencyofOneFormula(f)
-    val res = if (p._1 == true) ("sat", p._2) else ("unsat", p._2)
-    res
-  }
-
-}
diff --git a/src/multisets/CreateDisjunctions.scala b/src/multisets/CreateDisjunctions.scala
deleted file mode 100644
index 444de613ffa8a877e5a70a38f0baa5ad38fe4ee3..0000000000000000000000000000000000000000
--- a/src/multisets/CreateDisjunctions.scala
+++ /dev/null
@@ -1,729 +0,0 @@
-package multisets
-
-
-import scala.collection.mutable.Set
-
-
-object CreateDisjunctions {
-
-// start: input formula
-// output: formula without ITE Expresssions and formula denoting ITE experssions
-
-  def flattenITEExpressionsTerm(t:TermQFPA, vc:Int, il:List[(String,TermQFPA)]):(TermQFPA,Int,List[(String,TermQFPA)]) = t match {
-     case TPlus(t1, t2) => {
-      val (t1N, vc1, il1) = flattenITEExpressionsTerm(t1, vc, il)
-      val (t2N, vc2, il2) = flattenITEExpressionsTerm(t2, vc1, il1)
-      (TPlus(t1N, t2N), vc2, il2)
-    }
-     case TTimes(c, t1) => {
-      val (t1N, vc1, il1) = flattenITEExpressionsTerm(t1, vc, il)
-      (TTimes(c, t1N), vc1, il1)
-     }
-     case TIte(f, t1, t2) => {
-       val newITEVar = "FRESHv" + vc
-       var il1 = (newITEVar, t)  :: il
-       (TVariable(newITEVar), vc + 1, il1)
-     }
-     case _ => (t, vc, il)
-  }
-
-  def flattenITEExpressionsAtom(a:AtomQFPA, vc:Int, il:List[(String,TermQFPA)]):(QFPAFormula,Int,List[(String,TermQFPA)]) = a match {
-     case ALeq(t1, t2) => {
-      val (t1N, vc1, il1) = flattenITEExpressionsTerm(t1, vc, il)
-      val (t2N, vc2, il2) = flattenITEExpressionsTerm(t2, vc1, il1)
-      (QFPAAtom(ALeq(t1N, t2N)), vc2, il2)
-    }
-     case AEq(t1, t2) => {
-      val (t1N, vc1, il1) = flattenITEExpressionsTerm(t1, vc, il)
-      val (t2N, vc2, il2) = flattenITEExpressionsTerm(t2, vc1, il1)
-      (QFPAAtom(AEq(t1N, t2N)), vc2, il2)
-    }
-  }
-
-  def flattenITEExpressionsFormula(f:QFPAFormula, vc:Int, il:List[(String,TermQFPA)]):(QFPAFormula,Int,List[(String,TermQFPA)]) = f match {
-    case QFPAAnd(f1, f2) => {
-      val (f1N, vc1, il1) = flattenITEExpressionsFormula(f1, vc, il)
-      val (f2N, vc2, il2) = flattenITEExpressionsFormula(f2, vc1, il1)
-      (QFPAAnd(f1N, f2N), vc2, il2)
-    }
-    case QFPAOr(f1, f2) => {
-      val (f1N, vc1, il1) = flattenITEExpressionsFormula(f1, vc, il)
-      val (f2N, vc2, il2) = flattenITEExpressionsFormula(f2, vc1, il1)
-      (QFPAOr(f1N, f2N), vc2, il2)
-    }
-    case QFPANot(f1) => {
-      val (f1N, vc1, il1) = flattenITEExpressionsFormula(f1, vc, il)
-      (QFPANot(f1N), vc1, il1)
-    }
-    case QFPAAtom(a) => flattenITEExpressionsAtom(a, vc, il)
-    case _ => (f, vc, il)
-  }
-
- def flatten_ITEList(il:List[(String,TermQFPA)],ic:Int, toBeFlattened: Boolean):List[(String,TermQFPA)] = {
-    var addedFreshITEs = false
-    var ilN:List[(String,TermQFPA)] = Nil
-    var icN = ic
-    if (toBeFlattened) {
-      il.foreach(p => p._2 match {
-        case TIte(f, t1, t2) => {
-          var iltmp:List[(String,TermQFPA)] = Nil
-          val (fF, ic1, il1) = flattenITEExpressionsFormula(f, icN, iltmp)
-          val (t1F, ic2, il2) = flattenITEExpressionsTerm(t1, ic1, il1)
-          val (t2F, ic3, il3) = flattenITEExpressionsTerm(t2, ic2, il2)
-          if (il3.isEmpty) {
-            ilN = p :: ilN
-          } else {
-            val newITEVar = "FRESHv" + ic3
-            icN = ic3 + 1
-            ilN = il3 ::: ilN
-            ilN = (newITEVar, TIte(fF, t1F, t2F)) :: ilN 
-            addedFreshITEs = true
-          }
-        }
-        case _ => error("Impossible case ")
-      })
-      flatten_ITEList(ilN, icN, addedFreshITEs)
-    } else il
-  }
-
-
-  def flattenITEExpressions(f:QFPAFormula):(QFPAFormula, List[(String,TermQFPA)]) = {
-    var variableCount = 0
-    var iteList:List[(String,TermQFPA)] = Nil
-    val (f1, vc1, iteList1) = flattenITEExpressionsFormula(f, variableCount, iteList)
-    // every ITE is pulled out
-    val toBeFlattened = true
-    val iteListFinal = flatten_ITEList(iteList1, vc1, toBeFlattened)
-    (f1, iteListFinal)
-  }
-
-// end
-
-//--------------
-
-//start: v - list of (complex) terms
-// output: $1 - formula describing freshly introduced terms
-  def flattenComplexTerms(v:List[TermQFPA]):(QFPAFormula,List[TermQFPA]) =  {
-    var tc = 0
-    var tempForm:QFPAFormula = QFPATrue
-    var tempVector:List[TermQFPA] = Nil
-    v.foreach(t => t match {
-      case TVariable(v) => tempVector = t :: tempVector
-      case TConstant(c) => tempVector = t :: tempVector
-      case  _ => {
-        val newTermVar = "FRESHt" + tc
-        val fTemp = QFPAAtom(AEq(TVariable(newTermVar), t))
-        tempForm = QFPAAnd(tempForm, fTemp)
-        tempVector = TVariable(newTermVar) :: tempVector
-        tc = tc + 1
-      }
-      })
-    val fN = multisets.Multiset2StarsTranslator.removeTrueAndFalse(tempForm)
-    val tN = tempVector.reverse
-    (fN, tN)
-  }
-//end
-
-
-// ------------
-// start: input f AND l (l = list of conjunction of equlities about ITE)
-//output: DNF of f AND f1 in form List[List[formula]]
-  def nnform(f:QFPAFormula):QFPAFormula = f match {
-    case QFPANot(QFPANot(f1)) => nnform(f1)
-    case QFPANot(QFPAAnd(f1, f2)) => QFPAOr(QFPANot(nnform(f1)), QFPANot(nnform(f2)))
-    case QFPANot(QFPAOr(f1, f2)) => QFPAAnd(QFPANot(nnform(f1)), QFPANot(nnform(f2)))
-    case QFPAAnd(f1, f2) => QFPAAnd(nnform(f1), nnform(f2))
-    case QFPAOr(f1, f2) => QFPAOr(nnform(f1), nnform(f2))
-    case QFPANot(f1) => QFPANot(nnform(f1))
-    case _ => f
-  }
-
-  def removeNegationFromNegatedAtom(a:AtomQFPA):QFPAFormula = a match {
-    case ALeq(t1, t2) => QFPAAtom(ALeq(TPlus(t2, TConstant(1)), t1))
-    case AEq(t1, t2) => QFPAOr(
-      QFPAAtom(ALeq(TPlus(t1, TConstant(1)), t2)),
-      QFPAAtom(ALeq(TPlus(t2, TConstant(1)), t1))
-    )
-  }
-
-  def removeNegationCompletely(f:QFPAFormula):QFPAFormula = f match {
-    case QFPAAnd(f1, f2) => QFPAAnd(removeNegationCompletely(f1), removeNegationCompletely(f2))
-    case QFPAOr(f1, f2) => QFPAOr(removeNegationCompletely(f1), removeNegationCompletely(f2))
-    case QFPANot(QFPAAtom(a)) => removeNegationFromNegatedAtom(a)
-    case QFPANot(QFPATrue) => QFPAFalse
-    case QFPANot(QFPAFalse) => QFPATrue
-    case _ => f
-  }
-
-
-  def mergeTwoConjuntions(d1:List[QFPAFormula], d2:List[QFPAFormula]): List[List[QFPAFormula]] = {
-    val ln = d1 ::: d2
-    List(ln)
-  }
-
-  def addOneDisjuntToWholeFormula(l:List[List[QFPAFormula]], c:List[QFPAFormula]): List[List[QFPAFormula]] = {
-    var lt: List[List[QFPAFormula]] = Nil
-    l.foreach(s => {
-      val fn = mergeTwoConjuntions(s, c)
-      lt = fn ::: lt
-    })
-    lt
-  }
-
-  def mergeTwoDisjunctions(l1: List[List[QFPAFormula]], l2: List[List[QFPAFormula]]): List[List[QFPAFormula]] = {
-    var lt: List[List[QFPAFormula]] = Nil
-    l2.foreach(s => {
-      val ln = addOneDisjuntToWholeFormula(l1, s)
-      lt = ln ::: lt
-    })
-    lt
-  }
-
-
-  def disjuntiveNormalForm(f:QFPAFormula): List[List[QFPAFormula]] = {
-    val f1 = nnform(f)
-    val f2 = removeNegationCompletely(f1)
-    val f3 = f2 match {
-      case QFPAAnd(fa, fb) => {
-        val f1N = disjuntiveNormalForm(fa)
-        val f2N = disjuntiveNormalForm(fb)
-        mergeTwoDisjunctions(f1N, f2N)
-      }
-      case QFPAOr(fa, fb) => {
-        val f1N = disjuntiveNormalForm(fa)
-        val f2N = disjuntiveNormalForm(fb)
-        f1N ::: f2N
-      }
-      case  _ => List(List(f2))
-    }
-    f3
-  }
-
-
-// -------------------------
-
-
-  def mergeTogether(c:List[QFPAFormula],f:List[List[QFPAFormula]]):List[List[QFPAFormula]] = {
-    val list1 = f.map(d => c ::: d)
-    list1
-  }
-
-  def addITEExpressionToOneDisjunct(c:List[QFPAFormula], p:(String,TermQFPA)): List[List[QFPAFormula]] = {
-    val lN = p._2 match {
-      case TIte(f, t1, t2) => {
-         val f1 = disjuntiveNormalForm(f)
-         val f2 = disjuntiveNormalForm(QFPANot(f))
-         val c1 = QFPAAtom(AEq(TVariable(p._1), t1)) :: c
-         val c2 = QFPAAtom(AEq(TVariable(p._1), t2)) :: c
-         val l1 = mergeTogether(c1, f1)
-         val l2 = mergeTogether(c2, f2)
-         l1 ::: l2
-      }
-      case x@_ => error("Impossible case :" + x)
-    }
-    lN
-  }
-
-  def evaluateITEExpressionInListOfDisjunctions(l: List[List[QFPAFormula]], t:(String,TermQFPA)): List[List[QFPAFormula]] = {
-    var lt: List[List[QFPAFormula]] = Nil
-    l.foreach(s => {
-      val ln = addITEExpressionToOneDisjunct(s, t)
-      lt = ln ::: lt
-    })
-    lt
-  }
-
-  def unrollITEExpressions(f:QFPAFormula,lITE: List[(String,TermQFPA)]): List[List[QFPAFormula]] = {
-    val fN = disjuntiveNormalForm(f)
-    var lTemp = fN
-    lITE.foreach(t => {
-      val lNew = evaluateITEExpressionInListOfDisjunctions(lTemp, t)
-      lTemp = lNew
-    })
-    lTemp
-  }
-
-// end
-
-
-
-
-
-// ------------------
-
-/// STRT: to be considered!
-
-  def replaceInequalitiesWithEqualitiesinAtom(a:AtomQFPA, lc:Int):(AtomQFPA,Int) = a match {
-     case ALeq(t1, t2) => {
-     val newTermVar =  "FRESHl" + lc
-     val newRHS = TPlus(t1, TVariable(newTermVar))
-     (AEq(t2, newRHS), lc + 1)
-    }
-     case AEq(t1, t2) => (a, lc)
-  }
-
-  def replaceInequalitiesWithEqualitiesinOneSingleFormula(f:QFPAFormula, lc:Int):(QFPAFormula,Int) = f match {
-    case QFPAAtom(a) => {
-      val (a1, lc1) = replaceInequalitiesWithEqualitiesinAtom(a, lc)
-      (QFPAAtom(a1), lc1)
-    }
-    case QFPATrue => (f, lc)
-    case _ => error("Impossible case ")
-  }
-
-  def replaceInequalitiesWithEqualitiesinConjunct(l:List[QFPAFormula], lc:Int):(List[QFPAFormula],Int) = {
-    var lc1 = lc
-    var lTemp: List[QFPAFormula] = Nil
-    l.foreach(f => {
-      val (fT, lcT) = replaceInequalitiesWithEqualitiesinOneSingleFormula(f, lc1)
-      lc1 = lcT
-       lTemp = fT :: lTemp
-    })
-    (lTemp, lc1)
-  }
-
-
-  def replaceInequalitiesWithEqualities(l:List[List[QFPAFormula]]):List[List[QFPAFormula]] = {
-    var lTemp: List[List[QFPAFormula]] = Nil
-    var lc = 0
-    l.foreach(c => {
-      val (cT, lcT) = replaceInequalitiesWithEqualitiesinConjunct(c, lc)
-      lc = lcT
-      lTemp = cT :: lTemp
-    })
-    lTemp
-  }
-
-//// END
-
-  def consistentConjunctUsingZ3(c:List[QFPAFormula]):Boolean = {
-    val out = multisets.CheckingConsistency.callZ3toDetermineConsistency(c)
-    val res = if (out == "sat") true else false
-    res
-  }
-
-  def removeRedundantUsingZ3(c:List[QFPAFormula]):List[QFPAFormula] = {
-    var l1: List[QFPAFormula] = Nil
-    var l2 = c
-    while (! l2.isEmpty) {
-      val f = l2.head
-      l2 = l2.tail
-      if (consistentConjunctUsingZ3((QFPANot(f) :: l2) ::: l1) ) l1 = f :: l1
-    }
-    l1
-  }
-
-  def useAntisymmetryToDeriveEq(c:List[QFPAFormula]): List[QFPAFormula] = {
-    var l1: List[QFPAFormula] = Nil
-    var ltemp: List[QFPAFormula] = Nil
-    var l2 = c
-    while (! l2.isEmpty) {
-      val f = l2.head
-      l2 = l2.tail
-      f match {
-        case QFPAAtom(ALeq(t1, t2)) => {
-          if (l2.exists(fl => fl == QFPAAtom(ALeq(t2, t1)))) ltemp = f :: ltemp
-          else if (ltemp.exists(fl => fl == QFPAAtom(ALeq(t2, t1)))) l1 = QFPAAtom(AEq(t1, t2)) :: l1
-          else l1 = f :: l1 
-        }
-        case _ => l1 = f :: l1 
-      }
-    }
-    l1
-  }
-
-  def checkConsistencyAndRemoveRedundantUsingZ3(l:List[List[QFPAFormula]]): List[List[QFPAFormula]] = {
-    var lTemp: List[List[QFPAFormula]] = Nil
-    l.foreach(c => if (consistentConjunctUsingZ3(c)) {
-      val c1 = removeRedundantUsingZ3(c)
-      val c2 = useAntisymmetryToDeriveEq(c1)
-     // a <= b & b <= a ===> a = b
-      lTemp = c2 :: lTemp
-    })
-    lTemp
-  }
-
-// ----------------------
-
-/*
-
-  def checkIfTermIsAboutTempVVariable(t:TermQFPA):Boolean = t match {
-    case TVariable(v) => v.startsWith("FRESHv")
-    case TConstant(c) =>  false
-    case TPlus(t1, t2) => false
-    case TTimes(c, t1) => false
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def isAtomAboutTempVVariable(a:AtomQFPA):Boolean = a match {
-    case AEq(t1, t2) => checkIfTermIsAboutTempVVariable(t1)
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def isFormulaAboutTempVVariable(f:QFPAFormula):Boolean = f match {
-    case QFPAAtom(a) => isAtomAboutTempVVariable(a)
-    case QFPAEmpty => false
-    case QFPATrue => false
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def separateEqualitiesIntoTwoListsDepandingOnTempVarV(c:List[QFPAFormula]):(List[QFPAFormula],List[QFPAFormula]) = {
-    var l1T: List[QFPAFormula] = Nil
-    var l2T: List[QFPAFormula] = Nil
-    c.foreach(f => {
-      if (isFormulaAboutTempVVariable(f)) {
-        l2T = f :: l2T
-      } else l1T = f :: l1T
-    })
-    (l1T, l2T)
-  }
-
-
-  def getStringValueofTempVarV(t:TermQFPA):String = t match {
-    case TVariable(v) => v
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def createValueOfTempVarVAtom(a:AtomQFPA):(String,TermQFPA) = a match {
-    case AEq(t1, t2) => {
-      val s = getStringValueofTempVarV(t1)
-      (s, t2)
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def createValueOfTempVarV(f:QFPAFormula):(String,TermQFPA) = f match {
-    case QFPAAtom(a) => createValueOfTempVarVAtom(a)
-    case x@_ => error("Impossible case :" + x)
-  }
-
-   def updateValuesWitnNewVValueTerm(tt:TermQFPA, vu:String, tu: TermQFPA):TermQFPA = tt match {
-    case TVariable(v) => if (v == vu) tu else tt
-    case TConstant(c) =>  tt
-    case TPlus(t1, t2) => {
-      val t1N = updateValuesWitnNewVValueTerm(t1, vu, tu)
-      val t2N = updateValuesWitnNewVValueTerm(t2, vu, tu)
-      TPlus(t1N, t2N)
-    }
-    case TTimes(c, t1) => {
-      val t1N = updateValuesWitnNewVValueTerm(t1, vu, tu)
-      TTimes(c, t1N)
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-   def updateValuesWitnNewVValueAtom(a:AtomQFPA, v:String, t: TermQFPA):AtomQFPA = a match {
-    case AEq(t1, t2) => {
-      val t1N = updateValuesWitnNewVValueTerm(t1, v, t)
-      val t2N = updateValuesWitnNewVValueTerm(t2, v, t)
-      AEq(t1N, t2N)
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-   def updateValuesWitnNewVValueFormula(f:QFPAFormula, v:String, t: TermQFPA):QFPAFormula = f match {
-    case QFPAAtom(a) => QFPAAtom(updateValuesWitnNewVValueAtom(a, v, t))
-    case QFPAEmpty => f
-    case QFPATrue => f
-    case x@_ => error("Impossible case :" + x)
-  }
-
-
-   def updateValuesWitnNewVValue(l:List[QFPAFormula], v:String, t: TermQFPA):List[QFPAFormula] = {
-    var lTemp: List[QFPAFormula] = Nil
-    l.foreach(f => {
-      val fN = updateValuesWitnNewVValueFormula(f, v, t)
-      lTemp = fN :: lTemp
-    })
-    lTemp
-  }
-
-
-  def getRidOfTempVVariablesFromConjuntion(c:List[QFPAFormula]):List[QFPAFormula] = {
-    val (l1, l2) = separateEqualitiesIntoTwoListsDepandingOnTempVarV(c)
-    var l1T = l1
-    var l2T = l2
-    while (! l2T.isEmpty) {
-      val (v, t) = createValueOfTempVarV(l2T.head)
-      val lT = l2T.tail
-      l1T = updateValuesWitnNewVValue(l1T, v, t)
-      l2T = updateValuesWitnNewVValue(lT, v, t)
-    } 
-    l1T
-  }
-
-  def orientEqualities(c:List[QFPAFormula]):List[QFPAFormula] = {
-    var l1: List[QFPAFormula] = Nil
-    var l2 = c
-    while (! l2.isEmpty) {
-      val f = l2.head
-      l2 = l2.tail
-      f match {
-        case QFPAAtom(AEq(t1, TVariable(v))) =>  l1 = QFPAAtom(AEq(TVariable(v), t1)) :: l1 
-        case _ => l1 = f :: l1 
-      }
-    }
-    l1
-  }
-
-  def getRidOfTempVVariablesandOrientEqualities(l:List[List[QFPAFormula]]):List[List[QFPAFormula]] = {
-    var lTemp: List[List[QFPAFormula]] = Nil
-    l.foreach(c => {
-      val c1 = getRidOfTempVVariablesFromConjuntion(c)
-      val c2 = orientEqualities(c1)
-       lTemp = c2 :: lTemp
-    })
-    lTemp
-  }
-
-*/
-
-  def getVariablesfromFormula(f:QFPAFormula):Set[String] = {
-    val l1 = multisets.CheckingConsistency.getAllVariablesAndConstsFromFormula(f)
-    l1._1
-  } 
-
-  def getvariablesFromVector(l:List[TermQFPA]):Set[String] = {
-    var s1 = Set.empty[String]
-    l.foreach(t => s1 = s1 ++ multisets.RemoveStars.getAllVariablesFromTerm(t))
-    s1
-  }
-
-// start
-
-  def createZeroMap(vars:Set[String]):Map[String,Int] = {
-    var m = Map.empty[String,Int]
-    vars.foreach(v => m += (v -> 0))
-    m += ("CONST" -> 0)
-    m
-  }
-
-
-  def addVariableinMap(v:String,vars:Set[String]):Map[String,Int] = {
-    var m = createZeroMap(vars)
-    m += (v -> 1)
-    m
-  }
-
-  def addConstantInMap(c:Int,vars:Set[String]):Map[String,Int] = {
-    var m = createZeroMap(vars)
-    m += ("CONST" -> c)
-    m
-  }
-
-  def sumTwoMaps(m1:Map[String,Int],m2:Map[String,Int],vars:Set[String]):Map[String,Int] = {
-    var m3 = Map.empty[String,Int]
-    vars.foreach(v => {
-      val l = m1(v) + m2(v)
-      m3 += (v -> l)
-    })
-    val c = m1("CONST") + m2("CONST") 
-    m3 += ("CONST" -> c)
-    m3
-  }
-
-
-  def multiplyMap(c:Int,m:Map[String,Int],vars:Set[String]):Map[String,Int] = {
-    var mN = Map.empty[String,Int]
-    vars.foreach(v => {
-      val l = c * m(v)
-      mN += (v -> l)
-    })
-    val cn = c * m("CONST") 
-    mN += ("CONST" -> cn)
-    mN
-  }
-
-
-  def createMapRepresentingTerm(t:TermQFPA,vars:Set[String]):Map[String,Int] = t match {
-    case TVariable(v) => addVariableinMap(v,vars)
-    case TConstant(c) => addConstantInMap(c,vars)
-    case TPlus(t1, t2) => {
-      val m1 = createMapRepresentingTerm(t1, vars)
-      val m2 = createMapRepresentingTerm(t2, vars)
-      sumTwoMaps(m1, m2, vars)
-    }
-    case TTimes(c, t1) => {
-      val m1 = createMapRepresentingTerm(t1, vars)
-      multiplyMap(c, m1, vars)
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def createMapRepresentingFormula(f:QFPAFormula,vars:Set[String]):(String,Map[String,Int]) = {
-    val p = f match {
-      case QFPAAtom(ALeq(t1, t2)) => {
-        val s = "i"
-        val m1 = createMapRepresentingTerm(t1, vars)
-        val m2 = createMapRepresentingTerm(t2, vars)
-        val m3 = multiplyMap(-1, m1, vars)
-        val m = sumTwoMaps(m2, m3, vars)
-        (s, m)
-      }
-      case QFPAAtom(AEq(t1, t2)) => {
-        val s = "e"
-        val m1 = createMapRepresentingTerm(t1, vars)
-        val m2 = createMapRepresentingTerm(t2, vars)
-        val m3 = multiplyMap(-1, m1, vars)
-        val m = sumTwoMaps(m2, m3, vars)
-        (s, m)
-      }
-      case QFPATrue => {
-        val s = "t"
-        val m = createZeroMap(vars)
-        (s, m)
-      }
-      case x@_ => error("Impossible case :" + x)
-   }
-   p
-  }
-
-//  end
-
- 
-  def updateOneMapWithOther(mTU:Map[String,Int],m:Map[String,Int],v:String):Map[String,Int] = {
-    val c = mTU(v)
-    val j = m(v)
-    val mT1 = mTU - v
-    val m1 = m - v
-//    val vars = m.keySet 
-// hell:
-    var vars = Set.empty[String]
-    vars = vars ++ m1.keySet
-    val m2 = if (j == 1) multiplyMap(-1,m1,vars) else m1
-    val m3 = multiplyMap(c,m2,vars)
-    sumTwoMaps(mT1, m3, vars)
-  }
-
-  def updateMapwhileQE(l:List[(String,Map[String,Int])],m:Map[String,Int],v:String):List[(String,Map[String,Int])] = {
-    var lt = List.empty[(String,Map[String,Int])]
-    l.foreach(p => {
-      if (p._2 != m) {
-        val m1 = updateOneMapWithOther(p._2, m, v)
-        lt = (p._1, m1) :: lt
-      }
-    })
-    lt
-  }
-
-  def eliminateVariable(v:String,l:List[(String,Map[String,Int])]):(List[(String,Map[String,Int])],Boolean) = {
-    val lf = l.filter(p => p._1 == "e" && (p._2(v) == 1 || p._2(v) == -1))
-    val res = if (lf.isEmpty) (l, false) else (updateMapwhileQE(l, lf.head._2, v), true)
-    res
-  }
-
-
-  def createOneTermFromMap(i:Int,v:String,m:Map[String,Int]):TermQFPA = {
-     val c = i * m(v)
-     val t = if (v == "CONST") TConstant(c) else 
-       if (c == 1) TVariable(v) else TTimes(c, TVariable(v))
-     t
-  }
-
-  def constructTermFromMap(i:Int,vars:Set[String],m:Map[String,Int]):TermQFPA = {
-    val t = if (vars.isEmpty) TConstant(0) else {
-      val l = vars.toList
-      var term = createOneTermFromMap(i, l.head, m)
-      val ltail = l.tail
-      ltail.foreach(v =>  {
-        val t1 = createOneTermFromMap(i, v, m)
-        term = TPlus(t1, term)
-      })
-      term
-    }
-    t
-  }
-
-  def constructPositiveTermFromMap(pVars:Set[String],m:Map[String,Int]):TermQFPA = 
-   constructTermFromMap(1, pVars, m)
-
-  def constructNegativeTermFromMap(nVars:Set[String],m:Map[String,Int]):TermQFPA =
-    constructTermFromMap(-1, nVars, m)
-
-
-  def getPositiveAndNegativeVarsandConstFromMap(m:Map[String,Int],vars:Set[String]):(Set[String],Set[String]) = {
-    var sp = Set.empty[String]
-    var sn = Set.empty[String]
-    vars.foreach(v => {
-      if (m(v) > 0) sp = sp + v
-      if (m(v) < 0) sn = sn + v
-    })
-    if (m("CONST") > 0) sp = sp + "CONST"
-    if (m("CONST") < 0) sn = sn + "CONST"
-    (sp, sn)
-  }
-
-
-  def reconstructEqualityFromMap(m:Map[String,Int],vars:Set[String]):QFPAFormula = {
-    val (pVars, nVars) = getPositiveAndNegativeVarsandConstFromMap(m, vars)
-    val tp = constructPositiveTermFromMap(pVars, m)
-    val tn = constructNegativeTermFromMap(nVars, m)
-    QFPAAtom(AEq(tp, tn))
-  }
-
-  def reconstructInequalityFromMap(m:Map[String,Int],vars:Set[String]):QFPAFormula = {
-    val (pVars, nVars) = getPositiveAndNegativeVarsandConstFromMap(m, vars)
-    val tp = constructPositiveTermFromMap(pVars, m)
-    val tn = constructNegativeTermFromMap(nVars, m)
-    QFPAAtom(ALeq(tn, tp))
-  }
-
-
-  def reconstructFormulaFromMaps(t:(String,Map[String,Int]),vars:Set[String]):QFPAFormula = {
-    val f = if (t._1 == "t") QFPATrue else
-      if (t._1 == "e") reconstructEqualityFromMap(t._2,vars)
-      else  reconstructInequalityFromMap(t._2,vars) 
-    f
-  }
-
-  def reconstructFormulasFromMaps(l:List[(String,Map[String,Int])],vars:Set[String]):List[QFPAFormula] = {
-    val list1 = l.map(e => reconstructFormulaFromMaps(e,vars))
-    list1
-  }
-
-
-
-  def doSimpleQE(v:List[TermQFPA],l:List[QFPAFormula]):List[QFPAFormula] = {
-   val inVars = getvariablesFromVector(v)
-   var allVars = Set.empty[String]
-   l.foreach(f => allVars = allVars ++ getVariablesfromFormula(f))
-   val varsForQE = allVars -- inVars
-   val listOfMaps = l.map(f => createMapRepresentingFormula(f, allVars))
-   var fmla = listOfMaps
-   var eliminated = Set.empty[String]
-   varsForQE.foreach(v => {
-      val p = eliminateVariable(v, fmla)
-      fmla = p._1
-      if (p._2) eliminated = eliminated + v
-   })
-   val l1 = reconstructFormulasFromMaps(fmla,allVars -- eliminated)
-   l1
-  } 
-
-
- // def doEliminationOfConstants(v:List[TermQFPA],List[
-
-
-
-// -----------------------
-
-  def main(v:List[TermQFPA],f:QFPAFormula): (List[TermQFPA], List[List[QFPAFormula]]) = {
-    val (fTemp1, vN) = flattenComplexTerms(v)
-    val fNew1 = if (fTemp1 == QFPATrue) f else QFPAAnd(f, fTemp1)
-    val (fNew2, fl) = flattenITEExpressions(fNew1)
-    // fNew2 is a formula that doesn't contain ITE expressions, 
-    //fl is a list of a type (v, ITE(...)) no nested ITE expressions
-    val listDNFNoITEs = unrollITEExpressions(fNew2, fl)
-    // no more ITE expressions and listDNFNoITs is in DNF, does not contain ITEs
-    // listDNFNoITEs is a list of lists of formulas
-    val list1 = checkConsistencyAndRemoveRedundantUsingZ3(listDNFNoITEs)
-    // list1 contains only satisfiable constraints
-    val list2 = list1.map(f => doSimpleQE(vN,f))
-    val list3 = replaceInequalitiesWithEqualities(list2)
-/*    val list3 = getRidOfTempVVariablesandOrientEqualities(list2) */
-     // a + b = c ===> c = a + b
-    (vN, list3)
-    // vN is a term that contains only variables and list1 is a list of lists of formulas
-  }
-
-}
diff --git a/src/multisets/FormulaConstructor.scala b/src/multisets/FormulaConstructor.scala
deleted file mode 100644
index 4c72b3c6962778f1e83b126a65d9fa2d5603a0b3..0000000000000000000000000000000000000000
--- a/src/multisets/FormulaConstructor.scala
+++ /dev/null
@@ -1,536 +0,0 @@
-package multisets
-
-import scala.collection.mutable.Map
-import scala.collection.mutable.Set
-import java.util.NoSuchElementException
-import multisets.MultisetFormulaPrinter._
-
-
-
-object FormulaConstructor {
-
-
-// start: exists the execution with a message
-  def abort(msg: String) {
-    println(msg)
-    System.exit(-1)
-  }
-
-// start: parsing of NoSuchElementException message
-  def whichVarIsMissing(s: String): String = {
-      val strings = s.split (":");
-      strings(1)
-  }
-// end
-
-
-// Start: we check for atoms of a type a = b, whether it is about msets or integers
-  def checkTypesOfAtom(s: String, m: Map[String, String], a: Atom): Atom = {
-    try {
-      val af = a match {
-        case AEqual(MVariable(m1), MVariable(m2)) => {
-          val aN = if (m(m1) == "INT" && m(m2) == "INT") AAtomOut(AOEq(TOVariable(m1), TOVariable(m2)))
-          else a
-          aN
-        }
-        case AAtomOut(AOEq(TOVariable(v1), TOVariable(v2)))  => {
-          val aN = if (m(v1) == "INT" && m(v2) == "INT") a
-          else AEqual(MVariable(v1), MVariable(v2))
-          aN
-        }
-        case _ => a
-      }
-      af
-    } catch {
-       case ex: NoSuchElementException => {
-         val v = whichVarIsMissing(ex.getMessage)
-         abort("Program abort: in the problem " + s + " the variable " + v + " is not declared!")
-         AEqual(MEmpty, MEmpty)
-       }
-    }
-  }
-
-  def checkAtomsInFormula(s: String, p: (Map[String, String], Formula)): Formula = p._2 match {
-    case FAnd(f1, f2) => {
-      val f1N = checkAtomsInFormula(s, (p._1, f1))
-      val f2N = checkAtomsInFormula(s, (p._1, f2))
-      FAnd(f1N, f2N)
-    }
-    case FOr(f1, f2) => {
-      val f1N = checkAtomsInFormula(s, (p._1, f1))
-      val f2N = checkAtomsInFormula(s, (p._1, f2))
-      FOr(f1N, f2N)
-    }
-    case FNot(f1)  => {
-      val f1N = checkAtomsInFormula(s, (p._1, f1))
-      FNot(f1N)
-    }
-    case FAtom(a)  => {
-      val aN = checkTypesOfAtom(s, p._1, a)
-      FAtom(aN)
-    }
-    case FTrue  => p._2
-    case FFalse  => p._2
-  }
-// end
-
-// start: given a formula we derive two sets of variables: integer variables and set veriables
-  def getVariablesfromMultiset(m: Multiset): (Set[String], Set[String]) = m match {
-    case MVariable(v) => (Set[String](), Set(v))
-    case MEmpty => (Set[String](), Set[String]())
-    case MUnion(m1, m2) => {
-      val (s1, s2)  = getVariablesfromMultiset(m1)
-      val (p1, p2) = getVariablesfromMultiset(m2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case MIntersection(m1, m2) => {
-      val (s1, s2)  = getVariablesfromMultiset(m1)
-      val (p1, p2) = getVariablesfromMultiset(m2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case MPlus(m1, m2) => {
-      val (s1, s2)  = getVariablesfromMultiset(m1)
-      val (p1, p2) = getVariablesfromMultiset(m2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case MMinus(m1, m2) => {
-      val (s1, s2)  = getVariablesfromMultiset(m1)
-      val (p1, p2) = getVariablesfromMultiset(m2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case MSetMinus(m1, m2) => {
-      val (s1, s2)  = getVariablesfromMultiset(m1)
-      val (p1, p2) = getVariablesfromMultiset(m2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case MSetOf(m1) => getVariablesfromMultiset(m1)
-  }
-
-  def getVariablesfromTermIn(t: TermIn): (Set[String], Set[String]) = t match {
-    case TIMultiplicity(v) => (Set[String](), Set(v))
-    case TIConstant(c) => (Set[String](), Set[String]())
-    case TIPlus(t1, t2) => {
-      val (s1, s2)  = getVariablesfromTermIn(t1)
-      val (p1, p2) = getVariablesfromTermIn(t2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case TITimes(c, t1)=> getVariablesfromTermIn(t1)
-    case TIIte(f, t1, t2)=> {
-      val (s1, s2)  = getVariablesfromTermIn(t1)
-      val (p1, p2) = getVariablesfromTermIn(t2)
-      val (st, tt) = (s1 ++ p1, s2 ++ p2)
-      val (sf, tf) = getVariablesfromFormulaIn(f)
-      (sf ++ st, tf ++ tt)
-    }
-  }
-
-  def getVariablesfromAtomIn(a: AtomIn): (Set[String], Set[String]) = a match {
-    case AILeq(t1, t2) => {
-      val (s1, s2)  = getVariablesfromTermIn(t1)
-      val (p1, p2) = getVariablesfromTermIn(t2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case AIEq(t1,t2) => {
-      val (s1, s2)  = getVariablesfromTermIn(t1)
-      val (p1, p2) = getVariablesfromTermIn(t2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-  }
-
-  def getVariablesfromFormulaIn(f: FormulaIn): (Set[String], Set[String]) = f match {
-    case FIAnd(f1, f2) => {
-      val (s1, s2)  = getVariablesfromFormulaIn(f1)
-      val (t1, t2) = getVariablesfromFormulaIn(f2)
-      (s1 ++ t1, s2 ++ t2)
-    }
-    case FIOr(f1, f2) => {
-      val (s1, s2)  = getVariablesfromFormulaIn(f1)
-      val (t1, t2) = getVariablesfromFormulaIn(f2)
-      (s1 ++ t1, s2 ++ t2)
-    }
-    case FINot(f1)  => getVariablesfromFormulaIn(f1)
-    case FIAtom(a)  => getVariablesfromAtomIn(a)
-    case FITrue  => (Set[String](), Set[String]())
-    case FIFalse  => (Set[String](), Set[String]())
-  }
-
-  def getVariablesfromTermOut(t: TermOut): (Set[String], Set[String]) = t match {
-    case TOConstant(c) => (Set[String](), Set[String]())
-    case TOVariable(v) => (Set(v), Set[String]())
-    case TOCard(m) => getVariablesfromMultiset(m)
-    case TOPlus(t1, t2) => {
-      val (s1, s2)  = getVariablesfromTermOut(t1)
-      val (p1, p2) = getVariablesfromTermOut(t2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case TOTimes(c, t1)=> getVariablesfromTermOut(t1)
-    case TOIte(f, t1, t2)=> {
-      val (s1, s2)  = getVariablesfromTermOut(t1)
-      val (p1, p2) = getVariablesfromTermOut(t2)
-      val (st, tt) = (s1 ++ p1, s2 ++ p2)
-      val (sf, tf) = getVariablesfromFormulaOut(f)
-      (sf ++ st, tf ++ tt)
-    }
-  }
-
-  def getVariablesfromAtomOut(a: AtomOut): (Set[String], Set[String]) = a match {
-    case AOLeq(t1, t2) => {
-      val (s1, s2)  = getVariablesfromTermOut(t1)
-      val (p1, p2) = getVariablesfromTermOut(t2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case AOEq(t1,t2) => {
-      val (s1, s2)  = getVariablesfromTermOut(t1)
-      val (p1, p2) = getVariablesfromTermOut(t2)
-      (s1 ++ p1, s2 ++ p2)
-    }
-    case AOSum(l1, f, l2) => {
-      var s = Set[String]()
-      var t = Set[String]()
-      l1.foreach(v => {
-        val (st, tt) = getVariablesfromTermOut(v)
-        s = s ++ st
-        t = t ++ tt
-      })
-      l2.foreach(v => {
-        val (st, tt) = getVariablesfromTermIn(v)
-        s = s ++ st
-        t = t ++ tt
-      })
-      val (sf, tf) = getVariablesfromFormulaIn(f)
-      (s ++ sf, t ++ tf)
-    }
-  }
-
-  def getVariablesfromFormulaOut(f: FormulaOut): (Set[String], Set[String]) = f match {
-    case FOAnd(f1, f2) => {
-      val (s1, s2)  = getVariablesfromFormulaOut(f1)
-      val (t1, t2) = getVariablesfromFormulaOut(f2)
-      (s1 ++ t1, s2 ++ t2)
-    }
-    case FOOr(f1, f2) => {
-      val (s1, s2)  = getVariablesfromFormulaOut(f1)
-      val (t1, t2) = getVariablesfromFormulaOut(f2)
-      (s1 ++ t1, s2 ++ t2)
-    }
-    case FONot(f1)  => getVariablesfromFormulaOut(f1)
-    case FOAtom(a)  => getVariablesfromAtomOut(a)
-    case FOTrue  => (Set[String](), Set[String]())
-    case FOFalse  => (Set[String](), Set[String]())
-  }
-
-  def getVariablesfromAtom(a: Atom): (Set[String], Set[String]) = a match {
-    case AEqual(m1, m2) => {
-      val (s1, s2)  = getVariablesfromMultiset(m1)
-      val (t1, t2) = getVariablesfromMultiset(m2)
-      (s1 ++ t1, s2 ++ t2)
-    }
-    case ASubset(m1,m2) => {
-      val (s1, s2)  = getVariablesfromMultiset(m1)
-      val (t1, t2) = getVariablesfromMultiset(m2)
-      (s1 ++ t1, s2 ++ t2)
-    }
-    case AForAllElem(f1) => getVariablesfromFormulaIn(f1)
-    case AAtomOut(a1)  => getVariablesfromAtomOut(a1)
-  }
-
-  def getVariablesfromFormula(f: Formula): (Set[String], Set[String]) = f match {
-    case FAnd(f1, f2) => {
-      val (s1, s2)  = getVariablesfromFormula(f1)
-      val (t1, t2) = getVariablesfromFormula(f2)
-      (s1 ++ t1, s2 ++ t2)
-    }
-    case FOr(f1, f2) => {
-      val (s1, s2)  = getVariablesfromFormula(f1)
-      val (t1, t2) = getVariablesfromFormula(f2)
-      (s1 ++ t1, s2 ++ t2)
-    }
-    case FNot(f1)  => getVariablesfromFormula(f1)
-    case FAtom(a)  => getVariablesfromAtom(a)
-    case FTrue  => (Set[String](), Set[String]())
-    case FFalse  => (Set[String](), Set[String]())
-  }
-// end
-
-
-// start: checking that all types are correct
-  def checkTypesOfIntVariables(name: String, m: Map[String, String], ints: List[String]): Unit = {
-    try {
-      ints.foreach(v => if (m(v) != "INT") 
-        abort("Program abort: in the problem " + name + " the INT variable " + v + " is declared as" + m(v) +  "!")
-      )
-    } catch {
-       case ex: NoSuchElementException => {
-         val v = whichVarIsMissing(ex.getMessage)
-         abort("Program abort: in the problem " + name + " the variable " + v + " is not declared!")
-         AEqual(MEmpty, MEmpty)
-       }
-    }
-  }
-
-  def checkTypesOfMSetVariables(name: String, m: Map[String, String], msets: List[String]): Unit = {
-    try {
-      msets.foreach(v => if (m(v) == "INT") 
-        abort("Program abort: in the problem " + name + " the collection variable " + v + " is declared as INT!")
-      )
-    } catch {
-       case ex: NoSuchElementException => {
-         val v = whichVarIsMissing(ex.getMessage)
-         abort("Program abort: in the problem " + name + " the variable " + v + " is not declared!")
-         AEqual(MEmpty, MEmpty)
-       }
-    }
-  } 
-
-  def simpleTypeChecking(name: String, m: Map[String, String], ints: List[String], msets: List[String]): Unit = {
-    checkTypesOfIntVariables(name, m, ints)
-    checkTypesOfMSetVariables(name, m, msets)
-  }
-// end
-
-
-// start: here we construct formulas describing that S is a SET or e is an ELEM
-  def createConstraintAboutOneVar(t: String, v:String): Formula = {
-    val f = if (t == "SET") {
-      val f1in = FIAtom(AIEq(TIMultiplicity(v), TIConstant(0)))
-      val f2in = FIAtom(AIEq(TIMultiplicity(v), TIConstant(1)))
-      FAtom(AForAllElem(FIOr(f1in, f2in)))
-    } else FAtom(AAtomOut(AOEq(TOCard(MVariable(v)), TOConstant(1))))
-    f
-  }
-
-  def getAdditionalConstraints(m: Map[String, String], l: List[String]): Formula =  {
-    val ln = l.filter(v => m(v) != "MSET")
-    val f = if (ln.isEmpty) FTrue else {
-      var ft = createConstraintAboutOneVar(m(ln.head), ln.head)
-      val lnt = ln.tail
-      lnt.foreach(v =>  {
-        val fn = createConstraintAboutOneVar(m(v), v)
-        ft = FAnd(ft, fn)
-      })
-      ft
-    }
-    f
-  }
-// end
-
-
-// start:  translation to NNF
-  def nnfTermIn(t: TermIn): TermIn = t match {
-    case TIPlus(t1, t2) => {
-      val t1n  = nnfTermIn(t1)
-      val t2n  = nnfTermIn(t2)
-      TIPlus(t1n, t2n)
-    }
-    case TITimes(c, t1)=> {
-      val t1n  = nnfTermIn(t1)
-      TITimes(c, t1n)
-    }
-    case TIIte(f, t1, t2) => {
-      val t1n  = nnfTermIn(t1)
-      val t2n  = nnfTermIn(t2)
-      val f1 = nnfFormulaIn(f)
-      TIIte(f1, t1n, t2n)
-    }
-    case _ => t
-  }
-
-  def nnfAtomIn(a: AtomIn): AtomIn = a match {
-    case AILeq(t1, t2) => {
-      val t1n  = nnfTermIn(t1)
-      val t2n  = nnfTermIn(t2)
-      AILeq(t1n, t2n)
-    }
-    case AIEq(t1,t2) => {
-      val t1n  = nnfTermIn(t1)
-      val t2n  = nnfTermIn(t2)
-      AIEq(t1n, t2n)
-    }
-  }
-
-  def nnfFormulaIn(f: FormulaIn): FormulaIn =  f match {
-    case FIAnd(f1, f2) => {
-      val f1n  = nnfFormulaIn(f1)
-      val f2n  = nnfFormulaIn(f2)
-      FIAnd(f1n, f2n)
-    }
-    case FIOr(f1, f2) => {
-      val f1n  = nnfFormulaIn(f1)
-      val f2n  = nnfFormulaIn(f2)
-      FIOr(f1n, f2n)
-    }
-    case FINot(FIAnd(f1, f2)) => {
-      val f1n  = nnfFormulaIn(FINot(f1))
-      val f2n  = nnfFormulaIn(FINot(f2))
-      FIOr(f1n, f2n)
-    }
-    case FINot(FIOr(f1, f2)) => {
-      val f1n  = nnfFormulaIn(FINot(f1))
-      val f2n  = nnfFormulaIn(FINot(f2))
-      FIAnd(f1n, f2n)
-    }
-    case FINot(FINot(f1))  => nnfFormulaIn(f1)
-    case FINot(FIAtom(a)) => {
-      val a1 = nnfAtomIn(a)
-      FINot(FIAtom(a1))
-    }
-    case FINot(FITrue)  => FIFalse 
-    case FINot(FIFalse)  => FITrue
-    case FIAtom(a) => {
-      val a1 = nnfAtomIn(a)
-      FIAtom(a1)
-    }
-    case _  => f
-  }
-
-
-  def nnfTermOut(t: TermOut): TermOut = t match {
-    case TOPlus(t1, t2) => {
-      val t1n  = nnfTermOut(t1)
-      val t2n  = nnfTermOut(t2)
-      TOPlus(t1n, t2n)
-    }
-    case TOTimes(c, t1)=> {
-      val t1n  = nnfTermOut(t1)
-       TOTimes(c, t1n)
-    }
-    case TOIte(f, t1, t2) => {
-      val t1n  = nnfTermOut(t1)
-      val t2n  = nnfTermOut(t2)
-      val f1 = nnfFormulaOut(f)
-      TOIte(f1, t1n, t2n)
-    }
-    case _ => t
-  }
-
-  def nnfAtomOut(a: AtomOut): AtomOut = a match {
-    case AOLeq(t1, t2) => {
-      val t1n  = nnfTermOut(t1)
-      val t2n  = nnfTermOut(t2)
-      AOLeq(t1n, t2n)
-    }
-    case AOEq(t1,t2) => {
-      val t1n  = nnfTermOut(t1)
-      val t2n  = nnfTermOut(t2)
-      AOEq(t1n, t2n)
-    }
-    case AOSum(l1, f, l2) => {
-      val l1n = l1.map(v => nnfTermOut(v))
-      val l2n = l2.map(v => nnfTermIn(v))
-      val f1 = nnfFormulaIn(f)
-      AOSum(l1n, f1, l2n)
-    }
-  }
-
-  def nnfFormulaOut(f: FormulaOut): FormulaOut =  f match {
-    case FOAnd(f1, f2) => {
-      val f1n  = nnfFormulaOut(f1)
-      val f2n  = nnfFormulaOut(f2)
-      FOAnd(f1n, f2n)
-    }
-    case FOOr(f1, f2) => {
-      val f1n  = nnfFormulaOut(f1)
-      val f2n  = nnfFormulaOut(f2)
-      FOOr(f1n, f2n)
-    }
-    case FONot(FOAnd(f1, f2)) => {
-      val f1n  = nnfFormulaOut(FONot(f1))
-      val f2n  = nnfFormulaOut(FONot(f2))
-      FOOr(f1n, f2n)
-    }
-    case FONot(FOOr(f1, f2)) => {
-      val f1n  = nnfFormulaOut(FONot(f1))
-      val f2n  = nnfFormulaOut(FONot(f2))
-      FOAnd(f1n, f2n)
-    }
-    case FONot(FONot(f1))  => nnfFormulaOut(f1)
-    case FONot(FOAtom(a)) => {
-      val a1 = nnfAtomOut(a)
-      FONot(FOAtom(a1))
-    }
-    case FONot(FOTrue)  => FOFalse 
-    case FONot(FOFalse)  => FOTrue
-    case FOAtom(a) => {
-      val a1 = nnfAtomOut(a)
-      FOAtom(a1)
-    }
-    case _  => f
-  }
-
-  def nnfAtom(a: Atom): Atom = a match {
-    case AForAllElem(f1) => {
-      val f1n = nnfFormulaIn(f1)
-      AForAllElem(f1n)
-    }
-    case AAtomOut(a1)  => {
-      val a1n = nnfAtomOut(a1)
-      AAtomOut(a1n)
-    }
-    case _ => a
-  }
-
-  def nnf(f: Formula): Formula = f match {
-    case FAnd(f1, f2) => {
-      val f1n  = nnf(f1)
-      val f2n  = nnf(f2)
-      FAnd(f1n, f2n)
-    }
-    case FOr(f1, f2) => {
-      val f1n  = nnf(f1)
-      val f2n  = nnf(f2)
-      FOr(f1n, f2n)
-    }
-    case FNot(FAnd(f1, f2)) => {
-      val f1n  = nnf(FNot(f1))
-      val f2n  = nnf(FNot(f2))
-      FOr(f1n, f2n)
-    }
-    case FNot(FOr(f1, f2)) => {
-      val f1n  = nnf(FNot(f1))
-      val f2n  = nnf(FNot(f2))
-      FAnd(f1n, f2n)
-    }
-    case FNot(FNot(f1))  => nnf(f1)
-    case FNot(FAtom(a)) => {
-      val a1 = nnfAtom(a)
-      FNot(FAtom(a1))
-    }
-    case FNot(FTrue)  => FFalse 
-    case FNot(FFalse)  => FTrue
-    case FAtom(a) => {
-      val a1 = nnfAtom(a)
-      FAtom(a1)
-    }
-    case _  => f
-  }
-// end
-
-
-// start: input problem, output: (name, created-formula, negated-created-formula, constraints)
-// all output formulas are in NNF
-  def processOneProblem(p: (String, (Map[String, String], Formula))): (String, (Formula, Formula, Formula)) = {
-    val mf = p._2
-    val f1 = checkAtomsInFormula(p._1, mf)
-    val f1f = nnf(f1)
-    val (sInt, sMsets) = getVariablesfromFormula(f1)
-    val lInt = sInt.toList
-    val lMsets = sMsets.toList
-    val m  = mf._1
-    simpleTypeChecking(p._1, m, lInt, lMsets)
-    val fc = getAdditionalConstraints(m, lMsets)
-    val fcf = nnf(fc)
-    val fN = nnf(FNot(f1))
-    (p._1,  (f1f, fN, fcf))
-  }
-// end
-
-
-
-//------------------------------------------------
-
-  def main(problemList: List[(String, (Map[String, String], Formula))]) : List[(String, (Formula, Formula, Formula))] = {
-    val formulaList = problemList.map(p => processOneProblem(p))
-    formulaList
-  }
-}
-
diff --git a/src/multisets/MAPA-FunExamples.scala b/src/multisets/MAPA-FunExamples.scala
deleted file mode 100644
index 4f7b651575049e95dbeac0e683b0a885fc94aa7e..0000000000000000000000000000000000000000
--- a/src/multisets/MAPA-FunExamples.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-package mapaFun
-
-import mapaFun.MAPAFunFormulaPrinter._
-import multisets.MultisetFormulaPrinter._
-
-
-object MAPAFunExamples {
-
-//    val m1 = MFMPlus(MFFunction("f", MFSetVar("D")), MFFunction("f", MFSetVar("F")))
-    val m1 = MFMPlus(MFFunction("f", MFSetVar("A")), MFFunction("f", MFSetVar("E")))
-    val a1 = MFMSetEqual(MFFunction("f", MFSUnion(MFSetVar("A"), MFSetVar("E"))), m1)
-    val s1 = MFSIntersec(MFSetVar("A"), MFSetVar("E"))
-    val f1 = MFAnd(MFAtom(MFSetEqual(s1, MFEmptySet)), MFNot(MFAtom(a1)))
-
-//---------------
-// the one from the VMCAI submission
-
-    val f21 = MFAtom(MFSetSubset(MFSetVar("N"), MFSetVar("A")))
-    val f22 = MFAtom(MFIntEqual(MFSCard(MFSetVar("T")), MFIntConst (1)))
-    val f23 = MFAtom(MFSetEqual(MFSIntersec(MFSetVar("T"), MFSetVar("A")), MFEmptySet))
-    val f24 = MFAtom(MFMSetEqual(MFFunction("d", MFSetVar("T")), MFMSetVar("E")))
-    val f25 = MFAtom(MFMSetEqual(MFFunction("d", MFSetVar("N")), MFMSetVar("C")))
-    val f26 = MFAtom(MFSetEqual(MFSUnion(MFSetVar("N"), MFSetVar("T")), MFSetVar("N1")))
-    val f27 = MFAtom(MFMSetEqual(MFFunction("d", MFSetVar("N1")), MFMSetVar("C1")))
-    val f28 = MFNot(MFAtom(MFIntLessEqual(MFMCard(MFMSetVar("C1")), MFIPlus(MFMCard(MFMSetVar("C")), MFIntConst (1)))))
-    val f2 = MFAnd(MFAnd(MFAnd(f21, f22), MFAnd(f23, f24)), MFAnd(MFAnd(f25, f26), MFAnd(f27, f28)))
-
-//---------------
-
-
-    def run (name: String, f: MAPAFunFormula): Unit = {
-      println("Formula " + name + ":")
-      print_MAPAFunFormula(f)
-      println("")
-      println("---------------------")
-      val f1n = mapaFun.SetExpansionAndCNF.noMoreSets(f)
-      print_MAPAFunFormula(f1n)
-      println("")
-      println("---------------------")
-      val f2n = mapaFun.FunctionElimination.noMoreFunctions(f1n)
-      print_MAPAFunFormula(f2n)
-      println("")
-      println("---------------------")
-      val f3n = mapaFun.MapaFunConversion.mapaFun2standardMAPA(f2n)
-      print_multisetFormula(f3n)
-      println("")
-      println("---------------------")
-      println("And now the original decision procedure:")
-      println("---------------------")
-//      guru.multisets.Examples.run("f", f3n)
-      println("---------------------")
-   }
-
-
-// -----
-
-  def runExamples() {
-    run("f1", f1)
-//    run("f2", f2)
-  }
-
-
-}
-
-
diff --git a/src/multisets/MAPA-FunFunctionEliminations.scala b/src/multisets/MAPA-FunFunctionEliminations.scala
deleted file mode 100644
index 877da2fc5af6cd763d536bb3f4f780c023d652f6..0000000000000000000000000000000000000000
--- a/src/multisets/MAPA-FunFunctionEliminations.scala
+++ /dev/null
@@ -1,210 +0,0 @@
-package mapaFun
-
-import scala.collection.mutable.Map
-
-
-object FunctionElimination {
-
-
-  def createSumOfMultisets(l: List[String]): MAPAFunMultiset = {
-    var mm = MFMSetVar(l.head):  MAPAFunMultiset
-    val t = l.tail
-    t.foreach(s => mm = MFMPlus(MFMSetVar(s), mm))
-    mm
-  }
-
-
-  def createMultisetVariableOutofSet(s: String): String = {
-    val s1 = s.replace('S', 'M')
-    s1
-  }
-
-
-  def createListOfFreshMultisetsAndSetMultisetEqualitySet(l: List[String]): (List[String], Set[(String, String)]) = {
-    var sn = Set[(String, String)]()
-    var ln: List[String] = Nil
-    l.foreach(e => {
-      val st = createMultisetVariableOutofSet(e)
-      ln = st :: ln
-      sn = sn ++ Set((e, st))
-    })
-    (ln, sn)
-  }
-
-
-
-  def listOfSetsInUnion(s: MAPAFunSet): List[String] = s match {
-    case MFSetVar(v) => List(v)
-    case MFSUnion(MFSetVar(v), s1) => {
-      val l1 = listOfSetsInUnion(s1)
-      val l2 = v :: l1
-      l2
-    }
-    case MFSUnion(s1, MFSetVar(v)) => {
-      val l1 = listOfSetsInUnion(s1)
-      val l2 = v :: l1
-      l2
-    }
-    case MFSUnion(s1, s2) => {
-      val l1 = listOfSetsInUnion(s1)
-      val l2 = listOfSetsInUnion(s2)
-      val l3 = l1 ::: l2
-      l3
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-
-
-
-  def pullOutAllFunctionsFromMultiset(m: MAPAFunMultiset): (MAPAFunMultiset, Set[(String, String)])  = m match {
-    case MFMSetVar(v) => (m, Set[(String, String)]())
-    case MFEmptyMSet => (m, Set[(String, String)]())
-    case MFMUnion(m1, m2) => {
-      val (m1n, s1) = pullOutAllFunctionsFromMultiset(m1)
-      val (m2n, s2) = pullOutAllFunctionsFromMultiset(m2)
-      (MFMUnion(m1n, m2n), s1 ++ s2)
-    }
-    case MFMIntersec(m1, m2) => {
-      val (m1n, s1) = pullOutAllFunctionsFromMultiset(m1)
-      val (m2n, s2) = pullOutAllFunctionsFromMultiset(m2)
-      (MFMIntersec(m1n, m2n), s1 ++ s2)
-    }
-    case MFMPlus(m1, m2) => {
-      val (m1n, s1) = pullOutAllFunctionsFromMultiset(m1)
-      val (m2n, s2) = pullOutAllFunctionsFromMultiset(m2)
-      (MFMPlus(m1n, m2n), s1 ++ s2)
-    }
-    case MFMMinus(m1, m2) => {
-      val (m1n, s1) = pullOutAllFunctionsFromMultiset(m1)
-      val (m2n, s2) = pullOutAllFunctionsFromMultiset(m2)
-      (MFMMinus(m1n, m2n), s1 ++ s2)
-    }
-    case MFSetMinus(m1, m2) => {
-      val (m1n, s1) = pullOutAllFunctionsFromMultiset(m1)
-      val (m2n, s2) = pullOutAllFunctionsFromMultiset(m2)
-      (MFSetMinus(m1n, m2n), s1 ++ s2)
-    }
-    case MFSSetOf(m1) => {
-      val (m1n, s1) = pullOutAllFunctionsFromMultiset(m1)
-      (MFSSetOf(m1n), s1)
-    }
-    case MFFunction(f, s) => {
-      val l = listOfSetsInUnion(s)
-      val (ml, smes) = createListOfFreshMultisetsAndSetMultisetEqualitySet(l)
-      val mf = createSumOfMultisets(ml)
-      (mf, smes)
-    }
-  }
-
-
-  def pullOutAllFunctionsFromInteger(i: MAPAFunInt): (MAPAFunInt, Set[(String, String)]) = i match {
-    case MFIntVar(v) => (i, Set[(String, String)]())
-    case MFIntConst(c) => (i, Set[(String, String)]())
-    case MFIPlus(i1, i2) => {
-      val (i1n, s1) = pullOutAllFunctionsFromInteger(i1)
-      val (i2n, s2) = pullOutAllFunctionsFromInteger(i2)
-      (MFIPlus(i1n, i2n), s1 ++ s2)
-    }
-    case MFITimes(c, i1) => {
-      val (i1n, s1) = pullOutAllFunctionsFromInteger(i1)
-      (MFITimes(c, i1n), s1)
-    }
-    case MFSCard(s) => (i, Set[(String, String)]())
-    case MFMCard(m) => {
-      val (m1, s1) = pullOutAllFunctionsFromMultiset(m)
-      (MFMCard(m1), s1)
-    }
-  }
-
-
-  def pullOutAllFunctionsFromAtom(a: MAPAFunAtom): (MAPAFunFormula, Set[(String, String)]) = a match {
-    case MFSetEqual(s1, s2) => (MFAtom(a), Set[(String, String)]())
-    case MFSetSubset(s1, s2) => (MFAtom(a), Set[(String, String)]())
-    case MFMSetEqual(m1, m2) => {
-      val (m1n, s1) = pullOutAllFunctionsFromMultiset(m1)
-      val (m2n, s2) = pullOutAllFunctionsFromMultiset(m2)
-      val an = MFMSetEqual(m1n, m2n)
-      (MFAtom(an), s1 ++ s2)
-    }
-    case MFMSetSubset(m1, m2) => {
-      val (m1n, s1) = pullOutAllFunctionsFromMultiset(m1)
-      val (m2n, s2) = pullOutAllFunctionsFromMultiset(m2)
-      val an = MFMSetSubset(m1n, m2n)
-      (MFAtom(an), s1 ++ s2)
-    }
-    case MFIntEqual(i1, i2) => {
-      val (i1n, s1) = pullOutAllFunctionsFromInteger(i1)
-      val (i2n, s2) = pullOutAllFunctionsFromInteger(i2)
-      val an = MFIntEqual(i1n, i2n)
-      (MFAtom(an), s1 ++ s2)
-    }
-    case MFIntLessEqual(i1, i2) => {
-      val (i1n, s1) = pullOutAllFunctionsFromInteger(i1)
-      val (i2n, s2) = pullOutAllFunctionsFromInteger(i2)
-      val an = MFIntLessEqual(i1n, i2n)
-      (MFAtom(an), s1 ++ s2)
-    }
-    case MFIntDivides(c, i) => {
-      val (in, s1) = pullOutAllFunctionsFromInteger(i)
-      val an = MFIntDivides(c, in)
-      (MFAtom(an), s1)
-    }
-  }
-
-
-  def pullOutAllFunctionsFromFormula(f: MAPAFunFormula): (MAPAFunFormula, Set[(String, String)])  = f match {
-    case MFAnd(f1, f2) => {
-      val (f1n, s1) = pullOutAllFunctionsFromFormula(f1)
-      val (f2n, s2) = pullOutAllFunctionsFromFormula(f2)
-      (MFAnd(f1n, f2n), s1 ++ s2)
-    }
-    case MFOr(f1, f2) => {
-      val (f1n, s1) = pullOutAllFunctionsFromFormula(f1)
-      val (f2n, s2) = pullOutAllFunctionsFromFormula(f2)
-      (MFOr(f1n, f2n), s1 ++ s2)
-    }
-    case MFNot(f1)  => {
-      val (f1n, s1) = pullOutAllFunctionsFromFormula(f1)
-      (MFNot(f1n), s1)
-    }
-    case MFAtom(a)  => pullOutAllFunctionsFromAtom(a)
-  }
-
-
-
-  def createOneCardinalityFormula(p: (String, String)): MAPAFunFormula = {
-    val s = p._1
-    val m = p._2
-    val f = MFAtom(MFIntEqual(MFSCard(MFSetVar(s)), MFMCard(MFMSetVar(m))))
-    f
-  }
-
-
-  def createCardinalityFormulas(l:  List[(String, String)]): MAPAFunFormula = {
-    var ft = createOneCardinalityFormula(l.head)
-    val t = l.tail
-    val ff = if (t.isEmpty) ft else {
-      t.foreach(p => {
-        val fp = createOneCardinalityFormula(p)
-        ft = MFAnd(fp, ft)
-      })
-      ft
-    }
-    ff
-  }
-
-
-
-
-//--------------------------------------
-
-
-  def noMoreFunctions(f: MAPAFunFormula): MAPAFunFormula  = {
-    val (f1, s) = pullOutAllFunctionsFromFormula(f)
-    val l = s.toList
-    val f2 = createCardinalityFormulas(l)
-    MFAnd(f1, f2)
-  }
-}
-
diff --git a/src/multisets/MAPA-FunPrinter.scala b/src/multisets/MAPA-FunPrinter.scala
deleted file mode 100644
index 3cb7b593109c20f7a5624fd25e7df91c416a43d1..0000000000000000000000000000000000000000
--- a/src/multisets/MAPA-FunPrinter.scala
+++ /dev/null
@@ -1,153 +0,0 @@
-package mapaFun
-
-
-object MAPAFunFormulaPrinter {
-
-  def print_MAPAFunInt(i: MAPAFunInt): Unit = i match {
-    case MFIntVar(v) => Console.print(v)
-    case MFIntConst(c) => Console.print(c)
-    case MFIPlus(i1, i2) => {
-      print_MAPAFunInt(i1)
-      Console.print(" + ")
-      print_MAPAFunInt(i2)
-    }
-    case MFITimes(c, i1) => {
-      Console.print(c + "*")
-      print_MAPAFunInt(i1)
-    }
-    case MFSCard(s) => {
-      Console.print("| ")
-      print_MAPAFunSet(s)
-      print(" |")
-    }
-    case MFMCard(m) => {
-      Console.print("| ")
-      print_MAPAFunMultiset(m)
-      print(" |")
-    }
-  }
-
-  def print_MAPAFunMultiset(m: MAPAFunMultiset):Unit = m match {
-    case MFMSetVar(v) => Console.print(v)
-    case MFEmptyMSet => Console.print("EMPTY MULTISET")
-    case MFMUnion(m1, m2) => {
-      print_MAPAFunMultiset(m1)
-      Console.print(" UNION ")
-      print_MAPAFunMultiset(m2)
-    }
-    case MFMIntersec(m1, m2) => {
-      print_MAPAFunMultiset(m1)
-      Console.print(" INTERSEC ")
-      print_MAPAFunMultiset(m2)
-    }
-    case MFMPlus(m1, m2) => {
-      print_MAPAFunMultiset(m1)
-      Console.print(" PLUS ")
-      print_MAPAFunMultiset(m2)
-    }
-    case MFMMinus(m1, m2) => {
-      print_MAPAFunMultiset(m1)
-      Console.print(" MINUS ")
-      print_MAPAFunMultiset(m2)
-    }
-    case MFSetMinus(m1, m2) => {
-      print_MAPAFunMultiset(m1)
-      Console.print(" SET MINUS ")
-      print_MAPAFunMultiset(m2)
-    }
-    case MFSSetOf(m1) => {
-      Console.print(" SETOf ( ")
-      print_MAPAFunMultiset(m1)
-      print(" )")
-    }
-    case MFFunction(f, s) => {
-      Console.print(f + "[ ")
-      print_MAPAFunSet(s)
-      print(" ]")
-    }
-  }
-
-  def print_MAPAFunSet(s: MAPAFunSet):Unit = s match {
-    case MFSetVar(v) => Console.print(v)
-    case MFEmptySet => Console.print("EMPTY SET")
-    case MFUnivSet => Console.print("UNIVERSAL SET")
-    case MFSUnion(s1, s2) => {
-      print_MAPAFunSet(s1)
-      Console.print(" UNION ")
-      print_MAPAFunSet(s2)
-    }
-    case MFSIntersec(s1, s2) => {
-      print_MAPAFunSet(s1)
-      Console.print(" INTERSEC ")
-      print_MAPAFunSet(s2)
-    }
-    case MFSCompl(s1) => {
-      Console.print("( ")
-      print_MAPAFunSet(s1)
-      print(" )^c ")
-    }
-  }
-
-
-  def print_MAPAFunAtom(a: MAPAFunAtom):Unit = a match {
-    case MFSetEqual(s1, s2) => {
-      print_MAPAFunSet(s1)
-      Console.print(" = ")
-      print_MAPAFunSet(s2)
-    }
-    case MFSetSubset(s1, s2) => {
-      print_MAPAFunSet(s1)
-      Console.print(" SUBSET ")
-      print_MAPAFunSet(s2)
-    }
-    case MFMSetEqual(m1, m2) => {
-      print_MAPAFunMultiset(m1)
-      Console.print(" = ")
-      print_MAPAFunMultiset(m2)
-    }
-    case MFMSetSubset(m1, m2) => {
-      print_MAPAFunMultiset(m1)
-      Console.print(" SUBSET ")
-      print_MAPAFunMultiset(m2)
-    }
-    case MFIntEqual(i1, i2) => {
-      print_MAPAFunInt(i1)
-      Console.print(" = ")
-      print_MAPAFunInt(i2)
-    }
-    case MFIntLessEqual(i1, i2) => {
-      print_MAPAFunInt(i1)
-      Console.print(" =< ")
-      print_MAPAFunInt(i2)
-    }
-    case MFIntDivides(c, i) => {
-      Console.print(c + " * ")
-      print_MAPAFunInt(i)
-    }
-  }
-
-
-  def print_MAPAFunFormula(f: MAPAFunFormula):Unit = f match {
-    case MFAnd(f1, f2) => {
-      Console.print(" ( ")
-      print_MAPAFunFormula(f1)
-      print(" ) AND ( ")
-      print_MAPAFunFormula(f2)
-      print(" ) ")
-    }
-    case MFOr(f1, f2) => {
-      Console.print(" ( ")
-      print_MAPAFunFormula(f1)
-      print(" ) OR ( ")
-      print_MAPAFunFormula(f2)
-      print(" ) ")
-    }
-    case MFNot(f1)  => {
-      Console.print(" NOT ( ")
-      print_MAPAFunFormula(f1)
-      print(" ) ")
-    }
-    case MFAtom(a)  => print_MAPAFunAtom(a)
-  }
-
-}
\ No newline at end of file
diff --git a/src/multisets/MAPA-FunSetExpansionTranslator.scala b/src/multisets/MAPA-FunSetExpansionTranslator.scala
deleted file mode 100644
index 7962f98ff51cbd2bac9ec90a29b99a999ee2f0c0..0000000000000000000000000000000000000000
--- a/src/multisets/MAPA-FunSetExpansionTranslator.scala
+++ /dev/null
@@ -1,397 +0,0 @@
-package mapaFun
-
-
-import scala.collection.mutable.Map
-import scala.collection.immutable.Set
-import java.lang.Integer
-
-
-
-object SetExpansionAndCNF {
-
-
-
-
-
-
-
-
-// ---- getRidOfSetVariables
-
-
-  def simplifySetAtoms(s1: Set[String], s2: Set[String]): (Set[String], Set[String]) = {
-    val si = s1.intersect(s2)
-    val s1n = s1 -- si
-    val s2n = s2 -- si
-    (s1n, s2n)
-  }
-
-
-  def getRidOfSetVariablesinSet(s: MAPAFunSet, m: Map[String,Set[String]]): Set[String] = s match {
-    case MFSetVar(v) => m(v)
-    case MFEmptySet => Set[String]()
-    case MFUnivSet => m("ALL")
-    case MFSUnion(s1, s2) => {
-      val ss1 = getRidOfSetVariablesinSet(s1, m)
-      val ss2 = getRidOfSetVariablesinSet(s2, m)
-      ss1 ++ ss2
-    }
-    case MFSIntersec(s1, s2) => {
-      val ss1 = getRidOfSetVariablesinSet(s1, m)
-      val ss2 = getRidOfSetVariablesinSet(s2, m)
-      val ss3 = ss1.intersect(ss2)
-      ss3
-    }
-    case MFSCompl(s1) => {
-      val ss1 = getRidOfSetVariablesinSet(s1, m)
-      val ss2 = m("ALL") -- ss1
-      ss2
-    }
-  }
-
-  def createSetUnion(s: Set[String]): MAPAFunSet =  {
-    val l = s.toList
-    if (l.isEmpty) MFEmptySet else {
-       var ts =  MFSetVar(l.head): MAPAFunSet
-       val t = l.tail
-       t.foreach(e => {
-         val ns = MFSetVar(e)
-         ts = MFSUnion(ts, ns)
-       })
-       ts
-    }
-  }
-
-  def getRidOfSetVariablesinInt(i: MAPAFunInt, m: Map[String,Set[String]]): MAPAFunInt  = i match {
-    case MFIntVar(v) => i
-    case MFIntConst(c) => i
-    case MFIPlus(i1, i2) => {
-      val i1n = getRidOfSetVariablesinInt(i1, m)
-      val i2n = getRidOfSetVariablesinInt(i2, m)
-      MFIPlus(i1n, i2n)
-    }
-    case MFITimes(c, i1) => {
-      val i1n = getRidOfSetVariablesinInt(i1, m)
-      MFITimes(c, i1n)
-    }
-    case MFSCard(s) => {
-      val sl = getRidOfSetVariablesinSet(s, m)
-      val sn = createSetUnion(sl)
-      MFSCard(sn)
-    }
-    case MFMCard(ms) => {
-      val msn = getRidOfSetVariablesinMultiset(ms, m)
-      MFMCard(msn)
-    }
-  }
-
-  def getRidOfSetVariablesinMultiset(mm: MAPAFunMultiset, m: Map[String,Set[String]]): MAPAFunMultiset  = mm match {
-    case MFMSetVar(v) => mm
-    case MFEmptyMSet => mm
-    case MFMUnion(m1, m2) => {
-      val m1n = getRidOfSetVariablesinMultiset(m1, m)
-      val m2n = getRidOfSetVariablesinMultiset(m2, m)
-      MFMUnion(m1n, m2n)
-    }
-    case MFMIntersec(m1, m2) => {
-      val m1n = getRidOfSetVariablesinMultiset(m1, m)
-      val m2n = getRidOfSetVariablesinMultiset(m2, m)
-      MFMIntersec(m1n, m2n)
-    }
-    case MFMPlus(m1, m2) => {
-      val m1n = getRidOfSetVariablesinMultiset(m1, m)
-      val m2n = getRidOfSetVariablesinMultiset(m2, m)
-      MFMPlus(m1n, m2n)
-    }
-    case MFMMinus(m1, m2) => {
-      val m1n = getRidOfSetVariablesinMultiset(m1, m)
-      val m2n = getRidOfSetVariablesinMultiset(m2, m)
-      MFMMinus(m1n, m2n)
-    }
-    case MFSetMinus(m1, m2) => {
-      val m1n = getRidOfSetVariablesinMultiset(m1, m)
-      val m2n = getRidOfSetVariablesinMultiset(m2, m)
-      MFSetMinus(m1n, m2n)
-    }
-    case MFSSetOf(m1) => {
-      val m1n = getRidOfSetVariablesinMultiset(m1, m)
-      MFSSetOf(m1n)
-    }
-    case MFFunction(f, s) => {
-      val sl = getRidOfSetVariablesinSet(s, m)
-      val sn = createSetUnion(sl)
-      MFFunction(f, sn)
-    }
-  }
-
-
-  def getRidOfSetVariablesinAtom(a:MAPAFunAtom, m: Map[String,Set[String]]): MAPAFunAtom  = a match {
-    case MFSetEqual(s1, s2) => {
-      val ss1l = getRidOfSetVariablesinSet(s1, m)
-      val ss2l = getRidOfSetVariablesinSet(s2, m)
-      val (ss1ln, ss2ln) = simplifySetAtoms(ss1l, ss2l)
-      val s1n = createSetUnion(ss1ln)
-      val s2n = createSetUnion(ss2ln)
-      MFSetEqual(s1n, s2n)
-    }
-    case MFSetSubset(s1, s2) => {
-      val ss1l = getRidOfSetVariablesinSet(s1, m)
-      val ss2l = getRidOfSetVariablesinSet(s2, m)
-      val (ss1ln, ss2ln) = simplifySetAtoms(ss1l, ss2l)
-      val s1n = createSetUnion(ss1ln)
-      val s2n = createSetUnion(ss2ln)
-      MFSetSubset(s1n, s2n)
-    }
-    case MFMSetEqual(m1, m2) => {
-      val m1n = getRidOfSetVariablesinMultiset(m1, m)
-      val m2n = getRidOfSetVariablesinMultiset(m2, m)
-      MFMSetEqual(m1n, m2n)
-    }
-    case MFMSetSubset(m1, m2) => {
-      val m1n = getRidOfSetVariablesinMultiset(m1, m)
-      val m2n = getRidOfSetVariablesinMultiset(m2, m)
-      MFMSetSubset(m1n, m2n)
-    }
-    case MFIntEqual(i1, i2) => {
-      val i1n = getRidOfSetVariablesinInt(i1, m)
-      val i2n = getRidOfSetVariablesinInt(i2, m)
-      MFIntEqual(i1n, i2n)
-    }
-    case MFIntLessEqual(i1, i2) => {
-      val i1n = getRidOfSetVariablesinInt(i1, m)
-      val i2n = getRidOfSetVariablesinInt(i2, m)
-      MFIntLessEqual(i1n, i2n)
-    }
-    case MFIntDivides(c, i) => {
-      val in = getRidOfSetVariablesinInt(i, m)
-      MFIntDivides(c, in)
-    }
-  }
-
-
-  def getRidOfSetVariables(f: MAPAFunFormula, m: Map[String,Set[String]]): MAPAFunFormula = f match {
-    case MFAnd(f1, f2) => {
-      val f1n = getRidOfSetVariables(f1, m)
-      val f2n = getRidOfSetVariables(f2, m)
-      MFAnd(f1n, f2n)
-    }
-    case MFOr(f1, f2) => {
-      val f1n = getRidOfSetVariables(f1, m)
-      val f2n = getRidOfSetVariables(f2, m)
-      MFOr(f1n, f2n)
-    }
-    case MFNot(f1) => {
-      val f1n = getRidOfSetVariables(f1, m)
-      MFNot(f1n)
-    }
-    case MFAtom(a) =>{
-      val an = getRidOfSetVariablesinAtom(a, m)
-      MFAtom(an)
-    } 
-  }
-
-
-
-
-
-
-
-// ---- list of all sets 
-
-  def setofAllSetsinInt(i: MAPAFunInt): Set[String] = i match {
-    case MFIntVar(v) => Set[String]()
-    case MFIntConst(c) => Set[String]()
-    case MFIPlus(i1, i2) => {
-      val l1 = setofAllSetsinInt(i1)
-      val l2 = setofAllSetsinInt(i2)
-      l1 ++ l2
-    }
-    case MFITimes(c, i1) => setofAllSetsinInt(i1)
-    case MFSCard(s) => setofAllSetsinSet(s)
-    case MFMCard(m) => setofAllSetsinMultiset(m)
-  }
-
-  def setofAllSetsinMultiset(m: MAPAFunMultiset): Set[String] = m match {
-    case MFMSetVar(v) => Set[String]()
-    case MFEmptyMSet => Set[String]()
-    case MFMUnion(m1, m2) => {
-      val l1 = setofAllSetsinMultiset(m1)
-      val l2 = setofAllSetsinMultiset(m2)
-      l1 ++ l2
-    }
-    case MFMIntersec(m1, m2) => {
-      val l1 = setofAllSetsinMultiset(m1)
-      val l2 = setofAllSetsinMultiset(m2)
-      l1 ++ l2
-    }
-    case MFMPlus(m1, m2) => {
-      val l1 = setofAllSetsinMultiset(m1)
-      val l2 = setofAllSetsinMultiset(m2)
-      l1 ++ l2
-    }
-    case MFMMinus(m1, m2) => {
-      val l1 = setofAllSetsinMultiset(m1)
-      val l2 = setofAllSetsinMultiset(m2)
-      l1 ++ l2
-    }
-    case MFSetMinus(m1, m2) => {
-      val l1 = setofAllSetsinMultiset(m1)
-      val l2 = setofAllSetsinMultiset(m2)
-      l1 ++ l2
-    }
-    case MFSSetOf(m1) => setofAllSetsinMultiset(m1)
-    case MFFunction(f, s) => setofAllSetsinSet(s)
-  }
-
-  def setofAllSetsinSet(s: MAPAFunSet): Set[String]  = s match {
-    case MFSetVar(v) => Set(v)
-    case MFEmptySet => Set[String]()
-    case MFUnivSet => Set[String]()
-    case MFSUnion(s1, s2) => {
-      val l1 = setofAllSetsinSet(s1)
-      val l2 = setofAllSetsinSet(s2)
-      l1 ++ l2
-    }
-    case MFSIntersec(s1, s2) => {
-      val l1 = setofAllSetsinSet(s1)
-      val l2 = setofAllSetsinSet(s2)
-      l1 ++ l2
-    }
-    case MFSCompl(s1) => setofAllSetsinSet(s1)
-  }
-
-  def setofAllSetsinAtom(a: MAPAFunAtom): Set[String] = a match {
-    case MFSetEqual(s1, s2) => {
-      val l1 = setofAllSetsinSet(s1)
-      val l2 = setofAllSetsinSet(s2)
-      l1 ++ l2
-    }
-    case MFSetSubset(s1, s2) => {
-      val l1 = setofAllSetsinSet(s1)
-      val l2 = setofAllSetsinSet(s2)
-      l1 ++ l2
-    }
-    case MFMSetEqual(m1, m2) => {
-      val l1 = setofAllSetsinMultiset(m1)
-      val l2 = setofAllSetsinMultiset(m2)
-      l1 ++ l2
-    }
-    case MFMSetSubset(m1, m2) => {
-      val l1 = setofAllSetsinMultiset(m1)
-      val l2 = setofAllSetsinMultiset(m2)
-      l1 ++ l2
-    }
-    case MFIntEqual(i1, i2) => {
-      val l1 = setofAllSetsinInt(i1)
-      val l2 = setofAllSetsinInt(i2)
-      l1 ++ l2
-    }
-    case MFIntLessEqual(i1, i2) => {
-      val l1 = setofAllSetsinInt(i1)
-      val l2 = setofAllSetsinInt(i2)
-      l1 ++ l2
-    }
-    case MFIntDivides(c, i) => setofAllSetsinInt(i)
-  }
-
-  def setofAllSets(f: MAPAFunFormula): Set[String] = f match {
-    case MFAnd(f1, f2) => {
-      val s1 = setofAllSets(f1)
-      val s2 = setofAllSets(f2)
-      s1 ++ s2
-    }
-    case MFOr(f1, f2) => {
-      val s1 = setofAllSets(f1)
-      val s2 = setofAllSets(f2)
-      s1 ++ s2
-    }
-    case MFNot(f1)  => setofAllSets(f1)
-    case MFAtom(a)  => setofAllSetsinAtom(a)
-  }
-
-  def power2(n: Int): Int = {
-    var i = 1
-    for(k <- 1 to n) i = i * 2
-    i
-  }
-
-  def createListOfExponentialSize(n: Int): List[List[String]] = {
-    if (n == 0) Nil
-    else {
-      val ub = power2 (n - 1)
-      var l1: List[List[String]] = Nil
-      for (i <- 0 to (ub - 1) ) {
-        val s = (Integer.toBinaryString(i)).toList
-        var s1 = s.map (_.toString)
-        while (s1.length < (n - 1)) {
-          s1 = "0" :: s1
-        }
-        l1 = s1 :: l1
-      }
-      l1
-    }
-  }
-
-  def createStringfromList(i: Int, l: List[String]): String = {
-    val ln = l.take(i) ::: ( "1" :: l.drop(i) )
-    ln.mkString("S", "", "")
-  }
-
-
-  def createCubesForSet(i: Int, l: List[List[String]]): Set[String] = {
-    var s = Set[String]()
-    l.foreach(l1 => {
-      val st = createStringfromList(i, l1)
-      s = s ++ Set(st)
-    })
-    s
-  }
-
-
-  def createUniversalSetCubes(l: List[List[String]]): Set[String] = {
-    var s = Set[String]()
-    l.foreach(e => {
-      val l0 = "0" :: e
-      val s0 = l0.mkString("S", "", "")
-      s = s ++ Set(s0)
-      val l1 = "1" :: e
-      val s1 = l1.mkString("S", "", "")
-      s = s ++ Set(s1)
-    })
-    s
-  }
-
-  def createMapOfNewCubes(l: List[String]): Map[String,Set[String]] = {
-    val tm = Map[String, Set[String]]()
-    val n = l.length
-    var i = 0
-    val ls = createListOfExponentialSize(n)
-    l.foreach(e => {
-      val nl = createCubesForSet(i, ls)
-      i = i + 1
-      tm += (e -> nl)
-      }
-    )
-    val us = createUniversalSetCubes(ls)
-    tm += ("ALL" -> us)
-    tm
-  }
-
-  def listOfAllSets(f: MAPAFunFormula): Map[String,Set[String]] = {
-    val s1 = setofAllSets(f)
-    val l1 = s1.toList
-    val m1 = createMapOfNewCubes(l1)
-    m1
-  }
-
-
-//--------------------------------------
-
-  def noMoreSets(f: MAPAFunFormula): MAPAFunFormula = {
-    val l1 = listOfAllSets(f)
-    val f1 = getRidOfSetVariables(f, l1)
-    f1
-  }
-
-}
-
diff --git a/src/multisets/MAPA-FunTranslation2MAPA.scala b/src/multisets/MAPA-FunTranslation2MAPA.scala
deleted file mode 100644
index 5ebb931b476fd89986e14764e609288bc61c1d05..0000000000000000000000000000000000000000
--- a/src/multisets/MAPA-FunTranslation2MAPA.scala
+++ /dev/null
@@ -1,214 +0,0 @@
-package mapaFun
-
-import multisets._
-
-
-object MapaFunConversion {
-
-
-  def createFormulaThatTwoAreDisjoint(s1: String, s2: String): Formula = {
-    val a = AEqual(MIntersection(MVariable(s1), MVariable(s2)), MEmpty)
-    FAtom(a)
-  }
-
-  def createFormulaThatOneIsDisjoint(s: String, l: List[String]): Formula = {
-   val h = l.head
-   val t = l.tail
-   var ft = createFormulaThatTwoAreDisjoint(s, h)
-   t.foreach(e => {
-     val f1 = createFormulaThatTwoAreDisjoint(s, e)
-     ft = FAnd(f1, ft)
-   })
-   ft
-  }
-
-  def createFormulaForDisjointness(l: List[String]): Formula = {
-    var h = l.head
-    var t = l.tail
-    var ft = createFormulaThatOneIsDisjoint(h, t)
-    while (t.length > 1) {
-      h = t.head
-      t = t.tail
-      val f1 = createFormulaThatOneIsDisjoint(h, t)
-      ft = FAnd(f1, ft)
-    }
-    ft
-  }
-
-  def createFormulaInItIsSet(s: String): FormulaIn = {
-    val a0 = AIEq(TIMultiplicity(s), TIConstant(0))
-    val a1 = AIEq(TIMultiplicity(s), TIConstant(1))
-    FIOr(FIAtom(a0), FIAtom(a1))
-  }
-
-  def createFormulaInTheyAreSets(l: List[String]): FormulaIn = {
-    var f1 = createFormulaInItIsSet(l.head)
-    val t = l.tail
-    t.foreach(s => {
-      val ft = createFormulaInItIsSet(s)
-      f1 = FIAnd(ft, f1)
-    })
-    f1
-  }
-
-  def createFormulaTheyAreSets(l: List[String]): Formula = {
-    val f1 = createFormulaInTheyAreSets(l)
-    FAtom(AForAllElem(f1))
-  }
-
-  def createFormulaAboutSets(l: List[String]): Formula = {
-    val f1 = createFormulaTheyAreSets(l)
-    if (l.length == 1) f1 else {
-      val f2 = createFormulaForDisjointness(l)
-      FAnd(f1, f2)
-    }
-  }
-
-//-------------------
-
-  def convertMAPAFunSet2MapaMset(s: MAPAFunSet): (Multiset, Set[String])  = s match {
-    case MFSetVar(v) => (MVariable(v), Set(v))
-    case MFEmptySet => (MEmpty, Set[String]())
-    case MFSUnion(s1, s2) => {
-      val (m1, l1) = convertMAPAFunSet2MapaMset(s1)
-      val (m2, l2) = convertMAPAFunSet2MapaMset(s2)
-      (MPlus(m1, m2), l1 ++ l2)
-    }
-    case x@_ => error("Impossible case :" + x)  
-  }
-
-  def convertMAPAFunMset2MapaMset(m: MAPAFunMultiset): (Multiset, Set[String])  = m match {
-    case MFMSetVar(v) => (MVariable(v), Set[String]())
-    case MFEmptyMSet => (MEmpty, Set[String]())
-    case MFMUnion(m1, m2) => {
-      val (m1n, l1) = convertMAPAFunMset2MapaMset(m1)
-      val (m2n, l2) = convertMAPAFunMset2MapaMset(m2)
-      (MUnion(m1n, m2n), l1 ++ l2)
-    }
-    case MFMIntersec(m1, m2) => {
-      val (m1n, l1) = convertMAPAFunMset2MapaMset(m1)
-      val (m2n, l2) = convertMAPAFunMset2MapaMset(m2)
-      (MIntersection(m1n, m2n), l1 ++ l2)
-    }
-    case MFMPlus(m1, m2) => {
-      val (m1n, l1) = convertMAPAFunMset2MapaMset(m1)
-      val (m2n, l2) = convertMAPAFunMset2MapaMset(m2)
-      (MPlus(m1n, m2n), l1 ++ l2)
-    }
-    case MFMMinus(m1, m2) => {
-      val (m1n, l1) = convertMAPAFunMset2MapaMset(m1)
-      val (m2n, l2) = convertMAPAFunMset2MapaMset(m2)
-      (MMinus(m1n, m2n), l1 ++ l2)
-    }
-    case MFSetMinus(m1, m2) => {
-      val (m1n, l1) = convertMAPAFunMset2MapaMset(m1)
-      val (m2n, l2) = convertMAPAFunMset2MapaMset(m2)
-      (MSetMinus(m1n, m2n), l1 ++ l2)
-    }
-    case MFSSetOf(m1) => {
-      val (m1n, l1) = convertMAPAFunMset2MapaMset(m1)
-      (MSetOf(m1n), l1)
-    }
-    case x@_ => error("Impossible case :" + x)  
-  }
-
-
-  def convertMAPAFunint2MapaTO(i: MAPAFunInt): (TermOut, Set[String])  = i match {
-    case MFIntVar(v) => (TOVariable(v), Set[String]())
-    case MFIntConst(c) => (TOConstant(c), Set[String]())
-    case MFIPlus(i1, i2) => {
-      val (t1, l1) = convertMAPAFunint2MapaTO(i1)
-      val (t2, l2) = convertMAPAFunint2MapaTO(i2)
-      (TOPlus(t1, t2), l1 ++ l2)
-    }
-    case MFITimes(c, i1) => {
-      val (t1, l1) = convertMAPAFunint2MapaTO(i1)
-      (TOTimes(c, t1), l1)
-    }
-    case MFSCard(s) => {
-      val (m1, l1) = convertMAPAFunSet2MapaMset(s)
-      (TOCard(m1), l1)
-    }
-    case MFMCard(m) => {
-      val (m1, l1) = convertMAPAFunMset2MapaMset(m)
-      (TOCard(m1), l1)
-    }
-  }
-
-  def createFreshTO(n: Int): TermOut = {
-    val s = "FRESHInt" + n
-    TOVariable(s)
-  }
-
-  def convertAtomAndGetSets(a: MAPAFunAtom, i: Int): (Formula, Set[String], Int)  = a match {
-    case MFSetEqual(s1, s2) => {
-      val (m1, sl1) = convertMAPAFunSet2MapaMset(s1)
-      val (m2, sl2) = convertMAPAFunSet2MapaMset(s2)
-      (FAtom(AEqual(m1, m2)), sl1 ++ sl2, i)
-    }
-    case MFSetSubset(s1, s2) => {
-      val (m1, sl1) = convertMAPAFunSet2MapaMset(s1)
-      val (m2, sl2) = convertMAPAFunSet2MapaMset(s2)
-      (FAtom(ASubset(m1, m2)), sl1 ++ sl2, i)
-    }
-    case MFMSetEqual(m1, m2) => {
-      val (m1n, sl1) = convertMAPAFunMset2MapaMset(m1)
-      val (m2n, sl2) = convertMAPAFunMset2MapaMset(m2)
-      (FAtom(AEqual(m1n, m2n)), sl1 ++ sl2, i)
-    }
-    case MFMSetSubset(m1, m2) => {
-      val (m1n, sl1) = convertMAPAFunMset2MapaMset(m1)
-      val (m2n, sl2) = convertMAPAFunMset2MapaMset(m2)
-      (FAtom(ASubset(m1n, m2n)), sl1 ++ sl2, i)
-    }
-    case MFIntEqual(i1, i2) => {
-      val (i1n, sl1) = convertMAPAFunint2MapaTO(i1)
-      val (i2n, sl2) = convertMAPAFunint2MapaTO(i2)
-      (FAtom(AAtomOut(AOEq(i1n, i2n))), sl1 ++ sl2, i)
-    }
-    case MFIntLessEqual(i1, i2) => {
-      val (i1n, sl1) = convertMAPAFunint2MapaTO(i1)
-      val (i2n, sl2) = convertMAPAFunint2MapaTO(i2)
-      (FAtom(AAtomOut(AOLeq(i1n, i2n))), sl1 ++ sl2, i)
-    }
-    case MFIntDivides(c, i1) => {
-      val (i1n, sl1) = convertMAPAFunint2MapaTO(i1)
-      val ft = createFreshTO(i)
-      (FAtom(AAtomOut(AOEq(ft, TOTimes(c, i1n)))), sl1, i + 1)
-    }
-  }
-
-  def convertFormulaAndGetSets(f: MAPAFunFormula, i: Int): (Formula, Set[String], Int)  = f match {
-    case MFAnd(f1, f2) => {
-      val (f1n, s1, i1) = convertFormulaAndGetSets(f1, i)
-      val (f2n, s2, i2) = convertFormulaAndGetSets(f2, i1)
-      (FAnd(f1n, f2n), s1 ++ s2, i2)
-    }
-    case MFOr(f1, f2) => {
-      val (f1n, s1, i1) = convertFormulaAndGetSets(f1, i)
-      val (f2n, s2, i2) = convertFormulaAndGetSets(f2, i1)
-      (FOr(f1n, f2n), s1 ++ s2, i2)
-    }
-    case MFNot(f1)  => {
-      val (f1n, s1, i1) = convertFormulaAndGetSets(f1, i)
-      (FNot(f1n), s1, i1)
-    }
-    case MFAtom(a)  => convertAtomAndGetSets(a, i)
-  }
-
-
-//--------------------------------
-
-  def mapaFun2standardMAPA(f: MAPAFunFormula): Formula  = {
-    val (f1, s, _) = convertFormulaAndGetSets(f, 0)
-// i counts fresh variables introduced for divides
-    val l = s.toList
-    if (l.isEmpty) f1 else {
-      val f2 = createFormulaAboutSets(l)
-      val ff = FAnd(f1, f2)
-      ff
-    }
-  }
-
-
-}
\ No newline at end of file
diff --git a/src/multisets/MAPAParser.scala b/src/multisets/MAPAParser.scala
deleted file mode 100644
index 0e032cd440c79a261dee669c3672ad9438a058a3..0000000000000000000000000000000000000000
--- a/src/multisets/MAPAParser.scala
+++ /dev/null
@@ -1,213 +0,0 @@
-package multisets
-
-import scala.util.parsing.combinator.syntactical.StandardTokenParsers
-import scala.util.parsing.combinator._
-import scala.util.parsing.input._
-import scala.util.parsing.syntax._
-import scala.collection.mutable.Map
-import java.io.FileReader
-
-
-object MAPAParser extends StandardTokenParsers {
-
-  lexical.delimiters ++= List( "(", ")", ",",  ".", ":", "=", "<", "_", "{", "}", "+", "|", "-", "*" );
-  lexical.reserved ++= List( "Problem", "Variables", "Formula", "And", "Or", 
-     "Implies", "Equiv", "Not", "true", "false", "SUB", "ALLe", "VEC", "ite", "e", 
-      "empty", "INTR", "UN", "PLUS", "SETof", "SUM" );
-
-
-  def inputFile: Parser[ List[(String, (Map[String, String], Formula))] ] = (
-     rep(oneProblemInFile) 
-    | failure( "Cannot parse the input file." ))
-
-
-  def oneProblemInFile: Parser[(String, (Map[String, String], Formula))] = (
-     ("Problem" ~> "(" ~>  ident <~ ",") ~ ("Variables" ~> "(" ~> myVars <~ ")" <~ ",") ~ ("Formula" ~> "(" ~> myFla <~ ")" <~ ")" <~ "." ) ^^ 
-        { case name ~ vars ~ fla  =>  (name.toString, (vars, fla) ) }
-    | failure( "Cannot parse this problem." ))
-
-
-  def myVars: Parser[ Map[String, String] ] = (
-    repsep(oneVar, ",") ^^ createMap
-    | failure( "Cannot parse this Variables string." ))
-
-  def oneVar: Parser[ (String, String) ] = (
-    (ident ~ ":" ~ ident)^^ { case name ~ ":" ~ typeV  => (name.toString, typeV.toString ) }
-    | failure( "Cannot parse this variable." ))
-
-  def createMap(l: List[(String, String)]):  Map[String, String] = {
-    val m = Map[String, String]()
-    l.foreach(p => m += (p._1 -> p._2))
-    m
-  }
-
-
-  def myFla: Parser[ Formula ]  = (
-      myAtom ^^ (FAtom(_))
-    | ("And" ~> "(" ~> myFla  <~ ",") ~ (myFla <~ ")")^^ {case f1 ~ f2 => FAnd(f1, f2)}
-    | ("Or" ~> "(" ~> myFla <~ ",") ~ (myFla <~ ")")^^ {case f1 ~ f2 => FOr(f1, f2)}
-    | ("Implies" ~> "(" ~> myFla <~ ",") ~ (myFla <~ ")")^^ {case f1 ~ f2 => FOr(FNot(f1), f2)}
-    | ("Equiv" ~> "(" ~> myFla <~ ",") ~ (myFla <~ ")")^^ {case f1 ~ f2 => FOr(FAnd(f1, f2), FAnd(FNot(f1), FNot(f2)))}
-    | ("Not" ~> "(" ~> myFla <~ ")") ^^ {case f1  => FNot(f1)}
-    | "true" ^^ (f => FTrue)
-    | "false" ^^ (f => FFalse)
-    | failure( "Cannot parse this Formula string." ))
-
-
-  def myAtom: Parser[ Atom ]  = (
-      myAtomOut ^^ (AAtomOut(_))
-    | ("=" ~> "(" ~> myMset <~ ",") ~ (myMset <~ ")")^^ { case m1 ~ m2  => AEqual(m1, m2) }
-    | ("SUB" ~> "(" ~> myMset <~ ",") ~ (myMset <~ ")")^^ { case m1 ~ m2  => ASubset(m1, m2) }
-    | ("ALLe" ~> "." ~> myFlaIn)^^ { case f1   => AForAllElem(f1) }
-    | failure( "Cannot parse this atom." ))
-
-
-  def myFlaOut: Parser[ FormulaOut ]  = (
-      myAtomOut ^^ (FOAtom(_))
-    | ("And" ~> "(" ~> myFlaOut  <~ ",") ~ (myFlaOut <~ ")")^^ {case f1 ~ f2 => FOAnd(f1, f2)}
-    | ("Or" ~> "(" ~> myFlaOut <~ ",") ~ (myFlaOut <~ ")")^^ {case f1 ~ f2 => FOOr(f1, f2)}
-    | ("Implies" ~> "(" ~> myFlaOut <~ ",") ~ (myFlaOut <~ ")")^^ {case f1 ~ f2 => FOOr(FONot(f1), f2)}
-    | ("Equiv" ~> "(" ~> myFlaOut <~ ",") ~ (myFlaOut <~ ")")^^ {case f1 ~ f2 => FOOr(FOAnd(f1, f2), FOAnd(FONot(f1), FONot(f2)))}
-    | ("Not" ~> "(" ~> myFlaOut <~ ")") ^^ {case f1  => FONot(f1)}
-    | "true" ^^ (f => FOTrue)
-    | "false" ^^ (f => FOFalse)
-    | failure( "Cannot parse this formula." ))
-
-
-  def myAtomOut: Parser[ AtomOut ]  = (
-      ("=" ~> "(" ~> myTrmOut <~ ",") ~ (myTrmOut <~ ")")^^ { case i1 ~ i2  => AOEq(i1, i2) }
-    | ("<" ~> "=" ~> "(" ~> myTrmOut <~ ",") ~ (myTrmOut <~ ")")^^ { case i1 ~ i2  => AOLeq(i1, i2) }
-    | ("=" ~> "(" ~> "VEC" ~> "(" ~> myListTrmOut <~ ")" <~"," ) ~ ("SUM" ~> "_" ~> "{" ~> myFlaIn <~ "}") ~ 
-        ("VEC" ~> "(" ~> myListTrmIn <~ ")" <~ ")") ^^ { case l1 ~ f ~ l2   => AOSum(l1, f, l2) }
-    | failure( "Cannot parse this atom." ))
-
-
-  def  myListTrmOut: Parser[ List[TermOut] ]  = (
-      repsep(myTrmOut, ",") 
-    | failure( "Cannot parse this vector." ))
-
-
-  def myTrmOut: Parser[ TermOut ]  = (
-      myInt ^^ {case n  =>  TOConstant(n) }
-    | ident ^^ {case s =>  TOVariable(s.toString) }
-    | ("*" ~> "(" ~> myInt <~ ",") ~ (myTrmOut <~ ")") ^^ {case n ~ t => TOTimes(n, t) }
-    | ("|" ~> myMset <~ "|") ^^ { case m => TOCard(m) }
-    | ("+" ~> "(" ~> myListTrmOut <~ ")") ^^  createSumOfOutterTerms
-    | ("ite" ~> "(" ~> myFlaOut <~ ",") ~ myTrmOut ~ ("," ~> myTrmOut <~ ")")   ^^ { case f ~ t1 ~ t2 => TOIte(f, t1, t2) }
-    | failure( "Cannot parse this term." ))
-
-
-  def createSumOfOutterTerms(l: List[TermOut]):  TermOut = {
-    if (l.isEmpty) TOConstant(0) else {
-      var t = l.head
-      val l1 = l.tail
-      l1.foreach(e => t = TOPlus(t, e))
-      t
-    }
-  }
-
-
-  def myFlaIn: Parser[ FormulaIn ]  = (
-      myAtomIn ^^ (FIAtom(_))
-    | ("And" ~> "(" ~> myFlaIn  <~ ",") ~ (myFlaIn <~ ")")^^ {case f1 ~ f2 => FIAnd(f1, f2)}
-    | ("Or" ~> "(" ~> myFlaIn <~ ",") ~ (myFlaIn <~ ")")^^ {case f1 ~ f2 => FIOr(f1, f2)}
-    | ("Implies" ~> "(" ~> myFlaIn <~ ",") ~ (myFlaIn <~ ")")^^ {case f1 ~ f2 => FIOr(FINot(f1), f2)}
-    | ("Equiv" ~> "(" ~> myFlaIn <~ ",") ~ (myFlaIn <~ ")")^^ {case f1 ~ f2 => FIOr(FIAnd(f1, f2), FIAnd(FINot(f1), FINot(f2)))}
-    | ("Not" ~> "(" ~> myFlaIn <~ ")") ^^ {case f1  => FINot(f1)}
-    | "true" ^^ (f => FITrue)
-    | "false" ^^ (f => FIFalse)
-    | failure( "Cannot parse this formula." ))
-
-
-  def myAtomIn: Parser[ AtomIn ]  = (
-      ("=" ~> "(" ~> myTrmIn <~ ",") ~ (myTrmIn <~ ")") ^^ { case i1 ~ i2  => AIEq(i1, i2) }
-    | ("<" ~> "=" ~> "(" ~> myTrmIn <~ ",") ~ (myTrmIn <~ ")") ^^ { case i1 ~ i2  => AILeq(i1, i2) }
-    | failure( "Cannot parse this atom." ))
-
-
-  def myListTrmIn: Parser[ List[TermIn] ]  = (
-      repsep(myTrmIn, ",") 
-    | failure( "Cannot parse this vector." ))
-
-
-  def myTrmIn: Parser[ TermIn ]  = (
-      myInt ^^ {case n  =>  TIConstant(n) }
-    | (ident <~ "(" <~ "e" <~ ")") ^^ { case s => TIMultiplicity(s.toString) }
-    | ("*" ~> "(" ~> myInt <~ ",") ~ (myTrmIn <~ ")") ^^ {case n ~ t => TITimes(n, t) }
-    | ("+" ~> "(" ~> myListTrmIn <~ ")") ^^  createSumOfInnerTerms
-    | ("ite" ~> "(" ~> myFlaIn <~ ",") ~ myTrmIn ~ ("," ~> myTrmIn <~ ")")   ^^ { case f ~ t1 ~ t2 => TIIte(f, t1, t2) }
-    | failure( "Cannot parse this term." ))
-
-  def createSumOfInnerTerms(l: List[TermIn]):  TermIn = {
-    if (l.isEmpty) TIConstant(0) else {
-      var t = l.head
-      val l1 = l.tail
-      l1.foreach(e => t = TIPlus(t, e))
-      t
-    }
-  }
-
-
- def myInt: Parser[ Int ] = (
-    "-" ~> numericLit ^^ (x => x.toInt * -1)
-  | numericLit ^^ ( x => x.toInt )
-  | failure( "Cannot parse this number." ))
-
-
-  def myMset: Parser[ Multiset ]  = (
-      ident ^^ { case s => MVariable(s.toString) }
-    | "empty" ^^ { x => MEmpty}
-    | ("INTR" ~> "(" ~> myListMset <~ ")") ^^  createIntersectionOfMSets
-    | ("UN" ~> "(" ~> myListMset <~ ")") ^^  createUnionOfMSets
-    | ("PLUS" ~> "(" ~> myListMset <~ ")") ^^  createSumOfMSets
-    | ("-" ~> "(" ~> myMset <~ ",") ~ (myMset <~ ")") ^^ {case m1 ~ m2 => MMinus(m1, m2) }
-    | ("-" ~> "-" ~> "(" ~> myMset <~ ",") ~ (myMset <~ ")") ^^ {case m1 ~ m2 => MSetMinus(m1, m2) }
-    | ("SETof" ~> "(" ~> myMset <~ ")") ^^ {case m =>  MSetOf(m) }
-    | failure( "Cannot parse this multiset." ))
-
-  def createIntersectionOfMSets(l: List[Multiset]):  Multiset = {
-    if (l.isEmpty) MEmpty else {
-      var t = l.head
-      val l1 = l.tail
-      l1.foreach(e => t = MIntersection(t, e))
-      t
-    }
-  }
-
-  def createUnionOfMSets(l: List[Multiset]):  Multiset = {
-    if (l.isEmpty) MEmpty else {
-      var t = l.head
-      val l1 = l.tail
-      l1.foreach(e => t = MUnion(t, e))
-      t
-    }
-  }
-
-  def createSumOfMSets(l: List[Multiset]):  Multiset = {
-    if (l.isEmpty) MEmpty else {
-      var t = l.head
-      val l1 = l.tail
-      l1.foreach(e => t = MPlus(t, e))
-      t
-    }
-  }
-
-
-  def myListMset: Parser[ List[Multiset] ]  = (
-      repsep(myMset, ",") 
-    | failure( "Cannot parse this vector." ))
-
-
-
-//------------------------------------------------
-
- def main(fileName: String) : List[(String, (Map[String, String], Formula))] = {
-  val reader = StreamReader(new FileReader(fileName))
-  val tokens = new lexical.Scanner(reader)
-  phrase(inputFile)(tokens) match {
-    case Success( mapping, _ ) =>  mapping
-    case e => throw(new Exception("Error = " + e))
-  }
-  }
-}
-
diff --git a/src/multisets/MAPARun.scala b/src/multisets/MAPARun.scala
deleted file mode 100644
index 7bbf5b98231e349198bfedf5aff660c86cff26bf..0000000000000000000000000000000000000000
--- a/src/multisets/MAPARun.scala
+++ /dev/null
@@ -1,131 +0,0 @@
-package multisets
-
-
-import multisets.MultisetFormulaPrinter._
-import multisets.StarFormulaPrinter._
-
-
-
-object MAPARun {
-
-// start: describes the execution of checking satisfiability of one formula
-   def executeOneFormula (name: String, f: Formula): Boolean = {
-      println("Formula " + name + ":")
-      print_multisetFormula(f)
-      println("")
-      val (x, y, z) = multisets.NormalFormTranslator.main(f)
-      val fF = FAnd(x, FAnd(y, z))
-      println("Normalized formula " + name + ":")
-      print_multisetFormula(fF)
-      println("")
-      val (fS1, lS1, lS2, fS2) = multisets.Multiset2StarsTranslator.main(x, y, z)
-      val fS = StarFormula(fS1, lS1, lS2, fS2)
-      println("Translated formula " + name + ":")
-      print_starFormula(fS)
-      println("")
-      val (lS2N, listDNFfS2) = multisets.CreateDisjunctions.main(lS2, fS2)
-      val (ff, lpf) = multisets.RemoveDisjunctions.main(fS1, lS1, lS2N, listDNFfS2)
-      println("No more disjunctions:")
-      print_QFPAFormula(ff)
-      println(" AND " )
-      lpf.foreach(t => { 
-        print_PAVector(t._1)
-        print( " IN { ")
-        print_PAVector(t._2)
-        print( " |  ")
-        (t._3).foreach(c => {
-          print_QFPAFormula(c)
-          print(" AND ")
-        })
-        print( " } ^*  ")
-        println(" AND " )
-      })
-      println("Semilinear set computation :")
-      val ff1 = multisets.RemoveStars.removeStarsMain(ff, lpf)
-      println("No more stars: ")
-      print_QFPAFormula(ff1)
-      val l = multisets.CheckingConsistency.checkConsistencyofOneFormula(ff1)
-      val bs = l._1
-      val b = if (bs == "sat") true else false
-      println("")
-      println("---------------------")
-      if (b) {
-        println ("This formula is " + bs)
-        println("")
-        println("---------------------")
-/*        println("Here is the satisfying assignment:")
-        val m1 = guru.multisets.reconstructingModels.createSatisfyingAssignmentforQFPA(l)
-        println(m1)
-        println("")
-        println("After removing mu's and nu's : ")
-        val ff1t = guru.multisets.reconstructingModels.evaluateFormulaForVariablesStartingWith(ff1, m1, "FRESHnu")
-        val ff1s = guru.multisets.reconstructingModels.evaluateFormulaForVariablesStartingWith(ff1t, m1, "FRESHmu")
-        print_QFPAFormula(ff1s)
-        println("")
-        println("")
-        println("After removing obsolete disjuntions: ")
-        var ff2s = ff1s
-        var ltm: List[(List[TermQFPA], List[TermQFPA], List[QFPAFormula])] = Nil
-        lpf.foreach(t => {
-          if (guru.multisets.reconstructingModels.isNulVectorinGivenModel(t._1, m1)) {
-             val ff3s = guru.multisets.reconstructingModels.removeZeroVectorInFormula(ff2s, t._1)
-             ff2s = ff3s
-          } else ltm = t :: ltm
-        })
-        print_QFPAFormula(ff2s)
-        println("")
-        println("")
-        println("Star formulas and no disjunctions:")
-        print_QFPAFormula(ff)
-        println(" AND " )
-        ltm.foreach(t => { 
-          print_PAVector(t._1)
-          print( " IN { ")
-          print_PAVector(t._2)
-          print( " |  ")
-          (t._3).foreach(c => {
-            print_QFPAFormula(c)
-            print(" AND ")
-          })
-          print( " } ^*  ")
-          println(" AND " )
-        })
-        println("")
-
-        println("Introduce the real values of vectors : ")
-        val ff4 = guru.multisets.reconstructingModels.evaluateFormulaForVariablesStartingWith(ff2s, m1, "FRESHu") 
-        print_QFPAFormula(ff4) */
-      } else { println("")
-        println ("This formula is " + bs)
-        println("")
-        println("---------------------")
-      }
-      b
-   }
-// end
-
-
-
-  def run(fileName: String): Unit = {
-   val problemList = multisets.MAPAParser.main(fileName)
-   val formulasList = multisets.FormulaConstructor.main(problemList)
-   // all returned formulas are in NNF
-   formulasList.foreach(p => {
-     val flas = p._2
-     val fOrig = flas._1
-     val fOrigNeg = flas._2
-     val fCons = flas._3
-     val isValid = (executeOneFormula(p._1, FAnd(fOrigNeg, fCons)) == false)
-     if (isValid) println("This means that the original problem " + p._1 + " is valid.") else {
-       println("This was a model for the negated formula. Now we check the original formula:")
-       val isUnsat = (executeOneFormula(p._1, FAnd(fOrig, fCons)) == false)
-       if (isUnsat) println("This means, that the original problem " + p._1 + " is unsatisfiable.") else {
-         println("This means that the original problem " + p._1 + " is satisfiable, but not valid.")
-       }
-     }
-   })
- }
-
-
-
-}
\ No newline at end of file
diff --git a/src/multisets/Main.scala b/src/multisets/Main.scala
deleted file mode 100644
index 6019d42cf4af8fa94bc5ba4a920fdd6cfac13f1e..0000000000000000000000000000000000000000
--- a/src/multisets/Main.scala
+++ /dev/null
@@ -1,60 +0,0 @@
-package multisets
-
-import purescala.Extensions.Solver
-import purescala.Reporter
-import purescala.Trees._
-
-import scala.collection.mutable.Set
-
-
-
-class Main(reporter: Reporter) extends Solver(reporter) {
-  val description = "Multiset Solver"
-  Global.reporter = reporter
-
-  def createFormulaThatSomethingsIsSet(s:String):FormulaIn = {
-    val a1 = FIAtom(AIEq(TIMultiplicity(s), TIConstant(1)))
-    val a0 = FIAtom(AIEq(TIMultiplicity(s), TIConstant(0)))
-    FIOr(a1, a0)
-  }
-
-
-  def constructFormulaInAboutSets(s:Set[String]):FormulaIn = {
-    val sl = s.toList
-    val h = sl.head
-    val t = sl.tail
-    var f = createFormulaThatSomethingsIsSet(h)
-    t.foreach(e => {
-      val ft = createFormulaThatSomethingsIsSet(e)
-      f = FIAnd(f, ft)
-    })
-    f
-  }
-
-  def constructFormulaAboutSets(s:Set[String]):Formula = {
-    val f1 = constructFormulaInAboutSets(s)
-    FAtom(AForAllElem(f1))
-  }
-
-  def createFormula(p:(Formula,Set[String])):Formula = {
-    val f1 = p._1
-    val s = p._2
-    val f = if (s.isEmpty) f1 else {
-      val f2 = constructFormulaAboutSets(s)
-      FAnd(f1, f2) 
-    }
-    f
-  }
-
-
-  def solve(expr: Expr) : Option[Boolean] = {
-    val mt = multisets.MainAST2MultisetsTranslator.translate(negate(expr))
-    val mf = mt.map(p => createFormula(p))
-    val res = mf.map(f => !MAPARun.executeOneFormula("f", f))
-    res
-    }
-}
-
-object Global {
-  var reporter: Reporter = null
-}
diff --git a/src/multisets/MainAST2MultisetsTranslator.scala b/src/multisets/MainAST2MultisetsTranslator.scala
deleted file mode 100644
index 80ff039b3556639ff1516ddf98eb3433b9403d23..0000000000000000000000000000000000000000
--- a/src/multisets/MainAST2MultisetsTranslator.scala
+++ /dev/null
@@ -1,226 +0,0 @@
-package multisets
-
-import purescala.Trees._
-import purescala.TypeTrees._
-
-import scala.collection.mutable.Set
-
-
-
-object MainAST2MultisetsTranslator {
-
-
-  def translate(expr: Expr) : Option[(Formula, Set[String])] = {
-    case class CantTranslateExpression() extends Exception
-
-
-   def multisetTranslate(m: Expr): (Multiset, Set[String]) = (m : @unchecked) match {
-     case v @ Variable(id) if v.getType.isInstanceOf[MultisetType] => (MVariable(id.uniqueName), Set.empty[String])
-     case EmptyMultiset(_) => (MEmpty, Set.empty[String])
-     case MultisetIntersection(m1, m2) => {
-        val p1 = multisetTranslate(m1)
-        val p2 = multisetTranslate(m2)
-        (MIntersection(p1._1, p2._1), p1._2 ++ p2._2)
-     }
-     case MultisetUnion(m1, m2) => {
-        val p1 = multisetTranslate(m1)
-        val p2 = multisetTranslate(m2)
-        (MUnion(p1._1, p2._1), p1._2 ++ p2._2)
-     }
-     case MultisetPlus(m1, m2) => {
-        val p1 = multisetTranslate(m1)
-        val p2 = multisetTranslate(m2)
-        (MPlus(p1._1, p2._1), p1._2 ++ p2._2)
-     }
-     case MultisetDifference(m1, m2) => {
-        val p1 = multisetTranslate(m1)
-        val p2 = multisetTranslate(m2)
-        (MMinus(p1._1, p2._1), p1._2 ++ p2._2)
-     }
-     case MultisetToSet(m1) => {
-        val p1 = multisetTranslate(m1)
-        (MSetOf(p1._1), p1._2)
-     }
-  }
-
-  def termOutTranslate(exp: Expr): (TermOut, Set[String]) = (exp : @unchecked) match {
-    case v @ Variable(id) if v.getType == Int32Type => (TOVariable(id.uniqueName), Set.empty[String])
-    case IntLiteral(v) => (TOConstant(v), Set.empty[String])
-    case MultisetCardinality(m) => {
-      val mN = multisetTranslate(m)
-      (TOCard(mN._1), mN._2)
-    }
-    case SetCardinality(s) => {
-      val mN = setTranslate(s)
-      (TOCard(mN._1), mN._2)
-    }
-    case Plus(t1, t2) => {
-      val p1 = termOutTranslate(t1)
-      val p2 = termOutTranslate(t2)
-      (TOPlus(p1._1, p2._1), p1._2 ++ p2._2)
-    }
-    case Minus(t1, t2) => {
-      val p1 = termOutTranslate(t1)
-      val p2 = termOutTranslate(t2)
-      (TOPlus(p1._1, TOTimes(-1, p2._1)), p1._2 ++ p2._2)
-    }
-  }
-
-   def setTranslate(s: Expr): (Multiset, Set[String]) = (s : @unchecked) match {
-     case v @ Variable(id) if v.getType.isInstanceOf[SetType] => (MVariable(id.uniqueName), Set(id.uniqueName))
-     case EmptySet(_) => (MEmpty, Set.empty[String])
-     case SetIntersection(s1, s2) => {
-        val p1 = setTranslate(s1)
-        val p2 = setTranslate(s2)
-        (MIntersection(p1._1, p2._1), p1._2 ++ p2._2)
-     }
-     case SetUnion(s1, s2) => {
-        val p1 = setTranslate(s1)
-        val p2 = setTranslate(s2)
-        (MUnion(p1._1, p2._1), p1._2 ++ p2._2)
-     }
-     case SetDifference(s1, s2) => {
-        val p1 = setTranslate(s1)
-        val p2 = setTranslate(s2)
-        (MMinus(p1._1, p2._1), p1._2 ++ p2._2)
-     }
-     case MultisetToSet(m1) => {
-        val p1 = multisetTranslate(m1)
-        (MSetOf(p1._1), p1._2)
-     }
-  }
-
-
-
-
-
-
-  def createFormulaFromAndSeq(fs: Seq[Formula]): Formula = {
-    val f = if (fs.isEmpty) FTrue else {
-      var ft = fs.head
-      val t = fs.tail
-      t.foreach(f1 => ft = FAnd(f1, ft))
-      ft
-    }
-    f
-  }
-
-  def createFormulaFromOrSeq(fs: Seq[Formula]): Formula = {
-    val f = if (fs.isEmpty) FTrue else {
-      var ft = fs.head
-      val t = fs.tail
-      t.foreach(f1 => ft = FOr(f1, ft))
-      ft
-    }
-    f
-  }
-
-
-  def createUnionOfAllSets(s: Seq[Set[String]]): Set[String] = {
-    val sr = if (s.isEmpty) Set.empty[String] else {
-      var h = s.head
-      val t = s.tail
-      t.foreach(v => h = h ++ v)
-      h
-    }
-    sr
-  }
-
-/*
-  case class UMinus(expr: Expr) extends Expr with FixedType { 
-    val fixedType = Int32Type
-  }
-  case class Times(lhs: Expr, rhs: Expr) extends Expr with FixedType { 
-    val fixedType = Int32Type
-  }
-  case class Division(lhs: Expr, rhs: Expr) extends Expr with FixedType { 
-    val fixedType = Int32Type
-  } */
-
-
-  def rec(ex: Expr) : (Formula, Set[String]) = ex match {
-    case MultisetEquals(m1,m2) => {
-      val p1 = multisetTranslate(m1)
-      val p2 = multisetTranslate(m2)
-      (FAtom(AEqual(p1._1, p2._1)), p1._2 ++ p2._2)
-    }
-    case SubmultisetOf(m1,m2) => {
-      val p1 = multisetTranslate(m1)
-      val p2 = multisetTranslate(m2)
-      (FAtom(ASubset(p1._1, p2._1)), p1._2 ++ p2._2)
-    }
-    case SetEquals(s1,s2) => {
-      val p1 = setTranslate(s1)
-      val p2 = setTranslate(s2)
-      (FAtom(AEqual(p1._1, p2._1)), p1._2 ++ p2._2)
-    }
-    case SubsetOf(s1,s2) => {
-      val p1 = setTranslate(s1)
-      val p2 = setTranslate(s2)
-      (FAtom(ASubset(p1._1, p2._1)), p1._2 ++ p2._2)
-    }
-    case And(expS) => {
-      val pl = expS.map(e => rec(e))
-      val fl = pl.map(p => p._1)
-      val sl = pl.map(p => p._2)
-      val f1 = createFormulaFromAndSeq(fl)
-      val s1 = createUnionOfAllSets(sl)
-      (f1, s1)
-    }
-    case Or(expS) => {
-      val pl = expS.map(e => rec(e))
-      val fl = pl.map(p => p._1)
-      val sl = pl.map(p => p._2)
-      val f1 = createFormulaFromOrSeq(fl)
-      val s1 = createUnionOfAllSets(sl)
-      (f1, s1)
-    }
-    case Iff(f1, f2) => {
-      val p1 = rec(f1)
-      val p2 = rec(f2)
-      (FOr(FAnd(FNot(p1._1), FNot(p2._1)), FAnd(p1._1, p2._1)), p1._2 ++ p2._2)
-    }
-    case Implies(f1, f2) => {
-      val p1 = rec(f1)
-      val p2 = rec(f2)
-      (FOr(FNot(p1._1), p2._1), p1._2 ++ p2._2)
-    }
-    case Not(f1) => {
-      val p1 = rec(f1)
-      (FNot(p1._1), p1._2)
-    }
-    case LessThan(t1, t2) => {
-      val p1 = termOutTranslate(t1)
-      val p2 = termOutTranslate(t2)
-      (FAnd(FAtom(AAtomOut(AOLeq(p1._1, p2._1))), FNot(FAtom(AAtomOut(AOEq(p1._1, p2._1))))), p1._2 ++ p2._2)
-    }
-    case GreaterThan(t1, t2) => rec(LessThan(t2, t1))
-    case LessEquals(t1, t2) => {
-      val p1 = termOutTranslate(t1)
-      val p2 = termOutTranslate(t2)
-      (FAtom(AAtomOut(AOLeq(p1._1, p2._1))), p1._2 ++ p2._2)
-    }
-    case GreaterEquals(t1, t2) => rec(LessEquals(t2, t1))
-    case Equals(t1, t2) => {
-      val p1 = termOutTranslate(t1)
-      val p2 = termOutTranslate(t2)
-      (FAtom(AAtomOut(AOEq(p1._1, p2._1))), p1._2 ++ p2._2)
-    }
-    case unhandled => {
-      Global.reporter.warning("Can't translate this in Munch : " + unhandled)
-      throw CantTranslateExpression()
-    }
-    }
-
-
-    try {
-      Some(rec(expandLets(expr)))
-    } catch {
-      case CantTranslateExpression() => None
-    }
-
-  }
-
-
-}
-
diff --git a/src/multisets/Multiset.scala b/src/multisets/Multiset.scala
deleted file mode 100644
index 1fd8d77982fc1db010c6aed7b767e5496131abe7..0000000000000000000000000000000000000000
--- a/src/multisets/Multiset.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-//	piskac@larapc01:~/guru$ pwd
-//	/home/piskac/guru
-//	piskac@larapc01:~/guru$ scalac -d bin/ src/guru/multisets/*.scala
-//	piskac@larapc01:~/guru$ scala -cp bin/ guru.multisets.Main
-
-package multisets
-
-
-object Multisets  {
-
-  def main(args: Array[String]) : Unit = {
-    if (args.length == 0) {
-      println("Usage: scala -cp bin/ guru.multisets.Main fileName ")
-    } else {
-      val fileName = args(0)
-      multisets.MAPARun.run(fileName)
-    }
-  }
-}
-
diff --git a/src/multisets/Multiset2StarsTranslator.scala b/src/multisets/Multiset2StarsTranslator.scala
deleted file mode 100644
index 82c372b7e159efe4bd4bc13121a153c77b75c91e..0000000000000000000000000000000000000000
--- a/src/multisets/Multiset2StarsTranslator.scala
+++ /dev/null
@@ -1,246 +0,0 @@
-package multisets
-
-object Multiset2StarsTranslator {
-
-
-// start:
-
-  def translate2QFPAfromFormulaOut(f:FormulaOut):QFPAFormula = f match {
-    case FOAnd(f1,f2) => {
-      val f1n = translate2QFPAfromFormulaOut(f1)
-      val f2n = translate2QFPAfromFormulaOut(f2)
-      QFPAAnd(f1n, f2n)
-    }
-    case FOOr(f1,f2) => {
-      val f1n = translate2QFPAfromFormulaOut(f1)
-      val f2n = translate2QFPAfromFormulaOut(f2)
-      QFPAOr(f1n, f2n)
-    }
-    case FONot(f1)  => {
-      val f1n = translate2QFPAfromFormulaOut(f1)
-      QFPANot(f1n)
-    }
-    case FOAtom(a)  => {
-      val a1 = translate2QFPAAtomfromAtomOut(a)
-      QFPAAtom(a1)
-    }
-    case FOTrue => QFPATrue
-    case FOFalse => QFPAFalse
-  }
-
-
-  def translate2QFPATermfromTermOut(t:TermOut):TermQFPA  = t match {
-    case TOConstant(c) => TConstant(c)
-    case TOVariable(v) => TVariable(v)
-    case TOPlus(t1, t2) => {
-      val t1n = translate2QFPATermfromTermOut(t1)
-      val t2n = translate2QFPATermfromTermOut(t2)
-      TPlus(t1n, t2n)
-    }
-    case TOTimes(c, t1)=> {
-      val t1n = translate2QFPATermfromTermOut(t1)
-      TTimes(c, t1n)
-    }
-    case TOIte(f, t1, t2)=> {
-      val f1 = translate2QFPAfromFormulaOut(f)
-      val t1n = translate2QFPATermfromTermOut(t1)
-      val t2n = translate2QFPATermfromTermOut(t2)
-      TIte(f1,t1n, t2n)
-    }
-    case _ => error("Impossible case ")
-  }
-
-  def translate2QFPAAtomfromAtomOut(a:AtomOut):AtomQFPA = a match {
-    case AOLeq(t1,t2) => {
-      val t1n = translate2QFPATermfromTermOut(t1)
-      val t2n = translate2QFPATermfromTermOut(t2)
-      ALeq(t1n, t2n)
-    }
-    case AOEq(t1,t2) => {
-      val t1n = translate2QFPATermfromTermOut(t1)
-      val t2n = translate2QFPATermfromTermOut(t2)
-      AEq(t1n, t2n)
-    }
-    case _ => error("Impossible case ")
-  }
-
-  def translate2QFPAfromFormula(f:Formula):QFPAFormula = f match {
-    case FAnd(f1,f2) => {
-      val f1n = translate2QFPAfromFormula(f1)
-      val f2n = translate2QFPAfromFormula(f2)
-      QFPAAnd(f1n, f2n)
-    }
-    case FOr(f1,f2) => {
-      val f1n = translate2QFPAfromFormula(f1)
-      val f2n = translate2QFPAfromFormula(f2)
-      QFPAOr(f1n, f2n)
-    }
-    case FNot(f1)  => {
-      val f1n = translate2QFPAfromFormula(f1)
-      QFPANot(f1n)
-    }
-    case FAtom(AAtomOut(a))  => {
-      val a1 = translate2QFPAAtomfromAtomOut(a)
-      QFPAAtom(a1)
-    }
-    case FFalse => QFPAFalse
-    case FTrue => QFPATrue
-    case _ => error("Impossible case ")
-  }
-
-
-  def translate2QFPATermfromTermIn(t:TermIn):TermQFPA  = t match {
-    case TIMultiplicity(v) => TVariable(v)
-    case TIConstant(c) => TConstant(c)
-    case TIPlus(t1, t2) => {
-      val t1n = translate2QFPATermfromTermIn(t1)
-      val t2n = translate2QFPATermfromTermIn(t2)
-      TPlus(t1n, t2n)
-    }
-    case TITimes(c, t1)=> {
-      val t1n = translate2QFPATermfromTermIn(t1)
-      TTimes(c, t1n)
-    }
-    case TIIte(f, t1, t2)=> {
-      val f1 = translate2QFPAfromFormulaIn(f)
-      val t1n = translate2QFPATermfromTermIn(t1)
-      val t2n = translate2QFPATermfromTermIn(t2)
-      TIte(f1,t1n, t2n)
-    }
-  }
-
-  def translate2QFPAAtomfromAtomIn(a:AtomIn):AtomQFPA = a match {
-    case AILeq(t1,t2) => {
-      val t1n = translate2QFPATermfromTermIn(t1)
-      val t2n = translate2QFPATermfromTermIn(t2)
-      ALeq(t1n, t2n)
-    }
-    case AIEq(t1,t2) => {
-      val t1n = translate2QFPATermfromTermIn(t1)
-      val t2n = translate2QFPATermfromTermIn(t2)
-      AEq(t1n, t2n)
-    }
-  }
-
-  def translate2QFPAfromFormulaIn(f:FormulaIn):QFPAFormula = f match {
-    case FIAnd(f1,f2) => {
-      val f1n = translate2QFPAfromFormulaIn(f1)
-      val f2n = translate2QFPAfromFormulaIn(f2)
-      QFPAAnd(f1n, f2n)
-    }
-    case FIOr(f1,f2) => {
-      val f1n = translate2QFPAfromFormulaIn(f1)
-      val f2n = translate2QFPAfromFormulaIn(f2)
-      QFPAOr(f1n, f2n)
-    }
-    case FINot(f1)  => {
-      val f1n = translate2QFPAfromFormulaIn(f1)
-      QFPANot(f1n)
-    }
-    case FIAtom(a)  => {
-      val a1 = translate2QFPAAtomfromAtomIn(a)
-      QFPAAtom(a1)
-    }
-    case FITrue => QFPATrue
-    case FIFalse => QFPAFalse
-  }
-
-  def translate2QFPAfromForAll(f:Formula):QFPAFormula = f match {
-    case FAtom(AForAllElem(f1)) => translate2QFPAfromFormulaIn(f1)
-    case FFalse => QFPAFalse
-    case FTrue => QFPATrue
-    case _ => error("Impossible case ")
-  }
-
-  def translateListofTermsOut(v1:List[TermOut]):List[TermQFPA] = {
-    var l1: List[TermQFPA] = Nil
-    v1.foreach(t => {
-        val tN = translate2QFPATermfromTermOut(t)
-        l1 = tN :: l1
-    })
-    l1.reverse
-  }
-
-  def translateListofTermsIn(v1:List[TermIn]):List[TermQFPA] = {
-    var l1: List[TermQFPA] = Nil
-    v1.foreach(t => {
-        val tN = translate2QFPATermfromTermIn(t)
-        l1 = tN :: l1
-    })
-    l1.reverse
-  }
-
-
-  def getVectorValuesFromSumFormula(f:Formula):(List[TermQFPA], List[TermQFPA]) = f match {
-    case FAtom(AAtomOut(AOSum(v1, FITrue, v2))) => {
-      val l1 = translateListofTermsOut(v1)
-      val l2 = translateListofTermsIn(v2)
-      (l1, l2)
-    }
-    case _ => error("Impossible case ")
-  }
-
-
-  def nnf(f:QFPAFormula): QFPAFormula = f match {
-    case QFPAAnd(f1, f2) => {
-      val f1N = nnf(f1)
-      val f2N = nnf(f2)
-      QFPAAnd(f1N, f2N)
-    }
-    case QFPAOr(f1, f2) => {
-      val f1N = nnf(f1)
-      val f2N = nnf(f2)
-      QFPAOr(f1N, f2N)
-    }
-    case QFPANot(QFPANot(f1)) => nnf(f1)
-    case QFPANot(QFPAAnd(f1, f2)) => QFPAOr(nnf(QFPANot(f1)), nnf(QFPANot(f2)))
-    case QFPANot(QFPAOr(f1, f2)) => QFPAAnd(nnf(QFPANot(f1)), nnf(QFPANot(f2)))
-    case QFPANot(QFPAFalse) => QFPATrue
-    case QFPANot(QFPATrue) => QFPAFalse
-    case _ => f
-  }
-
-
-
-  def removeTrueAndFalse(f:QFPAFormula): QFPAFormula = f match {
-    case QFPAAnd(QFPATrue, f2) => removeTrueAndFalse(f2)
-    case QFPAAnd(f1, QFPATrue) => removeTrueAndFalse(f1)
-    case QFPAAnd(QFPAFalse, f2) => QFPAFalse
-    case QFPAAnd(f1, QFPAFalse) => QFPAFalse
-    case QFPAAnd(f1, f2) => {
-      val f1N = removeTrueAndFalse(f1)
-      val f2N = removeTrueAndFalse(f2)
-      QFPAAnd(f1N, f2N)
-    }
-    case QFPAOr(QFPATrue, f2) => QFPATrue
-    case QFPAOr(f1, QFPATrue) => QFPATrue
-    case QFPAOr(QFPAFalse, f2) => removeTrueAndFalse(f2)
-    case QFPAOr(f1, QFPAFalse) => removeTrueAndFalse(f1)
-    case QFPAOr(f1, f2) => {
-      val f1N = removeTrueAndFalse(f1)
-      val f2N = removeTrueAndFalse(f2)
-      QFPAOr(f1N, f2N)
-    }
-    case QFPANot(f1)  => {
-      val f1N = removeTrueAndFalse(f1)
-      val f1NN = if (f1N == QFPATrue) QFPAFalse else 
-        if (f1N == QFPAFalse) QFPATrue else QFPANot(f1N)
-      f1NN
-    }
-    case _ => f
-  }
-
-
-//  start: input fPA - presburger arithmetic formula, fForAll- for all formula, fSum-sumfourmula
-// output: $s1 AND $2 IN { $3 | $4} *
-
-
-  def main(fPA:Formula, fForAll: Formula, fSum:Formula):(QFPAFormula, List[TermQFPA], List[TermQFPA], QFPAFormula) = {
-    val f1 = removeTrueAndFalse(nnf(translate2QFPAfromFormula(fPA)))
-    val f2 = removeTrueAndFalse(nnf(translate2QFPAfromForAll(fForAll)))
-    val (l1, l2) = getVectorValuesFromSumFormula(fSum)
-    (f1, l1, l2, f2)
-  } 
-
-}
-
diff --git a/src/multisets/MultisetFormulaPrinter.scala b/src/multisets/MultisetFormulaPrinter.scala
deleted file mode 100644
index 26e33f473f63205e8d67dd7bc913b66907f1bcf7..0000000000000000000000000000000000000000
--- a/src/multisets/MultisetFormulaPrinter.scala
+++ /dev/null
@@ -1,237 +0,0 @@
-package multisets
-
-object MultisetFormulaPrinter {
- 
-  def print_multiset(m:Multiset):Unit = m match {
-    case MVariable(v) => Console.print(v)
-    case MEmpty => Console.print("EMPTY")
-    case MUnion(m1, m2) => {
-      print_multiset(m1)
-      Console.print(" UNION ")
-      print_multiset(m2)
-    }
-    case MIntersection(m1, m2) => {
-      print_multiset(m1)
-      Console.print(" INTERSECT ")
-      print_multiset(m2)
-    }
-    case MPlus(m1, m2) => {
-      print_multiset(m1)
-      Console.print(" PLUS ")
-      print_multiset(m2)
-    }
-    case MMinus(m1, m2) => {
-      print_multiset(m1)
-      Console.print(" MINUS ")
-      print_multiset(m2)
-    }
-    case MSetMinus(m1, m2) => {
-      print_multiset(m1)
-      Console.print(" SetMINUS ")
-      print_multiset(m2)
-    }
-    case MSetOf(m1) => {
-      Console.print(" SetOf( ")
-      print_multiset(m1)
-      print(" )")
-    }
-  }
-
-  def print_termIn(t:TermIn):Unit = t match {
-    case TIMultiplicity(v) => Console.print(v + "(e)")
-    case TIConstant(c) => Console.print(c)
-    case TIPlus(t1, t2) => {
-      print_termIn(t1)
-      Console.print(" + ")
-      print_termIn(t2)
-    }
-    case TITimes(c, t1)=> {
-      Console.print(c + "*")
-      print_termIn(t1)
-    }
-    case TIIte(f, t1, t2)=> {
-      Console.print("ITE(")
-      print_formulaIn(f)
-      print("; ")
-      print_termIn(t1)
-      print(", ")
-      print_termIn(t2)
-      print(")")
-    }
-  }
-
-
-  def print_atomIn(a:AtomIn):Unit = a match {
-    case AILeq(t1,t2) => {
-      print_termIn(t1)
-      Console.print(" =< ")
-      print_termIn(t2)
-    }
-    case AIEq(t1,t2) => {
-      print_termIn(t1)
-      Console.print(" = ")
-      print_termIn(t2)
-    }
-  }
-
-  def print_formulaIn(f:FormulaIn):Unit = f match {
-    case FIAnd(f1,f2) => {
-      Console.print(" ( ")
-      print_formulaIn(f1)
-      print(" ) AND ( ")
-      print_formulaIn(f2)
-      print(" ) ")
-    }
-    case FIOr(f1,f2) => {
-      Console.print(" ( ")
-      print_formulaIn(f1)
-      print(" ) OR ( ")
-      print_formulaIn(f2)
-      print(" ) ")
-    }
-    case FINot(f1)  => {
-      Console.print(" NOT ( ")
-      print_formulaIn(f1)
-      print(" ) ")
-    }
-    case FIAtom(a) => print_atomIn(a)
-    case FITrue => Console.print(" TRUE ")
-    case FIFalse => Console.print(" FALSE ")
-  }
-
-
- 
-  def print_termOut(t:TermOut):Unit = t match {
-    case TOConstant(c) => Console.print(c)
-    case TOVariable(v) => Console.print(v)
-    case TOCard(m) => {
-      Console.print("| ")
-      print_multiset(m)
-      Console.print("| ")
-    }
-    case TOPlus(t1, t2) => {
-      print_termOut(t1)
-      Console.print(" + ")
-      print_termOut(t2)
-    }
-    case TOTimes(c, t1)=> {
-      Console.print(c + "*")
-      print_termOut(t1)
-    }
-    case TOIte(f, t1, t2)=> {
-      Console.print("ITE(")
-      print_formulaOut(f)
-      print("; ")
-      print_termOut(t1)
-      print(", ")
-      print_termOut(t2)
-      print(")")
-    }
-  }
-
-  def print_atomOut(a:AtomOut):Unit = a match {
-    case AOLeq(t1,t2) => {
-      print_termOut(t1)
-      Console.print(" =< ")
-      print_termOut(t2)
-    }
-    case AOEq(t1,t2) => {
-      print_termOut(t1)
-      Console.print(" = ")
-      print_termOut(t2)
-    }
-    case AOSum(l1, f, l2) => {
-      Console.print(" ( ")
-      l1.foreach(x => {
-        print_termOut(x)
-        print(", ")
-      })
-      print(") = SUM {e in E, ")
-      print_formulaIn(f)
-      print("} (")
-      l2.foreach(x => {
-        print_termIn(x)
-        print(", ")
-      })
-      print(")")
-    }
-  }
-
-
-  def print_formulaOut(f:FormulaOut):Unit = f match {
-    case FOAnd(f1,f2) => {
-      Console.print(" ( ")
-      print_formulaOut(f1)
-      print(" ) AND ( ")
-      print_formulaOut(f2)
-      print(" ) ")
-    }
-    case FOOr(f1,f2) => {
-      Console.print(" ( ")
-      print_formulaOut(f1)
-      print(" ) OR ( ")
-      print_formulaOut(f2)
-      print(" ) ")
-    }
-    case FONot(f1)  => {
-      Console.print(" NOT ( ")
-      print_formulaOut(f1)
-      print(" ) ")
-    }
-    case FOAtom(a)  => print_atomOut(a)
-    case FOTrue => Console.print(" TRUE ")
-    case FOFalse => Console.print(" FALSE ")
-  }
-
-  def print_atom(a:Atom):Unit = a match {
-    case AEqual(m1,m2) => {
-      print_multiset(m1)
-      Console.print(" = ")
-      print_multiset(m2)
-    }
-    case ASubset(m1,m2) => {
-      print_multiset(m1)
-      Console.print(" SUBSET ")
-      print_multiset(m2)
-    }
-    case AForAllElem(f) => {
-      Console.print(" FOR ALL e IN E. ( ")
-      print_formulaIn(f)
-      print(" ) ")
-    }
-    case AAtomOut(a1)  => print_atomOut(a1)
-  }
-
-  def print_multisetFormula(f:Formula):Unit = f match {
-    case FAnd(f1,f2) => {
-      Console.print(" ( ")
-      print_multisetFormula(f1)
-      print(" ) AND ( ")
-      print_multisetFormula(f2)
-      print(" ) ")
-    }
-    case FOr(f1,f2) => {
-      Console.print(" ( ")
-      print_multisetFormula(f1)
-      print(" ) OR ( ")
-      print_multisetFormula(f2)
-      print(" ) ")
-    }
-    case FNot(FAnd(FNot(f1),FNot(f2)))   => {
-      Console.print(" ( ")
-      print_multisetFormula(f1)
-      print(" ) OR ( ")
-      print_multisetFormula(f2)
-      print(" ) ")
-    }
-    case FNot(f1)  => {
-      Console.print(" NOT ( ")
-      print_multisetFormula(f1)
-      print(" ) ")
-    }
-    case FAtom(a)  => print_atom(a)
-    case FTrue  => Console.print(" TRUE ")
-    case FFalse  => Console.print(" FALSE ")
-  }
-
-}
\ No newline at end of file
diff --git a/src/multisets/NormalFormTranslator.scala b/src/multisets/NormalFormTranslator.scala
deleted file mode 100644
index cdc0f30fc6a0c23a99f13a685dbea823ef01917f..0000000000000000000000000000000000000000
--- a/src/multisets/NormalFormTranslator.scala
+++ /dev/null
@@ -1,924 +0,0 @@
-package multisets
-
-
-import multisets.MultisetFormulaPrinter._
-
-
-object NormalFormTranslator {
-
-
-
-// start: this part extraxts all complex (diff. than a variable) expressions
-//input: f - Formula, mc - counter for fresh, mm - list containing (var, Multiset)
-//output : Formula - containing only variables as multisets, Int-counter  List - variable, multiset
-  def extractMsetsExpr_termOut(t:TermOut, mc:Int, mm:List[(String,Multiset)]):(TermOut,Int,List[(String,Multiset)]) = t match {
-    case TOConstant(c) => (TOConstant(c), mc, mm)
-    case TOVariable(v) => (TOVariable(v), mc, mm)
-    case TOCard(MVariable(m)) => (TOCard(MVariable(m)), mc, mm)
-    case TOCard(m) => {
-      val newMulVar = "FRESHm" + mc
-      var mm1 = (newMulVar, m)  :: mm
-      (TOCard(MVariable(newMulVar)), mc + 1, mm1)
-    }
-    case TOPlus(t1, t2) => {
-      val (t1n, mc1, mm1) = extractMsetsExpr_termOut(t1, mc, mm)
-      val (t2n, mc2, mm2) = extractMsetsExpr_termOut(t2, mc1, mm1)
-      (TOPlus(t1n, t2n), mc2, mm2)
-    }
-    case TOTimes(c, t1)=> {
-      val (t1n, mc1, mm1) = extractMsetsExpr_termOut(t1, mc, mm)
-      (TOTimes(c, t1n), mc1, mm1)
-    }
-    case TOIte(f, t1, t2)=> {
-      val (f1, mc1, mm1) = extractMsetsExpr_formulaOut(f, mc, mm)
-      val (t1n, mc2, mm2) = extractMsetsExpr_termOut(t1, mc1, mm1)
-      val (t2n, mc3, mm3) = extractMsetsExpr_termOut(t2, mc2, mm2)
-      (TOIte(f1,t1n, t2n), mc3, mm3)
-    }
-  }
-
-  def extractMsetsExpr_atomOut(a:AtomOut, mc:Int, mm:List[(String,Multiset)]):(AtomOut,Int,List[(String,Multiset)]) = a match {
-    case AOLeq(t1,t2) => {
-      val (t1n, mc1, mm1) = extractMsetsExpr_termOut(t1, mc, mm)
-      val (t2n, mc2, mm2) = extractMsetsExpr_termOut(t2, mc1, mm1)
-      (AOLeq(t1n, t2n), mc2, mm2)
-    }
-    case AOEq(t1,t2) => {
-      val (t1n, mc1, mm1) = extractMsetsExpr_termOut(t1, mc, mm)
-      val (t2n, mc2, mm2) = extractMsetsExpr_termOut(t2, mc1, mm1)
-      (AOEq(t1n, t2n), mc2, mm2)
-    }
-    case AOSum(l1, f, l2) => {
-      var l3: List[TermOut] = Nil
-      var mcN = mc
-      var mmN = mm
-      l1.foreach(t => {
-        val (t1, mc1, mm1) = extractMsetsExpr_termOut(t, mcN, mmN)
-        l3 = t1 :: l3 
-        mcN = mc1
-        mmN = mm1
-      })
-      (AOSum(l3.reverse, f, l2), mcN, mmN)
-    }
-  }
-
-  def extractMsetsExpr_formulaOut(f:FormulaOut, mc:Int, mm:List[(String,Multiset)]):(FormulaOut,Int,List[(String,Multiset)]) = f match {
-    case FOAnd(f1,f2) => {
-	val (f1n, mc1, mm1) = extractMsetsExpr_formulaOut(f1, mc, mm)
-	val (f2n, mc2, mm2) = extractMsetsExpr_formulaOut(f2, mc1, mm1)
-	(FOAnd(f1n, f2n), mc2, mm2)
-    }
-    case FOOr(f1,f2) => {
-	val (f1n, mc1, mm1) = extractMsetsExpr_formulaOut(f1, mc, mm)
-	val (f2n, mc2, mm2) = extractMsetsExpr_formulaOut(f2, mc1, mm1)
-	(FOOr(f1n, f2n), mc2, mm2)
-    }
-    case FONot(f1)  => {
-      val (f1n, mc1, mm1) = extractMsetsExpr_formulaOut(f1, mc, mm)
-      (FONot(f1n), mc1, mm1)
-    }
-    case FOAtom(a)  => {
-     val (a1, mc1, mm1) = extractMsetsExpr_atomOut(a, mc, mm)
-     (FOAtom(a1), mc1, mm1)
-    }
-    case FOTrue => (f, mc, mm)
-    case FOFalse => (f, mc, mm)
-  }
-
-  def extractMsetsExpr_atom(a:Atom, mc:Int, mm:List[(String,Multiset)]):(Atom,Int,List[(String,Multiset)]) = a match {
-    case AEqual(MVariable(v1),MVariable(v2)) => (AEqual(MVariable(v1),MVariable(v2)), mc, mm)
-    case AEqual(MVariable(v1),m2) => {
-      val newMulVar = "FRESHm" + mc
-      var mm1 = (newMulVar, m2)  :: mm
-      (AEqual(MVariable(v1),MVariable(newMulVar)), mc + 1, mm1)
-    }
-    case AEqual(m1, MVariable(v2)) => {
-      val newMulVar = "FRESHm" + mc
-      var mm1 = (newMulVar, m1)  :: mm
-      (AEqual(MVariable(newMulVar),MVariable(v2)), mc + 1, mm1)
-    }
-    case AEqual(m1,m2) => {
-      val newMulVar1 = "FRESHm" + mc
-      var mm1 = (newMulVar1, m1)  :: mm
-      val mcN = mc + 1
-      val newMulVar2 = "FRESHm" + mcN
-      var mm2 = (newMulVar2, m2)  :: mm1
-      (AEqual(MVariable(newMulVar1),MVariable(newMulVar2)), mcN + 1, mm2)
-    }
-    case ASubset(MVariable(v1),MVariable(v2)) => (ASubset(MVariable(v1),MVariable(v2)), mc, mm)
-    case ASubset(MVariable(v1),m2) => {
-      val newMulVar = "FRESHm" + mc
-      var mm1 = (newMulVar, m2)  :: mm
-      (ASubset(MVariable(v1),MVariable(newMulVar)), mc + 1, mm1)
-    }
-    case ASubset(m1, MVariable(v2)) => {
-      val newMulVar = "FRESHm" + mc
-      var mm1 = (newMulVar, m1)  :: mm
-      (ASubset(MVariable(newMulVar),MVariable(v2)), mc + 1, mm1)
-    }
-    case ASubset(m1,m2) => {
-      val newMulVar1 = "FRESHm" + mc
-      var mm1 = (newMulVar1, m1)  :: mm
-      val mcN = mc + 1
-      val newMulVar2 = "FRESHm" + mcN
-      var mm2 = (newMulVar2, m2)  :: mm1
-      (ASubset(MVariable(newMulVar1),MVariable(newMulVar2)), mcN + 1, mm2)
-    }
-    case AForAllElem(f) => (AForAllElem(f), mc, mm)
-    case AAtomOut(a1)  => {
-     val (a2, mc1, mm1) = extractMsetsExpr_atomOut(a1, mc, mm)
-     (AAtomOut(a2), mc1, mm1)
-    }
-  }
-
-  def extractMsetsExpr_formula(f:Formula, mc:Int, mm:List[(String,Multiset)]):(Formula,Int,List[(String,Multiset)]) = f match {
-    case FAnd(f1,f2) => {
-	val (f1n, mc1, mm1) = extractMsetsExpr_formula(f1, mc, mm)
-	val (f2n, mc2, mm2) = extractMsetsExpr_formula(f2, mc1, mm1)
-	(FAnd(f1n, f2n), mc2, mm2)
-    }
-    case FOr(f1,f2) => {
-	val (f1n, mc1, mm1) = extractMsetsExpr_formula(f1, mc, mm)
-	val (f2n, mc2, mm2) = extractMsetsExpr_formula(f2, mc1, mm1)
-	(FOr(f1n, f2n), mc2, mm2)
-    }
-    case FNot(f1)  => {
-      val (f1n, mc1, mm1) = extractMsetsExpr_formula(f1, mc, mm)
-      (FNot(f1n), mc1, mm1)
-    }
-    case FAtom(a)  => {
-     val (a1, mc1, mm1) = extractMsetsExpr_atom(a, mc, mm)
-     (FAtom(a1), mc1, mm1)
-    }
-    case FTrue  => (f, mc, mm)
-    case FFalse => (f, mc, mm)
-  }
-// end 
-
-
-// start: list(var, multiset), can contain complex multiset expressions
-// output: list(var, multiset), simple multiset expressions
-  def flatten_multisetList(mc:Int, mm:List[(String,Multiset)], toBeChecked: Boolean):List[(String,Multiset)] = {
-    var addedFreshMultisets = false
-    var ml: List[(String,Multiset)] = Nil
-    var mc1 = mc
-    if (toBeChecked) {
-      mm.foreach(p => p._2 match {
-         case MVariable(v) => ml = p :: ml
-         case MEmpty =>  ml = p :: ml
-         case MUnion(MVariable(v1),MVariable(v2)) =>  ml = p :: ml
-         case MUnion(MVariable(v1),m2) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MUnion(MVariable(v1),MVariable(newMulVar))) :: ((newMulVar, m2)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MUnion(m1,MVariable(v2)) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MUnion(MVariable(newMulVar),MVariable(v2))) :: ((newMulVar, m1)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MUnion(m1,m2) => {
-           val newMulVar1 = "FRESHm" + mc1
-           ml = (newMulVar1, m1)  :: ml
-           mc1 = mc1 + 1
-           val newMulVar2 = "FRESHm" + mc1
-           ml = (newMulVar2, m2)  :: ml
-           mc1 = mc1 + 1
-           ml = (p._1, MUnion(MVariable(newMulVar1),MVariable(newMulVar2))) :: ml
-           addedFreshMultisets = true
-         }
-         case MIntersection(MVariable(v1),MVariable(v2)) => ml = p :: ml
-         case MIntersection(MVariable(v1),m2) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MIntersection(MVariable(v1),MVariable(newMulVar))) :: ((newMulVar, m2)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MIntersection(m1,MVariable(v2)) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MIntersection(MVariable(newMulVar),MVariable(v2))) :: ((newMulVar, m1)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MIntersection(m1,m2) => {
-           val newMulVar1 = "FRESHm" + mc1
-           ml = (newMulVar1, m1)  :: ml
-           mc1 = mc1 + 1
-           val newMulVar2 = "FRESHm" + mc1
-           ml = (newMulVar2, m2)  :: ml
-           mc1 = mc1 + 1
-           ml = (p._1, MIntersection(MVariable(newMulVar1),MVariable(newMulVar2))) :: ml
-           addedFreshMultisets = true
-         }
-         case MPlus(MVariable(v1),MVariable(v2)) => ml = p :: ml
-         case MPlus(MVariable(v1),m2) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MPlus(MVariable(v1),MVariable(newMulVar))) :: ((newMulVar, m2)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MPlus(m1,MVariable(v2)) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MPlus(MVariable(newMulVar),MVariable(v2))) :: ((newMulVar, m1)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MPlus(m1,m2) => {
-           val newMulVar1 = "FRESHm" + mc1
-           ml = (newMulVar1, m1)  :: ml
-           mc1 = mc1 + 1
-           val newMulVar2 = "FRESHm" + mc1
-           ml = (newMulVar2, m2)  :: ml
-           mc1 = mc1 + 1
-           ml = (p._1, MPlus(MVariable(newMulVar1),MVariable(newMulVar2))) :: ml
-           addedFreshMultisets = true
-         }
-         case MMinus(MVariable(v1),MVariable(v2)) => ml = p :: ml 
-         case MMinus(MVariable(v1),m2) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MMinus(MVariable(v1),MVariable(newMulVar))) :: ((newMulVar, m2)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MMinus(m1,MVariable(v2)) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MMinus(MVariable(newMulVar),MVariable(v2))) :: ((newMulVar, m1)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MMinus(m1,m2) => {
-           val newMulVar1 = "FRESHm" + mc1
-           ml = (newMulVar1, m1)  :: ml
-           mc1 = mc1 + 1
-           val newMulVar2 = "FRESHm" + mc1
-           ml = (newMulVar2, m2)  :: ml
-           mc1 = mc1 + 1
-           ml = (p._1, MMinus(MVariable(newMulVar1),MVariable(newMulVar2))) :: ml
-           addedFreshMultisets = true
-         }
-         case MSetMinus(MVariable(v1),MVariable(v2)) => ml = p :: ml 
-         case MSetMinus(MVariable(v1),m2) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MSetMinus(MVariable(v1),MVariable(newMulVar))) :: ((newMulVar, m2)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MSetMinus(m1,MVariable(v2)) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (p._1, MSetMinus(MVariable(newMulVar),MVariable(v2))) :: ((newMulVar, m1)  :: ml)
-           mc1 = mc1 + 1
-           addedFreshMultisets = true
-         }
-         case MSetMinus(m1,m2) => {
-           val newMulVar1 = "FRESHm" + mc1
-           ml = (newMulVar1, m1)  :: ml
-           mc1 = mc1 + 1
-           val newMulVar2 = "FRESHm" + mc1
-           ml = (newMulVar2, m2)  :: ml
-           mc1 = mc1 + 1
-           ml = (p._1, MSetMinus(MVariable(newMulVar1),MVariable(newMulVar2))) :: ml
-           addedFreshMultisets = true
-         }
-         case MSetOf(MVariable(v)) => ml = p :: ml  
-         case MSetOf(m) => {
-           val newMulVar = "FRESHm" + mc1
-           ml = (newMulVar, m)  :: ml
-           mc1 = mc1 + 1
-           ml = (p._1, MSetOf(MVariable(newMulVar))) :: ml
-           addedFreshMultisets = true
-         }
-      })
-      flatten_multisetList(mc1, ml, addedFreshMultisets)
-    }
-    else mm
-  }
-// end
-
-
-
-// start: input list(string, multiset) (m1, m2 un m3),...
-// output: formula: Forall e.(m1 (e) = ... AND ..)
-  def createFormulafromPair(p:(String,Multiset)):FormulaIn = p._2 match {
-    case MEmpty => 
-      FIAtom(AIEq(TIMultiplicity(p._1),TIConstant(0)))
-    case MUnion(MVariable(v1),MVariable(v2)) => 
-      FIAtom(AIEq(TIMultiplicity(p._1),
-        TIIte(FIAtom(AILeq(TIMultiplicity(v1),TIMultiplicity(v2))), TIMultiplicity(v2), TIMultiplicity(v1))))
-    case MIntersection(MVariable(v1),MVariable(v2)) => 
-      FIAtom(AIEq(TIMultiplicity(p._1),
-        TIIte(FIAtom(AILeq(TIMultiplicity(v1),TIMultiplicity(v2))), TIMultiplicity(v1), TIMultiplicity(v2))))
-    case MPlus(MVariable(v1),MVariable(v2)) => 
-      FIAtom(AIEq(TIMultiplicity(p._1),
-        TIPlus(TIMultiplicity(v1), TIMultiplicity(v2))))
-    case MMinus(MVariable(v1),MVariable(v2)) => 
-      FIAtom(AIEq(TIMultiplicity(p._1),
-        TIIte(FIAtom(AILeq(TIMultiplicity(v1),TIMultiplicity(v2))), TIConstant(0), 
-        TIPlus(TIMultiplicity(v1), TITimes(-1, TIMultiplicity(v2))))))
-    case MSetMinus(MVariable(v1),MVariable(v2)) => 
-      FIAtom(AIEq(TIMultiplicity(p._1),
-        TIIte(FIAtom(AIEq(TIMultiplicity(v2),TIConstant(0))), TIMultiplicity(v1), TIConstant(0))))
-    case MSetOf(MVariable(v)) => 
-      FIAtom(AIEq(TIMultiplicity(p._1),
-        TIIte(FIAtom(AILeq(TIConstant(1),TIMultiplicity(v))), TIConstant(1), TIConstant(0))))
-    case _ => error("Impossible case, canot get this here, but got " + p)
-    }
-
-  def createFormulafromMultisetList(mlist:List[(String,Multiset)]):Formula = {
-    if (mlist.isEmpty) FAtom(AForAllElem(FITrue)) else {
-      val firstPair = mlist.head
-      val theRest = mlist.tail
-      var fN = createFormulafromPair(firstPair)
-      theRest.foreach(p => {
-        val f = createFormulafromPair(p)
-        fN = FIAnd(fN, f)
-      })
-      FAtom(AForAllElem(fN))
-    } 
-  } 
-// end
-
-
-// start: formula with m1 SUB m2 and m1 = m2
-// output formula with forall e. m1(e) <= m2(e) and m1(e) = m2(e)
-  def redefineMultisetAtom(a:Atom):Formula = a match {
-    case AEqual(MVariable(v1),MVariable(v2)) => 
-      FAtom(AForAllElem(FIAtom(AIEq(TIMultiplicity(v1), TIMultiplicity(v2)))))
-    case ASubset(MVariable(v1),MVariable(v2)) => 
-      FAtom(AForAllElem(FIAtom(AILeq(TIMultiplicity(v1), TIMultiplicity(v2)))))
-    case AForAllElem(f) => FAtom(AForAllElem(f))
-    case AAtomOut(a1)  => FAtom(AAtomOut(a1))
-    case _ => error("Impossible case ")
-  }
-
-  def redefineMultisetAtoms(f:Formula):Formula = f match {
-    case FAnd(f1,f2) => {
-	val f1n = redefineMultisetAtoms(f1)
-	val f2n = redefineMultisetAtoms(f2)
-	FAnd(f1n, f2n)
-    }
-    case FOr(f1,f2) => {
-	val f1n = redefineMultisetAtoms(f1)
-	val f2n = redefineMultisetAtoms(f2)
-	FOr(f1n, f2n)
-    }
-    case FNot(f1)  => {
-      val f1n = redefineMultisetAtoms(f1)
-      FNot(f1n)
-    }
-    case FAtom(a)  => {
-     val a1 = redefineMultisetAtom(a)
-     a1
-    }
-    case FTrue => f
-    case FFalse => f
-  }
-// end
-
-
-// start: input formula with cardinalities
-// output: new formula where each cardinality is replaced with a fresh int var + List(intVar, msetVar) <-both strings 
-
-  def extractCardExpr_termOut(t:TermOut, ic:Int, cl:List[(String,String)]):(TermOut,Int,List[(String,String)]) = t match {
-    case TOConstant(c) => (TOConstant(c), ic, cl)
-    case TOVariable(v) => (TOVariable(v), ic, cl)
-    case TOCard(MVariable(m)) => {
-      val newIntVar = "FRESHk" + ic
-      var cl1 = (newIntVar, m)  :: cl
-      (TOVariable(newIntVar), ic + 1, cl1)
-    }
-    case TOPlus(t1, t2) => {
-      val (t1n, ic1, cl1) = extractCardExpr_termOut(t1, ic, cl)
-      val (t2n, ic2, cl2) = extractCardExpr_termOut(t2, ic1, cl1)
-      (TOPlus(t1n, t2n), ic2, cl2)
-    }
-    case TOTimes(c, t1)=> {
-      val (t1n, ic1, cl1) = extractCardExpr_termOut(t1, ic, cl)
-      (TOTimes(c, t1n), ic1, cl1)
-    }
-    case TOIte(f, t1, t2)=> {
-      val (f1, ic1, cl1) = extractCardExpr_formulaOut(f, ic, cl)
-      val (t1n, ic2, cl2) = extractCardExpr_termOut(t1, ic1, cl1)
-      val (t2n, ic3, cl3) = extractCardExpr_termOut(t2, ic2, cl2)
-      (TOIte(f1,t1n, t2n), ic3, cl3)
-    }
-    case _ => error("Impossible case ")
-  }
-
-  def extractCardExpr_atomOut(a:AtomOut, ic:Int, cl:List[(String,String)]):(AtomOut,Int,List[(String,String)]) = a match {
-    case AOLeq(t1,t2) => {
-      val (t1n, ic1, cl1) = extractCardExpr_termOut(t1, ic, cl)
-      val (t2n, ic2, cl2) = extractCardExpr_termOut(t2, ic1, cl1)
-      (AOLeq(t1n, t2n), ic2, cl2)
-    }
-    case AOEq(t1,t2) => {
-      val (t1n, ic1, cl1) = extractCardExpr_termOut(t1, ic, cl)
-      val (t2n, ic2, cl2) = extractCardExpr_termOut(t2, ic1, cl1)
-      (AOEq(t1n, t2n), ic2, cl2)
-    }
-    case AOSum(l1, f, l2) => {
-      var l3: List[TermOut] = Nil
-      var icN = ic
-      var clN = cl
-      l1.foreach(t => {
-        val (t1, ic1, cl1) = extractCardExpr_termOut(t, icN, clN)
-        l3 = t1 :: l3 
-        icN = ic1
-        clN = cl1
-      })
-      (AOSum(l3.reverse, f, l2), icN, clN)
-    }
-  }
-
-  def extractCardExpr_formulaOut(f:FormulaOut, ic:Int, cl:List[(String,String)]):(FormulaOut,Int,List[(String,String)]) = f match {
-    case FOAnd(f1,f2) => {
-	val (f1n, ic1, cl1) = extractCardExpr_formulaOut(f1, ic, cl)
-	val (f2n, ic2, cl2) = extractCardExpr_formulaOut(f2, ic1, cl1)
-	(FOAnd(f1n, f2n), ic2, cl2)
-    }
-    case FOOr(f1,f2) => {
-	val (f1n, ic1, cl1) = extractCardExpr_formulaOut(f1, ic, cl)
-	val (f2n, ic2, cl2) = extractCardExpr_formulaOut(f2, ic1, cl1)
-	(FOOr(f1n, f2n), ic2, cl2)
-    }
-    case FONot(f1)  => {
-      val (f1n, ic1, cl1) = extractCardExpr_formulaOut(f1, ic, cl)
-      (FONot(f1n), ic1, cl1)
-    }
-    case FOAtom(a)  => {
-     val (a1, ic1, cl1) = extractCardExpr_atomOut(a, ic, cl)
-     (FOAtom(a1), ic1, cl1)
-    }
-    case FOTrue => (f, ic, cl)
-    case FOFalse => (f, ic, cl)
-  }
-
-
-  def extractCardExpr_atom(a:Atom, ic:Int, cl:List[(String,String)]):(Atom,Int,List[(String,String)]) = a match {
-    case AEqual(m1,m2) => (AEqual(m1,m2), ic, cl)
-    case ASubset(m1,m2) => (ASubset(m1,m2), ic, cl)
-    case AForAllElem(f) => (AForAllElem(f), ic, cl)
-    case AAtomOut(a1)  => {
-     val (a2, ic1, cl1) = extractCardExpr_atomOut(a1, ic, cl)
-     (AAtomOut(a2), ic1, cl1)
-    }
-  }
-
-  def extractCardExpr_formula(f:Formula, ic:Int, cl:List[(String,String)]):(Formula,Int,List[(String,String)]) = f match {
-    case FAnd(f1,f2) => {
-	val (f1n, ic1, cl1) = extractCardExpr_formula(f1, ic, cl)
-	val (f2n, ic2, cl2) = extractCardExpr_formula(f2, ic1, cl1)
-	(FAnd(f1n, f2n), ic2, cl2)
-    }
-    case FOr(f1,f2) => {
-	val (f1n, ic1, cl1) = extractCardExpr_formula(f1, ic, cl)
-	val (f2n, ic2, cl2) = extractCardExpr_formula(f2, ic1, cl1)
-	(FOr(f1n, f2n), ic2, cl2)
-    }
-    case FNot(f1)  => {
-      val (f1n, ic1, cl1) = extractCardExpr_formula(f1, ic, cl)
-      (FNot(f1n), ic1, cl1)
-    }
-    case FAtom(a)  => {
-     val (a1, ic1, cl1) = extractCardExpr_atom(a, ic, cl)
-     (FAtom(a1), ic1, cl1)
-    }
-    case FTrue => (f, ic, cl)
-    case FFalse => (f, ic, cl)
-  }
-// end 
-
-// start: input list(var, mset), output: (var) = SUM_{} mset
-  def createFormulafromCardinalityList(cl:List[(String,String)]):Formula = {
-  var l1: List[TermOut] = Nil
-  var l2: List[TermIn] = Nil
-  if (cl.isEmpty) FAtom(AAtomOut(AOSum(List(TOConstant(0)), FITrue, List(TIConstant(0))))) else {
-    cl.foreach(p => {
-      l1 = TOVariable(p._1) :: l1
-      l2 = TIMultiplicity(p._2) :: l2 
-     })
-     FAtom(AAtomOut((AOSum(l1, FITrue, l2))))
-   }
-  }
-
-// end 
-
-
-// start
-// input: f- formula, fFA - allready existing formula of the form forall e.f(e)
-//output:  $1 - formula without top-level forall, $2-forall e. f(e)
-  def uniteForAll(fI:FormulaIn,f:Formula):Formula = f match {
-    case FAtom(AForAllElem(f1))  => {
-      val fn = if (f1 == FITrue) fI else FIAnd(fI, f1)
-      FAtom(AForAllElem(fn))
-    }
-    case _ => error("Impossible case ")
-  }
-
-
-  def topLevelForAll(f:Formula,fFA:Formula):(Formula,Formula) = f match {
-    case FAnd(FAtom(AForAllElem(fI)),f2) => {
-       val (f2N, fFAN) = topLevelForAll(f2, fFA)
-       (f2N, uniteForAll(fI, fFAN))
-    }
-    case FAnd(f1, FAtom(AForAllElem(fI))) => {
-       val (f1N, fFAN) = topLevelForAll(f1, fFA)
-       (f1N, uniteForAll(fI, fFAN))
-    }
-    case FAnd(f1,f2) => {
-	val (f1n, fFA1) = topLevelForAll(f1, fFA)
-	val (f2n, fFA2) = topLevelForAll(f2, fFA1)
-        val f3n = if (f1n == FTrue) f2n else
-          if (f2n == FTrue) f1n else FAnd(f1n, f2n)
-	(f3n, fFA2)
-    }
-    case FOr(f1,f2) => (f, fFA)
-    case FNot(f1)  => (f, fFA)
-    case FAtom(AForAllElem(fI))  =>  (FTrue, uniteForAll(fI, fFA))
-    case FAtom(a)  => (f, fFA)
-    case FTrue => (f, fFA)
-    case FFalse => (f, fFA)
-  }
-// end
-
-
-// start
-// input formula f - output f1 where every forall e. f is replaced with a sum: 
-// forall e. f(e)  <=> 0 = sum_{true} ite(f(e); 0, 1)
-  def replaceForAllWithSums(f:Formula):Formula = f match {
-    case FAnd(f1,f2) => {
-      val f1n = replaceForAllWithSums(f1)
-      val f2n = replaceForAllWithSums(f2)
-      FAnd(f1n, f2n)
-    }
-    case FOr(f1,f2) => {
-      val f1n = replaceForAllWithSums(f1)
-      val f2n = replaceForAllWithSums(f2)
-      FOr(f1n, f2n)
-    }
-    case FNot(f1)  => {
-      val f1n = replaceForAllWithSums(f1)
-      FNot(f1n)
-    }
-    case FAtom(AForAllElem(f1))  => 
-      FAtom(AAtomOut(AOSum(List(TOConstant(0)), FITrue, List(TIIte(f1,TIConstant(0),TIConstant(1))))))
-    case FAtom(a)  => f
-    case FTrue => f
-    case FFalse => f
-  }
-
-  def notTopLevelForAll(f:Formula):Formula = f match {
-    case FAnd(f1,f2) => {
-      val f1n = notTopLevelForAll(f1)
-      val f2n = notTopLevelForAll(f2)
-     FAnd(f1n, f2n)
-    }
-    case FOr(f1,f2) => {
-      val f1n = replaceForAllWithSums(f1)
-      val f2n = replaceForAllWithSums(f2)
-     FOr(f1n, f2n)
-    }
-    case FNot(f1)  => FNot(replaceForAllWithSums(f1))
-    case FAtom(a)  => f
-    case FTrue  => f
-    case FFalse  => f
-  }
-// end
-
-
-
-// start: input formula f and fS which is already a sum atom
-// output: $1 without top level sums, $2 is a sum atom
-  def eliminateConditions(f:FormulaIn, lIn: List[TermIn]):List[TermIn] = {
-    var ltemp: List[TermIn] = Nil
-    lIn.foreach(t => {
-       val t1 = TIIte(f, t, TIConstant(0))
-       ltemp = t1 :: ltemp
-    })
-    ltemp.reverse
-  }
-
-
-  def uniteSums(lTO:List[TermOut], lTI: List[TermIn], fD:FormulaIn,f:Formula):Formula = f match {
-    case FAtom(AAtomOut(AOSum(lT0o, FITrue, lTIo)))  => fD match {
-      case FITrue => FAtom(AAtomOut(AOSum(lTO ::: lT0o, FITrue, lTI ::: lTIo)))
-      case _ => {
-        val ltN = eliminateConditions(fD, lTI)
-        FAtom(AAtomOut(AOSum(lTO ::: lT0o, FITrue, ltN ::: lTIo)))
-      }
-    }  
-    case _ => error("Impossible case ")
-  }
-
-  def topLevelSums(f:Formula,fS:Formula):(Formula,Formula) = f match {
-    case FAnd(FAtom(AAtomOut(AOSum(lTO, ff, lTI))), f2) => {
-       val (f2N, fSN) = topLevelSums(f2, fS)
-       (f2N, uniteSums(lTO, lTI, ff, fSN))
-    }
-    case FAnd(f1, FAtom(AAtomOut(AOSum(lTO, ff, lTI)))) => {
-       val (f1N, fSN) = topLevelSums(f1, fS)
-       (f1N, uniteSums(lTO, lTI, ff, fSN))
-    }
-    case FAnd(f1,f2) => {
-	val (f1n, fS1) = topLevelForAll(f1, fS)
-	val (f2n, fS2) = topLevelForAll(f2, fS1)
-        val f3n = if (f1n == FTrue) f2n else
-          if (f2n == FTrue) f1n else FAnd(f1n, f2n)
-	(f3n, fS2)
-    }
-    case FOr(f1,f2) => (f, fS)
-    case FNot(f1)  => (f, fS)
-    case FAtom(AAtomOut(AOSum(lTO, ff, lTI)))  =>  (FTrue, uniteSums(lTO, lTI, ff, fS))
-    case FAtom(a)  => (f, fS)
-    case FTrue  => (f, fS)
-    case FFalse  => (f, fS)
-  }
-// end
-
-
-// start: input f - formula fs- sum atom, sc -counter
-// outputs: $1 - formula without sums, $s2 - sum atom $3 -counter
-  def createEqualityAtom(to:TermOut, sc:Int):(Atom,TermOut,Int) = {
-    val newVar = "FRESHs" + sc
-    val scN = sc + 1
-    val a = AAtomOut(AOEq(to, TOVariable(newVar)))
-    (a, TOVariable(newVar), scN)
-  } 
-
-  def createEqualityFormula(lTO:List[TermOut], sc:Int):(Formula,List[TermOut],Int) = {
-    var tList: List[TermOut] = Nil
-    val t1 = lTO.head
-    val theRest = lTO.tail
-    var (aN, vN, scN) = createEqualityAtom(t1, sc)
-    var fN : Formula = FAtom(aN)
-    tList = vN :: tList
-    theRest.foreach(t => {
-      val (aN1, vN1, scN1) = createEqualityAtom(t, scN)
-      scN = scN1
-      fN = FAnd(fN, FAtom(aN1))
-      tList = vN1 :: tList
-    })
-    (fN, tList.reverse, scN)
-  } 
-
-  def notTopLevelSums(f:Formula,fS:Formula,sc:Int):(Formula,Formula,Int) = f match {
-    case FAnd(f1,f2) => {
-      val (f1n, fS1, sc1) = notTopLevelSums(f1, fS, sc)
-      val (f2n, fS2, sc2) = notTopLevelSums(f2, fS1, sc1)
-      (FAnd(f1n, f2n), fS2, sc2)
-    }
-    case FOr(f1,f2) => {
-      val (f1n, fS1, sc1) = notTopLevelSums(f1, fS, sc)
-      val (f2n, fS2, sc2) = notTopLevelSums(f2, fS1, sc1)
-      (FOr(f1n, f2n), fS2, sc2)
-    }
-    case FNot(f1)  => {
-      val (f1n, fS1, sc1) = notTopLevelSums(f1, fS, sc)
-      (FNot(f1n), fS1, sc1)
-    }
-    case FAtom(AAtomOut(AOSum(lTO, ff, lTI))) => {
-      val (f1, l1, scN) = createEqualityFormula(lTO, sc)
-      val fN = uniteSums(l1, lTI, ff, fS)
-      (f1, fN, scN)
-    }
-    case FAtom(a)  => (f, fS, sc)
-    case FTrue  => (f, fS, sc)
-    case FFalse  => (f, fS, sc)
-  }
-// end
-
-
-// start: input formula F, output: formula F' which does not contain True and False
-// only can contain either pure TRUE or FALSE
-  def removeTrueandFalsefromTermIn(t: TermIn): TermIn = t match {
-    case TIPlus(t1, t2) => {
-      val t1n  = removeTrueandFalsefromTermIn(t1)
-      val t2n  = removeTrueandFalsefromTermIn(t2)
-      TIPlus(t1n, t2n)
-    }
-    case TITimes(c, t1)=> {
-      val t1n  = removeTrueandFalsefromTermIn(t1)
-      TITimes(c, t1n)
-    }
-    case TIIte(f, t1, t2) => {
-      val t1n  = removeTrueandFalsefromTermIn(t1)
-      val t2n  = removeTrueandFalsefromTermIn(t2)
-      val f1 = removeTrueandFalsefromFormulaIn(f)
-      TIIte(f1, t1n, t2n)
-    }
-    case _ => t
-  }
-
-  def removeTrueandFalsefromAtomIn(a: AtomIn): AtomIn = a match {
-    case AILeq(t1, t2) => {
-      val t1n  = removeTrueandFalsefromTermIn(t1)
-      val t2n  = removeTrueandFalsefromTermIn(t2)
-      AILeq(t1n, t2n)
-    }
-    case AIEq(t1,t2) => {
-      val t1n  = removeTrueandFalsefromTermIn(t1)
-      val t2n  = removeTrueandFalsefromTermIn(t2)
-      AIEq(t1n, t2n)
-    }
-  }
-
-  def removeTrueandFalsefromFormulaIn(f: FormulaIn): FormulaIn =  f match {
-    case FIAnd(FIFalse, f2) => FIFalse
-    case FIAnd(f1, FIFalse) => FIFalse
-    case FIAnd(FITrue, f2) => removeTrueandFalsefromFormulaIn(f2)
-    case FIAnd(f1, FITrue) => removeTrueandFalsefromFormulaIn(f1)
-    case FIAnd(f1, f2) => {
-      val f1n  = removeTrueandFalsefromFormulaIn(f1)
-      val f2n  = removeTrueandFalsefromFormulaIn(f2)
-      val f3 = if (f1n == FIFalse || f2n == FIFalse) FIFalse else 
-        if (f1n == FITrue) f2n else
-          if (f2n == FITrue) f1n else FIAnd(f1n, f2n)
-      f3
-    }
-    case FIOr(FITrue, f2) => FITrue
-    case FIOr(f1, FITrue) => FITrue
-    case FIOr(FIFalse, f2) => removeTrueandFalsefromFormulaIn(f2)
-    case FIOr(f1, FIFalse) => removeTrueandFalsefromFormulaIn(f1)
-    case FIOr(f1, f2) => {
-      val f1n  = removeTrueandFalsefromFormulaIn(f1)
-      val f2n  = removeTrueandFalsefromFormulaIn(f2)
-      val f3 = if (f1n == FITrue || f2n == FITrue) FITrue else 
-        if (f1n == FIFalse) f2n else
-          if (f2n == FIFalse) f1n else FIOr(f1n, f2n)
-      f3
-    }
-    case FINot(f1) => {
-      val f1n  = removeTrueandFalsefromFormulaIn(f1)
-      val f3 = if (f1n == FITrue) FIFalse else 
-        if (f1n == FIFalse) FITrue else FINot(f1n)
-      f3
-    }
-    case FIAtom(a) => {
-      val a1 = removeTrueandFalsefromAtomIn(a)
-      FIAtom(a1)
-    }
-    case _  => f
-  }
-
-  def removeTrueandFalsefromTermOut(t: TermOut): TermOut = t match {
-    case TOPlus(t1, t2) => {
-      val t1n  = removeTrueandFalsefromTermOut(t1)
-      val t2n  = removeTrueandFalsefromTermOut(t2)
-      TOPlus(t1n, t2n)
-    }
-    case TOTimes(c, t1)=> {
-      val t1n  = removeTrueandFalsefromTermOut(t1)
-      TOTimes(c, t1n)
-    }
-    case TOIte(f, t1, t2) => {
-      val t1n  = removeTrueandFalsefromTermOut(t1)
-      val t2n  = removeTrueandFalsefromTermOut(t2)
-      val f1 = removeTrueandFalsefromFormulaOut(f)
-      TOIte(f1, t1n, t2n)
-    }
-    case _ => t
-  }
-
-  def removeTrueandFalsefromAtomOut(a: AtomOut): AtomOut = a match {
-    case AOLeq(t1, t2) => {
-      val t1n  = removeTrueandFalsefromTermOut(t1)
-      val t2n  = removeTrueandFalsefromTermOut(t2)
-      AOLeq(t1n, t2n)
-    }
-    case AOEq(t1,t2) => {
-      val t1n  = removeTrueandFalsefromTermOut(t1)
-      val t2n  = removeTrueandFalsefromTermOut(t2)
-      AOEq(t1n, t2n)
-    }
-    case AOSum(l1, f, l2) => {
-      val l1n = l1.map(v => removeTrueandFalsefromTermOut(v))
-      val l2n = l2.map(v => removeTrueandFalsefromTermIn(v))
-      val f1 = removeTrueandFalsefromFormulaIn(f)
-      AOSum(l1n, f1, l2n)
-    }
-  }
-
-  def removeTrueandFalsefromFormulaOut(f: FormulaOut): FormulaOut =  f match {
-    case FOAnd(FOFalse, f2) => FOFalse
-    case FOAnd(f1, FOFalse) => FOFalse
-    case FOAnd(FOTrue, f2) => removeTrueandFalsefromFormulaOut(f2)
-    case FOAnd(f1, FOTrue) => removeTrueandFalsefromFormulaOut(f1)
-    case FOAnd(f1, f2) => {
-      val f1n  = removeTrueandFalsefromFormulaOut(f1)
-      val f2n  = removeTrueandFalsefromFormulaOut(f2)
-      val f3 = if (f1n == FOFalse || f2n == FOFalse) FOFalse else 
-        if (f1n == FOTrue) f2n else
-          if (f2n == FOTrue) f1n else FOAnd(f1n, f2n)
-      f3
-    }
-    case FOOr(FOTrue, f2) => FOTrue
-    case FOOr(f1, FOTrue) => FOTrue
-    case FOOr(FOFalse, f2) => removeTrueandFalsefromFormulaOut(f2)
-    case FOOr(f1, FOFalse) => removeTrueandFalsefromFormulaOut(f1)
-    case FOOr(f1, f2) => {
-      val f1n  = removeTrueandFalsefromFormulaOut(f1)
-      val f2n  = removeTrueandFalsefromFormulaOut(f2)
-      val f3 = if (f1n == FOTrue || f2n == FOTrue) FOTrue else 
-        if (f1n == FOFalse) f2n else
-          if (f2n == FOFalse) f1n else FOOr(f1n, f2n)
-      f3
-    }
-    case FONot(f1) => {
-      val f1n  = removeTrueandFalsefromFormulaOut(f1)
-      val f3 = if (f1n == FOTrue) FOFalse else 
-        if (f1n == FOFalse) FOTrue else FONot(f1n)
-      f3
-    }
-    case FOAtom(a) => {
-      val a1 = removeTrueandFalsefromAtomOut(a)
-      FOAtom(a1)
-    }
-    case _  => f
-  }
-
-  def removeTrueandFalsefromAtom(a: Atom): Atom = a match {
-    case AForAllElem(f1) => {
-      val f1n = removeTrueandFalsefromFormulaIn(f1)
-      AForAllElem(f1n)
-    }
-    case AAtomOut(a1)  => {
-      val a1n = removeTrueandFalsefromAtomOut(a1)
-      AAtomOut(a1n)
-    }
-    case _ => a
-  }
-
-  def removeTrueandFalsefromFormulas(f:Formula): Formula = f match {
-    case FAnd(FFalse, f2) => FFalse
-    case FAnd(f1, FFalse) => FFalse
-    case FAnd(FTrue, f2) => removeTrueandFalsefromFormulas(f2)
-    case FAnd(f1, FTrue) => removeTrueandFalsefromFormulas(f1)
-    case FAnd(f1, f2) => {
-      val f1n  = removeTrueandFalsefromFormulas(f1)
-      val f2n  = removeTrueandFalsefromFormulas(f2)
-      val f3 = if (f1n == FFalse || f2n == FFalse) FFalse else 
-        if (f1n == FTrue) f2n else
-          if (f2n == FTrue) f1n else FAnd(f1n, f2n)
-      f3
-    }
-    case FOr(FTrue, f2) => FTrue
-    case FOr(f1, FTrue) => FTrue
-    case FOr(FFalse, f2) => removeTrueandFalsefromFormulas(f2)
-    case FOr(f1, FFalse) => removeTrueandFalsefromFormulas(f1)
-    case FOr(f1, f2) => {
-      val f1n  = removeTrueandFalsefromFormulas(f1)
-      val f2n  = removeTrueandFalsefromFormulas(f2)
-      val f3 = if (f1n == FTrue || f2n == FTrue) FTrue else 
-        if (f1n == FFalse) f2n else
-          if (f2n == FFalse) f1n else FOr(f1n, f2n)
-      f3
-    }
-    case FNot(f1) => {
-      val f1n  = removeTrueandFalsefromFormulas(f1)
-      val f3 = if (f1n == FTrue) FFalse else 
-        if (f1n == FFalse) FTrue else FNot(f1n)
-      f3
-    }
-    case FAtom(a) => {
-      val a1 = removeTrueandFalsefromAtom(a)
-      FAtom(a1)
-    }
-    case _  => f
-  }
-// end
-
-
-// ------------- MAIN -------------
-
-  def main(f:Formula): (Formula,Formula,Formula) = {
-    val f0 = removeTrueandFalsefromFormulas(f)
-    // formula f0 does not contain true or false but it could be only true or false
-    val msetCounter = 0
-    var msets: List[(String,Multiset)] = Nil
-    val (f1, mc, mcm) = extractMsetsExpr_formula(f0, msetCounter, msets)
-    // formula f1 does not contain complex multisets, they are all in mcm
-    val toBeChecked = true
-    val mlist = flatten_multisetList(mc, mcm, toBeChecked)
-    val fAll = createFormulafromMultisetList(mlist)
-    // fAll is a formula All e.m1(e) =  ,.. AND ... <- all complex multiset experssions as a formula
-    val f2 = redefineMultisetAtoms(f1)  //replace m1 = m2 and m1 SubSET m2 with for all e....
-    val intCounter = 0
-    var cards: List[(String,String)] = Nil
-    val (f3, ic, il) = extractCardExpr_formula(f2, intCounter, cards)
-    // f3 = new formula without cardinalities, il = list of the form (intVar, msetVar)
-    val fSum = createFormulafromCardinalityList(il)
-    // fSum <- atom about all cardinalities that were pulled out of the original formula
-    val (f4, fAll1) = topLevelForAll(f3, fAll)
-    // all top level forall are united in formula fAll1 and f4 does not contain top-level forall e...
-    val f5 = notTopLevelForAll(f4)
-    // f5 does not contain any forall e. f(e) expression - they are converted using sums
-    val (f6, fSum1) = topLevelSums(f5, fSum)
-    // all top level sums are united in formula fSum1 and f6 does not contain top-level sum
-    val sumCounter = 0
-    val (f7, fSum2, _) = notTopLevelSums(f6, fSum1, sumCounter)
-    (f7, fAll1, fSum2)
-  } 
-
-
-}
diff --git a/src/multisets/RemoveDisjunctions.scala b/src/multisets/RemoveDisjunctions.scala
deleted file mode 100644
index ab33790314a4f6062733c0ff9f5bf87aaa697bc8..0000000000000000000000000000000000000000
--- a/src/multisets/RemoveDisjunctions.scala
+++ /dev/null
@@ -1,83 +0,0 @@
-package multisets
-
-
-object RemoveDisjunctions {
-
-//
-
-  def createListofFreshVectors(n:Int, m:Int): List[List[TermQFPA]] = {
-    var i = 0
-    var lOut: List[List[TermQFPA]] = Nil
-    while (i < n) {
-      var j = 0
-      var  lIn: List[TermQFPA] = Nil
-      while (j < m) {
-        var num = i * m + j
-        var newUVar = "FRESHu" + num
-        var tmpTermVar = TVariable(newUVar)
-        lIn = tmpTermVar :: lIn
-        j += 1
-      }
-      var lInN = lIn.reverse
-      lOut = lInN :: lOut
-      i += 1
-    }
-    lOut
-  }
-
-  def createSumOfAllUVecs(i:Int, u:List[List[TermQFPA]]):TermQFPA = {
-   val n = u.length
-   var j = 0
-   var tt = (u(j))(i)
-   j += 1
-   while (j < n) {
-     var tn = (u(j))(i)
-     tt = TPlus(tt, tn) 
-     j += 1
-   }
-   tt
-  }
-
-
-
-  def createFormulaWithFreshUsVariables(u:List[TermQFPA], uVec:List[List[TermQFPA]]):QFPAFormula = {
-    val m = u.length
-    var j = 0
-    var tR = createSumOfAllUVecs(j, uVec)
-    var tL = u(j)
-    var eq = AEq(tL, tR)
-    var f:QFPAFormula = QFPAAtom(eq)
-    j += 1
-    while (j < m) {
-      tR = createSumOfAllUVecs(j, uVec)
-      tL = u(j)
-      eq = AEq(tL, tR)
-      f = QFPAAnd(f, QFPAAtom(eq))
-      j += 1
-    }
-    f
-  }
-
-
-//-------------------------------------
-// main creates List of LIAStar Formulas 
-// input f0 AND u IN { v | lDNF} ^*
-// output $1 AND List($2, $3, $4) where $2 IN { $3 | $4 } ^*
-
-
-  def main (f0:QFPAFormula, u:List[TermQFPA], v:List[TermQFPA], lDNF:List[List[QFPAFormula]]):
-   (QFPAFormula, List[(List[TermQFPA], List[TermQFPA], List[QFPAFormula])]) = {
-    val n = lDNF.length
-    val m = u.length
-    val listofFreshUs = createListofFreshVectors(n, m)
-    var i = 0
-    var listLIAS: List[(List[TermQFPA], List[TermQFPA], List[QFPAFormula])] = Nil
-    lDNF.foreach(c => {
-      listLIAS = (listofFreshUs(i), v, c) :: listLIAS
-      i += 1
-    })
-    val fPA = createFormulaWithFreshUsVariables(u, listofFreshUs)
-    (QFPAAnd(f0, fPA), listLIAS)
-  }
-}
-
diff --git a/src/multisets/RemoveStars.scala b/src/multisets/RemoveStars.scala
deleted file mode 100644
index 0a9753032c815e5caa264f224e03be29b8948747..0000000000000000000000000000000000000000
--- a/src/multisets/RemoveStars.scala
+++ /dev/null
@@ -1,422 +0,0 @@
-package multisets
-
-import scala.collection.mutable.Set
-
-
-object RemoveStars {
-
-// start: will be needed later
-
-  def createFormulafromConjunctions(l:List[QFPAFormula]):QFPAFormula = {
-    if (l.isEmpty) QFPATrue else {
-      var ff = l.head
-      val fr = l.tail
-      fr.foreach (f => ff = QFPAAnd(ff, f))
-      ff
-     }
-  }
-
-
-  def getAllVariablesFromTerm(t:TermQFPA): Set[String] = {
-    val p = multisets.CheckingConsistency.getAllVariablesAndConstsFromTerm(t)
-    p._1
-  }
-// end
-
-
-  def updateWithNewEqualityTerm(v:String, t:TermQFPA, tt:TermQFPA):TermQFPA  = tt match {
-    case TVariable(v1) => if (v == v1) t else tt
-    case TConstant(c) => tt
-    case TPlus(t1, t2) => {
-      val t1N = updateWithNewEqualityTerm(v, t, t1)
-      val t2N = updateWithNewEqualityTerm(v, t, t2)
-      TPlus(t1N, t2N) 
-    }
-    case TTimes(c, t1) => {
-      val t1N = updateWithNewEqualityTerm(v, t, t1)
-      TTimes(c, t1N)
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def updateWithNewEqualityOneEquality(v:String, t:TermQFPA, e:QFPAFormula):QFPAFormula = e match {
-    case QFPAAtom(AEq(t1, t2)) => {
-      val t1N = updateWithNewEqualityTerm(v, t, t1)
-      val t2N = updateWithNewEqualityTerm(v, t, t2)
-      QFPAAtom(AEq(t1N, t2N)) 
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-  def updateWithNewEqualityVector(va:String, t:TermQFPA, v:List[TermQFPA]):List[TermQFPA] = 
-    v.map(tt => updateWithNewEqualityTerm(va, t, tt))
-
-  def updateWithNewEqualityEqualities(va:String, t:TermQFPA, c:List[QFPAFormula]):List[QFPAFormula] = 
-    c.map(f => updateWithNewEqualityOneEquality(va, t, f))
-
-
-  def isGroundTerm(t:TermQFPA):Boolean = t match {
-    case TVariable(v) => false
-    case TConstant(c) => true
-    case TPlus(t1, t2) => {
-      val b1 = isGroundTerm(t1)
-      val b2 = isGroundTerm(t2)
-      b1 && b2
-    }
-    case TTimes(c, t1) => isGroundTerm(t1)
-    case TIte(f, t1, t2) => {
-      val b0 = isGroundFormula(f)
-      val b1 = isGroundTerm(t1)
-      val b2 = isGroundTerm(t2)
-      b0 && b1 && b2
-    }
-  }
-
-  def isGroundAtom(a:AtomQFPA):Boolean = a match {
-    case ALeq(t1, t2) => {
-      val b1 = isGroundTerm(t1)
-      val b2 = isGroundTerm(t2)
-      b1 && b2
-    }
-    case AEq(t1, t2) => {
-      val b1 = isGroundTerm(t1)
-      val b2 = isGroundTerm(t2)
-      b1 && b2
-    }
-  }
-
-  def isGroundFormula(f:QFPAFormula):Boolean = f match {
-    case QFPAAnd(f1, f2) => {
-      val b1 = isGroundFormula(f1)
-      val b2 = isGroundFormula(f2)
-      b1 && b2
-    }
-    case QFPAOr(f1, f2) => {
-      val b1 = isGroundFormula(f1)
-      val b2 = isGroundFormula(f2)
-      b1 && b2
-    }
-    case QFPANot(f1) => isGroundFormula(f1)
-    case QFPAAtom(a) => isGroundAtom(a)
-    case QFPAFalse => true
-    case QFPATrue => true
-  }
-
-
-  def createTermThatIsSumOfAllTermsInList(l:List[TermQFPA]):TermQFPA = {
-    val t = if (l.isEmpty) TConstant(0) else {
-      var t1 = l.head
-      val r = l.tail
-      r.foreach(tt => t1 = TPlus(tt, t1))
-      t1
-    }
-    t
-  }
-
-
-  def createTermBasedonListofValues(n:Int, l:List[(String,Int)]):TermQFPA = {
-   var lt: List[TermQFPA] = Nil
-   l.foreach(p => if (p._2 != 0) {
-     if (p._1 == "const") {
-       val m = -1 * n * p._2
-       val t = TConstant(m)
-       lt = t :: lt
-     } else {
-       val m = -1 * n * p._2
-       val t = if (m == 1) TVariable(p._1) else TTimes(m, TVariable(p._1))
-       lt = t :: lt
-     }
-   })
-   val tN = createTermThatIsSumOfAllTermsInList(lt)
-   tN
-  }
-
-  def createNewEqualityBasedOnListofValues(l:List[(String,Int)]):(String, TermQFPA) = {
-   var notFound = true
-   var lt: List[(String,Int)] = Nil
-   var n = 0
-   var v = ""
-   l.foreach(p => if (notFound && p._1 != "const" && (p._2 == 1 || p._2 == -1)) {
-     notFound = false
-     v = p._1
-     n = p._2
-   } else lt = p :: lt)
-   if (notFound) error("I am incomplete and dunno how to solve :" + lt)
-   val t = createTermBasedonListofValues(n, lt)
-   (v, t)
-  }
-
-  def reExpressEqualityandFindNewEquality(f:QFPAFormula):(String, TermQFPA) = f match {
-    case QFPAAtom(AEq(t1, t2)) => {
-      val s1 = getAllVariablesFromTerm(t1)
-      val s2 = getAllVariablesFromTerm(t2)
-      val s = s1 ++ s2
-      val vars = s.toList
-      var lt = createInitialZeroValuesList(vars)
-      val l1 = addValuesofTermToList(t1, lt)
-      val l2 = addValuesofTermToList(t2, lt)
-      val l2N = multiplyListWithConstant(-1, l2)
-      val l = sumTwoLists(l1, l2N)
-      val (v, t) = createNewEqualityBasedOnListofValues(l)
-      (v, t)
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-
-  def updateVectorVwithFormulas(v:List[TermQFPA], c:List[QFPAFormula]):List[TermQFPA] = {
-   var vTemp = v
-   var cTemp = c
-   while (! cTemp.isEmpty) {
-     val f = cTemp.head
-     val cRest = cTemp.tail
-     f match {
-       case QFPAAtom(AEq(TVariable(va), t)) => {
-         vTemp = updateWithNewEqualityVector(va, t, vTemp)
-         cTemp = updateWithNewEqualityEqualities(va, t, cRest)
-       }
-       case QFPAAtom(AEq(t, TVariable(va))) => {
-         vTemp = updateWithNewEqualityVector(va, t, vTemp)
-         cTemp = updateWithNewEqualityEqualities(va, t, cRest)
-       }
-       case _ => {
-         if (! isGroundFormula(f)) {
-           val (va, t) = reExpressEqualityandFindNewEquality(f)
-           vTemp = updateWithNewEqualityVector(va, t, vTemp)
-           cTemp = updateWithNewEqualityEqualities(va, t, cRest)
-         }
-       }
-     }
-   }
-   vTemp
-  }
-
-
-  def getAllVariablesFromVector(v:List[TermQFPA]):List[String] = {
-    var s = Set[String]()
-    v.foreach(t => {
-      val s1 = getAllVariablesFromTerm(t)
-      s = s ++ s1
-    })
-    s.toList
-  }
-
-  def createInitialZeroValuesList(v:List[String]):List[(String,Int)] = {
-    var l = List(("const", 0))
-    v.foreach(s => l = (s, 0) :: l)
-    l.reverse
-  }
-
-  def increaseConstantCount(c:Int, l:List[(String,Int)]):List[(String,Int)] = {
-    var lt: List[(String,Int)] = Nil
-    l.foreach(p => if (p._1 == "const") {
-      val k = p._2 + c
-      lt = ("const", k) :: lt
-    } else lt = p :: lt
-    )
-    lt.reverse
-  }
-
-  def increaseVariableCount(v:String, l:List[(String,Int)]):List[(String,Int)] = {
-    var lt: List[(String,Int)] = Nil
-    l.foreach(p => if (p._1 == v) {
-      val c = p._2 + 1
-      lt = (v, c) :: lt
-    } else lt = p :: lt
-    )
-    lt.reverse
-  }
-
-  def sumTwoLists(l1:List[(String,Int)], l2:List[(String,Int)]):List[(String,Int)] = {
-    var l: List[(String,Int)] = Nil
-    val n = l1.length
-    var i = 0
-    while (i < n) {
-      val p = l1(i)
-      val n = l2(i)._2
-      val s = p._2 + n
-      l = (p._1, s) :: l
-      i = i + 1
-    }
-    l.reverse
-  }
-
-  def multiplyListWithConstant(c:Int, l:List[(String,Int)]):List[(String,Int)] = {
-    var lt: List[(String,Int)] = Nil
-    val n = l.length
-    var i = 0
-    while (i < n) {
-      val p = l(i)
-      val s = c * p._2
-      lt = (p._1, s) :: lt
-      i = i + 1
-    }
-    lt.reverse
-  }
-
-  def addValuesofTermToList(t:TermQFPA, l:List[(String,Int)]):List[(String,Int)] = t match {
-    case TVariable(v) => increaseVariableCount(v, l)
-    case TConstant(c) => increaseConstantCount(c, l)
-    case TPlus(t1, t2) => {
-      val l1 = addValuesofTermToList(t1, l)
-      val l2 = addValuesofTermToList(t2, l)
-      val l3 = sumTwoLists(l1, l2)
-      l3
-    }
-    case TTimes(c, t1) => {
-      val l1 = addValuesofTermToList(t1, l)
-      val l2 = multiplyListWithConstant(c, l1)
-      l2
-    }
-    case x@_ => error("Impossible case :" + x)
-  }
-
-
-  def listContainingOccurancesOfVariables(t:TermQFPA, v:List[String]):List[(String,Int)] = {
-    var l = createInitialZeroValuesList(v)
-    val l1 = addValuesofTermToList(t, l)
-    l1
-  }
-
-  def isZeroVector(v:List[Int]):Boolean = v.forall(n => (n == 0))
-
-  def getValueinOneList(v:String, l:List[(String,Int)]):Int = {
-    var n = 0
-    l.foreach(p => if (p._1 == v) n = p._2)
-    n
-  }
-
-  def constructIntVectorforSLS(v:String, l:List[List[(String,Int)]]):List[Int] = {
-    var lt: List[Int] = Nil
-    l.foreach(s => {
-      val n = getValueinOneList(v, s)
-      lt = n :: lt
-    })
-    lt
-  }
-
-  def constructLinearSetFromList(l:List[List[(String,Int)]], v:List[String]):(List[Int], List[List[Int]]) = {
-    val baseVector = constructIntVectorforSLS("const", l)
-    var stepVectors: List[List[Int]] = Nil
-    v.foreach(s => {
-      val sV = constructIntVectorforSLS(s, l)
-      if (! isZeroVector(sV)) stepVectors = sV :: stepVectors
-    })
-    (baseVector, stepVectors)
-  }
-
-
-  def constructLinearSetFromThisNewVector(v:List[TermQFPA]):(List[Int], List[List[Int]]) = {
-   val a1 = getAllVariablesFromVector(v)
-   val n = v.length
-   var i = 0
-   var lB: List[List[(String,Int)]] = Nil
-   while (i < n) {
-     val ls = listContainingOccurancesOfVariables(v(i), a1)
-     lB = ls :: lB
-     i = i + 1 
-   }
-   val sls = constructLinearSetFromList(lB, a1)
-   sls 
-  }
-
-
-
-  def createSemilinearSet(v:List[TermQFPA], c:List[QFPAFormula]):(List[Int], List[List[Int]]) = {
-    val v1 = updateVectorVwithFormulas(v, c)
-    val sls = constructLinearSetFromThisNewVector(v1)
-    sls
-  }
-
-///////////////////
-
-  def createTermSumFromTermList(l:List[TermQFPA]):TermQFPA = {
-    val t1 = if (l.isEmpty) TConstant(0) else {
-      var th = l.head
-      val tt = l.tail
-      tt.foreach (t => th = TPlus(th, t))
-      th
-    }
-    t1
-  }
-
-  def createFormulaThatAllNusAreZero(s: Int, e:Int):QFPAFormula = {
-    var i = s
-    var lTemp: List[QFPAFormula] = Nil
-    while (i < e) {
-      val newNu = "FRESHnu" + i
-      val eq = QFPAAtom(AEq(TVariable(newNu), TConstant(0)))
-      lTemp = eq :: lTemp
-      i = i + 1 
-    }
-    val f = createFormulafromConjunctions(lTemp)
-    f
-  }
-
-  def createFormulaFromSemilinearSet(u:List[TermQFPA], slset:(List[Int], List[List[Int]]), mc:Int, nc:Int):
-   (QFPAFormula, Int, Int) = {
-    val n = (slset._1).length
-    var i = 0
-    var lTemp: List[QFPAFormula] = Nil
-    val m = (slset._2).length
-    val newMu = "FRESHmu" + mc
-    while (i < n) {
-      val t1 = if ((slset._1)(i) == 0) TConstant(0) else
-        TTimes((slset._1)(i), TVariable(newMu))
-      var j = 0
-      var l2Temp: List[TermQFPA] = Nil 
-      while (j < m) {
-        val nuN = nc + j
-        val newNu = "FRESHnu" + nuN
-        val termTemp = if (((slset._2)(j))(i) == 0) TConstant(0) else
-        TTimes(((slset._2)(j))(i), TVariable(newNu))
-        l2Temp = termTemp :: l2Temp
-        j = j + 1
-      }
-      val t2 = createTermSumFromTermList(l2Temp)
-      val eq = QFPAAtom(AEq(u(i), TPlus(t1, t2)))
-      lTemp = eq :: lTemp
-      i = i + 1
-    }
-    val fNew = createFormulafromConjunctions(lTemp)
-    val fMu = QFPANot(QFPAAtom(AEq(TVariable(newMu), TConstant(0))))
-    val fNu = createFormulaThatAllNusAreZero(nc, nc + m)
-    val constraints = QFPAOr(fMu, fNu)
-    val ff = if (slset._2 == Nil) fNew else QFPAAnd(fNew, constraints)
-    val mcN = mc + 1
-    val ncN = nc + m
-    (ff, mcN, ncN)
-  }
-
-
-  def createQFPAFormulaFromLIAStarFormula(u:List[TermQFPA], v:List[TermQFPA], c:List[QFPAFormula], mc: Int, nc: Int):
-   (QFPAFormula, Int, Int) = {
-    val slset = createSemilinearSet(v, c)
-    multisets.StarFormulaPrinter.print_PAVector(v)
-    print(" | ")
-    c.foreach(f => {
-      multisets.StarFormulaPrinter.print_QFPAFormula(f)
-      print(", ")})
-    println(" ")
-    println("semilinear set describing it is: " + slset)
-    val (fNew, m, n) = createFormulaFromSemilinearSet(u, slset, mc, nc)
-    (fNew, m, n)
-  }
-
-  def removeStarsMain(f:QFPAFormula, l:List[(List[TermQFPA], List[TermQFPA], List[QFPAFormula])]):QFPAFormula = {
-    var lTemp: List[QFPAFormula] = Nil
-    var mc = 0
-    var nc = 0
-    l.foreach(t => {
-      val (f1, m, n) = createQFPAFormulaFromLIAStarFormula(t._1, t._2, t._3, mc, nc)
-      lTemp = f1 :: lTemp
-      mc = m
-      nc = n
-    })
-    val fTemp = createFormulafromConjunctions(lTemp)
-    val g = multisets.Multiset2StarsTranslator.removeTrueAndFalse(QFPAAnd(f, fTemp))
-    g
-  }
-
-}
-
diff --git a/src/multisets/StarFormulaPrinter.scala b/src/multisets/StarFormulaPrinter.scala
deleted file mode 100644
index 57a0304b28c6d15ebd75b5a60a8dc6c289a6c374..0000000000000000000000000000000000000000
--- a/src/multisets/StarFormulaPrinter.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-package multisets
-
-object StarFormulaPrinter {
-
-  def print_QFPAterm(t:TermQFPA):Unit = t match {
-    case TConstant(c) => Console.print(c)
-    case TVariable(v) => Console.print(v)
-    case TPlus(t1, t2) => {
-      print_QFPAterm(t1)
-      Console.print(" + ")
-      print_QFPAterm(t2)
-    }
-    case TTimes(c, t1)=> {
-      Console.print(c + "*")
-      print_QFPAterm(t1)
-    }
-    case TIte(f, t1, t2)=> {
-      Console.print("ITE(")
-      print_QFPAFormula(f)
-      print("; ")
-      print_QFPAterm(t1)
-      print(", ")
-      print_QFPAterm(t2)
-      print(")")
-    }
-  }
-
-  def print_QFPAatom(a:AtomQFPA):Unit = a match {
-    case ALeq(t1,t2) => {
-      print_QFPAterm(t1)
-      Console.print(" =< ")
-      print_QFPAterm(t2)
-    }
-    case AEq(t1,t2) => {
-      print_QFPAterm(t1)
-      Console.print(" = ")
-      print_QFPAterm(t2)
-    }
-  }
-
-  def print_QFPAFormula(f:QFPAFormula):Unit = f match {
-    case QFPAAnd(f1,f2) => {
-      Console.print(" ( ")
-      print_QFPAFormula(f1)
-      print(" ) AND ( ")
-      print_QFPAFormula(f2)
-      print(" ) ")
-    }
-    case QFPAOr(f1,f2) => {
-      Console.print(" ( ")
-      print_QFPAFormula(f1)
-      print(" ) OR ( ")
-      print_QFPAFormula(f2)
-      print(" ) ")
-    }
-    case QFPANot(f1)  => {
-      Console.print(" NOT ( ")
-      print_QFPAFormula(f1)
-      print(" ) ")
-    }
-    case QFPAAtom(a)  => print_QFPAatom(a)
-    case QFPAFalse => Console.print(" FALSE ")
-    case QFPATrue  => Console.print(" TRUE ")
-  }
-
-
-  def print_PAVector(l:List[TermQFPA]):Unit = {
-    Console.print(" ( ")
-    l.foreach(t => {
-      print_QFPAterm(t)
-      print(", ")
-    })
-    print(") ")
-  }
-
-  def print_starFormula(f:StarFormula):Unit = f match {
-    case StarFormula(f1, l1, l2, f2) => {
-      print_QFPAFormula(f1)
-      Console.print(" AND ")
-      print_PAVector(l1)
-      print(" IN { ")
-      print_PAVector(l2)
-      print(" |  ")
-      print_QFPAFormula(f2)
-      print(" }*")
-    }
-  }
-
-}
-
diff --git a/src/orderedsets/AST.scala b/src/orderedsets/AST.scala
deleted file mode 100644
index 2e4ecc09ba1a042863c86bbda2d0e3290b77b61e..0000000000000000000000000000000000000000
--- a/src/orderedsets/AST.scala
+++ /dev/null
@@ -1,175 +0,0 @@
-package orderedsets
-
-import scala.text.Document
-import Document._
-import Primitives._
-import scala.util.parsing.input.Positional
-
-object AST {
-  implicit def sym2prop(s: Symbol): PropVar =
-    if (s.isBool) PropVar(s)
-    else error("Bad type for PropVar : " + s.tpe)
-
-  implicit def sym2term(s: Symbol): TermVar =
-    if (s.isInt || s.isSet) TermVar(s)
-    else error("Bad type for TermVar : " + s.tpe)
-
-  implicit def int2term(i: Int): Term = Lit(IntLit(i))
-
-  val emptyset = Lit(EmptySetLit)
-  val fullset = Lit(FullSetLit)
-  val zero = Lit(IntLit(0))
-  val one = Lit(IntLit(1))
-
-
-  sealed abstract class Formula extends Positional {
-    def print {Printer print (Printer toDocument this)}
-    
-    override def toString = {Printer printStr (Printer toDocument this)}
-    
-    def size = ASTUtil sizeOf this
-    
-    def &&(form: Formula) = And(List(this, form))
-    
-    def &&(forms: Seq[Formula]) = And(this :: forms.toList)
-    
-    def ||(form: Formula, forms: Formula*) = Or(this :: form :: forms.toList)
-    
-    def implies(form: Formula) = !this || form
-    
-    def unary_! = Not(this)
-  }
-  case object True extends Formula
-  case object False extends Formula
-  case class PropVar(sym: Symbol) extends Formula
-  case class Not(formula: Formula) extends Formula
-  case class And(formulas: List[Formula]) extends Formula
-  case class Or(formulas: List[Formula]) extends Formula
-  case class Predicate(comp: Logical, terms: List[Term]) extends Formula
-
-  sealed abstract class Term extends Positional {
-    def print {Printer print (Printer toDocument this)}
-    
-    override def toString = {Printer printStr (Printer toDocument this)}
-    
-    def size = ASTUtil sizeOf this
-    
-    def singleton = Op(SINGLETON, List(this))
-    
-    def <(term: Term) = Predicate(LT, List(this, term))
-    
-    def <=(term: Term) = Predicate(LE, List(this, term))
-    
-    def ===(term: Term) = Predicate(EQ, List(this, term))
-    
-    def =!=(term: Term) = Predicate(NE, List(this, term))
-    
-    def >(term: Term) = Predicate(GT, List(this, term))
-    
-    def >=(term: Term) = Predicate(GE, List(this, term))
-    
-    def seq(term: Term) = Predicate(SEQ, List(this, term))
-    
-    def slt(term: Term) = Predicate(SLT, List(this, term))
-    
-    def selem(term: Term) = Predicate(SELEM, List(this, term))
-    
-    def subseteq(term: Term) = Predicate(SUBSETEQ, List(this, term))
-    
-    def +(term: Term, terms: Term*) = Op(ADD, this :: term :: terms.toList)
-    
-    def -(term: Term) = Op(SUB, List(this, term))
-    
-    def *(term: Term, terms: Term*) = Op(MUL, this :: term :: terms.toList)
-    
-    def ++(term: Term) = Op(UNION, List(this, term))
-    
-    def ++(terms: Seq[Term]) = Op(UNION, this :: terms.toList)
-    
-    def **(term: Term) = Op(INTER, List(this, term))
-    
-    def --(term: Term) = Op(INTER, List(this, ~term))
-    
-    def lrange(from: Term, to: Term) = Op(LRANGE, List(from, to, this))
-    
-    def take(term: Term) = Op(TAKE, List(term, this))
-    
-    def card = Op(CARD, List(this))
-    
-    def sup = Op(SUP, List(this))
-    
-    def inf = Op(INF, List(this))
-    
-    def unary_~ = Op(COMPL, List(this))
-    //    def compl = Op(COMPL, List(this))
-  }
-
-  case class TermVar(sym: Symbol) extends Term
-  case class Lit(value: Literal) extends Term
-  case class Op(op: NonLogical, terms: List[Term]) extends Term
-
-
-  /**Pretty printer **/
-
-  private object Printer {
-    private implicit def stringToDoc(s: String): Document = text(s)
-    
-    private implicit def intToDoc(i: Int): Document = text(i.toString)
-    
-    // Helper methods
-    def paren(d: Document): Document =
-      group("(" :: nest(2, d) :: ")")
-      
-    def toDocument(f: Formula): Document = f match {
-      case True => "true"
-      case False => "false"
-      case PropVar(name) => name toString
-      case Not(f@Predicate(_, _)) => /*"\u00AC"*/ "!" :/: paren(toDocument(f))
-      case Not(f) => /*"\u00AC"*/ "!" :/: toDocument(f)
-      case And(fs) =>
-        //        paren( repsep(fs map toDocument, "\u2227") )
-        paren(repsep(fs map toDocument, "n"))
-      case Or(fs) =>
-        //        paren( repsep(fs map toDocument, "\u2228") )
-        paren(repsep(fs map toDocument, "v"))
-      case Predicate(op, t :: Nil) =>
-        op.toString :/: paren(toDocument(t))
-      case Predicate(op, ts) =>
-        paren(repsep(ts map toDocument, op toString))
-    }
-    
-    def toDocument(f: Term): Document = f match {
-      case TermVar(name) => name toString
-      case Lit(EmptySetLit) => "{}"
-      case Lit(FullSetLit) => "{ALL}"
-      case Lit(IntLit(value)) => value
-      case Op(op, t :: Nil) =>
-        op.toString :/: toDocument(t)
-      case Op(op@(LRANGE | TAKE), ts) =>
-        op.toString :/: paren(repsep(ts map toDocument, ","))
-      case Op(ITE(f), List(t, s)) =>
-        nest(2, group("if" :/: toDocument(f)) :/: group("then" :/: toDocument(t)) :/: group("else" :/: toDocument(s)))
-      case Op(op, ts) =>
-        paren(repsep(ts map toDocument, op toString))
-    }
-    
-    def repsep(doc: List[Document], sep: Document): Document =
-      if (doc isEmpty) empty else
-        doc.reduceLeft {(rest, d) => rest :/: group(sep :/: d)}
-    
-    def print(doc: Document) {
-      val writer = new java.io.PrintWriter(System.out)
-      doc.format(50, writer)
-      writer.println()
-      writer.flush()
-    }
-    
-    def printStr(doc: Document) = {
-      val writer = new java.io.StringWriter()
-      doc.format(50, writer)
-      writer.flush()
-      writer.toString
-    }
-  }
-
-}
diff --git a/src/orderedsets/ASTUtil.scala b/src/orderedsets/ASTUtil.scala
deleted file mode 100644
index 9d7281c86d5c341242013d0693d06dae50d16a16..0000000000000000000000000000000000000000
--- a/src/orderedsets/ASTUtil.scala
+++ /dev/null
@@ -1,171 +0,0 @@
-package orderedsets
-
-import AST._
-import Primitives._
-import Symbol._
-import scala.collection.mutable.ListBuffer
-
-case class IllegalTerm(a: Any) extends Exception(a + " should not be present in the formula to be converted.")
-
-object ASTUtil {
-  def intvars = variablesOf(_ == IntType)
-
-  def setvars = variablesOf(_ == SetType)
-
-  def propvars = variablesOf(_ == BoolType)
-
-  private def variablesOf(pred: Type => Boolean) = {
-    val empty: Set[Symbol] = Set.empty
-    def vars(f: Formula): Set[Symbol] = f match {
-      case PropVar(sym) if pred(sym.tpe) => Set(sym)
-      case True | False => empty
-      case Not(f) => vars(f)
-      case And(fs) => (empty /: fs) {_ ++ vars(_)}
-      case Or(fs) => (empty /: fs) {_ ++ vars(_)}
-      case Predicate(_, ts) => (empty /: ts) {_ ++ tvars(_)}
-      case _ => empty
-    }
-    def tvars(t: Term): Set[Symbol] = t match {
-      case TermVar(sym) if pred(sym.tpe) => Set(sym)
-      case Op(ITE(f), ts) => ((vars(f) /: ts) {_ ++ tvars(_)})
-      case Op(_, ts) => (empty /: ts) {_ ++ tvars(_)}
-      case _ => empty
-    }
-    vars _
-    //    (f: Formula) => vars(f).toList sort (_.name < _.name)
-  }
-
-
-  def getInfSets(syms: List[Symbol]): Set[Symbol] =
-    (Set.empty[Symbol] /: syms) {_ ++ _.infOfList}
-
-  def getSupSets(syms: List[Symbol]): Set[Symbol] =
-    (Set.empty[Symbol] /: syms) {_ ++ _.supOfList}
-
-
-  def filterInfs(syms: List[Symbol]) =
-    syms filter {s => s.infOfList != null && !s.infOfList.isEmpty}
-
-  def filterSups(syms: List[Symbol]) =
-    syms filter {s => s.supOfList != null && !s.supOfList.isEmpty}
-
-
-  /**Formula Splitter **/
-
-  type IntVar = Symbol
-  type SetVar = Symbol
-  type SplitResult = (List[Formula], List[Formula], List[(SetVar, IntVar)], List[(SetVar, IntVar)])
-
-  def split(conj: List[Formula]): SplitResult = {
-    val paforms = new ListBuffer[Formula]
-    val bapaforms = new ListBuffer[Formula]
-    val infs = new ListBuffer[(SetVar, IntVar)]
-    val sups = new ListBuffer[(SetVar, IntVar)]
-
-    for (form <- conj) form match {
-      case Predicate(EQ, List(TermVar(term), Op(INF, List(TermVar(set))))) => infs += ((set, term))
-      case Predicate(EQ, List(TermVar(term), Op(SUP, List(TermVar(set))))) => sups += ((set, term))
-      case f if isPA(f) => paforms += f
-      case f => bapaforms += f
-    }
-    (paforms.toList, bapaforms.toList, infs.toList, sups.toList)
-  }
-
-  def isPA(form: Formula): Boolean = form match {
-    case True | False | PropVar(_) => true
-    case Not(f) => isPA(f)
-    case And(fs) => fs forall isPA
-    case Or(fs) => fs forall isPA
-    case Predicate(_: IntOperand, ts) => ts forall isPA
-    case _ => false
-  }
-
-  def isPA(term: Term): Boolean = term match {
-    case TermVar(sym) => sym.isInt
-    case Lit(IntLit(_)) => true
-    case Op(ITE(f), ts) => isPA(f) && (ts forall isPA)
-    case Op(ADD | SUB | MUL | MIN | MAX, ts) => ts forall isPA
-    case _ => false
-  }
-
-  /* Formula size */
-
-  def sizeOf(form: Formula): Int = form match {
-    case True | False | PropVar(_) => 1
-    case Not(f) => sizeOf(f) + 1
-    case And(fs) => (1 /: (fs map sizeOf))(_ + _)
-    case Or(fs) => (1 /: (fs map sizeOf))(_ + _)
-    case Predicate(_, ts) => (1 /: (ts map sizeOf))(_ + _)
-  }
-
-  def sizeOf(term: Term): Int = term match {
-    case TermVar(_) | Lit(_) => 1
-    case Op(_, ts) => (1 /: (ts map sizeOf))(_ + _)
-  }
-
-  /* Extract formulas from set expressions */
-
-  def analyze(conj: List[Formula], split: SplitResult): List[Formula] = {
-    val orderedSets = Set((split._3 ::: split._4).map {_._1}: _*)
-    val forms = new ListBuffer[Formula]
-
-    for (form <- conj) form match {
-      case Predicate(SEQ, List(s1, s2)) =>
-        add(inf(s1), EQ, inf(s2))
-        add(sup(s1), EQ, sup(s2))
-      case Predicate(SUBSETEQ, List(s1, s2)) =>
-        add(inf(s2), LE, inf(s1))
-        add(sup(s1), LE, sup(s2))
-      case Predicate(EQ, List(Lit(IntLit(0)), Op(CARD, List(s1)))) =>
-        if (!inf(s1).isEmpty || !sup(s1).isEmpty)
-          return List(False)
-      case _ =>
-    }
-
-    def add(o1: Option[Term], comp: Logical, o2: Option[Term]) = (o1, o2) match {
-      case (Some(t1), Some(t2)) => forms += Predicate(comp, List(t1, t2))
-      case _ =>
-    }
-
-    def inf(term: Term): Option[Term] = term match {
-      case TermVar(sym) if orderedSets(sym) => Some(term.inf)
-      case Op(UNION, ts) => ts map inf match {
-        case is if is forall {_ isDefined} => Some(Op(MIN, is flatMap {_ toList}))
-        case _ => None
-      }
-      case Op(INTER, ts) => ts map inf match {
-        case is if is forall {_ isDefined} => Some(Op(MAX, is flatMap {_ toList}))
-        case _ => None
-      }
-      case Lit(_) | TermVar(_) | Op(COMPL, _) => None
-    }
-    def sup(term: Term): Option[Term] = term match {
-      case TermVar(sym) if orderedSets(sym) => Some(term.sup)
-      case Op(UNION, ts) => ts map sup match {
-        case is if is forall {_ isDefined} => Some(Op(MAX, is flatMap {_ toList}))
-        case _ => None
-      }
-      case Op(INTER, ts) => ts map sup match {
-        case is if is forall {_ isDefined} => Some(Op(MIN, is flatMap {_ toList}))
-        case _ => None
-      }
-      case Lit(_) | TermVar(_) | Op(COMPL, _) => None
-    }
-    forms.toList
-  }
-
-}
-
-/*
-object SetsToFormTest extends Application {
-  import AST._
-  val A = Symbol("A")
-  val B = Symbol("B")
-  val C = Symbol("C")
-  val form = (A subseteq (B ++ C))  && ((B ++ C) subseteq A) && (A.inf === 0) && (B.sup < C.inf)
-  
-  for (And(fs) <- NormalForms(form)) {
-    And(ASTUtil.analyze(fs, ASTUtil.split(fs))).print
-  }
-}
-*/
diff --git a/src/orderedsets/Context.scala b/src/orderedsets/Context.scala
deleted file mode 100644
index 078ffe12c02c1f56c33969eeb1809b1ec9973987..0000000000000000000000000000000000000000
--- a/src/orderedsets/Context.scala
+++ /dev/null
@@ -1,172 +0,0 @@
-package orderedsets
-
-import AST._
-import Primitives._
-import z3.scala._
-import scala.collection.mutable.ArrayBuffer
-import Symbol._
-import EquiClassPartition.EquiClass
-import purescala.Reporter
-import purescala.z3plugins.bapa.{BAPATheoryBubbles => BAPATheory}
-
-abstract sealed class Z3Output
-case object Z3Unsat extends Z3Output
-case class Z3Failure(e: Exception) extends Z3Output
-case class Z3Sat(deleteModel: (() => Unit), boolAssignments: (Symbol => Boolean), intAssignments: (Symbol => Int)) extends Z3Output;
-
-class Context(formula: Formula, reporter: Reporter) {
-  private val outIntVars = ASTUtil.intvars(formula).toList
-  private val outSetVars = ASTUtil.setvars(formula).toList
-  private val z3 = new Z3Context((new Z3Config).setParamValue("MODEL", "true"))
-  private lazy val th = new BAPATheory(z3)
-  private val intType = z3.mkIntSort
-  private val boolType = z3.mkBoolSort
-  private val setType = th.mkSetSort
-
-  private var debugStack = List(new ArrayBuffer[Formula])
-
-  private implicit def sym2z3ast(sym: Symbol): Z3AST = sym toZ3sym this
-
-  // TODO 'leaks' a Z3AST object ..
-  def mkSym(sym: Symbol) = sym.tpe match {
-    case IntType => z3.mkConst(z3.mkStringSymbol(sym.name), intType)
-    case BoolType => z3.mkConst(z3.mkStringSymbol(sym.name), boolType)
-    case SetType => z3.mkConst(z3.mkStringSymbol(sym.name), setType)
-//     case _ => error("Set symbol being passed to Z3!")
-  }
-
-  private def mkAST(form: Formula): Z3AST = form match {
-    case True => z3.mkTrue
-    case False => z3.mkFalse
-    case PropVar(sym) => sym
-    case And(fs) => z3.mkAnd((fs map mkAST).toArray: _ *)
-    case Or(fs) => z3.mkOr((fs map mkAST).toArray: _ *)
-    case Not(form) => z3.mkNot(mkAST(form))
-    case Predicate(SEQ, List(t1, t2)) => z3.mkEq(mkAST(t1), mkAST(t2))
-    case Predicate(SUBSETEQ, List(t1, t2)) => th.mkSubsetEq(mkAST(t1), mkAST(t2))
-    case Predicate(SELEM, List(t1, t2)) => th.mkElementOf(mkAST(t1), mkAST(t2))
-    case Predicate(op: IntLogical, List(t1, t2)) => logicalOp(op, mkAST(t1), mkAST(t2))
-    case _ => throw IllegalTerm(form)
-  }
-
-  private def logicalOp(op: IntOperand, t1: Z3AST, t2: Z3AST): Z3AST = op match {
-    case LT => z3.mkLT(t1, t2)
-    case LE => z3.mkLE(t1, t2)
-    case EQ => z3.mkEq(t1, t2)
-    case GT => z3.mkGT(t1, t2)
-    case GE => z3.mkGE(t1, t2)
-    case NE => z3.mkDistinct(t1, t2)
-  }
-
-  private def mkAST(term: Term): Z3AST = term match {
-    case TermVar(sym) => sym
-    case Lit(IntLit(v)) => z3.mkInt(v, intType)
-    case Op(ADD, ts) => z3.mkAdd((ts map mkAST).toArray: _ *)
-    case Op(SUB, List(t1, t2)) => z3.mkSub(mkAST(t1), mkAST(t2))
-    case Op(MUL, ts) => z3.mkMul((ts map mkAST).toArray: _ *)
-    case Op(ITE(f), List(t1, t2)) => z3.mkITE(mkAST(f), mkAST(t1), mkAST(t2))
-    case Op(MIN, List(t1)) => mkAST(t1)
-    case Op(MAX, List(t1)) => mkAST(t1)
-    case Op(MIN, t1 :: ts) => {
-      val subExpr = mkAST(Op(MIN, ts))
-      val thisExpr = mkAST(t1)
-      z3.mkITE(z3.mkLT(thisExpr, subExpr), thisExpr, subExpr)
-    }
-    case Op(MAX, t1 :: ts) => {
-      val subExpr = mkAST(Op(MAX, ts))
-      val thisExpr = mkAST(t1)
-      z3.mkITE(z3.mkGT(thisExpr, subExpr), thisExpr, subExpr)
-    }
-    case Op(UNION, ts) => ts map mkAST reduceLeft ((a,b) => th.mkUnion(a, b))
-    case Op(INTER, ts) => ts map mkAST reduceLeft ((a,b) => th.mkIntersect(a, b))
-    case Op(COMPL, List(t1)) => th.mkComplement(mkAST(t1))
-    case Op(CARD, List(t1)) => th.mkCard(mkAST(t1))
-    case Op(SINGLETON, List(t1)) => th.mkSingleton(mkAST(t1))
-    case Lit(EmptySetLit) => th.mkEmptySet
-    case Lit(FullSetLit) => th.mkComplement(th.mkEmptySet)
-    case _ => throw IllegalTerm(term)
-  }
-
-  /* Interface */
-
-  def impose(form: Formula) {
-    val nnfForm = NormalForms.nnf(form)
-//     println("imposing : " + nnfForm)
-    debugStack.head += nnfForm
-    z3.assertCnstr(mkAST(nnfForm))
-  }
-
-  def push {
-    debugStack ::= new ArrayBuffer[Formula]
-    z3.push
-  }
-
-  def pop {
-    assert(stackSize > 1)
-    z3.pop(1)
-    debugStack = debugStack.tail
-  }
-
-  def delete {
-    z3.delete
-//     z3 = null
-  }
-
-  def stackSize = debugStack.size
-
-  def printStack {
-    val size = stackSize
-    for ((buf, i) <- debugStack.zipWithIndex) {
-      print("[Level " + (size - i) + "] ")
-      NormalForms.nnf(And(buf.toList)).print
-      /*for (form <- buf) {
-        form.print
-      }*/
-    }
-  }
-
-  def isStillSAT: Boolean = z3.check() match {
-    case None =>
-      reporter.fatalError("There was an error with Z3.")
-    case Some(x) => x
-  }
-
-  private def getZ3Model: Z3Output = {
-    z3.checkAndGetModel() match {
-      case (None, _) => Z3Failure(new Exception("There was an error with Z3."))
-      case (Some(true), model) => {
-        def boolAssigns(sym: Symbol) = model.evalAs[Boolean](sym).getOrElse(false)
-        def intAssigns(sym: Symbol) = model.evalAs[Int](sym).getOrElse(0)
-        def delete() {model.delete}
-        Z3Sat(delete, boolAssigns, intAssigns)
-      }
-      case (Some(false), _) => Z3Unsat
-    }
-  }
-/*
-  def getModel(paForm: Formula, eqClasses: List[EquiClass]) {
-    push
-    impose(paForm)
-
-    val result = getZ3Model match {
-      case sat: Z3Sat => {
-        val model = Reconstruction(sat, outSetVars, outIntVars, eqClasses)
-        throw new SatException(model)
-      }
-      case Z3Unsat =>
-      case Z3Failure(e) =>
-        reporter.fatalError("There was an error with Z3 : " + e)
-    }
-    pop
-  }
-  */
-
-  def finalCheck {
-    z3.checkAndGetModel() match {
-      case (None, _) => throw new Exception("There was an error with Z3.")
-      case (Some(true), model) => throw new Z3SatException(model)
-  
-      case (Some(false), _) =>
-    }
-  }
-}
diff --git a/src/orderedsets/EquiClassPartition.scala b/src/orderedsets/EquiClassPartition.scala
deleted file mode 100644
index c295ad25886e369a34c0aced8ca7575b1a161cf1..0000000000000000000000000000000000000000
--- a/src/orderedsets/EquiClassPartition.scala
+++ /dev/null
@@ -1,376 +0,0 @@
-package orderedsets
-
-import scala.collection.mutable.{ArrayBuffer, HashMap => MutableMap, HashSet => MutableSet, ListBuffer}
-import AST._
-import ASTUtil._
-import Primitives._
-import GuessOrdering._
-
-object EquiClassPartition {
-
-  /**Split formula in PA and cardinality parts **/
-
-//   private type CardSplit = (Term, Int => Term)
-//
-//   private def split(formula: Formula, numC: Int): (Formula, List[CardSplit]) = {
-//     val cards = new ListBuffer[CardSplit]
-//
-//     def splitForm(form: Formula): Formula = form match {
-//       case True | False | PropVar(_) => form
-//       case And(fs) => And(fs map splitForm)
-//       case Or(fs) => Or(fs map splitForm)
-//       case Not(f) => Not(splitForm(f))
-//       case Predicate(EQ, List(Op(CARD, List(set)), zero@Lit(IntLit(0)))) =>
-//         cards += ((set, _ => zero))
-//         True
-//       case Predicate(cond, ts) => Predicate(cond, ts map splitTerm)
-//     }
-//     def splitTerm(term: Term): Term = term match {
-//       case Lit(_) | TermVar(_) => term
-//       case Op(CARD, List(set)) =>
-//         val auxVars = List.tabulate(numC)((_: Int) => TermVar(Symbol.freshInt))
-//         val auxFun = auxVars.toArray
-//         cards += ((set, auxFun.apply))
-//         Op(ADD, auxVars)
-//       case Op(op, ts) => Op(op, ts map splitTerm)
-//     }
-//     val form = splitForm(formula)
-//     (form, cards.toList)
-//   }
-
-
-  sealed trait Bound
-  case class Incl(bvars: List[Symbol]) extends Bound
-  case class Excl(bvars: List[Symbol]) extends Bound
-
-  sealed trait ClassType
-  case class Singleton(isLE: Boolean) extends ClassType
-  case object Bounded extends ClassType
-  case object Unbounded extends ClassType
-
-  private var classCount = 0
-  class EquiClass(val lower: Bound, val upper: Bound, val sets: List[Symbol], val classType: ClassType) {
-    val num = {classCount += 1; classCount}
-
-    var sparsenessBound: Option[Int] = None
-
-    def getNBound = sparsenessBound
-
-    var allSets: Option[List[Symbol]] = None
-
-    val infSets = lower match {
-      case Incl(infs) => getInfSets(infs)
-      case Excl(_) => Set.empty[Symbol]
-    }
-    val supSets = upper match {
-      case Incl(sups) => getSupSets(sups)
-      case Excl(_) => Set.empty[Symbol]
-    }
-    val sizeTerm = ((lower, upper): @unchecked) match {
-      case (Incl(low :: _), Incl(high :: _)) => high + 1 - low
-      case (Incl(low :: _), Excl(high :: _)) => high - low
-      case (Excl(low :: _), Incl(high :: _)) => high - low
-      case (Excl(low :: _), Excl(high :: _)) => high - (low + 1)
-    }
-  }
-
-  object EquiClass {
-    def unapply(obj: EquiClass): Option[(Int, Set[Symbol], List[Symbol], Set[Symbol], ClassType, Term)] = {
-      Some((obj.num, obj.infSets, obj.sets, obj.supSets, obj.classType, obj.sizeTerm))
-    }
-  }
-
-  var orderCount = 0;
-  // (continuationZ3call: (Context, Formula, List[EquiClass]) => Unit)
-  def apply(z3: Context, formula: Formula, order: Order) {
-    orderCount += 1
-    if (order.isEmpty) {
-      val zero = Symbol.freshInt
-      val nnfForm = NormalForms.nnf(formula && (zero === 0))
-
-      val allSets = setvars(nnfForm)
-      val eqClass = new EquiClass(Excl(List(zero)), Excl(List(zero)), allSets.toList, Unbounded)
-      eqClass.allSets = Some(allSets.toList)
-        
-      val classFormula = NormalForms.nnf(renameSets(eqClass.num, allSets)(nnfForm))
-      z3.impose(classFormula)
-      z3.impose(classSizeConstraints(eqClass, allSets))
-
-//       val formula0 = QFBAPAtoPATranslator.rewriteSetRel(nnfForm)
-//       val (paFormula, cardSplits) = split(formula0, 1)
-//       def transformTerm(term: Term): Term = term match {
-//         case Op(op, terms) =>
-//           Op(op, terms map transformTerm)
-//         case TermVar(sym) if sym.isSet =>
-//           TermVar(Symbol.partOf(sym, equiCls.num))
-//         case _ => term
-//       }
-//       val bapaBuffer = new ListBuffer[Formula]
-//       for ((setExpr, nameGen) <- cardSplits)
-//         bapaBuffer += transformTerm(setExpr).card === nameGen(0)
-//       
-//       val bapaForm = NormalForms.nnf(And(bapaBuffer.toList))
-//       val (paForm, n) = QFBAPAtoPATranslator(bapaForm, equiCls.num)
-//       
-//       equiCls.sparsenessBound = Some(n)
-//       equiCls.allSets = Some(setvars(nnfForm).toList)
-//       z3.getModel(paFormula && paForm, List(equiCls))
-      
-    } else {
-//       println
-//       println("Order " + orderCount + "      " + GuessOrdering.order2string(order))
-      
-      // Prepare formula
-      val (eqClasses, bapaSets) = createEqclasses(formula, order)
-//       val numC = eqclasses.size
-      
-      for (eqClass <- eqClasses) {
-        val allSets = bapaSets ++ eqClass.sets
-        eqClass.allSets = Some(allSets.toList)
-        
-        val classFormula = NormalForms.nnf(renameSets(eqClass.num, allSets)(formula))
-        z3.impose(classFormula)
-        z3.impose(classSizeConstraints(eqClass, allSets))
-      }
-    }
-    z3.finalCheck
-
-      
-//       val formula0 = QFBAPAtoPATranslator.rewriteSetRel(formula)
-//       val (paFormula, cardSplits) = split(formula0, numC)
-//
-//       // Translate each class to BAPA
-//       val paformBuffer = new ListBuffer[Formula]
-//       paformBuffer += paFormula
-//       val immutBapaSets = Set.empty ++ bapaSets
-//       for ((ec@EquiClass(num, infs, sets, sups, classType, classSize), index) <- eqclasses.zipWithIndex) {
-//         val allSets = immutBapaSets ++ sets
-//         ec.allSets = Some(allSets.toList)
-//
-//         def transformTerm(term: Term): Term = term match {
-//           case Op(op, terms) =>
-//             Op(op, terms map transformTerm)
-//           case TermVar(sym) if sym.isSet =>
-//             if (allSets(sym)) TermVar(Symbol.partOf(sym, num)) else emptyset
-//           case _ => term
-//         }
-//         val bapaBuffer = new ListBuffer[Formula]
-//         for ((setExpr, nameGen) <- cardSplits)
-//           bapaBuffer += transformTerm(setExpr).card === nameGen(index)
-//
-//         def intersection(sets: Set[Symbol]): Term = sets.toList match {
-//           case Nil => fullset
-//           case List(set) => Symbol.partOf(set, num)
-//           case ss => Op(INTER, ss map {set => TermVar(Symbol.partOf(set, num))})
-//         }
-//         classType match {
-//           case Singleton(false) =>
-//             val infAndSupSet = intersection(infs ++ sups)
-//             bapaBuffer += (fullset.card === 1)
-//             if (infAndSupSet != fullset) bapaBuffer += (infAndSupSet.card === 1)
-//
-//           case Singleton(true) =>
-//             val infSet = intersection(infs)
-//             val supSet = intersection(sups)
-//             bapaBuffer += (fullset.card === classSize)
-//
-//             assert(!infs.isEmpty && !sups.isEmpty)
-//             /*if (infs == sups) {
-//              bapaBuffer += (infSet.card > 0)
-//              bapaBuffer += (classSize > 1) implies ((infSet ++ supSet).card > 1)
-//            } else*/
-//             bapaBuffer += (infSet.card > 0)
-//             bapaBuffer += (supSet.card > 0)
-//             bapaBuffer += (classSize > 1) implies ((infSet ++ supSet).card > 1)
-//
-//
-//           case Bounded =>
-//             val infSet = intersection(infs)
-//             val supSet = intersection(sups)
-//             bapaBuffer += (fullset.card === classSize)
-//
-//             /*if (infs == sups) {
-//               if(!infs.isEmpty) bapaBuffer += ((infSet ++ supSet).card > 1)
-//             } else {*/
-//             if (!infs.isEmpty) bapaBuffer += (infSet.card > 0)
-//             if (!sups.isEmpty) bapaBuffer += (supSet.card > 0)
-//             if (!infs.isEmpty && !sups.isEmpty) bapaBuffer += ((infSet ++ supSet).card > 1)
-//           // }
-//           case Unbounded =>
-//         }
-//
-//         val bapaForm = NormalForms.nnf(And(bapaBuffer.toList))
-//         val (paForm, n) = QFBAPAtoPATranslator(bapaForm, num)
-//         paformBuffer += paForm
-//         ec.sparsenessBound = Some(n)
-//       }
-
-      // Add equality & order constraints
-      /* Already added
-      for (elem <- order) (elem: @unchecked) match {
-        case InfElem(first :: rest) =>
-          for (r <- rest) paformBuffer += (first === r)
-        case SupElem(first :: rest) =>
-          for (r <- rest) paformBuffer += (first === r)
-        case ComboElem(first :: rest1, rest2, false) =>
-          for (r <- rest1 ::: rest2) paformBuffer += (first === r)
-        case ComboElem(first1 :: rest1, first2 :: rest2, true) =>
-          for (r <- rest1) paformBuffer += (first1 === r)
-          for (r <- rest2) paformBuffer += (first2 === r)
-          paformBuffer += (first1 <= first2)
-      }
-      */
-
-      // Add equality & order constraints
-      /*
-      for ((first :: rest) <- order; r <- rest)
-        paformBuffer += (first === r)
-      for (((low :: _), (high :: _)) <- order zip order.tail)
-        paformBuffer += (low < high)
-        */
-
-//       val form = NormalForms.nnf(And(paformBuffer.toList))
-//       z3.getModel(form, classes.toList)
-  }
-
-
-
-  private def createEqclasses(formula: Formula, order: Order) = {
-    val classes = new ArrayBuffer[EquiClass]
-    val sets = new MutableSet[Symbol]
-    val bapaSets = new MutableSet[Symbol] ++ setvars(formula)
-
-    var least: Bound = null
-    var low: Bound = null
-    order.head match {
-      case SupElem(_) =>
-        error("Order cannot start with only upper bounds")
-
-      case InfElem(infs) =>
-        val infSets = getInfSets(infs)
-        sets ++= infSets
-        low = Incl(infs)
-        least = Excl(infs)
-
-      case ComboElem(infs, sups, isLE) =>
-        val infSets = getInfSets(infs)
-        val supSets = getSupSets(sups)
-        classes += new EquiClass(Incl(infs), Incl(sups), infSets.toList, Singleton(isLE))
-        low = Excl(sups)
-        sets ++= infSets
-        sets --= supSets
-        bapaSets --= supSets
-        least = Excl(infs)
-    }
-
-    // Create merged classes
-    for (elem <- order.tail) elem match {
-      case SupElem(sups) =>
-        val supSets = getSupSets(sups)
-        classes += new EquiClass(low, Incl(sups), sets.toList, Bounded)
-        sets --= supSets
-        bapaSets --= supSets
-        low = Excl(sups)
-
-      case InfElem(infs) =>
-        val infSets = getInfSets(infs)
-        classes += new EquiClass(low, Excl(infs), sets.toList, Bounded)
-        sets ++= infSets
-        low = Incl(infs)
-
-      case ComboElem(infs, sups, isLE) =>
-        val infSets = getInfSets(infs)
-        val supSets = getSupSets(sups)
-        classes += new EquiClass(low, Excl(infs), sets.toList, Bounded)
-        sets ++= infSets
-        classes += new EquiClass(Incl(infs), Incl(sups), sets.toList, Singleton(isLE))
-        sets --= supSets
-        low = Excl(sups)
-        bapaSets --= supSets
-    }
-    classes += new EquiClass(low, least, Nil, Unbounded)
-
-    (classes.toSeq, bapaSets.toSet)
-  }
-
-
-  private def intersection(sets: Set[Symbol], classNum: Int): Term = sets.toList match {
-    case Nil => null
-    case List(set) => Symbol.partOf(set, classNum)
-    case ss => Op(INTER, ss map {set => TermVar(Symbol.partOf(set, classNum))})
-  }
-
-  private def union(sets: Set[Symbol], classNum: Int): Term = sets.toList match {
-    case Nil => emptyset
-    case List(set) => Symbol.partOf(set, classNum)
-    case ss => Op(UNION, ss map {set => TermVar(Symbol.partOf(set, classNum))})
-  }
-
-  private def renameSets(classNum: Int, allSets: Set[Symbol]): Formula => Formula = {
-    def renameFormula(formula: Formula): Formula = formula match {
-      case Not(f) => !renameFormula(f)
-      case And(fs) => And(fs map renameFormula)
-      case Or(fs) => Or(fs map renameFormula)
-      case Predicate(cmp, ts) => Predicate(cmp, ts map renameTerm)
-      case _ => formula
-    }
-    def renameTerm(term: Term): Term = term match {
-      case TermVar(sym) if sym.isSet =>
-        if (allSets(sym)) TermVar(Symbol.partOf(sym, classNum))
-        else emptyset
-      case Op(op, ts) => Op(op, ts map renameTerm)
-      case _ => term
-    }
-    renameFormula _
-  }
-
-  private def classSizeConstraints(eqClass: EquiClass, allSets: Set[Symbol]) = {
-    val formBuffer = new ListBuffer[Formula]
-
-    val EquiClass(num, infs, sets, sups, classType, classSize) = eqClass
-
-    // Size constraints
-    classType match {
-      case Singleton(false) =>
-        val infAndSupSet = intersection(infs ++ sups, num)
-        val universe = union(allSets, num)
-        formBuffer += (universe.card <= 1)
-        if (infAndSupSet != null) formBuffer += (infAndSupSet.card === 1)
-
-      case Singleton(true) =>
-        val infSet = intersection(infs, num)
-        val supSet = intersection(sups, num)
-        val universe = union(allSets, num)
-        formBuffer += (universe.card <= classSize)
-
-        assert(!infs.isEmpty && !sups.isEmpty)
-        /*if (infs == sups) {
-        formBuffer += (infSet.card > 0)
-        formBuffer += (classSize > 1) implies ((infSet ++ supSet).card > 1)
-      } else*/
-        formBuffer += (infSet.card > 0)
-        formBuffer += (supSet.card > 0)
-        formBuffer += (classSize > 1) implies ((infSet ++ supSet).card > 1)
-
-
-      case Bounded =>
-        val infSet = intersection(infs, num)
-        val supSet = intersection(sups, num)
-        val universe = union(allSets, num)
-        formBuffer += (universe.card <= classSize)
-
-        /*if (infs == sups) {
-          if(!infs.isEmpty) formBuffer += ((infSet ++ supSet).card > 1)
-        } else {*/
-        if (!infs.isEmpty) formBuffer += (infSet.card > 0)
-        if (!sups.isEmpty) formBuffer += (supSet.card > 0)
-        if (!infs.isEmpty && !sups.isEmpty) formBuffer += ((infSet ++ supSet).card > 1)
-      // }
-      case Unbounded =>
-    }
-    And(formBuffer.toList)
-  }
-
-
-
-}
diff --git a/src/orderedsets/GuessOrdering.scala b/src/orderedsets/GuessOrdering.scala
deleted file mode 100644
index 03462cd9813e6cd3ec3e8a5b8320f0fce8571f5f..0000000000000000000000000000000000000000
--- a/src/orderedsets/GuessOrdering.scala
+++ /dev/null
@@ -1,832 +0,0 @@
-package orderedsets
-
-import scala.collection.mutable.{ArrayBuffer, HashMap => MutableMap, HashSet => MutableSet, ListBuffer}
-import AST._
-import ASTUtil._
-import Primitives._
-
-/*
-object Flags {
-  var useZ3Lib = true
-  var intermediateZ3 = true
-  var withMinMax = true
-  var countOnly = false
-  var countNaive = false
-  var naiveCounts = List[Int]()
-}*/
-
-object GuessOrdering {
-  def apply(callback: (Context, Formula, Order) => Unit)(z3: Context, conj: And) = {
-    val (paforms, bapaforms, infs, sups) = ASTUtil.split(conj.formulas)
-
-    //println("PA part"); And(paforms).print
-    //println("BAPA part"); And(bapaforms).print
-
-    if (infs.isEmpty && sups.isEmpty) {
-      // a non-ordered formula has no orderings
-      callback(z3, And(paforms ::: bapaforms), Nil)
-    } else {
-      val search = new Search(z3, paforms, bapaforms, infs, sups)
-      def _callback(order: Order) = callback(z3, And(bapaforms), order)
-      guessOrder(z3, _callback)(search.initialNodes, Set() ++ search.symbolToNodeMap.values)
-    }
-
-  }
-
-  private var debug: Search = null
-
-  /**Topological graph **/
-
-  class Node(val _vars: List[IntVar]) {
-    var isLEnodes = Set.empty[Node] // Nodes with smaller or equal value
-    var isLTnodes = Set.empty[Node] // Nodes with strictly smaller value
-    var isGEnodes = Set.empty[Node] // Nodes with greater or equal value
-    var isGTnodes = Set.empty[Node] // Nodes with strictly greater value
-    var inDegree: Int = -1
-
-    private var myVars = _vars
-    private var myelem: Elem = null
-
-    def elem = {
-      if (myelem == null) myelem = Elem(this)
-      myelem
-    }
-
-    def getRepr = myVars.head
-
-    def getVars = myVars
-
-    def addVars(vars: List[IntVar]) {
-      myVars :::= vars
-      myelem = null
-    }
-
-    def initInDegree {
-      removeOverlap
-      inDegree = isGEnodes.size + isGTnodes.size
-      assert((isGEnodes & isGTnodes).isEmpty, "Overlap") // TODO remove
-    }
-
-    def varStr = myVars.mkString("{", ",", "}")
-
-    private def addLE(node: Node) {
-      this.isLEnodes += node
-      node.isGEnodes += this
-    }
-
-    private def addGE(node: Node) {
-      this.isGEnodes += node
-      node.isLEnodes += this
-    }
-
-    private def addLT(node: Node) {
-      this.isLTnodes += node
-      node.isGTnodes += this
-    }
-
-    private def addGT(node: Node) {
-      this.isGTnodes += node
-      node.isLTnodes += this
-    }
-
-    private def remLE(node: Node) {
-      this.isLEnodes -= node
-      node.isGEnodes -= this
-    }
-
-    private def remGE(node: Node) {
-      this.isGEnodes -= node
-      node.isLEnodes -= this
-    }
-
-    private def remLT(node: Node) {
-      this.isLTnodes -= node
-      node.isGTnodes -= this
-    }
-
-    private def remGT(node: Node) {
-      this.isGTnodes -= node
-      node.isLTnodes -= this
-    }
-
-    private def addLEs(nodes: Set[Node]) = nodes foreach addLE
-
-    private def addGEs(nodes: Set[Node]) = nodes foreach addGE
-
-    private def addLTs(nodes: Set[Node]) = nodes foreach addLT
-
-    private def addGTs(nodes: Set[Node]) = nodes foreach addGT
-
-    private def remLEs(nodes: Set[Node]) = nodes foreach remLE
-
-    private def remGEs(nodes: Set[Node]) = nodes foreach remGE
-
-    private def remLTs(nodes: Set[Node]) = nodes foreach remLT
-
-    private def remGTs(nodes: Set[Node]) = nodes foreach remGT
-
-
-    def isEQto(node: Node): List[IntVar] = {
-      if (this == node) return Nil
-      if (isLTnodes(node) || isGTnodes(node))
-        throw UnsatException("Cannot be equal: " + varStr + " = " + node.varStr)
-
-      if (isLEnodes(node) || isGEnodes(node)) {
-        var test = false
-        test ||= !(this.isGTnodes & node.isLTnodes).isEmpty
-        test ||= !(this.isLTnodes & node.isGTnodes).isEmpty
-        test ||= !(this.isGTnodes & node.isLEnodes).isEmpty
-        test ||= !(this.isLEnodes & node.isGTnodes).isEmpty
-        test ||= !(this.isGEnodes & node.isLTnodes).isEmpty
-        if (test)
-          throw UnsatException("Cannot be equal (sandwich): " + varStr + " = " + node.varStr)
-
-        val circle1 = this.isLEnodes & node.isGEnodes
-        val circle2 = this.isGEnodes & node.isLEnodes
-        val union = circle1 ++ circle2 + node
-        for (n <- union)
-          this isEQtoNoRec n
-
-        (union.toList flatMap {_.getVars}).distinct
-      } else {
-        this isEQtoNoRec node
-        node.getVars
-      }
-    }
-
-    private def isEQtoNoRec(node: Node) {
-
-      this addLEs (node.isLEnodes - this)
-      this addLTs node.isLTnodes
-      this addGEs (node.isGEnodes - this)
-      this addGTs node.isGTnodes
-
-      addVars(node.getVars)
-
-      this remLE node
-      this remGE node
-      this remLT node
-      this remGT node
-
-      // n >= node == this    then rename   node -> this
-      for (n <- node.isLEnodes; if n != this) {
-        n remGE node
-        n addGE this
-      }
-      // n <= node == this    then rename   node -> this
-      for (n <- node.isGEnodes; if n != this) {
-        n remLE node
-        n addLE this
-      }
-      // n > node == this    then rename   node -> this
-      for (n <- node.isLTnodes) {
-        n remGT node
-        n addGT this
-      }
-      // n < node == this    then rename   node -> this
-      for (n <- node.isGTnodes) {
-        n remLT node
-        n addLT this
-      }
-
-      this.removeOverlap
-      node.removeOverlap
-
-    }
-
-
-    def isGEto(node: Node): List[IntVar] = {
-      if (this == node) return Nil
-
-      if (isLTnodes(node))
-        throw UnsatException("Cannot be greater nor equal: " + varStr + " >= " + node.varStr)
-
-      // this >= node && this <= node    implies    this = node 
-      // detect circle
-
-      if (isLEnodes(node)) {
-        var test = false
-        test ||= !(this.isGTnodes & node.isLTnodes).isEmpty
-        test ||= !(this.isLTnodes & node.isGTnodes).isEmpty
-        test ||= !(this.isGTnodes & node.isLEnodes).isEmpty
-        test ||= !(this.isLEnodes & node.isGTnodes).isEmpty
-        test ||= !(this.isGEnodes & node.isLTnodes).isEmpty
-        if (test)
-          throw UnsatException("Cannot be equal (implied sandwich): " + varStr + " = " + node.varStr)
-
-        val circle1 = this.isLEnodes & node.isGEnodes
-        val circle2 = this.isGEnodes & node.isLEnodes
-        val union = circle1 ++ circle2 + node
-        for (n <- union)
-          this isEQtoNoRec n
-
-        (union.toList flatMap {_.getVars}).distinct
-      } else if (isGTnodes(node) || isGEnodes(node)) {
-        Nil
-      } else {
-        // n > this >= node     implies   n > allStrictSmaller
-        for (n <- this.isLTnodes) {
-          val allStrictSmaller = node.isGTnodes ++ node.isGEnodes + node
-          n addGTs allStrictSmaller
-        }
-        // this >= node > n    implies   allStrictLarger > n
-        for (n <- node.isGTnodes) {
-          val allStrictLarger = this.isLTnodes ++ this.isLEnodes + this
-          n addLTs allStrictLarger
-        }
-        // n >= this >= node    implies   n >= node
-        for (n <- this.isLEnodes) {
-          val allStrictSmaller = node.isGTnodes
-          n addGTs allStrictSmaller
-
-          val allNonStrictSmaller = node.isGEnodes + node
-          n addGEs allNonStrictSmaller
-        }
-        // this >= node >= n    implies   this >= n
-        for (n <- node.isGEnodes) {
-          val allStrictLarger = this.isLTnodes
-          n addLTs allStrictLarger
-
-          val allNonStrictLarger = this.isLEnodes + this
-          n addLEs allNonStrictLarger
-        }
-        this addGE node
-        this.removeOverlap
-        node.removeOverlap
-        Nil
-      }
-    }
-
-    private def removeOverlap {
-      this remGEs (isGEnodes & isGTnodes)
-      this remLEs (isLEnodes & isLTnodes)
-    }
-
-    def isGTto(node: Node) {
-      if (this == node || isLTnodes(node) || isLEnodes(node))
-        throw UnsatException("Cannot be greater: " + varStr + " > " + node.varStr)
-
-      if (isGTnodes(node)) return
-
-      // n >/>= this > node    implies   n > node
-      for (n <- this.isLTnodes ++ this.isLEnodes) {
-        val allStrictSmaller = node.isGTnodes ++ node.isGEnodes + node
-        n addGTs allStrictSmaller
-      }
-      // this > node >/>= n    implies   this > n
-      for (n <- node.isGTnodes ++ node.isGEnodes) {
-        val allStrictLarger = this.isLTnodes ++ this.isLEnodes + this
-        n addLTs allStrictLarger
-      }
-
-      this addGT node
-      this.removeOverlap
-      node.removeOverlap
-    }
-
-    def decr = {
-      inDegree -= 1;
-      if (inDegree < 0) {
-        checkAllUsed
-      }
-      (inDegree == 0)
-    }
-
-    def incr {inDegree += 1}
-
-    def visit: (List[Node], List[Node]) = {
-      val ge = new ListBuffer[Node]
-      val gt = new ListBuffer[Node]
-
-      for (node <- this.isLEnodes; if node.decr) ge += node
-      for (node <- this.isLTnodes; if node.decr) gt += node
-      (ge.toList, gt.toList)
-    }
-
-    def unvisit {
-      for (node <- isLEnodes) node.incr
-      for (node <- isLTnodes) node.incr
-    }
-
-    override def toString =
-      "NODE " + varStr + "  # " + inDegree +
-              isLTnodes.map {_.varStr}.mkString("\n   LT [", ", ", "]") +
-              isGTnodes.map {_.varStr}.mkString("\n   GT [", ", ", "]") +
-              isLEnodes.map {_.varStr}.mkString("\n   LE [", ", ", "]") +
-              isGEnodes.map {_.varStr}.mkString("\n   GE [", ", ", "]")
-  }
-
-  /**Search **/
-
-  private class Search(z3: Context, _paforms: List[Formula], bapaform: List[Formula], infs: List[(SetVar, IntVar)], sups: List[(SetVar, IntVar)]) {
-    val symbolToNodeMap = new MutableMap[IntVar, Node]()
-    val infmap = new MutableMap[SetVar, IntVar]()
-    val supmap = new MutableMap[SetVar, IntVar]()
-
-    val unorderedInfMap = new MutableMap[SetVar, IntVar]()
-    val unorderedSupMap = new MutableMap[SetVar, IntVar]()
-
-    var paforms: List[Formula] = _paforms
-
-    debug = this
-
-    implicit def ivar2node(ivar: IntVar): Node = symbolToNodeMap(ivar)
-
-    def isMapped(ivar1: IntVar, ivar2: IntVar) = (symbolToNodeMap contains ivar1) && (symbolToNodeMap contains ivar2)
-
-    val boundVars = Set.empty ++ infs.map {_._2} ++ sups.map {_._2}
-    for (tvar <- boundVars) {
-      symbolToNodeMap += tvar -> new Node(List(tvar))
-    }
-    for (entry@(svar, tvar1) <- infs) infmap get svar match {
-      case Some(tvar2) =>
-        if (tvar1 != tvar2) {
-          paforms = (tvar1 === tvar2) :: paforms
-        }
-      case None =>
-        infmap += entry
-    }
-    for (entry@(svar, tvar1) <- sups) supmap get svar match {
-      case Some(tvar2) =>
-        if (tvar1 != tvar2) {
-          paforms = (tvar1 === tvar2) :: paforms
-        }
-      case None =>
-        supmap += entry
-    }
-
-    val allSets = (Set.empty ++ infmap.keySet ++ supmap.keySet)
-    for (svar <- allSets -- supmap.keySet) {
-      val sup = Symbol.supOf(svar)
-      supmap += svar -> sup
-      symbolToNodeMap += sup -> new Node(List(sup))
-    }
-    for (svar <- allSets -- infmap.keySet) {
-      val inf = Symbol.infOf(svar)
-      infmap += svar -> inf
-      symbolToNodeMap += inf -> new Node(List(inf))
-    }
-
-    // Add constraints (TODO equality constraints MUST go first)
-    for (f <- paforms) f match {
-      case Predicate(EQ, List(TermVar(t1), TermVar(t2))) if isMapped(t1, t2) =>
-        for (sym <- t1 isEQto t2)
-          symbolToNodeMap(sym) = symbolToNodeMap(t1)
-      case _ =>
-    }
-
-    for (svar <- allSets) {
-      val t1 = infmap(svar)
-      val t2 = supmap(svar)
-      paforms = (t2 >= t1) :: paforms
-    }
-
-    // Exactly as defined in the report
-    def infReduce(setExpr: Term): Term = setExpr match {
-      case Op(COMPL, _) => Symbol.freshInt
-      case Lit(EmptySetLit) => Symbol.freshInt
-      case Lit(FullSetLit) => Symbol.freshInt
-
-      case Op(UNION, trmLst) => Op(MIN, trmLst map infReduce)
-      case Op(INTER, trmLst) => Op(MAX, trmLst map infReduce)
-      case TermVar(v) if infmap.contains(v) => infmap(v)
-      case TermVar(v) if unorderedInfMap.contains(v) => unorderedInfMap(v)
-      case TermVar(v) => {val tf = Symbol.freshInt; unorderedInfMap(v) = tf; tf}
-      case _ => error("infReduce: Got:" + setExpr + "\n Set Expression expected")
-    }
-
-    def supReduce(setExpr: Term): Term = setExpr match {
-      case Op(COMPL, _) => Symbol.freshInt
-      case Lit(EmptySetLit) => Symbol.freshInt
-      case Lit(FullSetLit) => Symbol.freshInt
-
-      case Op(UNION, trmLst) => Op(MAX, trmLst map supReduce)
-      case Op(INTER, trmLst) => Op(MIN, trmLst map supReduce)
-      case TermVar(v) if supmap.contains(v) => supmap(v)
-      case TermVar(v) if unorderedSupMap.contains(v) => unorderedSupMap(v)
-      case TermVar(v) => {val tf = Symbol.freshInt; unorderedSupMap(v) = tf; tf}
-      case _ => error("supReduce: Got:" + setExpr + "\n Set Expression expected")
-    }
-
-    // TODO: Does not handle the card(A) > 0 like constrants
-    // TODO: How to handle seq to {} ?
-    //if (Flags.withMinMax)
-    for (f <- bapaform) f match {
-      case Predicate(SEQ, List(s1, s2)) => {
-        val lhsInf = infReduce(s1)
-        val rhsInf = infReduce(s2)
-        // TODO: Complemented set variables should be handled elegantly
-        val setVars = setvars(f)
-        if (setVars.forall(infmap.contains(_))) z3.impose(lhsInf === rhsInf)
-
-        addConstraint(lhsInf === rhsInf)
-
-        val lhsSup = supReduce(s1)
-        val rhsSup = supReduce(s2)
-        if (setVars.forall(supmap.contains(_))) z3.impose(lhsSup === rhsSup)
-
-        addConstraint(lhsSup === rhsSup)
-      }
-      case Predicate(SUBSETEQ, List(s1, s2)) => {
-        val lhsInf = infReduce(s1)
-        val rhsInf = infReduce(s2)
-        addConstraint(lhsInf >= rhsInf)
-
-        val lhsSup = supReduce(s1)
-        val rhsSup = supReduce(s2)
-        addConstraint(rhsSup >= lhsSup)
-      }
-      case _ =>
-    }
-
-    // TODO: Magic/dirty work
-    // This received formula of the form:
-    // { MIN( .... ) or MAX( ... ) or IntVar } { <= or === } { MIN( .... ) or MAX( ... ) or IntVar }
-    def addConstraint(form: Formula) = {
-
-//       println("Inferred : " + form)
-      z3.impose(form)
-
-      val tempSymbolToNodeMap = new MutableMap[IntVar, Node]()
-      for (v <- intvars(form)) {
-        tempSymbolToNodeMap(v) = new Node(List(v))
-      }
-
-      def makeMinMaxGraph(setExpr: Term): Node = setExpr match {
-        case Op(MIN, trmLst) => {
-          val tf = Symbol.freshInt;
-          tempSymbolToNodeMap(tf) = new Node(List(tf))
-          val nodesGreaterThanThis = trmLst map makeMinMaxGraph
-          for (n <- nodesGreaterThanThis) {
-            for (sym <- n isGEto tempSymbolToNodeMap(tf)) {
-              tempSymbolToNodeMap(sym) = n
-            }
-          }
-          tempSymbolToNodeMap(tf)
-        }
-        case Op(MAX, trmLst) => {
-          val tf = Symbol.freshInt
-          tempSymbolToNodeMap(tf) = new Node(List(tf))
-          val nodesLessThanThis = trmLst map makeMinMaxGraph
-          for (n <- nodesLessThanThis) {
-            for (sym <- tempSymbolToNodeMap(tf) isGEto n) {
-              tempSymbolToNodeMap(sym) = tempSymbolToNodeMap(tf)
-            }
-          }
-          tempSymbolToNodeMap(tf)
-        }
-        case TermVar(v) => tempSymbolToNodeMap(v)
-        case _ => error("makeMinMaxGraph: Got = " + setExpr + "\nExpecting SetExpression.")
-      }
-
-      form match {
-        case Predicate(EQ, t1 :: t2 :: Nil) => {
-          val lhsNode = makeMinMaxGraph(t1)
-          val rhsNode = makeMinMaxGraph(t2)
-          for (sym <- lhsNode isEQto rhsNode) {
-            tempSymbolToNodeMap(sym) = lhsNode
-          }
-        }
-        case Predicate(GE, t1 :: t2 :: Nil) => {
-          val lhsNode = makeMinMaxGraph(t1)
-          val rhsNode = makeMinMaxGraph(t2)
-          for (sym <- lhsNode isGEto rhsNode) {
-            tempSymbolToNodeMap(sym) = lhsNode
-          }
-        }
-        case _ => error("addConstraint: Got = " + form + "\nExpecting EQ or GE.")
-      }
-
-      for ((v, n) <- tempSymbolToNodeMap) {
-        if (symbolToNodeMap.contains(v)) {
-          for (k <- n.getVars; if k != v) {
-            if (symbolToNodeMap.contains(k)) {
-              //println("Adding: " + v + " = " + k)
-              paforms = (v === k) :: paforms
-            }
-          }
-          for (nodeGEtoV <- n.isLEnodes) {
-            for (k <- nodeGEtoV.getVars) {
-              if (symbolToNodeMap.contains(k)) {
-                //println("Adding: " + v + " <= " + k)
-                paforms = (v <= k) :: paforms
-              }
-            }
-          }
-          for (nodeGTtoV <- n.isLTnodes) {
-            for (k <- nodeGTtoV.getVars) {
-              if (symbolToNodeMap.contains(k)) {
-                //println("Adding: " + v + " < " + k)
-                paforms = (v < k) :: paforms
-              }
-            }
-          }
-          // The rest of cases not checked because of Transitive closure
-        }
-      }
-    }
-
-    for (f <- paforms) f match {
-    // TODO remove matched predicates from formula ?
-      case Predicate(LT, List(TermVar(t1), TermVar(t2))) if isMapped(t1, t2) => t2 isGTto t1
-      case Predicate(GT, List(TermVar(t1), TermVar(t2))) if isMapped(t1, t2) => t1 isGTto t2
-      case Predicate(LE, List(TermVar(t1), TermVar(t2))) if isMapped(t1, t2) =>
-        for (sym <- t2 isGEto t1)
-          symbolToNodeMap(sym) = symbolToNodeMap(t2)
-      case Predicate(GE, List(TermVar(t1), TermVar(t2))) if isMapped(t1, t2) =>
-        for (sym <- t1 isGEto t2)
-          symbolToNodeMap(sym) = symbolToNodeMap(t1)
-      case Predicate(EQ, List(TermVar(t1), TermVar(t2))) if isMapped(t1, t2) =>
-        for (sym <- t1 isEQto t2)
-          symbolToNodeMap(sym) = symbolToNodeMap(t1)
-      case _ =>
-    }
-
-    val nodes = symbolToNodeMap.values.toList.distinct
-    for (n <- nodes) n.initInDegree
-    val initialNodes = (for (n <- nodes; if n.inDegree == 0) yield n) sortWith (_.getVars.head.name < _.getVars.head.name)
-
-    // Create inf/sup to set data structure
-    for (termvar <- symbolToNodeMap.keys) {
-      termvar.infOfList = Set.empty[Symbol] ++ (for ((set, x) <- infmap; if termvar == x) yield set)
-      termvar.supOfList = Set.empty[Symbol] ++ (for ((set, x) <- supmap; if termvar == x) yield set)
-    }
-
-    /*
-    if (Flags.countNaive) {
-      Flags.naiveCounts = initialNodes.size :: Flags.naiveCounts
-      throw new UnsatException("(Just counting)")
-    }
-    */
-
-    z3.impose(And(paforms))
-    if (!z3.isStillSAT) {
-      //println("Z3 detected the PA-formula to be UNSAT.")
-      throw (new UnsatException("Z3 found this to be UNSAT."))
-    }
-  }
-
-  /**Guess Ordering */
-
-  private def pickOne[A](list: List[A]): List[(List[A], A, List[A])] = {
-    val front = new ListBuffer[A]
-    var back = list
-    val buffer = new ListBuffer[(List[A], A, List[A])]
-    while (back != Nil) {
-      val elem = back.head
-      back = back.tail
-      buffer += ((front toList, elem, back))
-      front += elem
-    }
-    buffer.toList
-  }
-
-  private def sortWithInfPriority(list: List[Node]) = {
-    val front = new ListBuffer[Node]
-    val back = new ListBuffer[Node]
-    var _list = list
-    while (_list != Nil) {
-      _list.head.elem match {
-        case _: InfElem => front += _list.head
-        case _ => back += _list.head
-      }
-      _list = _list.tail
-    }
-    front ++= back
-    front.toList
-  }
-
-  private def sortWithSupPriority(list: List[Node]) = {
-    val front = new ListBuffer[Node]
-    val back = new ListBuffer[Node]
-    var _list = list
-    while (_list != Nil) {
-      _list.head.elem match {
-        case _: SupElem => front += _list.head
-        case _ => back += _list.head
-      }
-      _list = _list.tail
-    }
-    front ++= back
-    front.toList
-  }
-
-  private def pickOneWithInfPriority(list: List[Node]) = pickOne(sortWithInfPriority(list))
-
-  private def pickOneWithSupPriority(list: List[Node]) = pickOne(sortWithSupPriority(list))
-
-
-
-  object Elem {
-    def apply(node: Node) = (filterInfs(node.getVars), filterSups(node.getVars)) match {
-    // TODO this is a hack
-      case (Nil, Nil) =>
-        println(node)
-        error("fail") // InfElem(node.getVars)
-      case (infs, Nil) => InfElem(infs)
-      case (Nil, sups) => SupElem(sups)
-      case (infs, sups) => ComboElem(infs, sups, false)
-    }
-  }
-  sealed trait Elem {
-    def isSup = false
-
-    def ++(node: Node): Option[Elem] = ++(Elem(node))
-
-    def ++(elem: Elem): Option[Elem] = (this, elem) match {
-      case (InfElem(a), InfElem(b)) => Some(InfElem(a ::: b))
-      case (SupElem(x), SupElem(y)) => Some(SupElem(x ::: y))
-
-      case (InfElem(a), SupElem(y)) => None // Some(ComboElem(a, y, false)) //None // Magic
-
-
-      case (SupElem(x), InfElem(b)) => Some(ComboElem(b, x, false))
-      case (InfElem(a), ComboElem(b, y, _)) => Some(ComboElem(a ::: b, y, false))
-      case (SupElem(x), ComboElem(b, y, _)) => Some(ComboElem(b, x ::: y, false))
-      case (ComboElem(a, x, _), InfElem(b)) => Some(ComboElem(a ::: b, x, false))
-      case (ComboElem(a, x, _), SupElem(y)) => Some(ComboElem(a, x ::: y, false))
-      case (ComboElem(a, x, _), ComboElem(b, y, _)) => Some(ComboElem(a ::: b, x ::: y, false))
-    }
-
-    def vars = this match {
-      case InfElem(infs) => infs
-      case SupElem(sups) => sups
-      case ComboElem(infs, sups, _) => infs ::: sups
-    }
-
-    override def toString = this match {
-      case InfElem(infs) => infs.mkString("I{", ",", "}")
-      case SupElem(sups) => sups.mkString("S{", ",", "}")
-      case ComboElem(infs, sups, true) =>
-        infs.mkString("I{", ",", "}") + " <= " + sups.mkString("S{", ",", "}")
-      case ComboElem(infs, sups, false) =>
-        infs.mkString("I{", ",", "}") + " = " + sups.mkString("S{", ",", "}")
-    }
-
-    def normalize = this match {
-      case ComboElem(infs, Nil, _) => InfElem(infs)
-      case ComboElem(Nil, sups, _) => SupElem(sups)
-      case _ => this
-    }
-
-    def getRepr = vars.head
-  }
-  case class InfElem(infs: List[IntVar]) extends Elem
-  case class SupElem(sups: List[IntVar]) extends Elem {
-    override def isSup = true
-  }
-  case class ComboElem(infs: List[IntVar], sups: List[IntVar], isLe: Boolean) extends Elem
-
-
-  private type Queue = List[Node]
-  private type RecOrder = List[Elem]
-  //type Order = List[List[IntVar]]
-  type Order = List[Elem]
-  //type Hint = Boolean
-
-  def merge(z3: Context, order: Order): Order = order match {
-    case InfElem(a) :: SupElem(x) :: rest =>
-      ComboElem(a, x, true) :: merge(z3, rest)
-    case first :: second :: rest =>
-      z3.impose(first.getRepr < second.getRepr)
-      first :: merge(z3, second :: rest)
-    case List(first) => first :: Nil
-    case Nil => Nil
-  }
-
-  private def guessOrder(z3: Context, callback: Order => Unit): (Queue, Set[Node]) => Unit = {
-
-    def rek(current: Queue, later: Queue, acc: RecOrder, toBeGuessed: Set[Node]) {
-      //if (Flags.intermediateZ3) {
-      if (!z3.isStillSAT) {
-        //println("HURRAY at " + toBeGuessed.size)
-        return
-      }
-      //}
-
-      if (current.isEmpty && later.isEmpty) {
-        //checkAllUsed
-        val order = merge(z3, acc.reverse map {_.normalize})
-
-        //if (Flags.intermediateZ3) {
-        if (!z3.isStillSAT) {
-          //println("HURRAY at " + toBeGuessed.size)
-          return
-        }
-        //}
-
-        callback(order)
-      } else {
-        // guess same equivalence class
-        val pickList = if (acc.head.isSup) pickOneWithSupPriority(current) else pickOneWithInfPriority(current)
-        for ((front, node, back) <- pickList) {
-          acc.head ++ node match {
-            case Some(elem) =>
-              val (ge, gt) = node.visit
-              val restNodes = toBeGuessed - node
-              z3.push
-              z3.impose(acc.head.getRepr === node.getRepr)
-              for (ii <- restNodes)
-                z3.impose(node.getRepr <= ii.getRepr)
-              rek(back ::: ge, front ::: later ::: gt, elem :: acc.tail, restNodes)
-              z3.pop
-              node.unvisit
-            case None =>
-          }
-        }
-        // guess next equivalence class
-        for ((front, node, back) <- pickOneWithInfPriority(current ::: later)) {
-          val (ge, gt) = node.visit
-          val restNodes = toBeGuessed - node
-          z3.push
-          z3.impose(acc.head.getRepr < node.getRepr)
-          for (ii <- restNodes)
-            z3.impose(node.getRepr <= ii.getRepr)
-          rek(back ::: ge, front ::: gt, Elem(node) :: acc, restNodes)
-          z3.pop
-          node.unvisit
-        }
-      }
-    }
-    // guess first equivalence class
-    (list: Queue, toBeGuessed: Set[Node]) => {
-
-      //for (node <- toBeGuessed) println(node)
-
-
-      for ((front, node, back) <- pickOneWithInfPriority(list)) {
-        val (ge, gt) = node.visit
-        val restNodes = toBeGuessed - node
-        z3.push
-        for (ii <- restNodes)
-          z3.impose(node.getRepr <= ii.getRepr)
-
-        rek(back ::: ge, front ::: gt, List(Elem(node)), restNodes)
-
-        z3.pop
-        node.unvisit
-      }
-    }
-  }
-
-
-  def order2string(order: Order) = order mkString "  <  "
-
-  /*
-    object OrderingCounter extends ((Formula, Order, Boolean) => Hint) {
-      def apply(form: Formula, order: Order, x: Boolean): Hint = {
-        Phase3.orderCount += 1
-        println("Order " + Phase3.orderCount + "      " + Phase2.order2string(order))
-        true
-      }
-    }
-  */
-  /*
-  def debugCheckGraph = {
-    val nodes = debug.symbolToNodeMap.values.toList
-    for (node <- nodes) {
-      for (n <- node.isLEnodes; if !(n.isGEnodes contains node)) {
-        println("Found problem:")
-        println("  " + node.varStr + " <= " + n.varStr)
-        println("  but not vice-versa")
-        error("stop")
-      }
-      for (n <- node.isGEnodes; if !(n.isLEnodes contains node)) {
-        println("Found problem:")
-        println("  " + node.varStr + " >= " + n.varStr)
-        println("  but not vice-versa")
-        error("stop")
-      }
-      for (n <- node.isLTnodes; if !(n.isGTnodes contains node)) {
-        println("Found problem:")
-        println("  " + node.varStr + " < " + n.varStr)
-        println("  but not vice-versa")
-        error("stop")
-      }
-      for (n <- node.isGTnodes; if !(n.isLTnodes contains node)) {
-        println("Found problem:")
-        println("  " + node.varStr + " > " + n.varStr)
-        println("  but not vice-versa")
-        error("stop")
-      }
-      
-      
-    }
-  }*/
-
-  def checkAllUsed = {
-    val nodes = debug.symbolToNodeMap.values.toList
-    val bad = for (node <- nodes; if node.inDegree > 0) yield node
-
-    if (!bad.isEmpty) {
-      //debugCheckGraph
-      println
-      println("Alllll: " + nodes.mkString("\n  ", ", \n  ", ""))
-      println
-      println("Baaaad: " + bad.mkString("\n  ", ", \n  ", ""))
-      println
-      System.out.flush
-      error("Some nodes were not added to the ordering !")
-    }
-  }
-}
diff --git a/src/orderedsets/Main.scala b/src/orderedsets/Main.scala
deleted file mode 100644
index e338e059a979ef67fbd7f1ab2a16801cc07c31ab..0000000000000000000000000000000000000000
--- a/src/orderedsets/Main.scala
+++ /dev/null
@@ -1,244 +0,0 @@
-package orderedsets
-
-import purescala.Reporter
-import purescala.Extensions.Solver
-import Reconstruction.Model
-import z3.scala.Z3Model
-
-import RPrettyPrinter.rpp
-
-class Main(reporter: Reporter) extends Solver(reporter) {
-  import purescala.Trees.{Expr,expandLets,negate}
-  import AST.Formula
-  val description = "BAPA with ordering"
-  override val shortDescription = "BAPA<"
-
-  // checks for V-A-L-I-D-I-T-Y !
-  // Some(true) means formula is valid (negation is unsat)
-  // Some(false) means formula is not valid (negation is sat)
-  // None means you don't know.
-  //
-  // If the formula was found to be not valid,
-  // a counter-example is displayed (i.e. the model for negated formula)
-  def solve(exprWithLets: Expr): Option[Boolean] = {
-    //reporter.info("INPUT to Ordered BAPA\n" + rpp(exprWithLets))
-
-    val expr = expandLets(exprWithLets)
-
-    //reporter.info("INPUT to Ordered BAPA\n" + rpp(expr))
-
-    //reporter.info("Sets: " + ExprToASTConverter.getSetTypes(expr))
-    try {
-      // Negate formula
-      (Some(!solve(ExprToASTConverter(negate(expr), reporter))), {
-
-        val sets = ExprToASTConverter.getSetTypes(expr)
-        if (sets.size > 1)
-          reporter.warning("Heterogeneous set types: " + sets.mkString(", "))
-
-      })._1
-    } catch {
-      case ConversionException(badExpr, msg) =>
-        reporter.info(badExpr, msg + " in " + badExpr.getClass)
-        None
-      case IncompleteException(msg) =>
-        reporter.info(msg)
-        None
-      case e =>
-        reporter.error("BAPA with ordering just crashed.\n  exception = " + e.toString)
-        None
-    } finally {
-      Symbol.clearCache
-    }
-  }
-
-  // checks for U-N-S-A-T-I-S-F-I-A-B-I-L-I-T-Y !
-  // true means formula is SAT
-  // false means formula is UNSAT
-  def solve(formula: Formula): Boolean = {
-    reporter.info("BAPA< formula to be shown unsat:\n" + formula.toString)
-//    reporter.info("BAPA< formula to be shown unsat:\n" + NormalForms.nnf(formula).toString)
-
-    val z3 = new Context(formula, reporter)
-    val startTime = System.nanoTime
-    try {
-      // Term rewriting and NNF/DNF transformation
-      for (conjunction <- NormalForms(formula)) {
-//         println
-//         println("Conjunction : " + conjunction)
-        z3.push
-        try {
-          // Guess orderings, create equivalence classes
-          // for each ordering and solve the resulting formulas.
-          GuessOrdering(EquiClassPartition.apply)(z3, conjunction)
-        } catch {
-          case UnsatException(_) =>
-        }
-        z3.pop
-      }
-      // No conjunction and no guessed ordering is satisfiable.
-      // Return UNSAT
-      false
-    } catch {
-      // Found a model (counter-example)
-      case Z3SatException(model) =>
-        reporter.info("Counter-example found :")
-        reporter.info(model.toString)
-        // Return SAT
-        if (!ExprToASTConverter.formulaRelaxed) true
-        else throw (new IncompleteException("OrdBAPA: Relaxed formula was found satisfiable."))
-      case SatException(Model(ints, sets)) =>
-        reporter.info("Counter-example found :")
-        for ((name, value) <- ints)
-          reporter.info("\t\t " + name + " -> " + value)
-        for ((name, value) <- sets)
-          reporter.info("\t\t " + name + " -> " + value)
-        // Return SAT
-        if (!ExprToASTConverter.formulaRelaxed) true
-        else throw (new IncompleteException("OrdBAPA: Relaxed formula was found satisfiable."))
-    } finally {
-      z3.delete
-      val totalTime = ((System.nanoTime - startTime) / 1000000) / 1000.0
-      //reporter.info("BAPA< total time : " + totalTime)
-    }
-  }
-}
-
-// Thrown when a model was found after guessing
-case class Z3SatException(model: Z3Model) extends Exception("A model was found")
-case class SatException(model: Model) extends Exception("A model was found")
-
-  
-// Thrown when a contradiction was derived during guessing
-case class UnsatException(msg: String) extends Exception(msg)
-
-case class ConversionException(expr: purescala.Trees.Expr, msg: String) extends RuntimeException(msg)
-
-
-// Convert PureScala expressions to OrdBAPA AST's
-object ExprToASTConverter {
-  import purescala.TypeTrees._
-  import purescala.Trees._
-  import Primitives._
-
-  var formulaRelaxed = false
-
-  def isSetType(_type: TypeTree) = _type match {
-    case SetType(_) => true
-    case _ => false
-  }
-
-  def isAcceptableType(_type: TypeTree) = isSetType(_type) || _type == Int32Type
-
-  def makeEq(v: Variable, t: Expr) = v.getType match {
-    case Int32Type => Equals(v, t)
-    case tpe if isSetType(tpe) => SetEquals(v, t)
-    case _ => throw (new ConversionException(v, "type " + v.getType))
-  }
-
-  private def toSetTerm(expr: Expr): AST.Term = expr match {
-    case ResultVariable() if isSetType(expr.getType) => Symbol("#res", Symbol.SetType)
-    case Variable(id) if isSetType(id.getType) => Symbol(id.uniqueName, Symbol.SetType)
-    case EmptySet(_) => AST.emptyset
-    case FiniteSet(elems) if elems forall {_.getType == Int32Type} => AST.Op(UNION, (elems map toIntTerm map {_.singleton}).toList)
-    case SetCardinality(set) => toSetTerm(set).card
-    case SetIntersection(set1, set2) => toSetTerm(set1) ** toSetTerm(set2)
-    case SetUnion(set1, set2) => toSetTerm(set1) ++ toSetTerm(set2)
-    case SetDifference(set1, set2) => toSetTerm(set1) -- toSetTerm(set2)
-    case Variable(_) => throw ConversionException(expr, "type " + expr.getType)
-    case _ => throw ConversionException(expr, "bad set term")
-  }
-
-  private def toIntTerm(expr: Expr): AST.Term = expr match {
-    case ResultVariable() if expr.getType == Int32Type => Symbol("#res", Symbol.IntType)
-    case Variable(id) if id.getType == Int32Type => Symbol(id.uniqueName, Symbol.IntType)
-    case IntLiteral(v) => AST.Lit(IntLit(v))
-    case Plus(lhs, rhs) => toIntTerm(lhs) + toIntTerm(rhs)
-    case Minus(lhs, rhs) => toIntTerm(lhs) - toIntTerm(rhs)
-    case Times(lhs, rhs) => toIntTerm(lhs) * toIntTerm(rhs) // TODO: check linearity ?
-    case UMinus(e) => AST.zero - toIntTerm(e)
-    case SetCardinality(e) => toSetTerm(e).card
-    case SetMin(set) if set.getType == SetType(Int32Type) => toSetTerm(set).inf
-    case SetMax(set) if set.getType == SetType(Int32Type) => toSetTerm(set).sup
-    case _ => throw ConversionException(expr, "bad int term")
-  }
-
-  private def toFormula(expr: Expr): AST.Formula = expr match {
-    case BooleanLiteral(true) => AST.True
-    case BooleanLiteral(false) => AST.False
-    case Variable(id) if id.getType == BooleanType => Symbol(id.uniqueName, Symbol.BoolType)
-    case Or(exprs) => AST.Or((exprs map toFormula).toList)
-    case And(exprs) => AST.And((exprs map toFormula).toList)
-    case Not(expr) => !toFormula(expr)
-    case Implies(expr1, expr2) => !(toFormula(expr1)) || toFormula(expr2)
-    case Iff(expr1, expr2) =>
-      val f1 = toFormula(expr1)
-      val f2 = toFormula(expr2)
-      (f1 && f2) || (!f1 && !f2)
-
-    // Set Formulas
-    case ElementOfSet(elem, set) => toIntTerm(elem) selem toSetTerm(set)
-    case SetEquals(set1, set2) => toSetTerm(set1) seq toSetTerm(set2)
-    // case IsEmptySet(set) => toSetTerm(set).card === 0
-    case SubsetOf(set1, set2) => toSetTerm(set1) subseteq toSetTerm(set2)
-
-    // Integer Formulas
-    case LessThan(lhs, rhs) => toIntTerm(lhs) < toIntTerm(rhs)
-    case LessEquals(lhs, rhs) => toIntTerm(lhs) <= toIntTerm(rhs)
-    case GreaterThan(lhs, rhs) => toIntTerm(lhs) > toIntTerm(rhs)
-    case GreaterEquals(lhs, rhs) => toIntTerm(lhs) >= toIntTerm(rhs)
-    case Equals(lhs, rhs) => (lhs.getType, rhs.getType) match {
-      case (Int32Type, Int32Type) => toIntTerm(lhs) === toIntTerm(rhs)
-      case types => throw ConversionException(expr, "types " + types)
-    }
-
-    // Assuming the formula to be True
-    case _ => throw ConversionException(expr, "bad formula")
-  }
-
-  def getSetTypes(expr: Expr): Set[TypeTree] = expr match {
-    case Or(es) => (es map getSetTypes) reduceLeft (_ ++ _)
-    case And(es) => (es map getSetTypes) reduceLeft (_ ++ _)
-    case Not(e) => getSetTypes(e)
-    case Implies(e1, e2) => getSetTypes(e1) ++ getSetTypes(e2)
-    // Set formulas
-    case ElementOfSet(_, set) => Set(set.getType, SetType(Int32Type))
-    case SetEquals(set1, set2) => Set(set1.getType, set2.getType)
-    // case IsEmptySet(set) => Set(set.getType)
-    case SubsetOf(set1, set2) => Set(set1.getType, set2.getType)
-    // Integer formulas
-    case LessThan(lhs, rhs) => getSetTypes(lhs) ++ getSetTypes(rhs)
-    case LessEquals(lhs, rhs) => getSetTypes(lhs) ++ getSetTypes(rhs)
-    case GreaterThan(lhs, rhs) => getSetTypes(lhs) ++ getSetTypes(rhs)
-    case GreaterEquals(lhs, rhs) => getSetTypes(lhs) ++ getSetTypes(rhs)
-    case Equals(lhs, rhs) => getSetTypes(lhs) ++ getSetTypes(rhs)
-    // Integer terms
-    case Plus(lhs, rhs) => getSetTypes(lhs) ++ getSetTypes(rhs)
-    case Minus(lhs, rhs) => getSetTypes(lhs) ++ getSetTypes(rhs)
-    case Times(lhs, rhs) => getSetTypes(lhs) ++ getSetTypes(rhs)
-    case UMinus(e) => getSetTypes(e)
-    case SetCardinality(set) => Set(set.getType)
-    case SetMin(set) => Set(set.getType, SetType(Int32Type))
-    case SetMax(set) => Set(set.getType, SetType(Int32Type))
-    case _ => Set.empty[TypeTree]
-  }
-
-  def apply(expr: Expr, reporter: Reporter) = {
-    def toRelaxedFormula(expr: Expr): AST.Formula =
-      try {
-        toFormula(expr)
-      } catch {
-        case ConversionException(badExpr, msg) =>
-          reporter.warning("BAPA was relaxed : " + msg + " in " + badExpr.getClass + "\n" + rpp(badExpr))
-          formulaRelaxed = true
-          AST.True // Assuming the formula to be True
-      }
-    formulaRelaxed = false;
-    expr match {
-      case And(exprs) => AST.And((exprs map toRelaxedFormula).toList)
-      case _ => toRelaxedFormula(expr)
-    }
-  }
-
-
-}
diff --git a/src/orderedsets/NormalForms.scala b/src/orderedsets/NormalForms.scala
deleted file mode 100644
index b8918434e8ee678a78056d41775c80c5b204d297..0000000000000000000000000000000000000000
--- a/src/orderedsets/NormalForms.scala
+++ /dev/null
@@ -1,261 +0,0 @@
-package orderedsets
-
-object NormalForms {
-  import AST._
-  import Primitives._
-
-  // chains all transformations
-  def apply(formula: Formula) = dnf(nnf(formula)) map rewrite map And
-
-  /**Normal form transformations **/
-
-  type Conjunction = List[Formula]
-  type DNF = Stream[Conjunction]
-
-  // Complete dnf transformation
-  def dnf(f: Formula): DNF = f match {
-    case And(Nil) => Stream(Nil)
-    case And(c :: Nil) => dnf(c)
-    case And(c :: cs) =>
-      for (conj1 <- dnf(c); conj2 <- dnf(And(cs)))
-      yield conj1 ++ conj2
-    case Or(Nil) => Stream(List(False))
-    case Or(d :: Nil) => dnf(d)
-    case Or(d :: ds) => dnf(d) append dnf(Or(ds))
-    case Not(And(_) | Or(_)) =>
-      // dnf(nnf(f))
-      error("Not in negated normal form !")
-    case _ => Stream(f :: Nil)
-  }
-
-
-  // Partial dnf transformation
-  // The relevant atoms for the ordered decision procedure are in dnf form
-  def pdnf(f: Formula): DNF = if (isAtom(f)) Stream(f :: Nil) else f match {
-    case And(Nil) => Stream(Nil)
-    case And(c :: Nil) => pdnf(c)
-    case And(c :: cs) =>
-      for (conj1 <- pdnf(c); conj2 <- pdnf(And(cs)))
-      yield conj1 ++ conj2
-    case Or(Nil) => Stream(List(False))
-    case Or(d :: Nil) => pdnf(d)
-    case Or(d :: ds) => pdnf(d) append pdnf(Or(ds))
-    case Not(And(_) | Or(_)) =>
-      // pdnf(nnf(f))
-      error("Not in negated normal form !")
-    case _ => Stream(f :: Nil)
-  }
-
-  private def isAtom(f: Formula): Boolean = f match {
-    case True | False | PropVar(_) => true
-    case Not(f) => isAtom(f)
-    case And(fs) => fs forall isAtom
-    case Or(fs) => fs forall isAtom
-    case Predicate(SELEM | SLT, _) => false
-    case Predicate(_, fs) => fs forall isAtom
-  }
-
-  private def isAtom(t: Term): Boolean = t match {
-    case Op(LRANGE | TAKE | INF | SUP, _) => false
-    case _ => true
-  }
-
-
-  private def flatAnd(f: Formula) = f match {
-    case And(fs) => fs
-    case _ => List(f)
-  }
-
-  private def flatOr(f: Formula) = f match {
-    case Or(fs) => fs
-    case _ => List(f)
-  }
-
-  // Negated normal form with and/or/union/inter/plus/times flattening
-  def nnf(form: Formula): Formula = form match {
-    case True | False | PropVar(_) | Not(PropVar(_)) => form
-    case And(fs) =>
-      val formulas = fs map nnf filterNot {_ == True}
-      if (formulas contains False) False
-      else formulas flatMap flatAnd match {
-        case Nil => True
-        case f :: Nil => f
-        case fs => And(fs)
-      }
-    case Or(fs) =>
-      val formulas = fs map nnf filterNot {_ == False}
-      if (formulas contains True) True
-      else formulas flatMap flatOr match {
-        case Nil => False
-        case f :: Nil => f
-        case fs => Or(fs)
-      }
-    case Predicate(op, terms) =>
-      Predicate(op, terms map nnf)
-    case Not(Not(p)) => nnf(p)
-    case Not(And(fs)) => nnf(Or(fs map Not))
-    case Not(Or(fs)) => nnf(And(fs map Not))
-    case Not(True) => False
-    case Not(False) => True
-    case Not(Predicate(op: IntLogical, terms)) =>
-      Predicate(negate(op), terms map nnf)
-    case Not(Predicate(op, terms)) =>
-      Not(Predicate(op, terms map nnf))
-  }
-
-  private def flatten(ts: List[Term], prim: NonLogical, neutral: Term, absorbing: Term) = {
-    def flat(t: Term) = t match {
-      case Op(p, ts) if p == prim => ts
-      case _ => List(t)
-    }
-    val terms = ts map nnf filterNot {_ == neutral}
-    if (terms contains absorbing) absorbing
-    else terms flatMap flat match {
-      case Nil => neutral
-      case List(t) => t
-      case ts => Op(prim, ts)
-    }
-  }
-
-  def nnf(term: Term): Term = term match {
-    case Op(ITE(f), ts@List(t1, t2)) => nnf(f) match {
-      case True => nnf(t1)
-      case False => nnf(t2)
-      case f0 => Op(ITE(f0), ts map nnf)
-    }
-    case Op(INTER, ts) => flatten(ts, INTER, fullset, emptyset)
-    case Op(UNION, ts) => flatten(ts, UNION, emptyset, fullset)
-    case Op(ADD, ts) => flatten(ts, ADD, zero, null)
-    case Op(MUL, ts) => flatten(ts, MUL, one, zero)
-    case Op(COMPL, List(Lit(EmptySetLit))) => fullset
-    case Op(COMPL, List(Lit(FullSetLit))) => emptyset
-    case Op(COMPL, List(Op(COMPL, List(t)))) => nnf(t)
-    case Op(COMPL, List(Op(INTER, ts))) => nnf(Op(UNION, ts map {~_}))
-    case Op(COMPL, List(Op(UNION, ts))) => nnf(Op(INTER, ts map {~_}))
-    case Op(CARD, List(t)) => nnf(t) match {
-      case Lit(EmptySetLit) => zero
-      //case Lit(FullSetLit) => maxC
-      case t => Op(CARD, List(t))
-    }
-    case Op(prim, ts) => Op(prim, ts map nnf)
-    case Lit(_) | TermVar(_) => term
-  }
-
-
-  /* Rewrite compound primitives and make INF/SUP operations pure */
-
-  def rewrite(formulas: Conjunction): Conjunction = formulas flatMap rewrite
-
-  def rewrite(f: Formula): Conjunction = f match {
-    case Predicate(SELEM, List(t, _s)) =>
-      rewritePure(t, tf => rewriteNonPure(_s, s => {
-        val af = Symbol.freshSet
-        (af.card === 1) :: (tf === af.inf) :: (tf === af.sup) ::
-                (af subseteq s) :: Nil
-      }))
-    case Not(Predicate(SELEM, List(t, s))) =>
-      rewrite(Predicate(SELEM, List(t, ~s)))
-
-    case Predicate(SLT, args) =>
-      rewritePure_*(args, xs => {
-        val List(s1, s2) = xs
-        val supf = Symbol.supOf(s1)
-        val inff = Symbol.infOf(s2)
-        (supf < inff) :: (supf === s1.sup) :: (inff === s2.inf) :: Nil
-      })
-    case Not(Predicate(SLT, args)) =>
-      rewritePure_*(args, xs => (xs: @unchecked) match {
-        case s1 :: s2 :: Nil =>
-          val supf = Symbol.supOf(s1)
-          val inff = Symbol.infOf(s2)
-          (supf >= inff) :: (supf === s1.sup) :: (inff === s2.inf) :: Nil
-      })
-    case Predicate(EQ, List(t, Op(op@(SUP | INF), List(s)))) =>
-      rewritePure(t, tf =>
-        rewritePure(s, sf =>
-          (tf === Op(op, List(sf))) :: Nil
-          ))
-    case Predicate(EQ, List(Op(op@(SUP | INF), List(s)), t)) =>
-      rewritePure(s, sf =>
-        rewritePure(t, tf =>
-          (tf === Op(op, List(sf))) :: Nil
-          ))
-    case Predicate(comp, terms) =>
-      rewriteNonPure_*(terms, ts => Predicate(comp, ts) :: Nil)
-
-    case Not(Predicate(comp, terms)) =>
-      rewriteNonPure_*(terms, ts => Not(Predicate(comp, ts)) :: Nil)
-
-    case And(_) | Or(_) if !isAtom(f) =>
-      error("A simplified conjunction cannot contain " + f)
-
-    case _ => List(f)
-  }
-
-  private def rewritePure(term: Term, ctx: TermVar => Conjunction) = term match {
-    case id@TermVar(_) => ctx(id)
-
-    case Op(_: SetOperand, _) | Lit(EmptySetLit | FullSetLit) =>
-      val sf = Symbol.freshSet
-      rewriteNonPure(term, s =>
-        if (s.isInstanceOf[TermVar]) ctx(s.asInstanceOf[TermVar])
-        else (sf seq s) :: ctx(sf))
-    case _ =>
-      val tf = Symbol.freshInt
-      rewriteNonPure(term, t =>
-        if (t.isInstanceOf[TermVar]) ctx(t.asInstanceOf[TermVar])
-        else (tf === t) :: ctx(tf))
-  }
-
-  private def rewriteNonPure(term: Term, ctx: Term => Conjunction): Conjunction = term match {
-    case Op(op@(INF | SUP), List(s)) =>
-      rewritePure(s, sf => {
-        val tf = Symbol.freshInt
-        (tf === Op(op, List(sf))) :: ctx(tf)
-      })
-
-    case Op(SINGLETON, List(t)) =>
-      val sf = Symbol.freshSet
-      rewritePure(t, tf => {
-        (sf.card === 1) :: (tf === sf.inf) :: (tf === sf.sup) :: ctx(sf)
-      })
-
-    case Op(TAKE, List(t, s)) =>
-      val af = Symbol.freshSet
-      rewritePure(s -- af, bf => {
-        val form = (af.inf === s.inf) :: (af slt bf) :: (bf.sup === s.sup) :: Nil
-        (t === af.card) :: (af subseteq s) :: rewrite(form) ::: ctx(af)
-      })
-
-    case Op(LRANGE, List(t1, t2, s)) =>
-      val s1 = Symbol.freshSet
-      val s2 = Symbol.freshSet
-      val s3 = Symbol.freshSet
-      val s4 = Symbol.freshSet
-      rewritePure(s, sf => {
-        val form = (sf.inf === s1.inf) :: (s1 slt s2) :: (s2.sup === sf.sup) :: Nil
-        val formIn = (s1.inf === s3.inf) :: (s3 slt s4) :: (s4.sup === s1.sup) :: Nil
-        (s1.card === t2) :: (s3.card === (t1 - 1)) :: (s1 ++ s2 seq sf) :: (s3 ++ s4 seq s1) :: rewrite(form ::: formIn) ::: ctx(s4)
-      })
-
-    case Op(op, terms) =>
-      rewriteNonPure_*(terms, ts => ctx(Op(op, ts)))
-
-    case _ => ctx(term)
-  }
-
-  private def rewritePure_*(trees: List[Term], ctx: List[TermVar] => Conjunction): Conjunction =
-    trees match {
-      case Nil => ctx(Nil)
-      case t :: ts =>
-        rewritePure(t, tSym => rewritePure_*(ts, tSyms => ctx(tSym :: tSyms)))
-    }
-
-  private def rewriteNonPure_*(trees: List[Term], ctx: List[Term] => Conjunction): Conjunction =
-    trees match {
-      case Nil => ctx(Nil)
-      case t :: ts =>
-        rewriteNonPure(t, tSym => rewriteNonPure_*(ts, tSyms => ctx(tSym :: tSyms)))
-    }
-
-}
diff --git a/src/orderedsets/Primitives.scala b/src/orderedsets/Primitives.scala
deleted file mode 100644
index ba4120cf223ac0534e326ef804383f223f97d3cc..0000000000000000000000000000000000000000
--- a/src/orderedsets/Primitives.scala
+++ /dev/null
@@ -1,68 +0,0 @@
-package orderedsets
-
-
-object Primitives {
-  sealed abstract class Literal
-  case class IntLit(value: Int) extends Literal
-  case object EmptySetLit extends Literal
-  case object FullSetLit extends Literal
-  //case object InfinityLit extends Literal
-
-
-  sealed abstract class Primitive(val name: String) {
-    override def toString: String = name
-
-    def isLogical: Boolean
-
-    def isIntOp: Boolean
-  }
-
-
-  trait Logical extends Primitive {def isLogical = true}
-  trait NonLogical extends Primitive {def isLogical = false}
-  trait IntOperand extends Primitive {def isIntOp = true}
-  trait SetOperand extends Primitive {def isIntOp = false}
-
-  // logical primitives on integers
-  case object LT extends Primitive("<") with Logical with IntOperand
-  case object LE extends Primitive("<=") with Logical with IntOperand
-  case object EQ extends Primitive("=") with Logical with IntOperand
-  case object NE extends Primitive("!=") with Logical with IntOperand
-  case object GT extends Primitive(">") with Logical with IntOperand
-  case object GE extends Primitive(">=") with Logical with IntOperand
-
-  // non-logical primitives on integers
-  // TODO: do we need DIV and MOD ?
-  case object ADD extends Primitive("+") with NonLogical with IntOperand
-  case object SUB extends Primitive("-") with NonLogical with IntOperand
-  case object MUL extends Primitive("*") with NonLogical with IntOperand
-  case object SINGLETON extends Primitive("SINGLETON") with NonLogical with SetOperand
-  case class ITE(f: AST.Formula) extends Primitive("if-then-else") with NonLogical with IntOperand
-  //  case object DIV extends Primitive("/") with NonLogical with IntOperand
-  //  case object MOD extends Primitive("%") with NonLogical with IntOperand
-  case object MIN extends Primitive("min") with NonLogical with IntOperand
-  case object MAX extends Primitive("max") with NonLogical with IntOperand
-
-  // logical primitives on sets
-  case object SEQ extends Primitive("==") with Logical with SetOperand
-  case object SLT extends Primitive("<<") with Logical with SetOperand
-  case object SELEM extends Primitive("in") with Logical with SetOperand
-  case object SUBSETEQ extends Primitive("c=") with Logical with SetOperand
-
-  // non-logical primitives on sets
-  // - SetOperands return sets, IntOperands return ints
-  case object UNION extends Primitive("++") with NonLogical with SetOperand
-  case object INTER extends Primitive("**") with NonLogical with SetOperand
-  //case object MINUS extends Primitive("--") with NonLogical with SetOperand
-  case object COMPL extends Primitive("COMPL") with NonLogical with SetOperand
-  case object LRANGE extends Primitive("LRANGE") with NonLogical with SetOperand
-  case object TAKE extends Primitive("TAKE") with NonLogical with SetOperand
-  case object CARD extends Primitive("CARD") with NonLogical with IntOperand
-  case object INF extends Primitive("INF") with NonLogical with IntOperand
-  case object SUP extends Primitive("SUP") with NonLogical with IntOperand
-
-  type IntLogical = Logical with IntOperand
-  val negate: IntLogical => IntLogical =
-  Map(List(LT, LE, EQ, NE, GT, GE) zip List(GE, GT, NE, EQ, LE, LT): _*)
-}
-  
diff --git a/src/orderedsets/QFBAPAtoPATranslator.scala b/src/orderedsets/QFBAPAtoPATranslator.scala
deleted file mode 100644
index d211c4848b2385eae1872a9e4f5980de0c4fac53..0000000000000000000000000000000000000000
--- a/src/orderedsets/QFBAPAtoPATranslator.scala
+++ /dev/null
@@ -1,258 +0,0 @@
-package orderedsets
-
-import scala.collection.mutable.{ListBuffer, HashMap => MutableMap}
-import AST._
-import Primitives._
-import scala.math._
-
-object QFBAPAtoPATranslator {
-  private implicit def rangeToList[T](r: IndexedSeq[T]): List[T] = r.toList
-
-  var useBapaPlugin = true
-    
-  def apply(f: Formula, eqClassNum: Int) = {
-    if (useBapaPlugin)
-      rename(eqClassNum)(f)
-    else
-      nlognTransform(f, eqClassNum)
-  }
-
-  def rename(eqClassNum: Int) = {
-    def renameFormula(form: Formula): Formula = form match {
-      case True | False | PropVar(_) => form
-      case Not(f) => !renameFormula(f)
-      case And(fs) => And(fs map renameFormula)
-      case Or(fs) => Or(fs map renameFormula)
-      case Predicate(c, ts) => Predicate(c, ts map renameTerm)
-    }
-    def renameTerm(term: Term): Term = term match {
-      case TermVar(sym) if sym.isSet => Symbol.partOf(sym, eqClassNum)
-      case Lit(_) | TermVar(_) => term
-      case Op(c, ts) => Op(c, ts map renameTerm)
-    }
-    renameFormula _
-  }
-    
-  def nlognTransform(f: Formula, eqClassNum: Int) = {
-    val setvars = ASTUtil.setvars(f)
-    val f1 = rewriteSetRel(f)
-    val (atoms, zeroes, ones) = countCardinalityExpressions(f1)
-    val n0 = findSparsenessBound(atoms - zeroes - ones)
-    val n = min(n0 + ones, 1 << setvars.size)
-    val body = reduce(n, eqClassNum)(f1)
-    /*
-    println("In QFBAPAtoPATranslator:")
-    f1.print
-    println("** Set variables    : " + setvars)
-    println("** #atoms           : " + atoms)
-    println("** #cards = 0       : " + zeroes)
-    println("** #cards <= 1      : " + ones)
-    println("** d                : " + (atoms - zeroes - ones))
-    println("** sparseness bound : " + n0)
-    println("** body             : ")
-    body.print
-*/
-    /*
-    println("** Set variables    : " + setvars)
-    println("** sparseness bound : " + n0 +" (+ " + ones + ")")
-    println("** n                : " + n)
-      */
-    /* if (setvars.isEmpty)
-(True, 0)
-else        */
-    (And(body :: nonNegativeCards(n, eqClassNum) ::: breakSymmetry(n, setvars.toList).toList), n)
-  }
-
-  private def propVar(k: Int, id: TermVar): Formula = Symbol.beta(k, id)
-
-  private def intVar(k: Int, i: Int): Term = Symbol.vennSize(k, i)
-
-  // replace Seteq and Subseteq with Card(...) = 0
-  def rewriteSetRel(form: Formula): Formula = form match {
-    case And(fs) => And(fs map rewriteSetRel)
-    case Or(fs) => Or(fs map rewriteSetRel)
-    case Predicate(SEQ, List(s1, s2)) =>
-      rewriteSetRel(s1 subseteq s2) && rewriteSetRel(s2 subseteq s1)
-    case Predicate(SUBSETEQ, List(s1, s2)) =>
-      (s1 ** ~s2).card === 0
-    case Not(Predicate(SEQ, List(s1, s2))) =>
-      rewriteSetRel(!(s1 subseteq s2)) || rewriteSetRel(!(s2 subseteq s1))
-    case Not(Predicate(SUBSETEQ, List(s1, s2))) =>
-      (s1 ** ~s2).card > 0
-    case Not(f) => !rewriteSetRel(f)
-    case Predicate(EQ, List(t1, t2@Op(CARD, _))) =>
-      Predicate(EQ, List(t2, t1))
-    case _ => form
-  }
-
-  // translate BA to PA expression
-  // Generate formula of the form
-  //    (if st0 then l_k else 0)
-  //  where st0 is the result of replacing, in setTerm, the set variables with k-family
-  //  of propositional variables, as given by set2prop.
-  def ba2pa(setTerm: Term, k: Int, eqClassNum: Int): Term = {
-    def set2prop(sterm: Term): Formula = sterm match {
-      case id@TermVar(_) => propVar(k, id)
-      case Lit(EmptySetLit) => False
-      case Lit(FullSetLit) => True
-      case Op(COMPL, List(set)) => !set2prop(set)
-      case Op(UNION, sets) => Or(sets map set2prop)
-      case Op(INTER, sets) => And(sets map set2prop)
-      case _ => throw IllegalTerm(setTerm)
-    }
-    Op(ITE(set2prop(setTerm)), List(intVar(k, eqClassNum), 0))
-  }
-
-  // reduce QFBAPA formula f to QFPA formula,
-  //  introducing only n generic partition cardinality variables
-  // pre: formula is in nnf
-  def reduce(n: Int, eqClassNum: Int) = {
-    def reduceFormula(form: Formula): Formula = form match {
-      case True | False | PropVar(_) => form
-      case Not(f) => !reduceFormula(f)
-      case And(fs) => And(fs map reduceFormula)
-      case Or(fs) => Or(fs map reduceFormula)
-      case Predicate(c: IntLogical, ts) => Predicate(c, ts map reduceTerm)
-      case _ => throw IllegalTerm(form)
-    }
-    def reduceTerm(term: Term): Term = term match {
-      case Op(CARD, List(set)) =>
-        if (n == 0) 0 else Op(ADD, for (k <- 1 to n) yield ba2pa(set, k, eqClassNum))
-      case Op(c, ts) =>
-        Op(c, ts map reduceTerm)
-      case Lit(_) | TermVar(_) => term
-    }
-    reduceFormula _
-  }
-
-  // Extractor for countCardinalityExpressions
-  private object ExCardLessEqual {
-    def unapply(form: Formula): Option[(Term, Int)] = form match {
-      case Predicate(EQ, List(Lit(IntLit(card)), Op(CARD, List(set)))) => Some((set, card))
-      case Predicate(EQ, List(Op(CARD, List(set)), Lit(IntLit(card)))) => Some((set, card))
-      case Predicate(GE, List(Lit(IntLit(card)), Op(CARD, List(set)))) => Some((set, card))
-      case Predicate(LE, List(Op(CARD, List(set)), Lit(IntLit(card)))) => Some((set, card))
-      case Predicate(GT, List(Lit(IntLit(card)), Op(CARD, List(set)))) => Some((set, card - 1))
-      case Predicate(LT, List(Op(CARD, List(set)), Lit(IntLit(card)))) => Some((set, card - 1))
-      case _ => None
-    }
-  }
-
-  // TODO not equivalent to ml code -.-
-  def countCardinalityExpressions(f: Formula): (Int, Int, Int) = {
-    var atoms = 0
-    var cardIs0 = 0
-    var cardIs1 = 0
-    def countFormula(form: Formula): Unit = form match {
-      case And(fs) => fs foreach countFormula
-      case Or(fs) => fs foreach countFormula
-      case ExCardLessEqual(_, 0) => cardIs0 += 1; atoms += 1
-      case ExCardLessEqual(_, 1) => cardIs1 += 1; atoms += 1
-      case Predicate(c: IntLogical, ts) => ts foreach countTerm
-      case True | False | PropVar(_) => ()
-      case _ => IllegalTerm(form)
-    }
-    def countTerm(term: Term): Unit = term match {
-      case Op(CARD, List(Lit(_))) => ()
-      case Op(CARD, _) => atoms += 1
-      case Op(_, ts) => ts foreach countTerm
-      case _ => ()
-    }
-    countFormula(f)
-    (atoms, cardIs0, cardIs1)
-  }
-
-  // symmetry_breaking predicate says that
-  // propositional variables denote a strictly
-  // increasing sequence of regions (lexical ordering)
-  private val BREAK_SYMMETRY = true
-
-  def breakSymmetry(n: Int, svars: List[Symbol]): List[Formula] =
-    if (BREAK_SYMMETRY)
-      List.tabulate(n - 1)(i => mkIndexLess(i + 1)(svars))
-    else Nil
-
-  private def mkIndexLess(i: Int) = {
-    def rek(sets: List[Symbol]): Formula = sets match {
-      case Nil => True
-      case s :: Nil =>
-        // prop less
-        val varI = propVar(i, s)
-        val varI_1 = propVar(i + 1, s)
-        !varI && varI_1
-      case s :: ss =>
-        // prop equal
-        val varI = propVar(i, s)
-        val varI_1 = propVar(i + 1, s)
-        val equal = (!varI && !varI_1) || (varI && varI_1)
-        rek(List(s)) || (equal && rek(ss))
-    }
-    rek _
-  }
-
-  // Imposes non-negativity for cardinalities of venn regions
-  private def nonNegativeCards(n: Int, eqClassNum: Int) =
-    for (i <- 1 to n) yield 0 <= intVar(i, eqClassNum)
-
-  // compute the largest n such that 2^n <= (n+1)^d
-  def findSparsenessBound(d: Int) = {
-    // Check if 2^n <= (n+1)^d by taking log of both sides
-    def small_n(n: Int) = n * log(2) <= d * log(n + 1)
-    def binSearch(low: Int, high: Int): Int = {
-      if (high <= low + 1) {
-        if (small_n(high))
-          high
-        else
-          low
-      } else {
-        val mid = (high + low) / 2
-        if (small_n(mid))
-          binSearch(mid, high)
-        else
-          binSearch(low, mid)
-      }
-    }
-    if (d <= 3)
-      d
-    else {
-      val a0 = d * log(d)
-      val b0 = 2 * d * (1 + log(d))
-      binSearch(a0.toInt, b0.toInt)
-    }
-  }
-
-  def rewriteITE(form: Formula): Formula = {
-    // The list which defines the termporary variables for ITE expressions.
-    // TODO: There will be multiple occurences of Op(ITE(p, trmLst))
-    // in the formula. Hence, this is memonized in the mkITEDef function
-    // TODO: How are formula compared?
-    val definitions = new ListBuffer[Formula]
-    val defMap = new MutableMap[Formula, TermVar]()
-    var numITE = 0
-    def mkITEDef(p: Formula, terms: List[Term]): TermVar = {
-      val List(t1, t2) = terms
-      val tf: TermVar = Symbol.freshInt
-      numITE += 1
-      definitions += (p && (tf === t1)) || (!p && (tf === t2))
-      defMap(p) = tf
-      tf
-    }
-    def expandTerm(t: Term): Term = t match {
-      case Op(ITE(p), terms) => defMap.getOrElse(p, mkITEDef(p, terms))
-      case Op(op, terms) => Op(op, terms map expandTerm)
-      case _ => t
-    }
-    def expandForm(f: Formula): Formula = f match {
-      case PropVar(_) => f
-      case And(fs) => And(fs map expandForm)
-      case Or(fs) => Or(fs map expandForm)
-      case Not(f) => Not(expandForm(f))
-      case Predicate(op: IntLogical, terms) => Predicate(op, terms map expandTerm)
-      case _ => throw (new IllegalTerm(f))
-    }
-    // All ITE terms replaced by fresh variables
-    definitions prepend expandForm(form)
-    And(definitions.toList)
-  }
-
-}
diff --git a/src/orderedsets/RPrettyPrinter.scala b/src/orderedsets/RPrettyPrinter.scala
deleted file mode 100644
index f2b7768ba175acb61390453c8363670d4d6db1e9..0000000000000000000000000000000000000000
--- a/src/orderedsets/RPrettyPrinter.scala
+++ /dev/null
@@ -1,142 +0,0 @@
-package orderedsets
-
-import scala.text.{Document, DocBreak}
-import Document._
-
-import purescala.Trees._
-import purescala.Common.Identifier
-
-object RPrettyPrinter {
-  def apply(expr: Expr) = rpp(expr)
-
-  def rpp(expr: Expr) = writeString(pp(expr))
-
-  private val indent = 2
-  private val docWidth = 80
-
-  private def writeString(doc: Document) = {
-    val writer = new java.io.StringWriter()
-    doc.format(docWidth, writer)
-    writer.flush()
-    writer.toString
-  }
-
-
-  // Helper methods
-  private val line: Document = DocBreak
-
-  private def paren(d: Document): Document =
-    group("(" :: nest(indent, d) :: ")")
-
-  private def brace(d: Document): Document =
-    group("{" :: nest(indent, d) :: "}")
-
-  private def block(d: Document): Document =
-    group("{" :: line :: nest(indent, d) :: line :: "}")
-
-  private def repsep(doc: Seq[Document], sep: Document): Document =
-    if (doc isEmpty) empty else
-      doc.reduceLeft {(rest, d) => rest :: sep :: d}
-
-  private def ppUnary(expr: Expr, sep: Document) =
-    paren(sep :/: pp(expr))
-
-  private def ppBinary(left: Expr, right: Expr, sep: Document) =
-    paren(pp(left) :/: sep :/: pp(right))
-
-  private def ppVarary(exprs: Seq[Expr], sep: Document) =
-    paren(repsep(exprs map pp, sep))
-
-  private def ppVararyDoc(exprs: Seq[Document], sep: Document) =
-    paren(repsep(exprs, sep))
-
-  private def ppVararyBrace(exprs: Seq[Expr], sep: Document) =
-    brace(repsep(exprs map pp, sep))
-
-
-  val (_AND, _OR, _NOT, _IFF, _IMPL, _EQ, _NE) =
-  (" n ", " v ", "!", "<=>", "==>", "==", "!=")
-
-  val (_LE, _LT, _GE, _GT) = ("<=", "<", ">=", ">")
-
-  val (_NEG) = ("-")
-
-  val (_SEQ, _SNE, _EMPTYSET, _UNION, _INTER, _MINUS, _INF, _SUP) =
-  ("=S=", "!=S=", "{}", "++", "**", "--", ".min", ".max")
-
-
-  private def pp(expr: Expr): Document = expr match {
-    case Variable(id) => id
-    case Let(b, d, e) => paren("let" :/: b.toString :/: ":=" :/: pp(d) :/: "in" :/: pp(e))
-    case And(es) => ppVarary(es, _AND :: line)
-    case Or(es) => ppVarary(es, _OR)
-    case Not(Equals(l, r)) => ppBinary(l, r, _NE)
-    case Not(SetEquals(l, r)) => ppBinary(l, r, _SNE)
-    case Not(e) => ppUnary(e, _NOT)
-    case Iff(l, r) => ppBinary(l, r, _IFF)
-    case Implies(l, r) => ppBinary(l, r, _IMPL)
-    case UMinus(e) => ppUnary(e, _NEG)
-    case SetEquals(l, r) => ppBinary(l, r, _SEQ)
-    case Equals(l, r) => ppBinary(l, r, _EQ)
-    case IntLiteral(v) => v
-    case BooleanLiteral(v) => text(v toString)
-    case StringLiteral(s) => "\"" :: s :: "\""
-    case CaseClass(ct, args) => ct.id :: ppVarary(args, ",")
-    case CaseClassSelector(_, cc, id) => pp(cc) :: "." :: id
-    case FunctionInvocation(fd, args) => fd.id :: ppVarary(args, ",")
-
-    case Plus(l, r) => ppBinary(l, r, "+")
-    case Minus(l, r) => ppBinary(l, r, "-")
-    case Times(l, r) => ppBinary(l, r, "*")
-    case Division(l, r) => ppBinary(l, r, "/")
-    case LessThan(l, r) => ppBinary(l, r, _LT)
-    case GreaterThan(l, r) => ppBinary(l, r, _GT)
-    case LessEquals(l, r) => ppBinary(l, r, _LE)
-    case GreaterEquals(l, r) => ppBinary(l, r, _GE)
-    case FiniteSet(rs) => ppVararyBrace(rs, ", ")
-    case EmptySet(_) => _EMPTYSET
-    case SetMin(s) => pp(s) :: _INF
-    case SetMax(s) => pp(s) :: _SUP
-    case SetUnion(l, r) => ppBinary(l, r, _UNION)
-    case SetDifference(l, r) => ppBinary(l, r, _MINUS)
-    case SetIntersection(l, r) => ppBinary(l, r, _INTER)
-    case SetCardinality(t) => "|" :: pp(t) :: "|"
-
-    case IfExpr(c, t, e) => paren(
-      group("if" :/: paren(pp(c))) :/:
-              group("then" :/: block(pp(t))) :/:
-              group("else" :/: block(pp(e)))
-      )
-    case MatchExpr(s, cases) =>
-      def ppc(p: Pattern): Document = p match {
-      //case InstanceOfPattern(None,     ctd) =>
-      //case InstanceOfPattern(Some(id), ctd) =>
-        case CaseClassPattern(None, ccd, subps) =>
-          ccd.id :: ppVararyDoc(subps map ppc, ",")
-        case CaseClassPattern(Some(bind), ccd, subps) =>
-          bind :/: "@" :/: ccd.id :: ppVararyDoc(subps map ppc, ",")
-        case WildcardPattern(None) => "_"
-        case WildcardPattern(Some(id)) => id
-        case _ => "Pattern?"
-      }
-      def ppguard(opt: Option[Expr]): Document = opt match {
-        case None => "=>"
-        case Some(ex) => "if" :/: pp(ex) :/: "=>"
-      }
-      pp(s) :/: "match" :/: brace(
-        (cases foldLeft (empty: Document)) {
-          (doc, mc) =>
-            doc :/: line :/: "case" :/: ppc(mc.pattern) :/: ppguard(mc.theGuard)
-        }
-        )
-    case ResultVariable() => "#res"
-    case _ => "Expr?"
-  }
-
-  private implicit def stringToDoc(s: String): Document = text(s)
-
-  private implicit def intToDoc(i: Int): Document = text(i.toString)
-
-  private implicit def identToDoc(id: Identifier): Document = text(id.toString)
-}
-
diff --git a/src/orderedsets/Reconstruction.scala b/src/orderedsets/Reconstruction.scala
deleted file mode 100644
index 69f225a7a5446d5dfe4e7ad9e3d971af6647714d..0000000000000000000000000000000000000000
--- a/src/orderedsets/Reconstruction.scala
+++ /dev/null
@@ -1,159 +0,0 @@
-package orderedsets
-
-import AST._
-import EquiClassPartition._
-
-object Reconstruction {
-  // Reconstruction aimed at getting the smallest model
-  import scala.collection.mutable.Map
-
-  case class ReconstructionImpossible(msg: String) extends Exception(msg)
-  private def fail(msg: String) = throw ReconstructionImpossible(msg)
-
-  // The output type
-  class Model(val intMap: Map[Symbol, Int], val setMap: Map[Symbol, Set[Int]])
-  object Model {
-    def unapply(model: Model): Option[(List[(Symbol, Int)], List[(Symbol, String)])] = {
-      val sortedInts = model.intMap.toList.sortWith {_._1.name < _._1.name}
-      val sortedSets = for ((sym, set) <- model.setMap.toList.sortWith {_._1.name < _._1.name})
-      yield (sym, set.toList.sortWith {_ < _}.mkString("Set { ", ", ", " }"))
-      Some((sortedInts, sortedSets))
-    }
-  }
-
-  // The Beta variables
-  class Beta(val pij: Set[Symbol], val size: Int) {
-    var set: Set[Int] = Set.empty
-
-    def isFull = set.size >= size
-
-    def isEmpty = size == 0
-
-    def insert(i: Int) = {
-      set += i
-      if (set.size > size) error("Venn size exceeded")
-    }
-
-    override def toString = "Pijs=" + pij.toString + "\n" + "Len = " + size + " \nSet = " + set + "\n"
-  }
-
-  object Beta {
-    def unapply(obj: Beta): Option[(Set[Symbol], Int, Set[Int])] = Some(obj.pij, obj.size, obj.set)
-  }
-
-  // This function puts the inf and the sup in the correct
-  // Venn Regions
-  def populate(betas: Array[Beta], sets: List[Symbol], elem: Int): Unit = {
-    betas find {beta => !beta.isFull && (sets forall beta.pij)} match {
-      case Some(beta) => beta insert elem
-      case None =>
-        println(sets)
-        betas foreach {println(_)}
-        fail("INF or SUP cannot be in this equivClass!!")
-    }
-  }
-
-  // Return the union of all the VennRegions contained in the setVar
-  def getUnionOfVennRegions(betas: Array[Beta], setVar: Symbol) = {
-    val containedSets = for (Beta(pij, _, set) <- betas; if pij(setVar)) yield set
-    (Set.empty[Int] /: containedSets)(_ ++ _)
-  }
-
-  // Main function to call
-  def apply(z3Out: Z3Sat, outSetVars: List[Symbol], outIntVar: List[Symbol], eqCls: List[EquiClass]) = {
-    val Z3Sat(_, boolZ3Values, intZ3Values) = z3Out
-    var outIntMap: Map[Symbol, Int] = Map()
-    var outSetMap: Map[Symbol, Set[Int]] = Map()
-
-    def boolVal(sym: Symbol) = boolZ3Values(sym)
-    def intVal(sym: Symbol) = intZ3Values(sym)
-
-    // The default values for integers is zero
-    // TODO Removed default value.. Why would a variable be unmapped ?
-    for (vOut <- outIntVar) outIntMap(vOut) = intVal(vOut)
-
-    var populatedSets: Map[Symbol, Set[Int]] = Map.empty
-
-    // Starting by making each venn region
-    for (v@EquiClass(num, setWithInfsHere, _, setWithSupsHere, clsType, _) <- eqCls) {
-      val setVarsInEq = v.allSets match {
-        case Some(sets) => sets map {Symbol.partOf(_, num)}
-        case None => fail("Forgot to initialize allsets!")
-      }
-      val N: Int = v.getNBound match {
-        case Some(value) => value
-        case None => fail("Forgot to initialize N in equivClass")
-      }
-      val upperBound = v.upper
-      val lowerBound = v.lower
-
-      // Populating the lengths and pij's of beta vectors
-      var betas: Array[Beta] = new Array(N)
-      for (ii <- 1 to N) {
-        var boolPValues: Set[Symbol] = Set.empty
-        for (set <- setVarsInEq) {
-          val pij = Symbol.beta(ii, TermVar(set))
-          // The default value for a venn region is empty
-          if (boolVal(pij))
-            boolPValues += set
-        }
-
-        // The ll.x variable
-        val ll_ii = Symbol.vennSize(ii, v.num)
-        betas(ii - 1) = new Beta(boolPValues, intVal(ll_ii))
-      }
-
-      var lb = lowerBound match {
-        case Excl(intVars) => intVal(intVars.head) + 1 //getOneValue(intVars) + 1
-        case Incl(intVars) => intVal(intVars.head)
-      //case _ => throw (new ReconstructionImpossible("Ill formed lower bound."))
-      }
-      var ub = upperBound match {
-        case Excl(intVars) => intVal(intVars.head) - 1 // These values must be present?
-        case Incl(intVars) => intVal(intVars.head)
-      //case _ => throw (new ReconstructionImpossible("Ill formed upper bound."))
-      }
-
-      // Is this the unbounded set
-      val wasUnbounded = clsType == Unbounded // lb > ub
-      val wasSingleton = (lb == ub) // clsType == Singleton
-
-      // Choose values for inf and sup of sets in this class
-      if (!setWithInfsHere.isEmpty) {
-        populate(betas, setWithInfsHere.toList.map {x => Symbol.partOf(TermVar(x), num)}, lb)
-        lb += 1
-      }
-
-      if (!setWithSupsHere.isEmpty && !wasSingleton) {
-        populate(betas, setWithSupsHere.toList.map {x => Symbol.partOf(TermVar(x), num)}, ub)
-        ub -= 1
-      }
-
-      // Populating the Venn Regions
-
-      for (beta <- betas) {
-        if (beta.size > 100) println("Warning, large set !  Size = " + beta.size)
-        while (!beta.isFull) {
-          beta insert lb
-          lb += 1
-        }
-      }
-      if (!wasUnbounded && lb - 1 != ub) {
-        //println("   WARNING: " +(lb-1) + " != " + ub)
-        fail("lb-1 != ub : " + (lb - 1) + " != " + ub)
-      }
-
-      for (s <- setVarsInEq)
-        populatedSets(s) = getUnionOfVennRegions(betas, s)
-    }
-    //println("Populated Sets = " + populatedSets.toString)
-
-    for (s <- outSetVars) {
-      val setSymbols = for (cls <- eqCls) yield Symbol.partOf(s, cls.num)
-      val setContents = for (sym <- setSymbols; if populatedSets contains sym) yield populatedSets(sym)
-      outSetMap(s) = (Set.empty[Int] /: setContents) {_ ++ _}
-    }
-
-    new Model(outIntMap, outSetMap)
-  }
-}
diff --git a/src/orderedsets/Symbol.scala b/src/orderedsets/Symbol.scala
deleted file mode 100644
index d7715141b53dafcc9c0866dd8e2705dacd36be87..0000000000000000000000000000000000000000
--- a/src/orderedsets/Symbol.scala
+++ /dev/null
@@ -1,119 +0,0 @@
-package orderedsets
-
-import AST.{TermVar}
-import scala.collection.mutable.{HashMap => MutableMap}
-import z3.scala._
-import Symbol._
-
-class Symbol private(val name: String, val tpe: Type) {
-  override def toString: String = name
-
-  private var ctx: Context = null
-  private var storedZ3Symb: Z3AST = null
-
-  def isInt = (tpe == IntType)
-
-  def isSet = (tpe == SetType)
-
-  def isBool = (tpe == BoolType)
-
-  def toZ3sym(ctxPassed: Context): Z3AST = {
-    if (ctx ne ctxPassed) {
-      ctx = ctxPassed
-      storedZ3Symb = ctx mkSym this
-    }
-    storedZ3Symb
-  }
-
-  // the collection of set variables whose inf/sup is denoted by this symbol
-  var infOfList: Set[Symbol] = null
-  var supOfList: Set[Symbol] = null
-}
-
-object Symbol {
-  sealed abstract class Type
-  case object IntType extends Type
-  case object SetType extends Type
-  case object BoolType extends Type
-
-  private val counters = new MutableMap[String, Int]()
-  private val interned = new MutableMap[String, Symbol]()
-
-  private def freshName(prefix: String): String = {
-    val count = counters.getOrElse(prefix, 1)
-    counters.put(prefix, count + 1)
-    prefix + "." + count
-  }
-
-  private def lookup(name: String, tpe: Type): Symbol = interned get name match {
-    case Some(sym) =>
-      if (sym.tpe != tpe) error("Incompatible types: " + sym.tpe + " and " + tpe)
-      sym
-    case None =>
-      val sym = new Symbol(name, tpe)
-      interned.put(name, sym)
-      sym
-  }
-
-  def clearCache {
-    counters.clear
-    interned.clear
-  }
-
-  def apply(name: String, tpe: Type) = Symbol.lookup(name, tpe)
-
-  def apply(name: String): Symbol = name.charAt(0) match {
-    case c if c.isUpper => lookup(name, SetType)
-    case c if c.isLower => lookup(name, IntType)
-    case '?' => lookup(name, BoolType)
-    case _ => error("Could not guess type of : " + name)
-  }
-
-  //  def fresh(prefix: String): Symbol =
-  //    new Symbol(freshName(prefix))
-
-  def freshInt: Symbol =
-    new Symbol(freshName("t"), IntType)
-
-  def freshSet: Symbol =
-    new Symbol(freshName("S"), SetType)
-
-//   def freshInt(prefix: String = "t"): Symbol =
-//     new Symbol(freshName(prefix), IntType)
-// 
-//   def freshSet(prefix: String = "S"): Symbol =
-//     new Symbol(freshName(prefix), SetType)
-
-
-  def partOf(setvar: TermVar, k: Int): Symbol =
-    lookup(setvar.sym.name + "." + k, SetType)
-    
-//   def newPartOf(setvar: TermVar, k: Int): Symbol =
-//     lookup(setvar.sym.name + "#" + k, setvar.tpe)
-
-  /*
-  def equiClass(k: Int): Symbol = error("do not use")
-
-  def equiRange(k: Int): Symbol = error("do not use")
-
-  def partClass(setvar: TermVar, k: Int): Symbol = error("do not use")
-
-  def partRange(setvar: TermVar, k: Int): Symbol = error("do not use")
-  */
-
-  def infOf(setvar: TermVar): Symbol =
-    lookup("inf." + setvar.sym.name, IntType)
-
-  def supOf(setvar: TermVar): Symbol =
-    lookup("sup." + setvar.sym.name, IntType)
-
-  def beta(k: Int, setvar: TermVar): Symbol =
-    lookup("pp." + k + "_" + setvar.sym.name, BoolType)
-
-  def vennSize(k: Int, i: Int): Symbol =
-    lookup("ll." + k + "." + i, IntType)
-
-  def bool2int(sym: Symbol): Symbol =
-    if (sym.isBool) new Symbol(sym.name, IntType)
-    else error("Bad type : " + sym.tpe)
-}
diff --git a/src/orderedsets/TreeOperations.scala b/src/orderedsets/TreeOperations.scala
deleted file mode 100644
index d7f1614ed9b199468bfef1b83f4c15778da6609a..0000000000000000000000000000000000000000
--- a/src/orderedsets/TreeOperations.scala
+++ /dev/null
@@ -1,141 +0,0 @@
-package orderedsets
-
-import scala.collection.mutable.{Set => MutableSet}
-
-import purescala._
-import Trees._
-import Common._
-import TypeTrees._
-import Definitions._
-
-import RPrettyPrinter.rpp
-
-object TreeOperations {
-  def dnf(expr: Expr): Stream[Seq[Expr]] = expr match {
-    case And(Nil) => Stream(Nil)
-    case And(c :: Nil) => dnf(c)
-    case And(c :: cs) =>
-      for (conj1 <- dnf(c); conj2 <- dnf(And(cs)))
-      yield conj1 ++ conj2
-    case Or(Nil) => Stream(Seq(BooleanLiteral(false)))
-    case Or(d :: Nil) => dnf(d)
-    case Or(d :: ds) => dnf(d) append dnf(Or(ds))
-    // Rewrite Iff and Implies
-    case Iff(p, q) =>
-      dnf(Or(And(p, q), And(negate(p), negate(q))))
-    case Implies(p, q) =>
-      dnf(Or(negate(p), q))
-    // Convert to nnf
-    case Not(e@(And(_) | Or(_) | Iff(_, _) | Implies(_, _))) =>
-      dnf(negate(e))
-    case _ => Stream(expr :: Nil)
-  }
-
-  def asCatamorphism(program: Program, f: FunDef): Option[Seq[(CaseClassDef, Identifier, Seq[Identifier], Expr)]] = {
-    def recCallsOnMatchedVars(l: (CaseClassDef, Identifier, Seq[Identifier], Expr)) = {
-      var varSet = MutableSet.empty[Identifier]
-      searchAndReplace({case FunctionInvocation(_, Seq(Variable(id))) => varSet += id; None; case _ => None})(l._4)
-      varSet.subsetOf(l._3.toSet)
-    }
-    val c = program.callees(f)
-    if (f.hasImplementation && f.args.size == 1 && c.size == 1 && c.head == f) f.body.get match {
-      case SimplePatternMatching(scrut, _, lstMatches)
-        if (scrut == f.args.head.toVariable) && lstMatches.forall(recCallsOnMatchedVars) => Some(lstMatches)
-      case _ => None
-    } else {
-      None
-    }
-  }
-
-  // 'Lazy' rewriter
-  // 
-  // Hoists if expressions to the top level and
-  // transforms them to disjunctions.
-  //
-  // The implementation is totally brain-teasing
-  def rewrite(expr: Expr): Expr =
-    Simplifier(rewrite(expr, ex => ex))
-
-  private def rewrite(expr: Expr, context: Expr => Expr): Expr = expr match {
-  // Convert to nnf
-    case Not(e@(And(_) | Or(_) | Iff(_, _) | Implies(_, _) | IfExpr(_, _, _))) =>
-      rewrite(negate(e), context)
-    case IfExpr(_c, _t, _e) =>
-      rewrite(_c, c =>
-        rewrite(_t, t =>
-          rewrite(_e, e =>
-            Or(And(c, context(t)), And(negate(c), context(e)))
-            )))
-    case And(_exs) =>
-      rewrite_*(_exs, exs =>
-        context(And(exs)))
-    case Or(_exs) =>
-      rewrite_*(_exs, exs =>
-        context(Or(exs)))
-    case Not(_ex) =>
-      rewrite(_ex, ex =>
-        context(Not(ex)))
-    case f@FunctionInvocation(fd, _args) =>
-      rewrite_*(_args, args =>
-        context(FunctionInvocation(fd, args) setType f.getType))
-    case u@UnaryOperator(_t, recons) =>
-      rewrite(_t, t =>
-        context(recons(t) setType u.getType))
-    case b@BinaryOperator(_t1, _t2, recons) =>
-      rewrite(_t1, t1 =>
-        rewrite(_t2, t2 =>
-          context(recons(t1, t2) setType b.getType)))
-    case c@CaseClass(cd, _args) =>
-      rewrite_*(_args, args =>
-        context(CaseClass(cd, args) setType c.getType))
-    case c@CaseClassSelector(ccd, _cc, sel) =>
-      rewrite(_cc, cc =>
-        context(CaseClassSelector(ccd, cc, sel) setType c.getType))
-    case f@FiniteSet(_elems) =>
-      rewrite_*(_elems, elems =>
-        context(FiniteSet(elems) setType f.getType))
-    case _: Terminal =>
-      context(expr)
-    case _ => // Missed case
-      error("Unsupported case in rewrite : " + expr.getClass)
-  }
-
-  private def rewrite_*(exprs: Seq[Expr], context: Seq[Expr] => Expr): Expr =
-    exprs match {
-      case Nil => context(Nil)
-      case _t :: _ts =>
-        rewrite(_t, t => rewrite_*(_ts, ts => context(t +: ts)))
-    }
-
-
-  object Simplifier {
-    private val True = BooleanLiteral(true)
-    private val False = BooleanLiteral(false)
-
-    def apply(expr: Expr) = simplify(expr)
-
-    def simplify(expr: Expr): Expr = expr match {
-      case Not(ex) => negate(ex)
-      case And(exs) => And(simplify(exs, True, False) flatMap flatAnd)
-      case Or(exs) => Or(simplify(exs, False, True) flatMap flatOr)
-      case _ => expr
-    }
-
-    private def simplify(exprs: Seq[Expr], neutral: Expr, absorbing: Expr): Seq[Expr] = {
-      val exs = (exprs map simplify) filterNot {_ == neutral}
-      if (exs contains absorbing) Seq(absorbing)
-      else exs
-    }
-
-    private def flatAnd(f: Expr) = f match {
-      case And(fs) => fs
-      case _ => Seq(f)
-    }
-
-    private def flatOr(f: Expr) = f match {
-      case Or(fs) => fs
-      case _ => Seq(f)
-    }
-  }
-
-}
diff --git a/src/orderedsets/Unifier.scala b/src/orderedsets/Unifier.scala
deleted file mode 100644
index 074b290e19c23f6e2aa628c96d7191ede011a99c..0000000000000000000000000000000000000000
--- a/src/orderedsets/Unifier.scala
+++ /dev/null
@@ -1,446 +0,0 @@
-package orderedsets
-
-import scala.{Symbol => ScalaSymbol}
-
-import sys.error
-
-object ExampleUnifier extends Unifier[String, String] {
-
-  // Tests and Examples
-  val examplePage262 = List(
-    'g('x2) === 'x1,
-    'f('x1, 'h('x1), 'x2) === 'f('g('x3), 'x4, 'x3)
-    )
-  val examplePage268 = List(
-    'f('x1, 'g('x2, 'x3), 'x2, 'b())
-            ===
-            'f('g('h('a(), 'x5), 'x2), 'x1, 'h('a(), 'x4), 'x4)
-    )
-  val examplePage269 = List(
-    'x2 === 'h('x1, 'x1),
-    'x3 === 'h('x2, 'x2),
-    'x4 === 'h('x3, 'x3)
-    )
-  val simple1 = List('f('A) === 'g('B))
-  val simple2 = List('f('A) === 'f('B, 'C))
-  val simple3 = List('f('A) === 'f('f('A)))
-  val simple4 = List('f('g('A), 'A) === 'f('B, 'xyz()))
-
-  def main(args: Array[String]) {
-
-    run(examplePage262, "Example from page 262")
-    run(examplePage268, "Example from page 268")
-    run(examplePage269, "Example from page 269")
-
-    run(simple1, "Fails because the heads of the terms are different")
-    run(simple2, "Fails to unify because the terms have different arity")
-    run(simple3, "Infinite unification (occurs check)")
-    run(simple4, "Unifies A with the atom xyz and B with the term g(xyz)")
-  }
-
-  def run(terms: List[(Term, Term)], name: String) {
-    try {
-      println
-      println(name)
-      for ((v, t) <- unify(terms))
-        println("  " + v + " -> " + pp(t))
-    } catch {
-      case UnificationImpossible(msg) =>
-        println("Unification failed: " + msg)
-    }
-  }
-
-  // type conversions, just for the examples
-
-  sealed abstract class RawTerm {
-    def ===(that: RawTerm): (Term, Term) = (this, that)
-  }
-  case class RawVar(name: String) extends RawTerm {
-    def apply(terms: RawTerm*) = RawFun(name, terms.toList)
-  }
-  case class RawFun(name: String, args: List[RawTerm]) extends RawTerm
-
-  implicit def str2term(sym: ScalaSymbol): RawVar = RawVar(sym.name)
-
-  implicit def raw2term(raw: RawTerm): Term = raw match {
-    case RawVar(name) => Var(name)
-    case RawFun(name, args) => Fun(name, args map raw2term)
-  }
-
-
-  def pv(str: String) = str
-
-  def pf(str: String) = str
-}
-
-import scala.collection.mutable.ArrayBuffer
-import scala.collection.Map
-import purescala.Common._
-import purescala.Trees._
-import purescala.TypeTrees._
-import purescala.Definitions.CaseClassDef
-
-
-object ADTUnifier extends Unifier[Variable, CaseClassDef] {
-  def pv(v: Variable) = v.id.toString
-
-  def pf(cc: CaseClassDef) = cc.id.toString
-
-  def freshVar(prefix: String)(typed: Typed) = Var(Variable(FreshIdentifier(prefix, true) setType typed.getType))
-
-  def unify(conjunction: Seq[Expr]): (Seq[Expr], Map[Variable, Expr]) = {
-    val equalities = new ArrayBuffer[(Term, Term)]()
-    val inequalities = new ArrayBuffer[(Var, Var)]()
-
-    def extractEquality(expr: Expr): Unit = expr match {
-      case Equals(t1, t2) =>
-        equalities += expr2term(t1) -> expr2term(t2)
-      case Not(Equals(t1, t2)) =>
-        inequalities += toPureTerm(t1) -> toPureTerm(t2)
-      case _ => error("Should not happen after separating the formula.")
-    }
-    def toPureTerm(expr: Expr) = expr2term(expr) match {
-      case v@Var(_) => v
-      case term =>
-        val v = freshVar("Diseq")(expr)
-        equalities += v -> term
-        v
-    }
-    def expr2term(expr: Expr): Term = expr match {
-      case v@Variable(id) => Var(v)
-      case CaseClass(ccdef, args) => Fun(ccdef, args map expr2term)
-      case CaseClassSelector(_, ex, sel) =>
-        val CaseClassType(ccdef) = ex.getType
-        val args = ccdef.fields map freshVar("Sel")
-        equalities += expr2term(ex) -> Fun(ccdef, args)
-        args(ccdef.fields findIndexOf {_.id == sel})
-      case _ => error("Should not happen after separating the formula.")
-    }
-    // extract equality constraints
-    conjunction foreach extractEquality
-
-    /*
-    println
-    println("--- Input to the unifier ---")
-    for ((l,r) <- equalities) println("  " + pp(l) + "  =  " + pp(r))
-    if (!inequalities.isEmpty) {
-      println("and")
-      for ((l,r) <- inequalities) println("  " + pp(l) + "  !=  " + pp(r))
-    }    
-    println
-    // */
-
-    val mgu = unify(equalities.toList)
-    val table = blowUp(mgu)
-    def subst(v: Variable) = table getOrElse (v, Var(v))
-
-    /*
-    def byName(entry1: (Variable,Term), entry2: (Variable,Term)) =
-      pv(entry1._1) < pv(entry2._1)
-    
-    //println
-    println("--- Output of the unifier (MGU) ---")
-    for ((x, t) <- mgu.toList sortWith byName)
-      println("  " + x + "  =  " + pp(t))
-    println
-  
-    val substTable = table mapValues term2expr
-    println("--- Output of the unifier (Substitution table) ---")
-    for ((x, t) <- substTable.toList sortWith {_._1.id.name < _._1.id.name})
-      println("  " + x + "  =  " + t)
-    // */
-
-
-    // check inequalities
-    for ((Var(x1), Var(x2)) <- inequalities) {
-      val t1 = subst(x1)
-      val t2 = subst(x2)
-      if (t1 == t2)
-        throw UnificationImpossible("'" + x1.id + " != " + x2.id + "' violated") // (both reduce to " + pp(t1) + ")")
-    }
-
-    /*
-    if (!inequalities.isEmpty)
-      println("Inequalities were checked to hold\n")
-    
-    println("--- Output of the unifier (Substitution table) ---")
-    val map1 = map.filterKeys{_.getType != Untyped}
-    for ((x, t) <- map1.toList sortWith byName)
-      println("  " + x + "  =  " + pp(t))
-    if (map1.isEmpty) println("  (empty table)")
-    println 
-    */
-
-    // Extract element equalities and disequalities
-    val elementFormula = new ArrayBuffer[Expr]()
-    for ((e1, term) <- table; if isElementType(e1)) {
-      term2expr(term) match {
-        case e2@Variable(_) =>
-          //println("  " + e1 + ": " + e1.getType +
-          //    "  ->  " + e2 + ": " + e2.getType) 
-          elementFormula += Equals(e1, e2)
-        case expr =>
-          //println("  " + e1 + ": " + e1.getType +
-          //    "  ->  " + expr + ": " + expr.getType)
-          //println("UNEXPECTED: " + term)
-          error("Unexpected " + expr)
-      }
-    }
-    for ((Var(e1), Var(e2)) <- inequalities; if isElementType(e1))
-      elementFormula += Not(Equals(e1, e2))
-
-    (elementFormula.toSeq, table mapValues term2expr)
-  }
-
-  def term2expr(term: Term): Expr = term match {
-    case Var(v) => v
-    case Fun(cd, args) => CaseClass(cd, args map term2expr)
-  }
-
-  def isElementType(typed: Typed) = typed.getType match {
-    case AbstractClassType(_) | CaseClassType(_) => false
-    case _ => true
-  }
-
-}
-
-
-
-import scala.collection.mutable.{ArrayBuffer => Seq, Map => MutableMap, Set, Stack}
-
-case class UnificationImpossible(msg: String) extends Exception(msg)
-
-trait Unifier[VarName >: Null, FunName >: Null] {
-  type MGU = Seq[(VarName, Term)]
-  type Subst = MutableMap[VarName, Term]
-
-  // transitive closure for the mapping - the smart way (in only one iteration)
-  def blowUp(mgu: MGU): Subst = {
-    val map = MutableMap[VarName, Term]()
-    def subst(term: Term): Term = term match {
-      case Var(v) => map get v match {
-        case Some(t) => t
-        case None => term
-      }
-      case Fun(f, args) => Fun(f, args map subst)
-    }
-    for ((v, t) <- mgu.reverse) {
-      map(v) = subst(t)
-    }
-    map
-  }
-
-  /* Interface */
-
-  // The AST to be unified
-  sealed abstract class Term
-  case class Var(name: VarName) extends Term
-  case class Fun(name: FunName, args: scala.collection.Seq[Term]) extends Term
-
-
-
-
-  def pv(s: VarName): String
-
-  def pf(f: FunName): String
-
-  def _pv(s: VarName): String = if (s == null) "<null>" else pv(s)
-
-  def _pf(f: FunName): String = if (f == null) "<null>" else pf(f)
-
-  def pp(t: Term): String = t match {
-    case Var(s) => _pv(s)
-    case Fun(f, ts) => _pf(f) + (ts map pp).mkString("(", ", ", ")")
-  }
-
-
-  def unify(term1: Term, term2: Term): MGU =
-    unify(List((term1, term2)))
-
-  def unify(terms: List[(Term, Term)]): MGU = {
-    val variableMap = MutableMap[VarName, Variable]()
-    def convertTerm(term: Term): Equation = term match {
-      case Var(name) => variableMap get name match {
-        case Some(v) =>
-          new Equation(v)
-        case None =>
-          val v = Variable(name)
-          variableMap(name) = v
-          new Equation(v)
-      }
-      case Fun(name, args) =>
-        new Equation(Function(name, Seq(args: _*) map convertTerm))
-    }
-    val frontier = terms map {x => merge(convertTerm(x._1), convertTerm(x._2))}
-    val dummyVariable = new Variable(null)
-    dummyVariable.eqclass.eqn.fun = Some(new Function(null, Seq(frontier: _*)))
-
-    val allVariables = Seq(dummyVariable) ++ variableMap.values
-    unify(allVariables map {_.eqclass}) filter {_._1 != null}
-  }
-
-  /* Data structures */
-
-  private case class Variable(name: VarName) {
-    // The equivalence class for that variable
-    var eqclass: Equivalence = new Equivalence(this)
-
-    override def toString = _pv(name)
-  }
-  private case class Function(val name: FunName, val eqns: Seq[Equation]) {
-    override def toString = _pf(name) + eqns.mkString("(", ",", ")")
-  }
-  private class Equation(val vars: Seq[Variable] = Seq(),
-                         var fun: Option[Function] = None) {
-    def this(v: Variable) = this (vars = Seq(v))
-
-    def this(f: Function) = this (fun = Some(f))
-
-    override def toString = {
-      if (fun.isEmpty) vars.mkString("{", ",", "}")
-      else if (vars.isEmpty) fun.mkString
-      else vars.mkString("{", ",", "}") + " = " + fun.mkString
-    }
-  }
-  private class Equivalence(val eqn: Equation) {
-    def this(v: Variable) = this (new Equation(v))
-
-    // How often variables in this class occur on the right-hand side
-    // of other terms
-    var refCounter = 0
-
-    override def toString = "[" + refCounter + "] " + eqn
-  }
-
-  /* Implementation */
-
-  private def unify(equivalences: Seq[Equivalence]): MGU = {
-    var numberOfClasses = equivalences.size
-    val substitutions = Seq[(VarName, Term)]()
-    val freeClasses = Stack[Equivalence]() // Equations with a zero ref counter
-
-    /*
-    val vars = equivalences map {_.eqn.vars.head}
-    val fvars = Seq[Variable]()
-    */
-
-    // Initialize reference counters
-    def countRefs(fun: Function) {
-      for (eqn <- fun.eqns) {
-        for (v <- eqn.vars) v.eqclass.refCounter += 1
-        for (f <- eqn.fun) countRefs(f)
-      }
-    }
-    for (equiv <- equivalences; f <- equiv.eqn.fun) countRefs(f)
-    for (equiv <- equivalences; if equiv.refCounter == 0) freeClasses push equiv
-
-    def compact(cl1: Equivalence, cl2: Equivalence) = {
-      if (cl1 == cl2) cl1
-      else {
-        numberOfClasses -= 1
-        merge(cl1, cl2)
-      }
-    }
-
-    // Main loop
-    while (numberOfClasses > 0) {
-      /*
-      println()
-      println("U:")
-      println("  vars : " + vars.mkString(", "))
-        val classes = (vars map {_.eqclass}).toSet
-        println(classes.size + " / " + numberOfClasses)
-        for (cl <- classes) println(cl)
-      println("T: ")
-      println("  vars : " + fvars.mkString(", "))
-        for ((v,t) <- substitutions) println("  " + v + " -> " + pp(t))
-      */
-
-      // Select multi equation
-      if (freeClasses.isEmpty) throw UnificationImpossible("cycle")
-
-      val currentClass = freeClasses.pop
-      val currentVars = currentClass.eqn.vars
-      val representative = Var(currentVars.head.name)
-      for (v <- currentVars.tail)
-        substitutions += (v.name -> representative)
-
-      currentClass.eqn.fun match {
-        case Some(function) =>
-          val (commonPart, frontier) = reduce(function)
-          substitutions += (representative.name -> commonPart)
-
-          // Compact equations (i.e. merge equivalence classes)
-          for (eqn <- frontier) {
-            /*
-            println(eqn)
-            */
-            val eqclass = (eqn.vars map {_.eqclass}) reduceLeft compact
-            eqclass.refCounter -= eqn.vars.size
-            eqn.vars.clear
-            merge(eqclass.eqn, eqn)
-            if (eqclass.refCounter == 0) freeClasses push eqclass
-
-            /*
-            println("  " + eqclass)
-            */
-          }
-        case None =>
-      }
-      numberOfClasses -= 1
-
-      /*
-      vars --= currentVars
-      fvars ++= currentVars
-      */
-    }
-    substitutions
-  }
-
-  private def merge(class1: Equivalence, class2: Equivalence): Equivalence = {
-    if (class1 == class2) return class1 // should not happen !?
-    if (class1.eqn.vars.size < class2.eqn.vars.size)
-      return merge(class2, class1)
-
-    merge(class1.eqn, class2.eqn)
-    class1.refCounter += class2.refCounter
-    for (v <- class2.eqn.vars)
-      v.eqclass = class1
-    class1
-  }
-
-  private def merge(equation1: Equation, equation2: Equation): Equation = {
-    if (equation1 == equation2) return equation1 // should not happen !?
-
-    equation1.vars ++= equation2.vars
-    equation1.fun match {
-      case None => equation1.fun = equation2.fun
-      case Some(Function(name1, args1)) => equation2.fun match {
-        case Some(Function(name2, args2)) =>
-          if (name1 != name2) throw UnificationImpossible("clash")
-          if (args1.size != args2.size) throw UnificationImpossible("arity")
-          val args = for ((eqn1, eqn2) <- args1 zip args2) yield merge(eqn1, eqn2)
-          equation1.fun = Some(Function(name1, args))
-        case None =>
-      }
-    }
-    equation1
-  }
-
-  private def reduce(function: Function) = {
-    val frontier = Seq[Equation]()
-    def rec(function1: Function): Term = {
-      val args = for (arg <- function1.eqns) yield {
-        if (arg.vars.isEmpty) {
-          rec(arg.fun.get)
-        } else {
-          frontier += arg
-          Var(arg.vars.head.name)
-        }
-      }
-      Fun(function1.name, args.toList)
-    }
-    (rec(function), frontier)
-  }
-
-}
diff --git a/src/orderedsets/UnifierMain.scala b/src/orderedsets/UnifierMain.scala
deleted file mode 100644
index eec35bcd2b9f2f47150fb6aa13f2fb6cc611220f..0000000000000000000000000000000000000000
--- a/src/orderedsets/UnifierMain.scala
+++ /dev/null
@@ -1,315 +0,0 @@
-package orderedsets
-
-import scala.collection.Map
-import scala.collection.mutable.{Map => MutableMap, Set => MutableSet}
-import purescala.Reporter
-import purescala.Extensions.Solver
-import Reconstruction.Model
-
-import purescala._
-import Trees._
-import Common._
-import TypeTrees._
-import Definitions._
-
-import RPrettyPrinter.rpp
-
-case class IncompleteException(msg: String) extends Exception(msg)
-
-class UnifierMain(reporter: Reporter) extends Solver(reporter) {
-  import purescala.Trees._
-  import TreeOperations._
-
-  val description = "Unifier for ADTs with abstractions"
-  override val shortDescription = "Unifier"
-  override def superseeds = List("BAPA<", "MUNCH")
-
-  var program: Program = null
-
-  override def setProgram(p: Program) = program = p
-
-  // checks for V-A-L-I-D-I-T-Y !
-  // Some(true) means formula is valid (negation is unsat)
-  // Some(false) means formula is not valid (negation is sat)
-  // None means you don't know.
-  //
-  def solve(exprWithLets: Expr): Option[Boolean] = {
-    val exprWithIfs = expandLets(exprWithLets)
-    val negatedExprWithIfs = negate(exprWithIfs)
-    val expr = rewrite(negatedExprWithIfs)
-    //println(rpp(expr))
-    try {
-      var counter = 0
-      for (conjunction <- dnf(expr)) {
-        counter += 1
-        //reporter.info("Solving conjunction " + counter)
-        //println(rpp(And(conjunction)))
-        try {
-          conjunction foreach checkIsSupported
-          catamorphism.clear
-          // restFormula is also a Sequence of conjunctions
-          val (varMap, restFormula) = solve(conjunction)
-          // TODO: Might contain multiple c_i ~= {} for a fixed i
-          val noAlphas = And(restFormula flatMap expandAlphas(varMap))
-          reporter.info("The resulting formula is\n" + rpp(noAlphas))
-          tryAllSolvers(noAlphas)
-        } catch {
-          case ex@ConversionException(badExpr, msg) =>
-            reporter.info("Conjunction " + counter + " is UNKNOWN, could not be parsed")
-            throw ex
-          case ex@IncompleteException(msg) =>
-            reporter.info("Conjunction " + counter + " is UNKNOWN, incomplete")
-            throw ex
-          //  throw(new IncompleteException("BAPA< cannot handle :" + badExpr + " : " + msg))
-          case UnificationImpossible(msg) =>
-            reporter.info("Conjunction " + counter + " is UNSAT, proved by Unifier") // (" + msg + ")")
-          case ex@SatException(_) =>
-            reporter.info("Conjunction " + counter + " is SAT")
-            throw ex
-        }
-      }
-      // All conjunctions were UNSAT
-      Some(true)
-    } catch {
-      case ConversionException(badExpr, msg) =>
-        reporter.warning(msg + " : " + badExpr.getClass.toString)
-        None
-      case IncompleteException(msg) =>
-        //reporter.info("Unifier cannot disprove this because it is incomplete")
-        if (msg != null) reporter.info(msg)
-        None
-      case SatException(_) =>
-        Some(false)
-      case e =>
-        reporter.error("Component 'Unifier' just crashed.\n  Exception = " + e.toString)
-        e.printStackTrace
-        None
-    } finally {
-      Symbol.clearCache
-    }
-  }
-
-  def tryAllSolvers(f: Expr): Unit = {
-    for (solver <- Extensions.loadedSolverExtensions; if solver != this) {
-      reporter.info("Trying solver: " + solver.shortDescription + " from inside the unifier.")
-      solver.isUnsat(f) match {
-        case Some(true) =>
-          reporter.info("Solver: " + solver.shortDescription + " proved the formula unsatisfiable")
-          return
-        case Some(false) =>
-          reporter.warning("Solver: " + solver.shortDescription + " proved the formula satisfiable")
-          throw (new SatException(null))
-        case None =>
-          reporter.info("Solver: " + solver.shortDescription + " was unable to conclusively determine the correctness of the formula")
-      }
-    };
-    throw IncompleteException("All the solvers were unable to prove the formula unsatisfiable, giving up.")
-  }
-
-  def checkIsSupported(expr: Expr) {
-    def check(ex: Expr): Option[Expr] = ex match {
-      case Let(_, _, _) | MatchExpr(_, _) =>
-        throw ConversionException(ex, "Unifier does not support this expression")
-      case IfExpr(_, _, _) =>
-
-        println
-        println("--- BEFORE ---")
-        println(rpp(expr))
-        println
-        println("--- AFTER ---")
-        println(rpp(rewrite(expr)))
-        println
-
-
-        throw ConversionException(ex, "Unifier does not support this expression")
-      case _ => None
-    }
-    searchAndReplace(check)(expr)
-  }
-
-
-  /* Returns a conjunction which contains the rest of the formula
-  * apart from the ADTs
-  */
-  def solve(conjunction: Seq[Expr]): (Variable => Expr, Seq[Expr]) = {
-    val (treeEquations, rest) = separateADT(conjunction)
-
-    /*
-    reporter.info("Fc")
-    treeEquations  foreach println
-    reporter.info("Rest")
-    rest foreach println
-    */
-
-    // The substitution table
-    val (elementFormula, substTable) = ADTUnifier.unify(treeEquations)
-
-    // The substitution function (returns identity if unmapped)
-    def subst(v: Variable): Expr = substTable getOrElse (v, v)
-
-    (subst, elementFormula ++ rest)
-
-  }
-
-  /* Step 1 : Do DNF transformation (done elsewhere) */
-
-  /* Step 2 : Split conjunction into (FT, Rest) purifying terms if needed.
-  * FT are equations over ADT trees.
-  * We allow element variables to appear in FT.
-  * Later, we will also allow element variables to appear in FT,
-  * but this has not been implemented yet.
-  */
-
-  import scala.collection.mutable.{Stack, ArrayBuffer}
-  import purescala._
-  import Common.FreshIdentifier
-  import TypeTrees.Typed
-
-  def freshVar(prefix: String, typed: Typed) = Variable(FreshIdentifier(prefix, true) setType typed.getType)
-
-
-  def separateADT(conjunction: Seq[Expr]) = {
-    val workStack = Stack(conjunction.reverse: _*)
-    val good = new ArrayBuffer[Expr]() // Formulas over ADTs
-    val bad = new ArrayBuffer[Expr]() // Formulas of unknown logic
-    // TODO: Allow literals in unifier ?
-    def isGood(expr: Expr) = expr match {
-      case Variable(_) | CaseClass(_, _) | CaseClassSelector(_, _, _) => true
-      case _ => false
-    }
-    def isBad(expr: Expr) = expr match {
-      case CaseClass(_, _) | CaseClassSelector(_, _, _) => false
-      case _ => true
-    }
-    def purifyGood(expr: Expr) = if (isGood(expr)) None else {
-      val fresh = freshVar("col", expr)
-      workStack push Equals(fresh, expr) // will be bad
-      //      println("PUSH bad  : " + isBad(expr) + "  " +  expr)
-      Some(fresh)
-    }
-    def purifyBad(expr: Expr) = if (isBad(expr)) None else {
-      val fresh = freshVar("adt", expr)
-      workStack push Equals(fresh, expr) // will be good
-      //      println("PUSH good : " + isGood(expr) + "  " + expr)
-      Some(fresh)
-    }
-    def process(expr: Expr): Unit = expr match {
-      case Equals(t1, t2) if isGood(t1) && isGood(t2) =>
-        //      println("POP good  :       " + expr)
-        val g1 = searchAndReplace(purifyGood)(t1)
-        val g2 = searchAndReplace(purifyGood)(t2)
-        good += Equals(g1, g2)
-      //        println("ADD good  :       " + Equals(g1, g2))
-      case Not(Equals(t1, t2)) if isGood(t1) && isGood(t2) =>
-        //      println("POP good2 :       " + expr)
-        val g1 = searchAndReplace(purifyGood)(t1)
-        val g2 = searchAndReplace(purifyGood)(t2)
-        good += Not(Equals(g1, g2))
-      //        println("ADD good2 :       " + Not(Equals(g1, g2)))
-      case Not(Not(ex)) =>
-        process(ex)
-      case _ =>
-        //      println("POP bad   :       " + expr)
-        val t = searchAndReplace(purifyBad)(expr)
-        bad += t
-    //        println("ADD bad   :       " + t)
-    }
-    while (!workStack.isEmpty) {
-      val expr = workStack.pop
-      process(expr)
-    }
-    (good.toSeq, bad.toSeq)
-  }
-
-  /* Step 3 : Perform unifcation on equations over ADTs.
-  * Obtain a substitution u = T(t) and
-  * disequalites N(u,t) over ADT variables, and
-  * get implied (dis)equalities FE over element variables.
-  */
-
-  /* Step 4 : Partial evaluation of catamorphisms */
-  def isAlpha(substArg: Expr => Expr)(expr: Expr): Option[Expr] = expr match {
-    case FunctionInvocation(fd, Seq(arg)) => asCatamorphism(program, fd) match {
-      case Some(lstMatch) => substArg(arg) match {
-        case t@Variable(_) => {
-          Some(evalCatamorphism(t, fd, expr))
-        }
-        case CaseClass(cd, args) => {
-          val (_, _, ids, rhs) = lstMatch.find(_._1 == cd).get
-          val repMap = Map(ids.map(id => Variable(id): Expr).zip(args): _*)
-          //reporter.warning("Converting\n" + rpp(expr) + " to " + rpp(rhs))
-          val res = searchAndReplace(repMap.get)(rhs)
-          //reporter.warning("Result:\n" + rpp(res))
-          Some(res)
-        }
-        case badArg =>
-          println(rpp(badArg))
-          error("Bad argument/substitution to catamorphism")
-      }
-      case None => // Not a catamorphism
-        warning("Function " + fd.id + " is not a catamorphism.")
-        None
-    //error("Not a catamorphism.")
-    }
-    case _ => None // not a function invocation
-  }
-
-  def substFunArg(varMap: Variable => Expr)(expr: Expr) = expr match {
-    case v@Variable(_) => varMap(v)
-    case _ => expr
-  }
-
-
-  val displayedWarnings = MutableSet[String]()
-
-  def warning(text: String) {
-    if (!displayedWarnings(text)) {
-      displayedWarnings(text) = true
-      reporter.warning(text)
-    }
-  }
-
-
-  private val catamorphism = MutableMap[(Variable, FunDef), Variable]()
-
-  def evalCatamorphism(v: Variable, fd: FunDef, collType: Typed) = catamorphism get ((v, fd)) match {
-    case Some(c) => c
-    case None =>
-      val c = freshVar("Coll", collType)
-      catamorphism((v, fd)) = c
-      c
-  }
-
-  def expandAlphas(varMap: Variable => Expr)(expr: Expr): Seq[Expr] = {
-    //catamorphism.clear
-    val partiallyEvaluated = searchAndReplace(isAlpha(substFunArg(varMap)))(expr)
-    if (partiallyEvaluated == expr) {
-      //reporter.warning(rpp(expr) + "\ndoes not contain any catamorphism.")
-      Seq(expr) // Not a catamorphism
-    }
-    else { // partiallyEvaluated is the Partially evaluated expression
-      //reporter.warning(rpp(expr) + "\n found to contain one or more catamorphisms. Translated to:\n" + rpp(partiallyEvaluated))
-      var conjuncts = Seq(partiallyEvaluated)
-      // SetEquals or just Equals?
-      //searchAndReplace({case v@Variable(_) => nonEmptySetsExpr :+= Not(SetEquals(v, EmptySet(v.getType))); None; case _ => None})(partiallyEvaluated)
-
-      // for (svar <- catamorphism.values; if hasSetType(svar))
-      //   conjuncts :+= Not(SetEquals(svar, EmptySet(svar.getType)))
-      //catamorphism.clear
-
-      /*
-      println("--- catamorphism ---")
-      for (((t, fd), c) <- catamorphism)
-        println(fd.id + "( " + t + " )  =  " + c)
-      println
-      */
-
-      conjuncts
-    }
-  }
-
-  def hasSetType(typed: Typed) = typed.getType match {
-    case SetType(_) => true
-    case _ => false
-  }
-}
diff --git a/src/setconstraints-tests/ManipSuite.scala b/src/setconstraints-tests/ManipSuite.scala
deleted file mode 100644
index c6237b7fe38511f25b570a90af46b00ae78f21ba..0000000000000000000000000000000000000000
--- a/src/setconstraints-tests/ManipSuite.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-package setconstraints
-
-import org.scalatest.FunSuite
-import Trees._
-import Manip._
-
-class ManipSuite extends FunSuite {
-
-  def v(str: String) = VariableType(str)
-  def c(s: SetType) = ComplementType(s)
-  def u(sts: SetType*) = UnionType(sts)
-  def i(sts: SetType*) = IntersectionType(sts)
-  val e = EmptyType
-  val a = UniversalType
-
-  test("basic simplify"){
-    assert(simplify(u(v("x"), c(v("x")))) === a)
-    assert(simplify(i(v("x"), c(v("x")))) === e)
-    assert(simplify(u(v("x"), v("y"), v("x"), c(v("x")))) === a)
-    assert(simplify(i(v("x"), v("y"), v("x"), c(v("x")))) === e)
-    assert(simplify(u(v("x"), v("y"), v("x"), v("x"), u(v("y"), v("x")))) === u(v("x"), v("y")))
-  }
-
-  test("basic vars"){
-    val vs = Set("x", "y", "z")
-    assert(vars(i(u(v("x"), v("x")), i(v("x"), i(v("z"))), v("y"))) == vs)
-  }
-
-}
diff --git a/src/setconstraints-tests/SolverSuite.scala b/src/setconstraints-tests/SolverSuite.scala
deleted file mode 100644
index 3c46bf17ec0281ac9428d1f870d98abf373c064e..0000000000000000000000000000000000000000
--- a/src/setconstraints-tests/SolverSuite.scala
+++ /dev/null
@@ -1,153 +0,0 @@
-package setconstraints
-
-import org.scalatest.FunSuite
-
-import Trees._
-import Solver._
-
-class SolverSuite extends FunSuite {
-
-  def v(str: String) = VariableType(str)
-  def c(s: SetType) = ComplementType(s)
-  def u(sts: SetType*) = UnionType(sts)
-  def i(sts: SetType*) = IntersectionType(sts)
-  def f0 = ConstructorType("f0", Seq())
-  def f1(s: SetType) = ConstructorType("f1", Seq(s))
-  def f2(s1: SetType, s2: SetType) = ConstructorType("f2", Seq(s1, s2))
-  def f3(s1: SetType, s2: SetType, s3: SetType) = ConstructorType("f3", Seq(s1, s2, s3))
-//  val constructors = Map("f0" -> 0, "f1" -> 1, "f2" -> 2, "f3" -> 3)
-  val v1 = v("v1")
-  val v2 = v("v2")
-  val v3 = v("v3")
-  val e = EmptyType
-  val a = UniversalType
-
-  test("is one level"){
-    assert(isOneLevel(e))
-    assert(!isOneLevel(u(i(e),e)))
-    assert(isOneLevel(i(v("x"), v("y"), c(v("z")))))
-    assert(isOneLevel(i(f2(i(), i(v("x"), v("z"))))))
-    assert(!isOneLevel(f2(i(), i(v("x"), v("z")))))
-
-    val oneLevel = i(c(v("x")), v("y"), f3(i(v("x")), i(), i(v("y"), c(v("z")))))
-    assert(isOneLevel(oneLevel))
-
-    assert(isOneLevel(Include(oneLevel, e)))
-    assert(!isOneLevel(Include(oneLevel, a)))
-  }
-
-
-  test("to one level"){
-    val s1 = Set(Include(f2(v1, v2), v3))
-    val constr1 = Map("f1" -> 1, "f2" -> 2)
-    println("system:\n" + PrettyPrinter(s1.asInstanceOf[Set[Relation]]))
-    val ol1 = oneLevel(s1, constr1)
-    println("one level system:\n" + PrettyPrinter(ol1.asInstanceOf[Set[Relation]]))
-    assert(isOneLevel(ol1.asInstanceOf[Set[Relation]]))
-
-    val s2 = Set(Include(f1(f1(v1)), v2))
-    val constr2 = Map("f1" -> 1)
-    println("system:\n" + PrettyPrinter(s2.asInstanceOf[Set[Relation]]))
-    val ol2 = oneLevel(s2, constr1)
-    println("one level system:\n" + PrettyPrinter(ol2.asInstanceOf[Set[Relation]]))
-    assert(isOneLevel(ol2.asInstanceOf[Set[Relation]]))
-
-    val s3 = Set(Include(f2(f1(v1), v2), v3))
-    val constr3 = Map("f1" -> 1, "f2" -> 2)
-    println("system:\n" + PrettyPrinter(s3.asInstanceOf[Set[Relation]]))
-    val ol3 = oneLevel(s3, constr1)
-    println("one level system:\n" + PrettyPrinter(ol3.asInstanceOf[Set[Relation]]))
-    assert(isOneLevel(ol3.asInstanceOf[Set[Relation]]))
-  }
-
-  val constructors = Map("b" -> 0, "c" -> 1)
-  def fc(s: SetType) = ConstructorType("c", Seq(s))
-  val fb = ConstructorType("b", Seq())
-  val system = Set(
-    Include(v1, v2),
-    Include(fc(v2), c(v2)),
-    Include(fc(c(v2)), v2))
-
-  val system2 = Set(
-    Include(i(v1, v2, v3), EmptyType),
-    Include(i(v1, fb, v3), EmptyType),
-    Include(i(v3, v1, fc(v2)), EmptyType)
-  )
-
-  test("decreasing order"){
-    val decrOrder = decreasingOrder(system2)
-    println("decreasing order system:\n" + PrettyPrinter(And(decrOrder.toSeq)))
-  }
-
-  val system3 = Set(
-    Include(i(c(v2), v1), EmptyType),
-    Include(i(v2, fc(v2)), EmptyType),
-    Include(i(c(v2), fc(c(v2))), EmptyType)
-  )
-
-  test("cascading systems"){
-    val cascad = cascadingSystems(oneLevel(system3, constructors), constructors)
-    println("cascading systems:\n" + cascad.map(sys => PrettyPrinter(And(sys.toSeq))))
-    assert(cascad.forall((system: Set[Include]) => isOneLevel(system.asInstanceOf[Set[Relation]])))
-  }
-
-  val constructorsForm = Map("Or" -> 2, "Not" -> 1, "Implies" -> 2)
-  val form = VariableType("Formula")
-  val ret = VariableType("ret")
-  val tmp = VariableType("tmp")
-  val or = (f1: SetType, f2: SetType) => ConstructorType("Or", Seq(f1, f2))
-  val implies = (f1: SetType, f2: SetType) => ConstructorType("Implies", Seq(f1, f2))
-  val not = (f: SetType) => ConstructorType("Not", Seq(f))
-  val systemFormula: Set[Relation] = Set(
-    //Include(or(form, form), form),
-    //Include(implies(form, form), form),
-    //Include(not(form), form),
-    Include(form, u(or(form, form), not(form), implies(form, form))),
-    Include(u(or(form, form), not(form), implies(form, form)), form),
-    Include(or(not(ret), ret), tmp),
-    Include(not(ret), tmp),
-    Include(or(ret, ret), tmp),
-    Include(tmp, ret)
-    //Include(ret, tmp),
-  )
-
-
-
-  test("solver"){
-  /*
-    println("solving system:\n" + PrettyPrinter(And(system.toSeq)))
-    val oneLevelSystem = oneLevel(system, constructors)
-    println("one level system:\n" + PrettyPrinter(And(oneLevelSystem.toSeq)))
-    assert(isOneLevel(oneLevelSystem.asInstanceOf[Set[Relation]]))
-    val decrOrder = decreasingOrder(oneLevelSystem)
-    println("decreasing order system:\n" + PrettyPrinter(And(decrOrder.toSeq)))
-    val cascad = cascadingSystems(decrOrder, constructors)
-    println("cascading systems:\n" + cascad.map(sys => PrettyPrinter(And(sys.toSeq))))
-    val cascadEq = cascadingEquations(cascad)
-    println("cascading equations systems:\n" + cascadEq.map(sys => PrettyPrinter(And(sys.toSeq))))
-    val remTLV = removeTopLevelVars(cascadEq)
-    println("no top level vars systems:\n" + remTLV.map(sys => PrettyPrinter(And(sys.toSeq))))
-    val solvedSys = solvedForm(remTLV, constructors)
-    println("solved form systems:\n" + solvedSys.map(sys => PrettyPrinter(And(sys.toSeq))))
-    val fvs = freeVars(solvedSys.head)
-    println(fvs)
-    */
-
-    println("solving system:\n" + PrettyPrinter(systemFormula))
-    val oneLevelSystem = oneLevel(systemFormula.asInstanceOf[Set[Include]], constructorsForm)
-    assert(isOneLevel(oneLevelSystem.asInstanceOf[Set[Relation]]))
-    println("one level system:\n" + PrettyPrinter(And(oneLevelSystem.toSeq)))
-    val decrOrder = decreasingOrder(oneLevelSystem)
-    println("decreasing order system:\n" + PrettyPrinter(And(decrOrder.toSeq)))
-    val cascad = cascadingSystems(decrOrder, constructorsForm)
-    println("cascading systems:\n" + cascad.map(sys => PrettyPrinter(And(sys.toSeq))))
-    val cascadEq = cascadingEquations(cascad)
-    println("cascading equations systems:\n" + cascadEq.map(sys => PrettyPrinter(And(sys.toSeq))))
-    val remTLV = removeTopLevelVars(cascadEq)
-    println("no top level vars systems:\n" + remTLV.map(sys => PrettyPrinter(And(sys.toSeq))))
-    val solvedSys = solvedForm(remTLV, constructorsForm)
-    println("solved form systems:\n" + solvedSys.map(sys => PrettyPrinter(And(sys.toSeq))))
-    val fvs = freeVars(solvedSys.head)
-    println(fvs)
-  }
-}
diff --git a/src/setconstraints/ADTExtractor.scala b/src/setconstraints/ADTExtractor.scala
deleted file mode 100644
index 45647561a34e1d70d9b44972fca1625c961b2ff4..0000000000000000000000000000000000000000
--- a/src/setconstraints/ADTExtractor.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-package setconstraints
-
-import purescala.Definitions._
-import purescala.TypeTrees.ClassType
-import setconstraints.Trees._
-
-import scala.collection.mutable.HashMap
-
-object ADTExtractor {
-
-  def apply(pgm: Program): HashMap[ClassTypeDef, SetType] = {
-    val hm = new HashMap[ClassTypeDef, SetType]
-    var dcls = pgm.definedClasses
-    while(!dcls.isEmpty) {
-      val curr = dcls.head
-      if(curr.isInstanceOf[AbstractClassDef]) {
-        hm.put(curr, freshVar(curr.id.name))
-        dcls = dcls.filterNot(_ == curr)
-      } else if(curr.isInstanceOf[CaseClassDef]) {
-        val name = curr.id.name
-        val fields = curr.asInstanceOf[CaseClassDef].fields
-        try {
-          val l = fields.map(vd => hm(vd.tpe.asInstanceOf[ClassType].classDef)).toList
-          hm.put(curr, ConstructorType(name, l))
-          dcls = dcls.filterNot(_ == curr)
-        } catch {
-          case _: NoSuchElementException => {
-            dcls = dcls.tail ++ List(dcls.head)
-          }
-        }
-      } else error("Found a class which is neither an AbstractClassDef nor a CaseClassDef")
-    }
-    hm
-  }
-
-}
diff --git a/src/setconstraints/CnstrtGen.scala b/src/setconstraints/CnstrtGen.scala
deleted file mode 100644
index 611711034b7ce06a4f7cd7d06633245fb5efc562..0000000000000000000000000000000000000000
--- a/src/setconstraints/CnstrtGen.scala
+++ /dev/null
@@ -1,118 +0,0 @@
-package setconstraints
-
-import purescala.Definitions._
-import purescala.Trees.{And => _, Equals => _, _}
-import purescala.Common.Identifier
-import purescala.TypeTrees.ClassType
-
-import Trees._
-
-object CnstrtGen {
-  
-  def apply(pgm: Program,
-                typeVars: Map[ClassTypeDef, VariableType],
-                funVars: Map[FunDef, (Seq[VariableType], VariableType)],
-                cl2adt: Map[ClassTypeDef, SetType]
-              ): Set[Relation] = {
-
-    def unzip3[A,B,C](seqs: Seq[(A,B,C)]): (Seq[A],Seq[B],Seq[C]) = 
-      seqs.foldLeft((Seq[A](), Seq[B](), Seq[C]()))((a, t) => (t._1 +: a._1, t._2 +: a._2, t._3 +: a._3))
-
-    def cnstrExpr(expr: Expr, context: Map[Identifier, VariableType]): (VariableType, Seq[Relation], Map[Expr, VariableType]) = {
-      val exprVarType = freshVar("expr")
-      val (rels, e2t) = expr match {
-        case Variable(id) => {
-          (Seq(Equals(context(id), exprVarType)), Map[Expr, VariableType]())
-        }
-        case IfExpr(cond, then, elze) => {
-          val (tType, tCnstrs, tMap) = cnstrExpr(then, context)
-          val (eType, eCnstrs, eMap) = cnstrExpr(elze, context)
-          val newCnstrs = Equals(UnionType(Seq(tType, eType)), exprVarType) +: (tCnstrs ++ eCnstrs)
-          (newCnstrs, (tMap ++ eMap)) 
-        }
-        case MatchExpr(scrut, cases) => {
-          val (sType, sCnstrs, sMap) = cnstrExpr(scrut, context)
-          val (pts, ptexpcnstr) = cases.map(mc => {
-            val (pt, cnstrs, pvc) = pattern2Type(mc.pattern)
-            val (expT, expC, expM) = cnstrExpr(mc.rhs, context ++ pvc)
-            (pt, (expT, expC ++ cnstrs, expM))
-          }).unzip
-          val (cTypes, cCnstrs, cMaps) = unzip3(ptexpcnstr)
-          val mCnstrs = cTypes.map(t => Include(t, exprVarType))
-          val scrutPatternCnstr = Include(sType, UnionType(pts))
-          val fMap: Map[Expr, VariableType] = cMaps.foldLeft(sMap)((a, m) => a ++ m)
-          val finalCnstrs = scrutPatternCnstr +: (mCnstrs ++ cCnstrs.flatMap(x => x) ++ sCnstrs)
-          (finalCnstrs, fMap)
-        }
-        case FunctionInvocation(fd, args) => {
-          val (tArgs,rt) = funVars(fd)
-          /*
-          tArgs.zip(args).foreach{case (v, expr) => {
-              val (newT, newCnstr) = cnstrExpr(expr, context)
-              funCallsCnstr ++= newCnstr
-              funCallsCnstr += Include(newT, v)
-            }
-          }
-          */
-          (Seq(Equals(rt, exprVarType)), Map[Expr, VariableType]())
-        }
-        case CaseClass(ccd, args) => {
-          val (argsType, cnstrts, maps) = unzip3(args.map(e => cnstrExpr(e, context)))
-          val fMap = maps.foldLeft(Map[Expr, VariableType]())((a, m) => a ++ m)
-          val fcnstrts = Equals(ConstructorType(ccd.id.name, argsType), exprVarType) +: cnstrts.flatMap(x => x)
-          (fcnstrts, fMap)
-        }
-        case _ => error("Not yet supported: " + expr)
-      }
-      (exprVarType, rels, (e2t: Map[Expr, VariableType]) + (expr -> exprVarType))
-    }
-
-    def pattern2Type(pattern: Pattern): (VariableType, Seq[Relation], Map[Identifier, VariableType]) = pattern match {
-      case InstanceOfPattern(binder, ctd) => error("not yet supported")
-      case WildcardPattern(binder) => {
-        val v = freshVar(binder match {case Some(id) => id.name case None => "x"})
-        (v, Seq[Relation](), binder match {case Some(id) => Map(id -> v) case None => Map()})
-      }
-      case CaseClassPattern(binder, ccd, sps) => {
-        val cvt = freshVar(ccd.id.name)
-        val (subConsType, cnstrs, subVarType) = unzip3(sps.map(p => pattern2Type(p)))
-        val newMap = subVarType.foldLeft(Map[Identifier, VariableType]())((acc, el) => acc ++ el)
-        val nCnstrs: Seq[Relation] = subConsType.zip(ccd.fields).zip(sps).foldLeft(cnstrs.flatMap(x => x))((a, el) => el match {
-          case ((t, vd), sp) => sp match {
-            case WildcardPattern(_) => a :+ Equals(t, cl2adt(vd.tpe.asInstanceOf[ClassType].classDef))
-            case _ => a
-          }
-        })
-        val ccnstr = Equals(ConstructorType(ccd.id.name, subConsType), cvt)
-        (cvt, ccnstr +: nCnstrs, newMap)
-      }
-    }
-
-    def cnstrFun(fd: FunDef): (Seq[Relation], Map[Expr, VariableType]) = {
-      val argsT = funVars(fd)._1
-      val argsID = fd.args.map(vd => vd.id)
-      val context = argsID.zip(argsT).foldLeft(Map[Identifier, VariableType]())((acc, el) => acc + el)
-      val (bodyType, cnstrts, map) = cnstrExpr(fd.body.get, context)
-      (cnstrts :+ Include(bodyType, funVars(fd)._2), map)
-    }
-
-    def cnstrTypeHierarchy(pgm: Program): Seq[Relation] = {
-      val caseClasses = pgm.definedClasses.filter(_.isInstanceOf[CaseClassDef])
-      caseClasses.map(cc => Include(cl2adt(cc), cl2adt(cc.parent.get)))
-    }
-
-    def propagateEq(cnstrts: Set[Relation]): Set[Relation] = {
-      null
-    }
-
-    val cnstrtsTypes = cnstrTypeHierarchy(pgm)
-
-    val funs = pgm.definedFunctions
-    val (cnstrtsFunctions, map) = funs.foldLeft(Seq[Relation](), Map[Expr, VariableType]())((a, f) => {
-      val (rels, m) = cnstrFun(f)
-      (a._1 ++ rels, a._2 ++ m)
-    })
-    (cnstrtsTypes ++ cnstrtsFunctions).toSet
-  }
-
-}
diff --git a/src/setconstraints/ConstraintsGenerator.scala b/src/setconstraints/ConstraintsGenerator.scala
deleted file mode 100644
index a7b34f2a60a085ea022038616f37a7f14dce3177..0000000000000000000000000000000000000000
--- a/src/setconstraints/ConstraintsGenerator.scala
+++ /dev/null
@@ -1,209 +0,0 @@
-package setconstraints
-
-import purescala.Definitions._
-import purescala.Trees.{And => _, Equals => _, _}
-import purescala.Common.Identifier
-import purescala.TypeTrees.ClassType
-
-import Trees._
-import Tools._
-import Manip._
-
-object ConstraintsGenerator {
-
-  def apply(pgm: Program): (Set[Relation], Set[VariableType], Map[String, Int]) = {
-    val (traits, constructors) = adtExtractors(pgm)
-    val funVars = labelFunction(pgm)
-
-    val cnstrtsTypes = constraintsTypes(pgm.definedClasses, constructors, traits)
-    val (cnstrtsFuns, exprMap) = constraintsFuns(pgm.definedFunctions, funVars, traits, constructors)
-
-    val rels = cnstrtsTypes ++ cnstrtsFuns
-    val frels = propagateEq(rels, traits.values.toSet ++ funVars.values.unzip._2.toSet)
-
-    (frels, traits.map{
-      case (_, v) => v
-    }.toSet, constructors.map{
-      case (_, ConstructorType(n, sts)) => (n, sts.size)
-    })
-  }
-
-  def constraintsExpr(expr: Expr, 
-                      context: Map[Identifier, VariableType], 
-                      funVars: Map[FunDef, (Seq[VariableType], VariableType)],
-                      traits: Map[AbstractClassDef, VariableType],
-                      constructors: Map[CaseClassDef, ConstructorType]): (VariableType, Set[Relation], Map[Expr, VariableType]) = {
-
-    val cl2adt: Map[ClassTypeDef, SetType] = traits.asInstanceOf[Map[ClassTypeDef, SetType]] ++ constructors.asInstanceOf[Map[ClassTypeDef, SetType]]
-
-    def pattern2Type(pattern: Pattern): (VariableType, Set[Relation], Map[Identifier, VariableType]) = pattern match {
-      case InstanceOfPattern(binder, ctd) => error("not yet supported")
-      case WildcardPattern(binder) => {
-        val v = freshVar(binder match {case Some(id) => id.name case None => "x"})
-        (v, Set[Relation](), binder match {case Some(id) => Map(id -> v) case None => Map()})
-      }
-      case CaseClassPattern(binder, ccd, sps) => {
-        val cvt = freshVar(ccd.id.name)
-        val (subConsType, cnstrs, subVarType) = unzip3(sps.map(p => pattern2Type(p)))
-        val newMap = subVarType.foldLeft(Map[Identifier, VariableType]())((acc, el) => acc ++ el)
-        val nCnstrs: Set[Relation] = subConsType.zip(ccd.fields).zip(sps).foldLeft(cnstrs.toSet.flatten)((a, el) => el match {
-          case ((t, vd), sp) => {
-            val cd = vd.tpe.asInstanceOf[ClassType].classDef
-            val cdt = cl2adt(cd)
-            sp match {
-              case WildcardPattern(_) => a + Equals(t, cdt)
-              case _ => a
-            }
-          }
-        })
-        val ccnstr = Equals(ConstructorType(ccd.id.name, subConsType), cvt)
-        (cvt, nCnstrs + ccnstr, newMap ++ (binder match {case Some(id) => Map(id -> cvt) case None => Map()}))
-      }
-    }
-
-    def constraintsExpr0(expr: Expr, context: Map[Identifier, VariableType]): (VariableType, Set[Relation], Map[Expr, VariableType]) = {
-      val exprVarType = freshVar("expr")
-      val (rels, e2t) = expr match {
-        case Variable(id) => {
-          (Set[Relation](Equals(context(id), exprVarType)), Map[Expr, VariableType]())
-        }
-        case IfExpr(cond, then, elze) => {
-          val (tType, tCnstrs, tMap) = constraintsExpr0(then, context)
-          val (eType, eCnstrs, eMap) = constraintsExpr0(elze, context)
-          val newCnstrs = (tCnstrs ++ eCnstrs) + Equals(UnionType(Seq(tType, eType)), exprVarType)
-          (newCnstrs, (tMap ++ eMap))
-        }
-        case MatchExpr(scrut, cases) => {
-          val (sType, sCnstrs, sMap) = constraintsExpr0(scrut, context)
-          val (pts, ptexpcnstr) = cases.map(mc => {
-            val (pt, cnstrs, pvc) = pattern2Type(mc.pattern)
-            val (expT, expC, expM) = constraintsExpr0(mc.rhs, context ++ pvc)
-            (pt, (expT, expC ++ cnstrs, expM))
-          }).unzip
-          val (cTypes, cCnstrs, cMaps) = unzip3(ptexpcnstr)
-          val mCnstrs: Set[Relation] = cTypes.toSet.map((t: VariableType) => Include(t, exprVarType))
-          val scrutPatternCnstr: Relation = Include(sType, UnionType(pts))
-          val fMap: Map[Expr, VariableType] = cMaps.foldLeft(sMap)((a, m) => a ++ m)
-          val finalCnstrs = (mCnstrs ++ cCnstrs.flatten ++ sCnstrs) + scrutPatternCnstr 
-          (finalCnstrs, fMap)
-        }
-        case FunctionInvocation(fd, args) => {
-          val (tArgs,rt) = funVars(fd)
-          (Set[Relation](Equals(rt, exprVarType)), Map[Expr, VariableType]())
-        }
-        case CaseClass(ccd, args) => {
-          val test = args.map(e => constraintsExpr0(e, context))
-          val (argsType, cnstrts, maps) = unzip3(test)
-          val fMap = maps.foldLeft(Map[Expr, VariableType]())((a, m) => a ++ m)
-          val fcnstrts = cnstrts.toSet.flatten + Equals(ConstructorType(ccd.id.name, argsType), exprVarType)
-          (fcnstrts, fMap)
-        }
-        case _ => error("Not yet supported: " + expr)
-      }
-      (exprVarType, rels, (e2t: Map[Expr, VariableType]) + (expr -> exprVarType))
-    }
-
-    constraintsExpr0(expr, context)
-  }
-
-  def propagateEq(cnstrts: Set[Relation], keywords: Set[VariableType]): Set[Relation] = {
-    def iter(cnstrts: Set[Relation]): Set[Relation] = {
-      /*
-      cnstrts.foldLeft(cnstrts)((a, rel) => rel match {
-        case Equals(v1@VariableType(_), v2@VariableType(_)) if traits.contains(v1) =>
-          (a - rel).map(substitute(_, v2, v1))
-        case Equals(v1@VariableType(_), v2@VariableType(_)) if traits.contains(v2) =>
-          (a - rel).map(substitute(_, v1, v2))
-        case _ => a
-      }
-      val (eq, rest) = extract((rel: Relation) => rel match {
-        case Equals(v1@VariableType(_), v2@VariableType(_)) if traits.contains(v1) || traits.contains(v2) => true
-        case _ => false
-      }, cnstrts)
-      eq match {
-        case None => cnstrts
-        case Some(Equals(v1@VariableType(_), v2@VariableType(_))) if traits.contains(v1) => rest.map(substitute(_, v2, v1))
-        case Some(Equals(v1@VariableType(_), v2@VariableType(_))) if traits.contains(v2) => rest.map(substitute(_, v1, v2))
-        case _ => error("no way...")
-      }
-      */
-      val (eq, rest) = extract((rel: Relation) => rel match {
-        case Equals(v@VariableType(_), s) if !keywords.contains(v) => true
-        case Equals(s, v@VariableType(_)) if !keywords.contains(v) => true
-        case _ => false
-      }, cnstrts)
-      eq match {
-        case None => cnstrts
-        case Some(Equals(v@VariableType(_), s)) if !keywords.contains(v) => rest.map(substitute(_, v, s))
-        case Some(Equals(s, v@VariableType(_))) if !keywords.contains(v) => rest.map(substitute(_, v, s))
-        case _ => error("no way...")
-      }
-    }
-    fix(iter, cnstrts)
-  }
-
-
-  def constraintsFuns(fds: Seq[FunDef],
-                      funVars: Map[FunDef, (Seq[VariableType], VariableType)],
-                      traits: Map[AbstractClassDef, VariableType],
-                      constructors: Map[CaseClassDef, ConstructorType]): (Set[Relation], Map[Expr, VariableType]) =
-    fds.foldLeft(Set[Relation](), Map[Expr, VariableType]())((a, f) => {
-      val (rels, m) = constraintsFun(f, funVars, traits, constructors)
-      (a._1 ++ rels, a._2 ++ m)
-    })
-
-  def constraintsFun(fd: FunDef, 
-                     funVars: Map[FunDef, (Seq[VariableType], VariableType)],
-                     traits: Map[AbstractClassDef, VariableType],
-                     constructors: Map[CaseClassDef, ConstructorType]): (Set[Relation], Map[Expr, VariableType]) = {
-    val argsT = funVars(fd)._1
-    val argsID = fd.args.map(vd => vd.id)
-    val context = argsID.zip(argsT).foldLeft(Map[Identifier, VariableType]())((acc, el) => acc + el)
-    val (bodyType, cnstrts, map) = constraintsExpr(fd.body.get, context, funVars, traits, constructors)
-    (cnstrts + Equals(bodyType, funVars(fd)._2), map)
-  }
-
-  def constraintsTypes(cls: Seq[ClassTypeDef], constructors: Map[CaseClassDef, ConstructorType], traits: Map[AbstractClassDef, VariableType]): Set[Relation] = {
-    val caseClasses: Seq[CaseClassDef] = cls.filter(_.isInstanceOf[CaseClassDef]).asInstanceOf[Seq[CaseClassDef]]
-    caseClasses.map(cc => {
-      val parent: AbstractClassDef = cc.parent.get
-      Include(constructors(cc), traits(parent))
-    }).toSet
-  }
-
-  def labelFunction(pgm: Program): Map[FunDef, (Seq[VariableType], VariableType)] =
-    pgm.definedFunctions.foldLeft(Map[FunDef, (Seq[VariableType], VariableType)]())((a, fd) => {
-      val varTypes = (fd.args.map(vd => freshVar(fd.id.name + "_arg_" + vd.id.name)), freshVar(fd.id.name + "_return"))
-      a + (fd -> varTypes)
-    })
-
-  def adtExtractors(pgm: Program): (Map[AbstractClassDef, VariableType], Map[CaseClassDef, ConstructorType]) = {
-    import scala.collection.mutable.HashMap
-    val traits = new HashMap[AbstractClassDef, VariableType]
-    val constructors = new HashMap[CaseClassDef, ConstructorType]
-    var dcls = pgm.definedClasses
-    while(!dcls.isEmpty) {
-      val curr = dcls.head
-      if(curr.isInstanceOf[AbstractClassDef]) {
-        val trai = curr.asInstanceOf[AbstractClassDef]
-        traits.put(trai, freshVar(curr.id.name))
-        dcls = dcls.filterNot(_ == trai)
-      } else if(curr.isInstanceOf[CaseClassDef]) {
-        val cc = curr.asInstanceOf[CaseClassDef]
-        val name = cc.id.name
-        val fields = cc.fields
-        try {
-          val l = fields.map(vd => traits(vd.tpe.asInstanceOf[ClassType].classDef.asInstanceOf[AbstractClassDef])).toList //hack, fields might be case class too
-          constructors.put(cc, ConstructorType(name, l))
-          dcls = dcls.filterNot(_ == cc)
-        } catch {
-          case _: NoSuchElementException => {
-            dcls = dcls.tail ++ List(dcls.head)
-          }
-        }
-      } else error("Found a class which is neither an AbstractClassDef nor a CaseClassDef")
-    }
-    (Map(traits.toSeq: _*), Map(constructors.toSeq: _*))
-  }
-
-}
diff --git a/src/setconstraints/LabelProgram.scala b/src/setconstraints/LabelProgram.scala
deleted file mode 100644
index 0abf494096d9a856666743e97ca809a895eb038c..0000000000000000000000000000000000000000
--- a/src/setconstraints/LabelProgram.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-package setconstraints
-
-import scala.collection.mutable.{Map, HashMap}
-
-import purescala.Definitions._
-import setconstraints.Trees._
-
-object LabelProgram {
-
-  def apply(pgm: Program): (Map[ClassTypeDef, VariableType],
-    Map[FunDef, (Seq[VariableType], VariableType)]) =
-      (labelTypeHierarchy(pgm), labelFunction(pgm))
-
-
-  private def labelFunction(pgm: Program): Map[FunDef, (Seq[VariableType], VariableType)] = {
-    val hm = new HashMap[FunDef, (Seq[VariableType], VariableType)]
-    pgm.definedFunctions.foreach(fd => {
-      val varTypes = (fd.args.map(vd => freshVar(fd.id.name + "_arg_" + vd.id.name)), freshVar(fd.id.name + "_return"))
-      hm.put(fd, varTypes)
-    })
-    hm
-  }
-
-  private def labelTypeHierarchy(pgm: Program): Map[ClassTypeDef, VariableType] = {
-    val hm = new HashMap[ClassTypeDef, VariableType]
-    pgm.definedClasses.foreach(clDef => hm.put(clDef, freshVar(clDef.id.name)))
-    hm
-  }
-}
diff --git a/src/setconstraints/Main.scala b/src/setconstraints/Main.scala
deleted file mode 100644
index 9d4d061a711e0ccc9d07626c56bb46c0e62f40e3..0000000000000000000000000000000000000000
--- a/src/setconstraints/Main.scala
+++ /dev/null
@@ -1,20 +0,0 @@
-package setconstraints
-
-import Trees._
-import purescala.Definitions.Program
-import purescala.Definitions.AbstractClassDef
-import purescala.Reporter
-import purescala.Extensions.Analyser
-
-class Main(reporter: Reporter) extends Analyser(reporter) {
-  val description: String = "Analyser for advanced type inference based on set constraints"
-  override val shortDescription = "Set constraints"
-
-  def analyse(pgm: Program) : Unit = {
-    val (cnstr, traits, constructors) = ConstraintsGenerator(pgm)
-    reporter.info("The constraints are: " + PrettyPrinter(cnstr))
-    val solvedSystem = Solver.solve(cnstr, constructors)
-    reporter.info("The solved systems are: " + solvedSystem.map(sys => PrettyPrinter(And(sys))))
-  }
-
-}
diff --git a/src/setconstraints/Manip.scala b/src/setconstraints/Manip.scala
deleted file mode 100644
index 541db24c264ddbc5e241c08e97c75239bb6519ca..0000000000000000000000000000000000000000
--- a/src/setconstraints/Manip.scala
+++ /dev/null
@@ -1,281 +0,0 @@
-package setconstraints
-
-import setconstraints.Trees._
-
-object Manip {
-
-  def mapPostorder(s: SetType, f: (SetType) => SetType): SetType = s match {
-    case EmptyType | UniversalType | VariableType(_) => f(s)
-    case UnionType(sts) => f(UnionType(sts.map(s => mapPostorder(s, f))))
-    case IntersectionType(sts) => f(IntersectionType(sts.map(s => mapPostorder(s, f))))
-    case ComplementType(s) => f(ComplementType(mapPostorder(s, f)))
-    case ConstructorType(n@_, sts) => f(ConstructorType(n, sts.map(s => mapPostorder(s, f))))
-    case FunctionType(s1, s2) => {
-      val ns1 = mapPostorder(s1, f)
-      val ns2 = mapPostorder(s2, f)
-      f(FunctionType(ns1, ns2))
-    }
-    case TupleType(sts) => f(TupleType(sts.map(s => f(s))))
-  }
-  def mapPostorder(f: Formula, ff: (Formula) => Formula, ft: (SetType) => SetType): Formula = f match {
-    case And(fs) => ff(And(fs.map(f => mapPostorder(f, ff, ft))))
-    case Include(s1, s2) => {
-      val ns1 = mapPostorder(s1, ft)
-      val ns2 = mapPostorder(s2, ft)
-      ff(Include(ns1, ns2))
-    }
-    case Equals(s1, s2) => {
-      val ns1 = mapPostorder(s1, ft)
-      val ns2 = mapPostorder(s2, ft)
-      ff(Equals(ns1, ns2))
-    }
-  }
-
-  def mapPreorder(s: SetType, f: (SetType) => SetType): SetType = {
-    val ns = f(s) 
-    ns match {
-      case EmptyType | UniversalType | VariableType(_) => ns
-      case UnionType(sts) => UnionType(sts.map(s => mapPreorder(s, f)))
-      case IntersectionType(sts) => IntersectionType(sts.map(s => mapPreorder(s, f)))
-      case ComplementType(s) => ComplementType(mapPreorder(s, f))
-      case ConstructorType(n@_, sts) => ConstructorType(n, sts.map(s => mapPreorder(s, f)))
-      case FunctionType(s1, s2) => {
-        val ns1 = mapPreorder(s1, f)
-        val ns2 = mapPreorder(s2, f)
-        FunctionType(ns1, ns2)
-      }
-      case TupleType(sts) => TupleType(sts.map(s => f(s)))
-    }
-  }
-  def mapPreorder(f: Formula, ff: (Formula) => Formula, ft: (SetType) => SetType): Formula = ff(f) match {
-    case And(fs) => And(fs.map(f => mapPreorder(f, ff, ft)))
-    case Include(s1, s2) => {
-      val ns1 = mapPreorder(s1, ft)
-      val ns2 = mapPreorder(s2, ft)
-      Include(ns1, ns2)
-    }
-    case Equals(s1, s2) => {
-      val ns1 = mapPreorder(s1, ft)
-      val ns2 = mapPreorder(s2, ft)
-      Equals(ns1, ns2)
-    }
-  }
-  
-  def mapPreorderWhile(s: SetType, f: (SetType) => SetType, p: (SetType) => Boolean): SetType = {
-    val ns = f(s) 
-    if(!p(ns)) ns else ns match {
-      case EmptyType | UniversalType | VariableType(_) => ns
-      case UnionType(sts) => UnionType(sts.map(s => mapPreorderWhile(s, f, p)))
-      case IntersectionType(sts) => IntersectionType(sts.map(s => mapPreorderWhile(s, f, p)))
-      case ComplementType(s) => ComplementType(mapPreorderWhile(s, f, p))
-      case ConstructorType(n@_, sts) => ConstructorType(n, sts.map(s => mapPreorderWhile(s, f, p)))
-      case FunctionType(s1, s2) => {
-        val ns1 = mapPreorderWhile(s1, f, p)
-        val ns2 = mapPreorderWhile(s2, f, p)
-        FunctionType(ns1, ns2)
-      }
-      case TupleType(sts) => TupleType(sts.map(s => f(s)))
-    }
-  }
-  def fold[A](s: SetType, z: A)(f: (A, SetType) => A): A = s match {
-    case EmptyType | UniversalType | VariableType(_) => f(z, s)
-    case u@UnionType(sts) => f(sts.foldLeft(z)((a, s) => fold(s, a)(f)), u)
-    case i@IntersectionType(sts) => f(sts.foldLeft(z)((a, s) => fold(s, a)(f)), i)
-    case c@ComplementType(s) => f(fold(s, z)(f), c)
-    case c@ConstructorType(_, sts) => f(sts.foldLeft(z)((a, s) => fold(s, a)(f)), c)
-    case ft@FunctionType(s1, s2) => {
-      val tmp1 = fold(s1, z)(f)
-      val tmp2 = fold(s2, tmp1)(f)
-      f(tmp2, ft)
-    }
-    case t@TupleType(sts) => f(sts.foldLeft(z)((a, s) => fold(s, a)(f)), t)
-  }
-  def fold[A](f: Formula, z: A)(ff: (A, Formula) => A, ft: (A, SetType) => A): A = f match {
-    case a@And(fs) => ff(fs.foldLeft(z)((a, f) => fold(f, a)(ff, ft)), a)
-    case i@Include(s1, s2) => {
-      val tmp1 = fold(s1, z)(ft)
-      val tmp2 = fold(s2, tmp1)(ft)
-      ff(tmp2, i)
-    }
-    case eq@Equals(s1, s2) => {
-      val tmp1 = fold(s1, z)(ft)
-      val tmp2 = fold(s2, tmp1)(ft)
-      ff(tmp2, eq)
-    }
-  }
-
-  def simplify(s: SetType): SetType = {
-    def simplifyOne(s: SetType): SetType = s match {
-      case UnionType(Seq()) => EmptyType
-      case UnionType(sts) if sts.exists(isUniversalType) => UniversalType
-      case u@UnionType(_) => {
-        val UnionType(sts) = flatten(u)
-        if(sts.exists(s1 => sts.exists(s2 => isInverse(s1, s2))))
-          UniversalType
-        else {
-          val nsts = sts.filterNot(isEmptyType)
-          nsts match {
-            case Seq() => EmptyType
-            case Seq(s) => s
-            case _ => UnionType(nsts.distinct)
-          }
-        }
-      }
-      case IntersectionType(Seq()) => UniversalType
-      case IntersectionType(sts) if sts.exists(isEmptyType) => EmptyType
-      case i@IntersectionType(_) => {
-        val IntersectionType(sts) = flatten(i)
-        if (sts.exists(s1 => sts.exists(s2 => isIncompatible(s1, s2))))
-          EmptyType
-        else {
-          val nsts = sts.filterNot(isUniversalType)
-          nsts match {
-            case Seq() => UniversalType
-            case Seq(s) => s
-            case _ => IntersectionType(nsts.distinct)
-          }
-        }
-      }
-      case ComplementType(EmptyType) => UniversalType
-      case ComplementType(UniversalType) => EmptyType
-      case ComplementType(ComplementType(s)) => s
-      case ConstructorType(_, args) if args.exists(isEmptyType) => EmptyType
-      case s => s
-    }
-    mapPostorder(s, simplifyOne)
-  }
-
-  def vars(f: Formula): Set[String] = fold(f, Set[String]())((a, f) => a, (a, s) => s match {
-    case VariableType(name) => a + name
-    case _ => a
-  })
-  def vars(s: SetType): Set[String] = fold(s, Set[String]())((a, s) => s match {
-    case VariableType(name) => a + name
-    case _ => a
-  })
-
-  def constructors(f: Formula): Set[String] = fold(f, Set[String]())((a, f) => a, (a, s) => s match {
-    case ConstructorType(n, _) => a + n
-    case _ => a
-  })
-  def constructors(s: SetType): Set[String] = fold(s, Set[String]())((a, s) => s match {
-    case ConstructorType(n, _) => a + n
-    case _ => a
-  })
-
-  def substitute(s: SetType, ov: VariableType, ns: SetType): SetType = mapPostorder(s, {
-    case v@VariableType(_) if v == ov => ns
-    case s => s
-  })
-  def substitute(s: SetType, maps: Map[VariableType, SetType]): SetType = mapPostorder(s, {
-    case v@VariableType(_) if maps.contains(v) => maps(v)
-    case s => s
-  })
-
-  def substitute(r: Relation, ov: VariableType, ns: SetType): Relation = mapPostorder(r, (f: Formula) => f, (s: SetType) => s match {
-    case v@VariableType(_) if v == ov => ns
-    case s => s
-  }).asInstanceOf[Relation]
-  def substitute(r: Relation, maps: Map[VariableType, SetType]): Relation = mapPostorder(r, (f: Formula) => f, (s: SetType) => s match {
-    case v@VariableType(_) if maps.contains(v) => maps(v)
-    case s => s
-  }).asInstanceOf[Relation]
-
-/*
-  def dnf(s: SetType): SetType = {
-    def dnf0(s: SetType) = s match {
-      case EmptyType | UniversalType | VariableType(_) | ConstructorType(_, _) => UnionType(Seq(IntersectionType(Seq(s))))
-      case UnionType(sts) => UnionType(sts.flatMap{
-        case UnionType(sts2) => sts2
-        case _ => error("not dnf")
-      })
-      case ComplementType(UnionType(sts)) => dnf0(IntersectionType(sts.map{
-        case IntersectionType(sts2) => UnionType(sts2.map{
-          case ComplementType(s) => IntersectionType(Seq(s))
-          case s => IntersectionType(Seq(ComplementType(s)))
-        })
-        case _ => error("not dnf")
-      }))
-      case IntersectionType(sts) => UnionType(sts.flatMap{
-        case UnionType(sts2) => 
-      case _ => error("not dnf")
-    }
-    mapPostorder(s, dnf0)
-  }
-  */
-
-  def nnf(s: SetType, constructors: Map[String, Int]): SetType = {
-    def nnf0(s: SetType) = s match {
-      case ComplementType(EmptyType) => UniversalType
-      case ComplementType(UniversalType) => EmptyType
-      case ComplementType(ComplementType(s)) => s
-      case ComplementType(UnionType(sts)) => IntersectionType(sts.map(s => ComplementType(s)))
-      case ComplementType(IntersectionType(sts)) => UnionType(sts.map(s => ComplementType(s)))
-      case ComplementType(ConstructorType(name, sts)) =>
-        UnionType(constructors.flatMap{case (n, a) => {
-          if(n != name) 
-            Seq(ConstructorType(n, (1 to a).map(_ => UniversalType)))
-          else
-            sts.zipWithIndex.map{
-              case (s, i1) => ConstructorType(name, sts.zipWithIndex.map{
-                case (_, i2) => if(i1 == i2) ComplementType(s) else UniversalType
-              })
-            }
-        }}.toSeq)
-      case _ => s
-    }
-    mapPreorder(s, nnf0)
-  }
-
-  def flatten(formula: Formula): Formula = {
-    def flatten0(f: Formula) = f match {
-      case And(fs) => And(fs.flatMap{
-          case And(fs2) => fs2
-          case f => List(f)
-        })
-      case f => f
-    }
-    mapPostorder(formula, flatten0, s => s)
-  }
-  def flatten(setType: SetType): SetType = {
-    def flatten0(s: SetType) = s match {
-      case UnionType(sts) => UnionType(sts.flatMap{
-          case UnionType(sts2) => sts2
-          case s => List(s)
-        })
-      case IntersectionType(sts) => IntersectionType(sts.flatMap{
-          case IntersectionType(sts2) => sts2
-          case s => List(s)
-        })
-      case s => s
-    }
-    mapPostorder(setType, flatten0)
-  }
-
-  def includes(f: Formula): Seq[Include] = flatten(f) match {
-    case And(fs) if fs.forall(isRelation) => fs.flatMap(f => removeEquals(f.asInstanceOf[Relation]))
-    case f@_ => error("unexpected formula :" + f)
-  }
-
-  def removeEquals(r: Relation): Seq[Include] = r match {
-    case Equals(s1, s2) => Seq(Include(s1, s2), Include(s2, s1))
-    case i@Include(_,_) => Seq(i)
-  }
-
-  private def isRelation(f: Formula): Boolean = f.isInstanceOf[Relation]
-
-  private def isUniversalType(s: SetType): Boolean = s == UniversalType
-  private def isEmptyType(s: SetType): Boolean = s == EmptyType
-  private def isInverse(s1: SetType, s2: SetType): Boolean = (s1, s2) match {
-    case (ComplementType(s1), s2) if s1 == s2 => true
-    case (s1, ComplementType(s2)) if s1 == s2 => true
-    case _ => false
-  }
-  private def isIncompatible(s1: SetType, s2: SetType): Boolean = (s1, s2) match {
-    case (ComplementType(s1), s2) if s1 == s2 => true
-    case (s1, ComplementType(s2)) if s1 == s2 => true
-    case (ConstructorType(n1, _), ConstructorType(n2, _)) if n1 != n2 => true
-    case _ => false
-  }
-
-}
diff --git a/src/setconstraints/MatchAnalyzer.scala b/src/setconstraints/MatchAnalyzer.scala
deleted file mode 100644
index 3fd4cb3e99cd781fde0741950f5d368f61cf98a4..0000000000000000000000000000000000000000
--- a/src/setconstraints/MatchAnalyzer.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-package setconstraints
-
-import Trees._
-import purescala.Definitions.Program
-import purescala.Reporter
-
-object MatchAnalyzer {
-
-  def apply(pgm: Program, fixPoints: Seq[Equals], reporter: Reporter) {
-
-  }
-
-}
diff --git a/src/setconstraints/PrettyPrinter.scala b/src/setconstraints/PrettyPrinter.scala
deleted file mode 100644
index cbb6f575ae0113312abf5e55c037016eb7963616..0000000000000000000000000000000000000000
--- a/src/setconstraints/PrettyPrinter.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-package setconstraints
-
-import setconstraints.Trees._
-
-object PrettyPrinter {
-
-  def apply(rels: Set[Relation]) = ppFormula(And(rels.toSeq))
-
-  def apply(f: Formula): String = ppFormula(f)
-
-  def apply(st: SetType): String = ppSetType(st)
-
-//  def apply(fp: FixPoint): String = ppFixPoint(fp)
-
-  private def ppFormula(f: Formula): String = f match {
-    case And(fs) => fs.map(ppFormula).mkString("(\n  ", "\n \u2227 ", ")")
-    case Include(s1, s2) => ppSetType(s1) + " \u2286 " + ppSetType(s2)
-    case Equals(s1, s2) => ppSetType(s1) + " = " + ppSetType(s2)
-  }
-
-  private def ppSetType(st: SetType): String = st match {
-    case ConstructorType(name, Seq()) => name
-    case ConstructorType(name, sts) => name + sts.map(ppSetType).mkString("(", ", ", ")")
-    case UnionType(Seq()) => "0"
-    case UnionType(Seq(s)) => ppSetType(s)
-    case UnionType(sts) => sts.map(ppSetType).mkString("(", " \u222A ", ")")
-    case IntersectionType(Seq()) => "1"
-    case IntersectionType(Seq(s)) => ppSetType(s)
-    case IntersectionType(sts) => sts.map(ppSetType).mkString("(", " \u2229 ", ")")
-    case ComplementType(s) => "\u00AC" + ppSetType(s)
-    case FunctionType(s1, s2) => "(" + ppSetType(s1) + " --> " + ppSetType(s2) + ")"
-    case TupleType(sts) => sts.map(ppSetType).mkString("(", ", ", ")")
-    case VariableType(name) => name
-    case EmptyType => "0"
-    case UniversalType => "1"
-  }
-/*
-  private def ppFixPoint(fp: FixPoint): String = fp match {
-    case FixPoint(t, s) => ppSetType(t) + " = " + ppSetType(s)
-  }
-  */
-}
diff --git a/src/setconstraints/Solver.scala b/src/setconstraints/Solver.scala
deleted file mode 100644
index f57549ba4b5135d03e68b1d2b5cfad971f450bdb..0000000000000000000000000000000000000000
--- a/src/setconstraints/Solver.scala
+++ /dev/null
@@ -1,490 +0,0 @@
-package setconstraints
-
-import Trees._
-import Manip._
-import Tools._
-
-object Solver {
-
-  def apply(system: Set[Relation], constructors: Map[String, Int]): Option[Map[VariableType, SetType]] = {
-    val solvedSystems = solve(system, constructors)
-    if(solvedSystems.isEmpty)
-      None
-    else {
-      val sys = solvedSystems.head
-      val freeVarsMap = Map(freeVars(sys).map(v => (v, EmptyType)).toSeq: _*)
-      val system = sys.map{case Equals(v, s) => Equals(v, simplify(substitute(s, freeVarsMap)))}
-      val initMap: Map[VariableType, SetType] = Map(system.map{case Equals(v, _) => (v.asInstanceOf[VariableType], EmptyType)}.toSeq: _*)
-      println(system.map(PrettyPrinter(_)))
-      Some(fix(
-        (m: Map[VariableType, SetType]) => {
-          println("new iteration")
-          println(m.map{case (v, s) => (PrettyPrinter(v), PrettyPrinter(s))})
-          val ns = system.map{case Equals(v, s) => Equals(v, simplify(substitute(s, m)))}
-          println(ns.map(PrettyPrinter(_)))
-          Map(ns.map{case Equals(v, s) => (v.asInstanceOf[VariableType], s)}.toSeq: _*)
-        },
-        initMap))
-    }
-  }
-
-  def solve(system: Set[Relation], constructors: Map[String, Int]): Set[Seq[Equals]] = {
-    val includes = system.flatMap(Manip.removeEquals)
-    val oneLevelSystem = oneLevel(includes, constructors)
-    val decrOrder = decreasingOrder(oneLevelSystem)
-    val cascad = cascadingSystems(decrOrder, constructors)
-    val cascadEq = cascadingEquations(cascad)
-    val remTLV = removeTopLevelVars(cascadEq)
-    val solvedSys = solvedForm(remTLV, constructors)
-    solvedSys
-  }
-
-  def freeVars(system: Seq[Equals]): Set[VariableType] = {
-    val bvs = system.map{case Equals(v, _) => v}.toSet
-    system.foldLeft(Set[VariableType]())((a, eq) => eq match {
-      case Equals(_, s) => a ++ Manip.vars(s).filter((v: String) => !bvs.contains(VariableType(v))).map(VariableType(_))
-    })
-  }
-
-  def solvedForm(systems: Set[Seq[Equals]], constructors: Map[String, Int]): Set[Seq[Equals]] = {
-    def substComp(s: SetType, ov: VariableType, ns: SetType) = mapPostorder(s, {
-      case ComplementType(v@VariableType(_)) if v == ov => ns
-      case s => s
-    })
-    def solvedForm(system: Seq[Equals]): Seq[Equals] = {
-      val vs: Seq[VariableType] = system.map{case Equals(v@VariableType(_), _) => v case _ => error("not cascading equations")}
-      val nvs = vs.map{case VariableType(n) => freshVar(n)}
-      def doAllSubst(s: SetType): SetType = vs.zip(nvs).foldLeft(s)((a, p) => p match {
-        case (v, nv) => substComp(a, v, nv)
-      })
-      val nps = system.zip(nvs).map{
-        case (Equals(v@VariableType(_), s), nv) => Equals(v, doAllSubst(nnf(s, constructors)))
-        case _ => error("not format")
-      }
-      val nns = system.zip(nvs).map{
-        case (Equals(v@VariableType(_), s), nv) => Equals(nv, doAllSubst(nnf(ComplementType(s), constructors)))
-        case _ => error("not format")
-      }
-      val nnns = nns.zipWithIndex.filter{
-        case (Equals(VariableType(n), s), i) =>
-          nps.exists{case Equals(_, s2) => Manip.vars(s2).exists(_ == n)} ||
-          nns.zipWithIndex.exists{case (Equals(_, s2), i2) => i != i2 && Manip.vars(s2).exists(_ == n)}
-        case _ => error("unexpected")
-      }.unzip._1
-      nps ++ nnns
-    }
-    systems.map(solvedForm)
-  }
-
-  def removeTopLevelVars(systems: Set[Seq[Equals]]): Set[Seq[Equals]] = {
-    def removeTopLevelVars0(system: Seq[Equals]): Seq[Equals] = {
-      def subst(s: SetType, ov: VariableType, eqs: Seq[Equals]) = eqs.find{case Equals(v, _) => v == ov} match {
-        case Some(Equals(_, ns)) => mapPreorderWhile(s, {
-          case v@VariableType(_) if v == ov => ns
-          case s => s
-        }, {
-          case ConstructorType(_, _) => false
-          case _ => true
-        })
-        case None => s
-      }
-      system.foldLeft(Seq[Equals]())((initEqs, eq) => eq match {
-          case Equals(v, s) => {
-            val ns = Manip.vars(s).foldLeft(s)((a, v) => subst(a, VariableType(v), initEqs))
-            initEqs :+ Equals(v, simplify(ns))
-          }
-      })
-    }
-    systems.map(removeTopLevelVars0)
-  }
-
-  def cascadingEquations(systems: Set[Set[Include]]): Set[Seq[Equals]] = {
-    def cascadingEquations0(system: Set[Include]): Seq[Equals] = {
-      val vs = vars(system).toSeq
-      val nvs = vs.map(freshVar(_))
-      val ts = vs.zip(nvs).map{case (v, nv) => {
-        val lb = UnionType(system.flatMap{
-          case Include(IntersectionType(lits), EmptyType) if !lits.isEmpty && lits.head == ComplementType(VariableType(v)) => lits.tail
-          case _ => Seq()
-        }.toSeq)
-        val ub = IntersectionType(system.flatMap{
-          case Include(IntersectionType(lits), EmptyType) if !lits.isEmpty && lits.head == VariableType(v) => 
-            Seq(ComplementType(IntersectionType(lits.tail)))
-          case _ => Seq()
-        }.toSeq)
-        UnionType(Seq(lb, IntersectionType(Seq(nv, ub))))
-      }}
-      val ns = vs.zip(ts).map{case (v, t) => Equals(VariableType(v), t)}
-      val sns = ns.map{case Equals(v, rhs) => Equals(v, simplify(rhs))}
-      sns.sortWith((eq1, eq2) => (eq1.s1, eq2.s1) match {
-        case (VariableType(v1), VariableType(v2)) => v1 < v2
-        case _ => error("no vars as lhs of equals")
-      })
-    }
-    systems.map(cascadingEquations0)
-  }
-
-  def cascadingSystems(system: Set[Include], constructors: Map[String, Int]): Set[Set[Include]] = {
-
-    def constructorRule(system: Set[Include]): Set[Set[Include]] = {
-      val (option, rest) = extract((x: Include) => x match {
-        case Include(IntersectionType(Seq(ConstructorType(_, args))), EmptyType) => true 
-        case _ => false
-      }, system)
-      option match {
-        case Some(Include(IntersectionType(Seq(ConstructorType(_, args))), EmptyType)) =>
-          args.map(arg => rest + Include(arg, EmptyType)).toSet
-        case None => Set(system)
-        case _ => error("")
-      }
-    }
-
-    def transitiveRule(system: Set[Include]): Set[Include] = {
-    /*
-      val (candidates, r1) = system.partition{
-        case Include(IntersectionType(List(VariableType(_), _)), EmptyType) => true
-        case _ => false
-      }
-      val (candidatesNeg, r2) = r1.partition{
-        case Include(IntersectionType(List(ComplementType(VariableType(_)), _)), EmptyType) => true
-        case _ => false
-      }
-      val newCnstrs = candidates.flatMap{
-        case Include(IntersectionType(List(VariableType(v1), s1)), EmptyType) => {
-          candidatesNeg.flatMap{
-            case Include(IntersectionType(List(ComplementType(VariableType(v2)), s2)), EmptyType) => {
-              if(v1 == v2)
-                Set(Include(IntersectionType(List(s1, s2)), EmptyType))
-              else
-                Nil
-            }
-            case _ => error("")
-          }
-        }
-        case _ => error("")
-      }
-      newCnstrs ++ system
-      */
-
-      def keepOneLevel(lits1: Seq[SetType], lits2: Seq[SetType]): SetType = {
-
-        def combineConstructors(c1: ConstructorType, c2: ConstructorType): Option[ConstructorType] = (c1, c2) match {
-          case (ConstructorType(n1, _), ConstructorType(n2, _)) if n1 != n2 => None
-          case (ConstructorType(n, args1), ConstructorType(_, args2)) => {
-            val args = args1.zip(args2).map{
-              case (IntersectionType(lits1), IntersectionType(lits2)) => combineLits(lits1 ++ lits2)
-              case _ => error("not one level")
-            }
-            if(args.exists{
-              case None => true
-              case Some(_) => false
-            }) None else Some(ConstructorType(n, args.map{
-              case Some(lits) => IntersectionType(lits)
-              case None => error("no way")
-            }))
-          }
-        }
-
-        def combineLits(lits: Seq[SetType]): Option[Seq[SetType]] = if(lits.exists(_ == EmptyType)) None else if(lits.exists{
-            case v@VariableType(_) => lits.exists((s: SetType) => s == ComplementType(v))
-            case ComplementType(v@VariableType(_)) => lits.exists((s: SetType) => s == v)
-            case _ => false
-          }) None else Some(lits)
-
-        (lits1, lits2) match {
-          case (Seq(), lits2) => IntersectionType(lits2)
-          case (lits1, Seq()) => IntersectionType(lits1)
-          case _ => {
-            val (init1, last1) = (lits1.init, lits1.last)
-            val (init2, last2) = (lits2.init, lits2.last)
-            val (lits, constr) = (last1, last2) match {
-              case (c1@ConstructorType(_, _), c2@ConstructorType(_, _)) => (init1 ++ init2, combineConstructors(c1, c2))
-              case (c@ConstructorType(_, _), s) => (s +: (init1 ++ init2), Some(c))
-              case (s, c@ConstructorType(_, _)) => (s +: (init1 ++ init2), Some(c))
-              case (s1, s2) => (lits1 ++ lits2, None)
-            }
-            (combineLits(lits), constr) match {
-              case (None, _) => EmptyType
-              case (_, None) => EmptyType
-              case (Some(lits), Some(c)) => decreasingOrder(IntersectionType(lits :+ c))
-            }
-          }
-        }
-      }
-
-
-/*
-      def simp(s1: SetType, s2: SetType): SetType = {
-        val res = (s1, s2) match {
-          case (EmptyType, _) => EmptyType
-          case (_, EmptyType) => EmptyType
-          case (v1, ComplementType(v2))) if v1 == v2 => EmptyType
-          case (ComplementType(v1), v2) if v1 == v2 => EmptyType
-          case (ConstructorType(_, args)) if args.exists(_ == EmptyType) => EmptyType
-          case (ConstructorType(n1, _), ConstructorType(n2, _)) if n1 != n2 => EmptyType
-          case (ConstructorType(n1, args1), ConstructorType(n2, args2))) =>
-            if(n1 != n2) 
-              error("unexpected")
-            else
-              keepOneLevel(IntersectionType(Seq(ConstructorType(n1, args1.zip(args2).map{
-                case (IntersectionType(lits1), IntersectionType(lits2)) => simplify(IntersectionType(lits1 ++ lits2)) match {
-                  case EmptyType => EmptyType
-                  case UniversalType => IntersectionType(Seq())
-                  case i@IntersectionType(_) => i
-                  case v@VariableType(_) => IntersectionType(Seq(v))
-                  case v@ComplementType(VariableType(_)) => IntersectionType(Seq(v))
-                  case _ => error("unexpected")
-                }
-                case _ => error("not one level: " + i)
-              }))))
-          case _ => s
-        }
-        decreasingOrder(res)
-
-        val res = (s1, s2) match {
-          case IntersectionType(Seq(EmptyType, _)) => EmptyType
-          case IntersectionType(Seq(_, EmptyType)) => EmptyType
-          case IntersectionType(Seq(v1, ComplementType(v2))) if v1 == v2 => EmptyType
-          case IntersectionType(Seq(ComplementType(v1), v2)) if v1 == v2 => EmptyType
-          case IntersectionType(Seq(ConstructorType(_, args))) if args.exists(_ == EmptyType) => EmptyType
-          case IntersectionType(Seq(ConstructorType(n1, _), ConstructorType(n2, _))) if n1 != n2 => EmptyType
-          case i@IntersectionType(Seq(ConstructorType(n1, args1), ConstructorType(n2, args2))) =>
-            if(n1 != n2) 
-              error("unexpected")
-            else
-              keepOneLevel(IntersectionType(Seq(ConstructorType(n1, args1.zip(args2).map{
-                case (IntersectionType(lits1), IntersectionType(lits2)) => simplify(IntersectionType(lits1 ++ lits2)) match {
-                  case EmptyType => EmptyType
-                  case UniversalType => IntersectionType(Seq())
-                  case i@IntersectionType(_) => i
-                  case v@VariableType(_) => IntersectionType(Seq(v))
-                  case v@ComplementType(VariableType(_)) => IntersectionType(Seq(v))
-                  case _ => error("unexpected")
-                }
-                case _ => error("not one level: " + i)
-              }))))
-          case _ => s
-        }
-        decreasingOrder(res)
-      }
-        */
-
-      val trans = system.flatMap[Include, Set[Include]]{
-        case Include(EmptyType, EmptyType) => Set()
-        case i@Include(IntersectionType(Seq()), EmptyType) => Set(i)
-        case i@Include(IntersectionType(lits), EmptyType) => lits.head match {
-          case ConstructorType(_, _) => Set()
-          case v@VariableType(_) => system.flatMap[Include, Set[Include]]{
-            case Include(IntersectionType(lits2), EmptyType) => {
-              if(!lits2.isEmpty && lits2.head == ComplementType(v))
-                Set(Include(
-                  keepOneLevel(lits.tail, lits2.tail),
-                  EmptyType))
-              else Set()
-            }
-            case _ => Set()
-          }
-          case ComplementType(v@VariableType(_)) => system.flatMap[Include, Set[Include]]{
-            case Include(IntersectionType(lits2), EmptyType) => {
-              if(!lits2.isEmpty && lits2.head == v)
-                Set(Include(
-                  keepOneLevel(lits.tail, lits2.tail),
-                  EmptyType))
-              else Set()
-            }
-            case _ => Set()
-          }
-          case _ => error("not one level")
-        }
-        case _ => error("not one level")
-      }
-
-      trans ++ system
-    }
-
-    def iter(systems: Set[Set[Include]]): Set[Set[Include]] = systems.flatMap(system => {
-      val trans = transitiveRule(system)
-      val constrSystem = constructorRule(trans)
-      val consistentSystems: Set[Set[Include]] = constrSystem.filterNot(sys => sys.exists{
-        case Include(UniversalType, EmptyType) => true
-        case Include(IntersectionType(Seq(ConstructorType(_, Seq()))), EmptyType) => true
-        case _ => false
-      })
-      val res = consistentSystems.map((system: Set[Include]) => system.flatMap[Include, Set[Include]]{
-        case Include(EmptyType, EmptyType) => Set()
-        case i => Set(i)
-      })
-      res
-    })
-
-    fix(iter, Set(system))
-  }
-
-  def decreasingOrder(s: SetType): SetType = {
-    def order(s1: SetType, s2: SetType): Boolean = (s1, s2) match {
-      case (VariableType(n1), VariableType(n2)) => n1 > n2
-      case (ComplementType(VariableType(n1)), VariableType(n2)) => n1 > n2
-      case (VariableType(n1), ComplementType(VariableType(n2))) => n1 > n2
-      case (ComplementType(VariableType(n1)), ComplementType(VariableType(n2))) => n1 > n2
-      case (VariableType(_), ConstructorType(_, _)) => true
-      case (ComplementType(VariableType(_)), ConstructorType(_, _)) => true
-      case (ConstructorType(_, _), VariableType(_)) => false
-      case (ConstructorType(_, _), ComplementType(VariableType(_))) => false
-      case _ => error("not one level: " + PrettyPrinter(s1) + " should not have to be compared to " + PrettyPrinter(s2))
-    }
-    val ns = s match {
-      case EmptyType => EmptyType
-      case IntersectionType(sts) => IntersectionType(sts.sortWith(order))
-      case _ => error("not expected")
-    }
-    ns
-  }
-  def decreasingOrder(system: Set[Include]): Set[Include] = system.map{
-    case Include(s, EmptyType) => Include(decreasingOrder(s), EmptyType)
-    case _ => error("not expected")
-  }
-
-  def oneLevel(system: Set[Include], constructors: Map[String, Int]): Set[Include] = {
-
-    def canIntersectionLit(lhs: SetType): Option[SetType] = simplify(lhs) match {
-      case UniversalType => Some(IntersectionType(Seq()))
-      case v@VariableType(_) => Some(IntersectionType(Seq(v)))
-      case c@ComplementType(VariableType(_)) => Some(IntersectionType(Seq(c)))
-      case i@IntersectionType(sts) if sts.forall(isLiteral) => Some(i)
-      case _ => None
-    }
-    def canOneLevel(lhs: SetType): Option[SetType] = simplify(lhs) match {
-      case e@EmptyType => Some(e)
-      case UniversalType => Some(IntersectionType(Seq()))
-      case v@VariableType(_) => Some(IntersectionType(Seq(v)))
-      case c@ComplementType(VariableType(_)) => Some(IntersectionType(Seq(c)))
-      case ConstructorType(n, args) => {
-        val oneArgs = args.map(canIntersectionLit)
-        if(oneArgs.forall(_ != None))
-          Some(IntersectionType(Seq(ConstructorType(n, oneArgs.map{_.get}))))
-        else
-          None
-      }
-      case i@IntersectionType(sts) => {
-        val (constr, rest) = extract(isConstructor _, sts)
-        if(!rest.forall(isLiteral))
-          None
-        else constr match {
-          case None => Some(i)
-          case Some(c@ConstructorType(_, _)) => {
-            canOneLevel(c) match {
-              case Some(IntersectionType(Seq(c))) => Some(IntersectionType(rest :+ c))
-              case _ => None
-            }
-          }
-          case _ => error("unexpected")
-        }
-      }
-      case _ => None
-    }
-
-    def normalForm(lhs: SetType): SetType = lhs match {
-      case EmptyType => lhs
-      case IntersectionType(sts) => IntersectionType(sts.map{
-        case ConstructorType(n, args) => ConstructorType(n, args.map(normalForm))
-        case x => x
-      })
-      case s => IntersectionType(Seq(s))
-    }
-    def toOneLevels(lhs: SetType): Set[SetType] = {
-      import scala.collection.mutable.ListBuffer
-      val newCnstrs = ListBuffer[SetType]()
-      def toOneLevel0(lhs: SetType): SetType = lhs match {
-        case VariableType(_) => lhs
-        case IntersectionType(Seq(s)) => s
-        case UnionType(Seq(s)) => s
-        case _ => {
-          val nv = freshVar("x")
-          lhs match {
-            case EmptyType => newCnstrs += nv
-            case UniversalType => newCnstrs += ComplementType(nv)
-            case ComplementType(v@VariableType(_)) => {
-              newCnstrs += IntersectionType(Seq(nv, v))
-              newCnstrs += IntersectionType(Seq(ComplementType(nv), ComplementType(v)))
-            }
-            case IntersectionType(sts) => {
-              newCnstrs += IntersectionType(ComplementType(nv) +: sts)
-              sts.foreach(s => newCnstrs += IntersectionType(Seq(nv, ComplementType(s))))
-            }
-            case UnionType(sts) => {
-              newCnstrs += IntersectionType(nv +: sts.map(s => ComplementType(s)))
-              sts.foreach(s => newCnstrs += IntersectionType(Seq(ComplementType(nv), s)))
-            }
-            case c@ConstructorType(name, args) => {
-              newCnstrs += IntersectionType(Seq(ComplementType(nv), c))
-              args.zipWithIndex.foreach{
-                case (arg, i) => newCnstrs += IntersectionType(Seq(
-                  nv, 
-                  ConstructorType(name, args.zipWithIndex.map{case (arg, j) => if(i == j) ComplementType(arg) else IntersectionType(Seq())})))
-              }
-              constructors.foreach{
-                case (n, a) => 
-                  if(n != name) 
-                    newCnstrs += IntersectionType(Seq(nv, ConstructorType(n, (1 to a).map(_ => IntersectionType(Seq())))))
-              }
-            }
-            case _ => error("unexpected")
-          }
-          nv
-        }
-      }
-      val nlhs = mapPostorder(lhs, toOneLevel0)
-      val res = newCnstrs.toSet + nlhs
-      res
-    }
-
-
-    val lhsSystem = system.map{
-      case Include(s, EmptyType) => s
-      case Include(s1, s2) => IntersectionType(Seq(s1, ComplementType(s2)))
-    }
-    val res = lhsSystem.flatMap(lhs => canOneLevel(lhs) match {
-      case Some(s) => Set(s)
-      case None => toOneLevels(lhs)
-    })
-    val normalRes = res.map(normalForm)
-    normalRes.map(lhs => Include(lhs, EmptyType))
-  }
-
-  def isConstructor(s: SetType): Boolean = s match {
-    case ConstructorType(_, _) => true
-    case _ => false
-  }
-  def isLiteral(s: SetType): Boolean = s match {
-    case VariableType(_) => true
-    case ComplementType(VariableType(_)) => true
-    case _ => false
-  }
-  def isInterLit(s: SetType): Boolean = s match {
-    case IntersectionType(sts) => sts.forall(isLiteral)
-    case _ => false
-  }
-  def isOneLevel(s: SetType): Boolean = s match {
-    case EmptyType => true
-    case IntersectionType(Seq()) => true
-    case IntersectionType(sts) => {
-      val (init, last) = (sts.init, sts.last)
-      if(init.forall(isLiteral)) {
-        if(isConstructor(last)) {
-          val ConstructorType(_, args) = last 
-          args.forall(isInterLit)
-        } else if(isLiteral(last)) {
-          true
-        } else false
-      } else false
-    }
-    case _ => false
-  }
-  def isOneLevel(r: Relation): Boolean = r match {
-    case Include(s1, EmptyType) if isOneLevel(s1) => true
-    case _ => {println("not one level: " + r); false}
-  }
-  def isOneLevel(system: Set[Relation]): Boolean = system.forall(isOneLevel)
-  def vars(system: Set[Include]): Set[String] = system.foldLeft(Set[String]())((a, incl) => 
-    a ++ Manip.vars(incl))
-}
diff --git a/src/setconstraints/Tools.scala b/src/setconstraints/Tools.scala
deleted file mode 100644
index 66b09c56b77361c07143cd301f3be8077f520008..0000000000000000000000000000000000000000
--- a/src/setconstraints/Tools.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-package setconstraints
-
-import purescala.Definitions._
-
-object Tools {
-
-  def childOf(root: ClassTypeDef, classes: Seq[ClassTypeDef]) = classes.filter(_.parent == root)
-
-  def toCaseClasses(classes: Seq[ClassTypeDef]): Seq[CaseClassDef] = 
-    classes.filter(_.isInstanceOf[CaseClassDef]).map(_.asInstanceOf[CaseClassDef])
-
-  def fix[A](f: (A) => A, a: A): A = {
-    val res = f(a)
-    if(res == a) a else fix(f, res)
-  }
-
-  def unzip3[A,B,C](seqs: Seq[(A,B,C)]): (Seq[A],Seq[B],Seq[C]) = 
-    seqs.foldLeft((Seq[A](), Seq[B](), Seq[C]()))((a, t) => (a._1 :+ t._1, a._2 :+ t._2, a._3 :+ t._3))
-
-  def unzip3[A,B,C](sets: Set[(A,B,C)]): (Set[A],Set[B],Set[C]) = 
-      sets.foldLeft((Set[A](), Set[B](), Set[C]()))((a, t) => (a._1 + t._1, a._2 + t._2, a._3 + t._3))
-
-  def extract[A](p: (A) => Boolean, seq: Seq[A]): (Option[A], Seq[A]) = {
-    val (s1, s2) = seq.partition(p)
-    if(s1.isEmpty)
-      (None, s2)
-    else
-      (Some(s1.head), s2 ++ s1.tail)
-  }
-
-  def extract[A](p: (A) => Boolean, set: Set[A]): (Option[A], Set[A]) = {
-    val (s1, s2) = set.partition(p)
-    if(s1.isEmpty)
-      (None, s2)
-    else
-      (Some(s1.head), s2 ++ s1.tail)
-  }
-}
diff --git a/src/setconstraints/Trees.scala b/src/setconstraints/Trees.scala
deleted file mode 100644
index f76269ef77f087750619a68dcab839bd6ed73302..0000000000000000000000000000000000000000
--- a/src/setconstraints/Trees.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package setconstraints
-
-object Trees {
-
-  sealed trait Formula
-
-  case class And(fs: Seq[Formula]) extends Formula
-
-  sealed abstract trait Relation extends Formula
-
-  sealed abstract trait SetType 
-
-  case class Include(s1: SetType, s2: SetType) extends Relation
-  case class Equals(s1: SetType, s2: SetType) extends Relation
-
-  case class UnionType(sets: Seq[SetType]) extends SetType
-  case class IntersectionType(sets: Seq[SetType]) extends SetType
-  case class ComplementType(st: SetType) extends SetType
-  case class FunctionType(s1: SetType, s2: SetType) extends SetType
-  case class TupleType(sets: Seq[SetType]) extends SetType
-  case class ConstructorType(name: String, sets: Seq[SetType]) extends SetType
-  case class VariableType(name: String) extends SetType
-  case object EmptyType extends SetType
-  case object UniversalType extends SetType
-
-  private var varCounter = -1
-  def freshVar(name: String) = {
-    varCounter += 1
-    VariableType(name + "_" + varCounter)
-  }
-
-}
diff --git a/test/BVs.scala b/test/BVs.scala
deleted file mode 100644
index 37a4c11ca292a70546adfa42a7170eef84738330..0000000000000000000000000000000000000000
--- a/test/BVs.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-object BVs {
-  sealed abstract class List
-  case class Cons(head : Int, tail : List) extends List
-  case class Nil() extends List
-
-  def size(l : List) : Int = {
-    l match {
-      case Nil() => 0
-      case Cons(_, xs) => 1 + /* for "small" counter examples: */ 2 * size(xs)
-    }
-  } ensuring(_ >= 0) // smallest counter-example is a list of size Integer.MAX_VALUE, could take a while to find it :)
-
-  def mul(i : Int, j : Int) : Int = {
-    require(i >= 0 && j >= 0)
-    i * j
-  } ensuring(res => res >= 0)
-}
diff --git a/tests/README b/tests/README
deleted file mode 100644
index 79f87ab7ca9a9a73bc47b97f549c852b27655367..0000000000000000000000000000000000000000
--- a/tests/README
+++ /dev/null
@@ -1,28 +0,0 @@
-How to run a test:
------------------
-
-
-SCALACHECK
-----------
-
-All tests in the "scalacheck" folder can be run with the following command (from the root of the project):
-
-scala -cp bin:bin/examples:bin/tests:lib/ScalaCheck-1.5.jar TEST_FILE
-
-Where TEST_FILE is for example: scalacheck.examples.BSTSpec
-
-
-SCALATEST AND SCALASPECS
-------------------------
-
-All tests in the "scalatest" folder can be run with the following command (from the root of the project):
-
-scala -cp bin:bin/examples:bin/tests:lib/scalatest-0.9.5.jar:lib/specs-1.5.0.jar org.scalatest.tools.Runner -o -s TEST_FILE
-
-Where TEST_FILE is for example: scalatest.examples.MultisetSpec
-
-
-SCRIPT TO RUN TESTS
------------------------
-
-[[TODO]] Coming soon =)
\ No newline at end of file
diff --git a/tests/contracts/scalacheck/BSTSpec.scala b/tests/contracts/scalacheck/BSTSpec.scala
deleted file mode 100644
index ee90b9b87123fd8b80815f2a68b2cfbf87241680..0000000000000000000000000000000000000000
--- a/tests/contracts/scalacheck/BSTSpec.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-package contracts
-
-import org.scalacheck.{Arbitrary,Properties,Gen}
-import org.scalacheck.Prop._
-import org.scalacheck.ConsoleReporter.testStatsEx
-import org.scalacheck.Test.check
-import org.scalacheck.Arbitrary.arbitrary
-
-object BSTSpec {
-  import contracts.bstdefspec.BSTAsSet._
-  
-  /**********************************************************/
-  /*********************** GENERATORS ***********************/
-  /**********************************************************/
-  implicit def arbitraryTree: Arbitrary[BST] =
-    Arbitrary(smallListInt.map(xs => {
-      
-      def makeTree(t: BST, xs: List[Int]): BST = xs match {
-        case Nil => t
-        case x :: xs => makeTree(add(x,t),xs)
-      }
-                                             
-      makeTree(Empty, xs)
-    }))
-
-  // gen list (size undefined) of small integer (likely to have duplicates)
-  val smallInt = Gen.choose(0,5) 
-  val smallListInt = Gen.listOf[Int](smallInt)
-  
-  
-  /**********************************************************/
-  /*********************** PROPERTIES ***********************/
-  /**********************************************************/
-  val treeContainsValue = forAll( (tree: BST, value: Int) => contains(value,tree) == content(tree).contains(value))
-  val treeInsertValue   = forAll( (tree: BST, value: Int) => content(add(value, tree)) == content(tree) + value)
-  
-  
-  /**********************************************************/
-  // collect tests
-  val tests = List(
-    ("treeContainsValue",  treeContainsValue),
-    ("treeInsertValue", treeInsertValue)
-  )
-  
-  // main
-  def main(args: scala.Array[String]) = 
-    tests foreach { case (name, p) => testStatsEx(name, check(p)) }
-}
diff --git a/tests/contracts/scalacheck/DPLLSpec.scala b/tests/contracts/scalacheck/DPLLSpec.scala
deleted file mode 100644
index e90f67414dbef7916ed6721ca3f0d65d32a4db4c..0000000000000000000000000000000000000000
--- a/tests/contracts/scalacheck/DPLLSpec.scala
+++ /dev/null
@@ -1,117 +0,0 @@
-//package contracts
-//
-//import org.scalacheck.{Arbitrary,Properties,Gen}
-//import org.scalacheck.Prop._
-//import org.scalacheck.ConsoleReporter.testStatsEx
-//import org.scalacheck.Test.check
-//import org.scalacheck.Arbitrary.arbitrary
-//
-//import java.util.{Arrays}
-//
-//
-//
-//object DPLLSpec /*extends Properties("DPLL")*/ {
-//  import funpm.logic.DPLL._
-//
-//  
-//   
-//  //********************************************************//
-//  // ARBITRARY GENERATORS
-//  //********************************************************//
-//  implicit val arbLiteral: Arbitrary[Literal] = Arbitrary(genLiteral)
-//  implicit val arbClause: Arbitrary[List[Literal]] = Arbitrary(genClause)
-//  implicit val arbClauseSet: Arbitrary[List[List[Literal]]] = Arbitrary {
-//   for {
-//     n <- Gen.choose(0,3)
-//     s <- Gen.vectorOf(n,genClause)
-//   } yield s
-//  }
-//  
-//  
-//  //********************************************************//
-//  // GENERATORS
-//  //********************************************************//
-//    
-//  // Literal (Data type)
-//  def genLit(f: String => Literal) = for {
-//    c <- Gen.choose(65,70) map (_.toChar)
-//  } yield f(c.toString)  
-//  
-//  
-//  def genPos = genLit(pos)
-//  def genNeg = genLit(neg)
-//  def genLiteral = Gen.frequency((2, genPos), (1, genNeg))
-//  
-//  
-//  // List[Literal]
-//  //XXX: Why doesn't this work with "Set" instead of "List"?!
-//  def genClause = for {
-//    n <- Gen.choose(0,3)
-//    s <- Gen.vectorOf(n,genLiteral)
-//  } yield s
-//  
-//  //********************************************************//
-//  // UTILITARY METHOD
-//  //********************************************************//
-//  def listOfList2setOfSet[T](xss: List[List[T]]): Set[Set[T]] = 
-//    Set() ++ (xss.map(xs => list2set(xs)))
-//  
-//  def list2set[T](xs: List[T]): Set[T] = 
-//    Set() ++ xs
-//  
-//  def list2setOfSet[T](xs: List[T]): Set[Set[T]] = Set(list2set(xs))
-//  
-//  //********************************************************//
-//  // PROPERTIES (To Test)
-//  //********************************************************//
-//   
-//  
-//  //********************************************************//
-//  // find_one_literals
-//  
-//  val singleLiteral = property((lit: Literal) => find_one_literals(Set(Set(lit))) == Set(lit))
-//  
-//  val findLiteralInOneClause = property((clause: List[Literal]) => {
-//    val clauseSet = list2setOfSet(clause)
-//    val literals = find_one_literals(clauseSet)
-//    clauseSet.filter(_.size == 1).:\[Set[Literal]](Set())((xss,xs) => xs ++ xss) == literals
-//  })
-//  
-//  val findLiteralInClauseSet = property((clauses: List[List[Literal]]) => {
-//    val clauseSet = listOfList2setOfSet(clauses)
-//    val literals = find_one_literals(clauseSet)
-//    
-//    clauseSet.filter(_.size == 1).:\[Set[Literal]](Set())((xss,xs) => xs ++ xss) == literals
-//  })
-//  
-//  //********************************************************//
-//  // find_unique_literals
-//  
-//  val findUniqueLiteralsInClauseSet = property((clauses: List[List[Literal]]) => {
-//    val clauseSet = listOfList2setOfSet(clauses)
-//    val literals = find_unique_literals(clauseSet)
-//    literals.forall(lit => clauseSet.forall(set => !set.contains(lit.flip)))
-//  })
-//  
-//  
-//  //********************************************************//
-//  // one_literal_rule
-////  val applyOneLiteralRule = property((clauses: List[List[Literal]], lit: Literal) => {
-////    val clauseSet = listOfList2setOfSet(clauses)
-////    
-////  })
-//  
-//  val tests = List(
-//    ("singleLiteral",  singleLiteral),
-//    ("findLiteralInOneClause",  findLiteralInOneClause),
-//    ("findLiteralInClauseSet", findLiteralInClauseSet),
-//    ("findUniqueLiteralsInClauseSet", findUniqueLiteralsInClauseSet)
-//  )
-//  
-//  
-//  
-//  
-//  def main(args: scala.Array[String]) = 
-//    tests foreach { case (name, p) => testStatsEx(name, check(p)) }
-//
-//}
diff --git a/tests/contracts/scalacheck/LeftistHeapSpec.scala b/tests/contracts/scalacheck/LeftistHeapSpec.scala
deleted file mode 100644
index ac86913f16c93df40d43e8c526c62e4545b1dcae..0000000000000000000000000000000000000000
--- a/tests/contracts/scalacheck/LeftistHeapSpec.scala
+++ /dev/null
@@ -1,55 +0,0 @@
-package contracts
-
-
-import org.scalacheck.{Arbitrary,Gen}
-import org.scalacheck.Prop._
-import org.scalacheck.ConsoleReporter.testStatsEx
-import org.scalacheck.Test.check
-import org.scalacheck.Arbitrary.arbitrary
-
-
-import contracts.heap._
-
-object LeftistHeapSpec {
-  import contracts.heap.LeftistHeap._
-  
-  
-  /**********************************************************/
-  /*********************** GENERATORS ***********************/
-  /**********************************************************/
-  val genElem = for(v <- arbitrary[Int]) yield Elem(v)
-  val genE = Gen.value(E)
-  val genT = for {
-    e <- arbitrary[Elem]
-    h <- arbitrary[Heap]
-  } yield h.insert(e)
-  
-  def genHeap: Gen[Heap] = Gen.lzy(Gen.oneOf(genE,genT))
-   
-  implicit def arbHeap: Arbitrary[Heap] = Arbitrary(genHeap)
-  implicit def arbElem: Arbitrary[Elem] = Arbitrary(genElem)
-  
-  println(genHeap.sample)
-  println(genHeap.sample)
-  
-  /**********************************************************/
-  /*********************** PROPERTIES ***********************/
-  /**********************************************************/
-  val heapInsert = forAll( (heap: Heap, value: Elem) => content(heap.insert(value))(value) == content(heap)(value) + 1)
-  val heapFindMin = forAll{ heap : Heap => (heap.rankk > 0) ==> (heap.findMin == min(content(heap).elements.toList))}
-  val heapDeleteMin = forAll{ heap: Heap => (heap.rankk > 0) ==> (content(heap.deleteMin).equals(content(heap) - heap.findMin))}
-  val heapMerge = forAll( (thiz: Heap, that: Heap) => content(thiz.merge(that)).equals(content(thiz) +++ content(that)))
-  
-   /**********************************************************/
-  // collect tests
-  val tests = List(
-    ("heapInsert",  heapInsert),
-    ("heapFindMin", heapFindMin),
-    ("heapDeleteMin", heapDeleteMin),
-    ("heapMerge", heapMerge)
-  )
-  
-  // main
-  def main(args: scala.Array[String]) = () 
-   tests foreach { case (name, p) => testStatsEx(name, check(p))}
-}
diff --git a/tests/contracts/scalatest/DPLLTest.scala b/tests/contracts/scalatest/DPLLTest.scala
deleted file mode 100644
index 0702ea731da07ec332379ee0eae90f4ae028e688..0000000000000000000000000000000000000000
--- a/tests/contracts/scalatest/DPLLTest.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-//package scalatest.examples
-//
-//import org.scalatest.Suite
-//
-//
-//
-//class DPLLTest extends Suite {
-//  import funpm.logic.DPLL._
-//  
-//  def testFindClausesWithOnlyOneLiteralAndReturnTheSingletonLiteralsForEachClause() {
-//    expect(Set()) {
-//      find_one_literals(Set())
-//    }
-//    expect(Set()) {
-//      find_one_literals(Set(Set()))
-//    }
-//    expect(Set(pos("A"))) {
-//      find_one_literals(Set(Set(pos("A"))))
-//    }
-//    expect(Set(pos("A"),neg("A"))) {
-//      find_one_literals(Set(Set(pos("A")),Set(neg("A"))))
-//    }
-//    expect(Set()) {
-//      find_one_literals(Set(Set(pos("A"),pos("B"))))
-//    }
-//  }
-//	
-//  
-//  
-//}
diff --git a/tests/contracts/scalatest/LeftistHeapSpec.scala b/tests/contracts/scalatest/LeftistHeapSpec.scala
deleted file mode 100644
index 5482467297ee8dfb47f6afb325ebdad6f2905a19..0000000000000000000000000000000000000000
--- a/tests/contracts/scalatest/LeftistHeapSpec.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-package scalatest.examples
-
-import org.scalatest.matchers.ShouldMatchers
-import org.scalatest.Spec
-
-import contracts.heap._
-
-/**
- * Test description of the behavior expected by a leftist heap. 
- */
-class LeftistHeapSpec extends Spec with ShouldMatchers {
-
-  implicit def int2elem(x: Int): Elem = Elem(x)
-  
-  describe("A Leftis Heap") {
-    it("should insert elements in the heap and keep the heap ordered")  {
-      val heap = T(1,Elem(1),E,E)
-      
-      (heap.insert(-1)) should equal (T(1,Elem(-1),T(1,Elem(1),E,E),E))
-      (heap.insert(1)) should equal (T(1,Elem(1),T(1,Elem(1),E,E),E))
-      
-    }
-    
-  }
-}
diff --git a/tests/scala/collection/MultisetSpec.scala b/tests/scala/collection/MultisetSpec.scala
deleted file mode 100644
index 366acb59c1b5b22d21de8450bc818d9b64e7ce6d..0000000000000000000000000000000000000000
--- a/tests/scala/collection/MultisetSpec.scala
+++ /dev/null
@@ -1,109 +0,0 @@
-package scalatest.examples
-
-import org.scalatest.matchers.ShouldMatchers
-import org.scalatest.Spec
-
-import scala.collection.immutable.HashMultiset
-
-/**
- * Test description of the behavior expected by a multiset. 
- */
-class MultisetSpec extends Spec with ShouldMatchers  {
-
-  describe("A Multiset") {
-    
-    it("should have no element if empty.") {
-      val empty = HashMultiset.empty[Int]
-      
-      empty should have size 0
-      empty should be ('empty)
-      assert(!empty.elements.hasNext)
-      empty(0) should be (0)
-      empty should not contain (0)
-    }
-    
-    it("should increase the cardinality of identical elements.") {
-      val mset = HashMultiset(1,1,2)
-      
-      mset should not be ('empty)
-      mset should have size 3
-      mset(1) should be (2)
-      mset(2) should be (1)
-      mset(3) should be (0)
-    }
-    
-    it("should implement structural equality when comparing two multisets.") {
-      val empty1 = HashMultiset.empty[Int]
-      val empty2 = HashMultiset.empty[Int]
-      
-      val filled1 = HashMultiset(1,1,2)
-      val filled2 = HashMultiset.empty[Int] + (1,1,2)
-      
-      empty1 should equal (empty2)
-      filled1 should equal (filled2)
-      
-      filled1 should not equal (empty1)
-    }
-    
-    it("should held be empty if intersected with an empty multiset.") {
-      val mset = HashMultiset(1,1,2)
-      val empty = HashMultiset.empty[Int]
-      
-      //check that "**" and "intersect" are indeed alias one of the other 
-      (empty ** empty) should equal (empty)
-      (empty intersect empty) should equal (empty)
-      
-      (empty ** mset) should equal (empty)
-      (empty intersect mset) should equal (empty)
-      
-      (mset ** empty) should equal (empty)
-      (mset intersect empty) should equal (empty)
-    }
-    
-    it("should not change when interseced/unified with itself.") {
-      val mset = HashMultiset(1,1,2,0,3)
-      
-      (mset ** mset) should equal (mset)
-      (mset ++ mset) should equal (mset)
-    }
-    
-    it("should decrease the cardinality of an element when removed.") {
-      val mset = HashMultiset(1,2,1)
-      
-      (mset -- List(1)) should equal (HashMultiset(1,2))
-      (mset -- List(1)) should equal (HashMultiset(2,1))
-      (mset -- List(1,2)) should equal (HashMultiset(1))
-      (mset -- List(1,1,2)) should be ('empty)
-      
-      ((mset -- List(1)).apply(1)) should be (1)
-      ((mset -- List(1)).apply(2)) should be (1)
-      ((mset -- List(2)).apply(1)) should be (2)
-      (mset -- List(1,1,2)) should not contain (0)
-    }
-    
-    it("should never contains an element with cardinality lower than zero.") {
-      val mset = HashMultiset(1)
-      
-      (mset -- List(1)) should be ('empty)
-      (mset -- List(1,1)) should be ('empty)
-      (mset -- List(1,1)) should not contain (0)
-      
-      ((mset -- List(1,1)) ++ List(1)) should contain (1)
-    }
-    
-    it("can be degenerated to a set.") {
-      val mset = HashMultiset(1,1,1,1,1,1,2,2,2,2,2,3,4)
-      val set = mset.asSet
-      
-      set should have size (4) 
-      List(1,2,3,4).forall(set.contains(_))
-    }
-    
-    it("should union as sum when +++ is used") {
-      val mset1 = HashMultiset(7, 8)
-      val mset2 = HashMultiset(6, 7)
-      
-      (mset1 +++ mset2) should equal (HashMultiset(6,7,7,8))
-    }
-  }
-}
diff --git a/tests/udita/BinarySearchTreeTest.scala b/tests/udita/BinarySearchTreeTest.scala
deleted file mode 100644
index a4d63288e3c9f7e7721daf218ea068fbc0829d5d..0000000000000000000000000000000000000000
--- a/tests/udita/BinarySearchTreeTest.scala
+++ /dev/null
@@ -1,85 +0,0 @@
-package udita
-
-import gov.nasa.jpf.jvm.Verify;
-
-object BinarySearchTreeTest  extends Application {
-
-  sealed abstract class BinarySearchTree;
-  case object Empty extends BinarySearchTree;
-  case class Node(left: BinarySearchTree, value:Int, right:BinarySearchTree) extends BinarySearchTree;
-
-  def size(t: BinarySearchTree): Int = t match {
-    case Empty => 0;
-    case Node(left,value,right) => size(left) + 1 + size(right);
-  }
-  
-  def add(x: Int, t:BinarySearchTree):BinarySearchTree =t match {
-    case Empty => Node(Empty,x,Empty);
-    case Node(left,value,right) if (x < value) => Node(add(x,left),value,right);
-    case Node(left,value,right) if (x >= value) => Node(left,value,add(x,right));    
-  }
-  
-  def contains(x :Int, t:BinarySearchTree):Boolean = t match {
-    case Empty => false;
-    case Node(left,value,right) if (x == value) => true;
-    case Node(left,value,right) if (x < value) => contains(x,left);
-    case Node(left,value,right) if (x > value) => contains(x,right);
-  }
-  
-  private def generateBinarySearchTree(treeSize:Int): BinarySearchTree = {
-    val size = Verify.getInt(1, treeSize);
-    val maxNodeValue = size - 1;
-    val t = getSubTree(size, 0, maxNodeValue);
-    System.out.println(t);
-    return t;
-  }
-  
-  private def getSubTree(size:Int, min:Int, max:Int): BinarySearchTree = {
-    if (size == 0) return Empty;
-    if (size == 1) return Node(Empty, Verify.getInt(min,max), Empty);
-
-    val value = Verify.getInt(min,max);
-
-    val leftSize = value - min;
-    val rightSize = size - 1 - leftSize;
-
-    return Node(getSubTree(leftSize, min, value - 1), value, getSubTree(rightSize, value + 1, max));
-  }
-  
-  def content(t:BinarySearchTree):Set[Int] = t match {
-    case Empty => Set.empty;
-    case Node(left,value,right) => (content(left) ++ Set(value) ++ content(right));
-  }
-  
-//  def forallTree(treeSize:Int,property : (BinarySearchTree => Boolean)):Boolean = {
-//      property(generateBinarySearchTree(treeSize));
-//  }
-//  
-//  def forallInt(min:Int, max:Int, property: (Int => Boolean)) : Boolean ={
-//    property(Verify.getInt(min,max));
-//  }
-  
-  //val t = add(17, add(6, add(3, add(5,add(3,Empty)))));
-  
-  //testing tree
-//  System.out.println(t);
-//  System.out.println(content(t));
-//  System.out.println(size(t));
-//  System.out.println(contains(5,t));
-  
-  //testing getInt
-  //assert(forallInt(0,4,(x => forallTree(4,t => content(add(x,t)) == content(t) + x))));
-  
-  def forAll(property:(BinarySearchTree,Int)=> Boolean){
-    assert(property(generateBinarySearchTree(4),Verify.getInt(0,4)));
-  }
-  
-  forAll((t:BinarySearchTree, x:Int) => content(add(x,t)) == content(t) + x);
-  
-  //System.out.println(generateBinarySearchTree(4));
-  //System.out.println("property: "+forallInt(0,4,(x => forallTree(4,t => content(add(x,t)) == content(t) + x))));
-}
-
-
-
-
diff --git a/tests/udita/BinomialHeapTest.scala b/tests/udita/BinomialHeapTest.scala
deleted file mode 100644
index 0099f703ab4476978af88cbb728b9761f559dfec..0000000000000000000000000000000000000000
--- a/tests/udita/BinomialHeapTest.scala
+++ /dev/null
@@ -1,143 +0,0 @@
-package udita
-
-import scala.collection.immutable.Multiset;
-import gov.nasa.jpf.jvm.Verify;
-
-object BinomialHeapTest extends Application {
-  sealed case class BinomialHeap(trees:List[BinomialTree]);
-  
-  sealed case class BinomialTree(rank:Int, value:Int, children:List[BinomialTree]);
-  
-  def rankk(t1:BinomialTree):Int = t1 match {
-    case BinomialTree(rank, _, _) => rank;
-  }
-  
-  def root(t1:BinomialTree):Int = t1 match {
-    case BinomialTree(_, value, _) => value;
-  }
-  
-  def link(t1:BinomialTree, t2:BinomialTree):BinomialTree = t1 match {
-    case BinomialTree(rank1,value1,children1) => t2 match {
-      case BinomialTree(rank2,value2,children2) => {
-        if (value1 <= value2) BinomialTree(rank1+1, value1, t2::children1); 
-        else BinomialTree(rank2+1, value2, t1::children2);
-      }
-    }
-  }
-  
-  def insertTree(t:BinomialTree, trees:List[BinomialTree]):List[BinomialTree] = trees match {
-    case Nil => List(t);
-    case t1::ts1 => {
-      if (rankk(t) < rankk(t1)) t::trees;  //bug t::ts1;
-      else insertTree(link(t,t1),ts1);
-    }
-  }
-  
-  def insert(x:Int, trees:List[BinomialTree]):List[BinomialTree] = insertTree(BinomialTree(0,x,Nil), trees);
-  
-  def insert(x:Int, heap:BinomialHeap):BinomialHeap = heap match {
-    case BinomialHeap(ts) => BinomialHeap(insert(x,ts));
-  }                                                                             
-  
-  def merge(ts1:List[BinomialTree],ts2:List[BinomialTree]):List[BinomialTree] = ts1 match {
-    case Nil => ts2;
-    case t1::tss1 => ts2 match {
-      case Nil => ts1;
-      case t2::tss2 => {
-        if (rankk(t1) < rankk(t2)) t1::merge(tss1,ts2);
-        else if (rankk(t2) < rankk(t1)) t2::merge(ts1,tss2);
-        else insertTree(link(t1,t2),merge(tss1,tss2)); 
-      }
-    }
-  }
-  
-  def removeMinTree(ts:List[BinomialTree]):(BinomialTree,List[BinomialTree]) = ts match {
-    case t1::Nil => (t1,Nil);
-    case t1::ts1 => {
-      val (t11,ts11) = removeMinTree(ts1);
-      if (root(t1) <= root(t11)) (t1,ts1);
-      else (t11,t1::ts11);
-    }
-    case Nil => error("removing from empt tree");
-  }
-  
-  def findMin(ts:List[BinomialTree]):Int = {
-    val (t1,_) = removeMinTree(ts);
-    root(t1);
-  }
-  
-  def deleteMin(ts:List[BinomialTree]):List[BinomialTree] ={
-    val (BinomialTree(_,x,ts1),ts2) = removeMinTree(ts);
-    merge(ts1.reverse,ts2);
-  }
-  
-  def deleteMin(heap:BinomialHeap):BinomialHeap = heap match {
-    case BinomialHeap(ts) => BinomialHeap(deleteMin(ts));
-  }
-  
-  def findMin(heap:BinomialHeap):Int = heap match {
-    case BinomialHeap(ts) => findMin(ts);
-  }
-  
-  def generateBinomialTree(rank:Int, min:Int, max:Int): BinomialTree = {
-    if(rank == 0) BinomialTree(rank, Verify.getInt(min,max), Nil);
-    else {
-      val value = Verify.getInt(min,max - rank);
-      var list = List[BinomialTree]();
-      for(i <- 0 until rank) {
-        list = generateBinomialTree(i,value+1,max)::list;
-      }
-      BinomialTree(rank,value,list);
-    }
-  }
-  
-  def generateBinomialHeap(heapSize:Int):BinomialHeap = {
-   var div:Int = heapSize;
-   var list = List[BinomialTree]();
-   var i = 0;
-   while(div > 0) {
-     var mod:Int = div % 2;
-     if (mod == 1) {
-       list= list ::: List(generateBinomialTree(i,0,heapSize));
-     }
-     div = div/2;
-     i+=1;
-   }
-   BinomialHeap(list);
-  }
-
-  def content(t : BinomialHeap): Multiset[Int] = {
-     def inner(t: BinomialTree, mset: Multiset[Int]): Multiset[Int] = t match {
-      case BinomialTree(rank, value, children) => {
-        innerList(children, mset +++ List(value));
-      }
-     }
-     def innerList(ts: List[BinomialTree], mset:Multiset[Int]): Multiset[Int] = ts match {
-       case Nil => mset
-       case t::tss => inner(t, innerList(tss,mset))
-     }
-     t match {
-       case BinomialHeap(ts) => innerList(ts,Multiset.empty[Int]);
-     }
-  }
-  
-  
-  var heap = BinomialHeap(Nil);
-  heap = insert(5,insert(26,insert(1,insert(17,insert(4,heap)))));
-  
-//  System.out.println(heap);
-//  System.out.println(findMin(heap));
-//  System.out.println(deleteMin(heap));
-//  System.out.println(content(heap));
-//  
-//  System.out.println(content(insert(1,heap)) == content(heap) +++ List(1));
-//  System.out.println(generateBinomialHeap(3));
-// 
-                                            
-  def forAll(property : ((BinomialHeap,Int) => Boolean)){
-    assert(property(generateBinomialHeap(4), Verify.getInt(0,4)));
-  }
-
-  forAll((heap, value) => (content(insert(value,heap)) == content(heap) +++ List(value)));
-
-}
diff --git a/tests/udita/LeftistHeapTest.scala b/tests/udita/LeftistHeapTest.scala
deleted file mode 100644
index dc8ea49ff88a710d7dfddc29d2d91af5bfa587af..0000000000000000000000000000000000000000
--- a/tests/udita/LeftistHeapTest.scala
+++ /dev/null
@@ -1,101 +0,0 @@
-package udita
-
-
-import scala.collection.immutable.Multiset;
-import gov.nasa.jpf.jvm.Verify;
-
-object LeftistHeapTest extends Application {
-
-  sealed abstract class Heap{
-    def rankk():Int = this match {
-      case Empty => 0;
-      case Node(rank,_,_,_) => rank;
-    }
-    
-    def insert(x: Int): Heap = {
-      LeftistHeapTest.merge(this, Node(1,x,Empty,Empty))
-    }
-    
-    def findMin(): Int = this match {
-      case Empty => Predef.error(toString());
-      case Node(_,x,_,_) => x
-    }
-    
-//    override def toString(): String = this match {
-//      case Empty => "Empty";
-//      case Node(rank,x,left,right) => "Node("+rank+","+x+","+left+","+right+")";
-//    }
-    
-    //ensuring(res => res == min(content(this).elements.toList))
-    
-    def deleteMin(): Heap = this match {
-      case Empty => Predef.error(toString());
-      case Node(_, _, left: Heap, right: Heap) => LeftistHeapTest.merge(left,right);
-    } 
-    //ensuring(res  => content(res).equals(content(this) - findMin))
-  }
-  
-  case class Node(rank:Int, value:Int, left:Heap, right:Heap) extends Heap;
-  case object Empty extends Heap;
-  
-  def merge(heap1:Heap, heap2:Heap): Heap = heap1 match {
-    case Empty => heap2;
-    case Node(_, value1, left1, right1) => heap2 match {
-      case Empty => heap1;
-      case Node(_, value2, left2, right2) if (value1 <= value2) =>
-        makeAndSwap(left1, value1, merge(right1,heap2));
-      case Node(_, value2, left2, right2) if (value1 > value2) =>
-        makeAndSwap(left2, value2, merge(heap1,right2));
-    }
-  }
-  
-  def makeAndSwap(left:Heap, value:Int, right:Heap): Heap = {
-    if(left.rankk() >= right.rankk()){
-      Node(right.rankk() + 1, value, left, right);
-    } else {
-      Node(left.rankk() + 1, value, right, left);      
-    }
-  }
-  
-  
-  def forAllLeftistHeap(size:Int, property:(Heap=>Boolean)): Boolean = {
-    property(generateLeftistHeap(size));
-  }
-  
-  def generateLeftistHeap(treeSize:Int):Heap = {
-    val size = Verify.getInt(1, treeSize);
-    val maxNodeValue = size - 1;
-    val t = getSubTree(size, -1, maxNodeValue - 1);
-    System.out.println(t);
-    return t;
-  }
-  
-  private def getSubTree(size:Int, min:Int, max:Int): Heap = {
-    if (size == 0) return Empty;
-    if (size == 1) return Node(1, Verify.getInt(min+1,max+1), Empty, Empty);
-
-    val value = Verify.getInt(min+1,max+1);
-    val rightSize = Verify.getInt(0,(size - 1)/2);
-    val leftSize = size - 1 - rightSize;
-    
-    val rightSub = getSubTree(rightSize, value, max);
-    val leftSub = getSubTree(leftSize, value, max);
-    
-    return Node(rightSub.rankk() + 1, value, leftSub, rightSub);
-  }
-  
-  def content(t : Heap): Multiset[Int] = {
-    def inner(t: Heap, mset: Multiset[Int]): Multiset[Int] = t match {
-      case Empty => mset
-      case Node(rank,value,left,right) => inner(right, inner(left, mset +++ List(value)))
-    }
-    inner(t,Multiset.empty[Int]);
-  }
-  
-  def forAll(property : ((Heap,Int) => Boolean)){
-    assert(property(generateLeftistHeap(4), Verify.getInt(0,4)));
-  }
-
-  forAll((heap: Heap, value: Int) => content(heap.insert(value)) == content(heap) +++ List(value));
-
-}
\ No newline at end of file
diff --git a/tests/udita/RedBlackTreeTest.scala b/tests/udita/RedBlackTreeTest.scala
deleted file mode 100644
index 53c64e9e0e1673c7b186bbcc866f959beae01640..0000000000000000000000000000000000000000
--- a/tests/udita/RedBlackTreeTest.scala
+++ /dev/null
@@ -1,135 +0,0 @@
-package udita
-
-import gov.nasa.jpf.jvm.Verify;
-
-object RedBlackTreeTest extends Application {
-  
-  val RED:Boolean = true;
-  val BLACK:Boolean = false; 
-  
-  sealed abstract class Tree
-  case class Empty() extends Tree
-  case class Node(color: Boolean, left: Tree, value: Int, right: Tree) extends Tree
-  
-  
-  def member(x: Int, t:Tree): Boolean = t match {
-    case Empty() => false
-    case Node(_,a,y,b) => 
-      if (x < y) member(x,a)
-      else if (x > y) member(x,b)
-      else true
-  }
-  
-  def insert(x: Int, t: Tree): Tree = {
-    def ins(t: Tree): Tree = t match {
-      case Empty() => Node(RED,Empty(),x,Empty())
-      case Node(c,a,y,b) =>
-        if      (x < y)  balance(c, ins(a), y, b)
-        else if (x == y) Node(c,a,y,b)
-        else             balance(c,a,y,ins(b))
-    }
-    makeBlack(ins(t))
-  }
-  
-  def balance(c: Boolean, a: Tree, x: Int, b: Tree): Tree = (c,a,x,b) match {
-    case (BLACK,Node(RED,Node(RED,a,xV,b),yV,c),zV,d) => 
-      Node(RED,Node(BLACK,a,xV,b),yV,Node(BLACK,c,zV,d))
-    case (BLACK,Node(RED,a,xV,Node(RED,b,yV,c)),zV,d) => 
-      Node(RED,Node(BLACK,a,xV,b),yV,Node(BLACK,c,zV,d))
-    case (BLACK,a,xV,Node(RED,Node(RED,b,yV,c),zV,d)) => 
-      Node(RED,Node(BLACK,a,xV,b),yV,Node(BLACK,c,zV,d))
-    case (BLACK,a,xV,Node(RED,b,yV,Node(RED,c,zV,d))) => 
-      Node(RED,Node(BLACK,a,xV,b),yV,Node(BLACK,c,zV,d))
-    case (c,a,xV,b) => Node(c,a,xV,b)
-  }
-  
-  /** makeBLACK: Turn a node BLACK. */
-  def makeBlack(n: Tree): Tree = n match {
-    case Node(RED,l,v,r) => Node(BLACK,l,v,r)
-    case _ => n
-  }
-  
-  /* global invariants: 
-   * RED-BLACK trees are binary search trees obeying two key invariants:
-   *
-   * (1) Any path from a root node to a leaf node contains the same number
-   *     of BLACK nodes. (A balancing condition.)
-   *
-   * (2) RED nodes always have BLACK children.
-   *
-   */
-  
-  /* Empty tree are consideRED to be BLACK */
-  def isBLACK(t: Tree): Boolean = t match {
-    case Node(RED,_,_,_) => false
-    case _ => true
-  }
-  
-  
-  def anyPathsContainsSameNumberOfBlackNodes(t: Tree): Boolean = {
-    def blacks(t: Tree, acc: Int): List[Int] = t match {
-      case Empty() => List(acc + 1) // because Empty are assumed to be BLACK
-      case Node(_,l,_,r) => 
-        val upAcc = if(isBLACK(t)) acc + 1 else acc 
-        blacks(l,upAcc) ::: blacks(r,upAcc)  
-    }
-    val paths = blacks(t, 0)
-    
-    if(paths.isEmpty)
-      true
-    else
-      paths.forall(_ == paths.head)
-  } 
-  
-  def areRedNodeChildrenBlack(t: Tree): Boolean = t match {
-    case Node(RED,l,_,r) =>
-      isBLACK(l) && isBLACK(r) &&
-      areRedNodeChildrenBlack(l) && areRedNodeChildrenBlack(r)
-    case Node(BLACK,l,_,r) =>
-      areRedNodeChildrenBlack(l) && areRedNodeChildrenBlack(r)
-    case _ => true
-  }
-  
-  def generateRedBlackTree(treeSize:Int): Tree = {
-    val t = generateBinarySearchTree(treeSize);
-    Verify.ignoreIf(!anyPathsContainsSameNumberOfBlackNodes(t) || !areRedNodeChildrenBlack(t));
-    return t;
-  }
-  
-  private def generateBinarySearchTree(treeSize:Int): Tree = {
-    val size = Verify.getInt(1, treeSize);
-    val maxNodeValue = size - 1;
-    val t = getSubTree(size, 0, maxNodeValue);
-    return t;
-  }
-  
-  private def getSubTree(size:Int, min:Int, max:Int): Tree = {
-    if (size == 0) return Empty();
-    if (size == 1) return Node(Verify.getBoolean(), Empty(), Verify.getInt(min,max), Empty());
-
-    val value = Verify.getInt(min,max);
-
-    val leftSize = value - min;
-    val rightSize = size - 1 - leftSize;
-
-    return Node(Verify.getBoolean(), getSubTree(leftSize, min, value - 1), value, getSubTree(rightSize, value + 1, max));
-  }
-  
-  def content(t:Tree):Set[Int] = t match {
-    case Empty() => Set.empty;
-    case Node(_,left,value,right) => (content(left) ++ Set(value) ++ content(right));
-  }
-  
-  def forAll(property: (Tree,Int) => Boolean){     
-    val t = generateRedBlackTree(4);
-    val x = Verify.getInt(0,4);
-    assert(property(t,x));
-    System.out.println(x+" "+t);
-  }
-  
-  forAll((t:Tree, x:Int)  => ({val t1 = insert(x,t); anyPathsContainsSameNumberOfBlackNodes(t1) && areRedNodeChildrenBlack(t1)}));
-  //forAll{t: Tree => areRedNodeChildrenBlack(t)} //(2)
-
-  //generateRedBlackTree(4);
-
-}
diff --git a/tests/udita/SkewBinaryRandomAccessListTest.scala b/tests/udita/SkewBinaryRandomAccessListTest.scala
deleted file mode 100644
index e7051ca907fc90fb930858db5a1e3ed17590b767..0000000000000000000000000000000000000000
--- a/tests/udita/SkewBinaryRandomAccessListTest.scala
+++ /dev/null
@@ -1,136 +0,0 @@
-package udita
-
-import scala.collection.immutable.Multiset;
-import gov.nasa.jpf.jvm.Verify;
-
-object SkewBinaryRandomAccessListTest extends Application {
-
-  sealed abstract class Tree
-  case class Leaf(w: Int) extends Tree
-  case class Node(w: Int, left: Tree, right: Tree) extends Tree
-  
-  type RList = List[(Int, Tree)]  
-  
-  val empty = Nil
-  
-  def isEmpty(ts: RList) = ts.isEmpty
-  
-  def cons(w: Int, ts: RList): RList = ts match {
-    case (w1,t1) :: (w2,t2) :: rest if (w1 == w2) => 
-      (1+w1+w2, Node(w,t1,t2)) :: rest
-      
-    case _ => 
-      (1, Leaf(w)) :: ts 
-  }
-  
-  def head(ts: RList): Int = ts match {
-    case Nil => error("head of empty list")
-    case (1, Leaf(x)) :: ts => x
-    case (_, Node(x, _, _)) :: ts => x
-  }
-  
-  def tail(ts: RList): RList = ts match {
-    case Nil => error("tail of empty list")
-    case (1, Leaf(x)) :: ts => ts
-    case (w, Node(x, t1, t2)) :: rest => 
-      (w/2, t1) :: (w/2, t2) :: rest
-  }
-  
-  def lookup(i: Int, ts: RList): Int = ts match {
-    case Nil => error("lookup of empty list")
-    case (w,t) :: ts =>
-      if (i < w) lookupTree(w,i,t)
-      else lookup(i-w, ts)
-  }
-  
-  def lookupTree(w: Int, i: Int, t: Tree): Int = (w,i,t) match {
-    case (1,0, Leaf(x)) => x
-    case tuple @ (1,_,Leaf(x)) => error("lookupTree: error for "+tuple)
-    case (_,0, Node(x,_,_)) => x
-    case (_,_,Node(x,t1,t2)) =>
-      if (i < w/2) lookupTree(w/2,i-1,t1)
-      else lookupTree(w/2,i-1-w/2,t2)
-  }
-  
-  def updateTree(w: Int, i: Int, y: Int, t: Tree): Tree = (w,i,y,t) match {
-    case (1,0,_,Leaf(x)) => Leaf(y)
-    case tuple @ (1,_,_,Leaf(x)) => error("updateTree: Error for "+tuple)
-    case (_,0,_,Node(x,t1,t2)) => Node(y,t1,t2)
-    case (_,_,_,Node(x,t1,t2)) => 
-      if (i <= w/2) Node(x,updateTree(w/2,i-1,y,t1),t2)
-      else Node(x,t1, updateTree(w/2,i-1-w/2,y,t2))
-  } 
- 
-  
-  def update(i: Int, y: Int, ts: RList): RList = ts match {
-    case Nil => error("update of empty list")
-    case (w,t) :: ts =>
-      if (i < w) (w, updateTree(w,i,y,t)) :: ts
-      else (w,t) :: update(i-w,y,ts)
-  }
-  
-  def incTreeList(ws:List[Int]):List[Int] = ws match {
-    case w1::w2::rest => {
-      if (w1 == w2) (1+w1+w2)::rest;
-      else 1 :: ws;
-    }
-    case _ => 1 :: ws;
-  }
-  
-  def makeSizeList(size:Int):List[Int] = {
-    var list:List[Int] = Nil;
-    for(i <- 0 until size) {
-      list = incTreeList(list);
-    }
-    return list;
-  }
-  
-  def generateSkewBinaryList(maxSize:Int): RList = {
-    val size = Verify.getInt(1, maxSize);
-    val sizeList = makeSizeList(size);
-    val rl = generateAllTrees(sizeList);
-    System.out.println(rl);
-    return rl;
-  }
-  
-  def generateAllTrees(sizeList:List[Int]):RList = sizeList match {
-    case hd::rest =>  List((hd, generateTree(hd))):::generateAllTrees(rest);
-    case Nil => Nil;
-  }
-    
-  private def generateTree(size:Int): Tree = {
-    val maxNodeValue = size - 1;
-    val t = getSubTree(size, 0, 0);//should go up to maxNodeValue
-    //System.out.println(t);
-    return t;
-  }
-  
-  private def getSubTree(size:Int, min:Int, max:Int): Tree = {
-    if (size == 1) return Leaf(Verify.getInt(min,max));
-    val value = Verify.getInt(min,max);
-    val subtreeSize = (size-1) / 2;
-    return Node(value, getSubTree(subtreeSize, min, max), getSubTree(subtreeSize, min, max));
-  }
-
-  def content(t : RList): Multiset[Int] = {
-    def inner(t: Tree, mset: Multiset[Int]): Multiset[Int] = t match {
-      case Leaf(value) => mset +++ List(value);
-      case Node(value, left, right) => inner(right,inner(left, mset +++ List(value)));
-    }
-    def innerList(ts: RList, mset:Multiset[Int]): Multiset[Int] = ts match {
-      case Nil => mset
-      case (w,t)::tss => inner(t, innerList(tss,mset))
-    }   
-    innerList(t,Multiset.empty[Int]);
-  }
-  
-    
-  //generateSkewBinaryList(4);
-  
-  def forAll(property : ((RList,Int) => Boolean)){
-    assert(property(generateSkewBinaryList(4), Verify.getInt(0,4)));
-  }
-
-  forAll((skew, value) => (content(cons(value,skew)) == content(skew) +++ List(value)));
-
-}
diff --git a/tests/udita/SplayHeapTest.scala b/tests/udita/SplayHeapTest.scala
deleted file mode 100644
index ea31f659d30b22cd19786334de63d29428a9bab7..0000000000000000000000000000000000000000
--- a/tests/udita/SplayHeapTest.scala
+++ /dev/null
@@ -1,148 +0,0 @@
-package udita
-
-import gov.nasa.jpf.jvm.Verify;
-
-object SplayHeapTest extends Application {
-  sealed abstract class Heap
-  case class E() extends Heap
-  case class T(x: Int, a: Heap, b: Heap) extends Heap
-  
-  def isEmpty(h: Heap): Boolean = h.isInstanceOf[E]
-  
-  def partition(pivot: Int, t: Heap): (Heap,Heap) = t match {
-    case E() => (E(),E())
-    case T(x,a,b) =>
-      if(x <= pivot) b match {
-        case E() => (T(x,a,E()),E())
-        case T(y,b1,b2) =>
-          if(y <= pivot) {
-            val (small,big) = partition(pivot,b2)
-            val r1 = T(y,T(x,a,b1),small)
-            val r2 = big
-            (r1,r2)
-          } else  {
-            val (small,big) = partition(pivot,b1)
-            val r1 = T(x, a, small)
-            val r2 = T(y, big, b2)
-            (r1,r2)
-          }
-      } else a match {
-        case E() => (E(), T(x,E(),b))
-        case T(y,a1,a2) =>
-          if(y <= pivot) {
-            val (small,big) = partition(pivot,a2)
-            val r1 = T(y,a1,small)
-            val r2 = T(x,big,b)
-            (r1,r2)
-          } else {
-            val (small,big) = partition(pivot,a1)
-            val r1 = small
-            val r2 = T(y,big,T(x,a2,b))
-            (r1,r2)
-          }
-      }
-  }
-  
-  def insert(x: Int, t: Heap): Heap = {
-    val (a,b) = partition(x,t)
-    T(x,a,b)
-  }
-  
-  def merge(t1: Heap, t2: Heap): Heap = t1 match {
-    case E() => t2
-    case T(x,a,b) =>
-      val (ta,tb) = partition(x,t2)
-      val a1 = merge(ta,a)
-      val b1 = merge(tb,b)
-      T(x,a1,b1)
-  }
-  
-  def deleteMin(t: Heap): Heap = t match {
-    case E() => error("empty")
-    case T(x,E(),b) => b
-    case T(y,T(x,E(),b),c) => T(y,b,c)
-    case T(y,T(x,a,b),c) => T(x,deleteMin(a),T(y,b,c))  
-  }
-  
-  def deleteMin2(t: Heap): (Int,Heap) = t match {  
-    case E() => error("empty")
-    case T(x,E(),b) => (x, b)
-    case T(y,T(x,E(),b),c) => (x,T(y,b,c))
-    case T(y,T(x,a,b),c) =>
-      val (r, a1) = deleteMin2(a)
-      (r,T(x,a1,T(y,b,c)))
-  }
-  
-  def findMin(t: Heap): Int = t match { 
-    case E() => error("empty")
-    case T(x,E(),b) => x
-    case T(x,a,b) => findMin(a)
-  }
-  
-  def findMin2(t: Heap): (Int,Heap) = t match {
-    case E() => error("empty")
-    case T(x,E(),b) => (x, t)
-    case T(x,a,b) =>
-      val (x1, a1) = findMin2(a)
-      (x1,T(x,a1,b))
-  }
-  
-  def app(x: Int, ys: List[Int],  zs: List[Int]): List[Int] = ys match {
-    case Nil => x :: zs
-    case y :: ys => y :: app(x,ys,zs)
-  }
-  
-
-  def to_list(t: Heap): List[Int] = t match { 
-    case E() => Nil
-    case T(x,a,b) => app(x,to_list(a),to_list(b))
-  }
-
-  def check_sorted(xs: List[Int]): Boolean = xs match {
-    case Nil => true
-    case x :: xs =>
-      xs.forall(x <= _) && check_sorted(xs)
-  }
-
-  def to_list2(t: Heap): List[Int] = { 
-    val xs = to_list(t)
-    check_sorted(xs)
-    xs
-  }
-  
-  def generateSplayHeap(treeSize:Int): Heap = {
-    return generateBinarySearchTree(treeSize);
-  }
-  
-  private def generateBinarySearchTree(treeSize:Int): Heap = {
-    val size = Verify.getInt(1, treeSize);
-    val maxNodeValue = size - 1;
-    val t = getSubTree(size, 0, maxNodeValue);
-    return t;
-  }
-  
-  private def getSubTree(size:Int, min:Int, max:Int): Heap = {
-    if (size == 0) return E();
-    if (size == 1) return T(Verify.getInt(min,max), E(), E());
-
-    val value = Verify.getInt(min,max);
-
-    val leftSize = value - min;
-    val rightSize = size - 1 - leftSize;
-
-    return T(value, getSubTree(leftSize, min, value - 1), getSubTree(rightSize, value + 1, max));
-  }
-  
-  def content(t:Heap):Set[Int] = t match {
-    case E() => Set.empty;
-    case T(value,left,right) => (content(left) ++ Set(value) ++ content(right));
-  }
-  
-  def forAll(property: (Heap) => Boolean){     
-    val t = generateSplayHeap(4);
-    assert(property(t));
-    System.out.println(t);
-  }
-  
-  forAll{h: Heap => check_sorted(to_list(h))}
-}
diff --git a/tmp/InputProgramGeneration.scala b/tmp/InputProgramGeneration.scala
deleted file mode 100644
index d4d50f875035531ba0f1fcb8c22b01c30cc05163..0000000000000000000000000000000000000000
--- a/tmp/InputProgramGeneration.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-import funcheck.lib.Specs._
-
-object BSTTest {
-  /** Specification Variables */
-  def content(t : BST) : Set[Int] = t match {
-    case Leaf() => Set.empty
-    case Node(left,right,v) => (content(left) ++ Set(v) ++ content(right))
-  }
-  
-  def contains(key: Int, t : BST): Boolean = { 
-    t match {
-      case Leaf() => false
-      case Node(left,right,v) => {
-	if (key == v) true
-	else if (key < v) contains(key, left)
-	else contains(key, right)
-      }
-      }
-  }
-  
-  /** Properties */
-  forAll[(BST,Int)]( p => contains(p._2,p._1) == content(p._1).contains(p._2))
-  
-  /** Program */
-  @generator
-  sealed abstract class BST
-  case class Node(left: BST, right: BST, v: Int) extends BST
-  case class Leaf() extends BST 
-}
diff --git a/tmp/OutputProgramGeneration.scala.scala b/tmp/OutputProgramGeneration.scala.scala
deleted file mode 100644
index 90b072d102d30e73a54592dda9c942cbd88a806a..0000000000000000000000000000000000000000
--- a/tmp/OutputProgramGeneration.scala.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-// injected
-import org.scalacheck.{Arbitrary,Gen,Prop,Shrink}
-
-//removed
-// import funcheck.lib.Specs._
-
-object BSTTest {
-  
-  def main(args: Array[String]) = {
-    println(genBST.sample) 
-  }
-  
-  /** Specification Variables */
-  def content(t : BST) : Set[Int] = t match {
-    case Leaf() => Set.empty
-    case Node(left,right,v) => (content(left) ++ Set(v) ++ content(right))
-  }
-  
-  def contains(key: Int, t : BST): Boolean = { 
-    t match {
-      case Leaf() => false
-      case Node(left,right,v) => {
-	    if (key == v) true
-	    else if (key < v) contains(key, left)
-	    else contains(key, right)
-      }
-    }
-  }
-  
-  /** Properties */
-  // removed
-  // forAll[(BST,Int)]( p => contains(p._2,p._1) == content(p._1).contains(p._2))
-  
-  // injected
-  // replaced with ScalaCheck forAll
-  Console.Prop.forAll( (tree:BST,v:Int) => contains(v,tree) == content(tree).contains(v))(b: Boolean => Prop.propBoolean(b), arbBST, Shrink.shrinkAny[BST], Arbitrary.arbInt, Shrink.shrinkInt)
-  
-  /** Program */
-  @generator
-  sealed abstract class BST
-  case class Node(left: BST, right: BST, v: Int) extends BST
-  case class Leaf() extends BST
-  
-  /**********************************************/
-  /**********************************************/
-  
-  /** Automatically Injected Code*/
-  // Generators
-  def genBST: Gen[BST] = Gen.lzy(Gen.oneOf(genLeaf,genNode))
-  
-  def genNode: Gen[Node] = Gen.lzy(for {
-    left <- genBST
-    right <- genBST
-    v <- Arbitrary.arbitrary[Int]
-  } yield Node(left,right,v))
-  
-  def genLeaf: Gen[Leaf] = Gen.lzy(Gen.value(Leaf()))
-  
-  // Arbitrary
-  def arbBST: Arbitrary[BST] = Arbitrary(genBST)
-  def arbNode: Arbitrary[Node] = Arbitrary(genNode)
-  def arbLeaf: Arbitrary[Leaf] = Arbitrary(genLeaf)
-  
-}
diff --git a/vs b/vs
deleted file mode 100755
index 85b293c4344ff98e5d63846e226045d5da6bd725..0000000000000000000000000000000000000000
--- a/vs
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-runner="./scalac-funcheck"
-newargs=""
-
-for arg in $@
-do
-    if [ -e ${arg} ]
-    then
-        newargs="${newargs} ${arg}"
-    else
-        newargs="${newargs} -P:funcheck:${arg}"
-    fi
-done
-
-if [ -e ${runner} ]
-then
-    ${runner} -P:funcheck:CAV ${newargs} -P:funcheck:CAV
-    exit 0
-else
-    echo "${runner} not found. Have you run 'sbt all' ?"
-    exit 1
-fi
-
diff --git a/web/lib/funcheck-plugin_2.8.1-1.0.jar b/web/lib/funcheck-plugin_2.8.1-1.0.jar
deleted file mode 100644
index 69448e58e9f838866f43e5f15f538d09287c075d..0000000000000000000000000000000000000000
Binary files a/web/lib/funcheck-plugin_2.8.1-1.0.jar and /dev/null differ
diff --git a/web/lib/multiset-placeholder-library_2.8.1-1.0.jar b/web/lib/multiset-placeholder-library_2.8.1-1.0.jar
deleted file mode 100644
index 65576db9550092e02b40d5803495c99d598ae41b..0000000000000000000000000000000000000000
Binary files a/web/lib/multiset-placeholder-library_2.8.1-1.0.jar and /dev/null differ
diff --git a/web/lib/purescala-definitions_2.8.1-1.0.jar b/web/lib/purescala-definitions_2.8.1-1.0.jar
deleted file mode 100644
index 0ef03598e5fab8ff85846b065bb44d3f077b4bf0..0000000000000000000000000000000000000000
Binary files a/web/lib/purescala-definitions_2.8.1-1.0.jar and /dev/null differ
diff --git a/web/lib/scala-compiler.jar b/web/lib/scala-compiler.jar
deleted file mode 100644
index 551596023c04beae1b53f63b7d1b0893cb7986ee..0000000000000000000000000000000000000000
Binary files a/web/lib/scala-compiler.jar and /dev/null differ
diff --git a/web/lib/z3.jar b/web/lib/z3.jar
deleted file mode 100644
index 8c6d5d9174d449abe05cae1f8fb60768d9fea799..0000000000000000000000000000000000000000
Binary files a/web/lib/z3.jar and /dev/null differ
diff --git a/web/project/build.properties b/web/project/build.properties
deleted file mode 100644
index d7876c01cd04bad7ad0a3632a9ab8b08744bd5e2..0000000000000000000000000000000000000000
--- a/web/project/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-#Project properties
-#Fri Apr 23 11:24:20 PDT 2010
-project.organization=Lift
-project.name=Lift SBT Template
-sbt.version=0.7.4
-project.version=0.1
-def.scala.version=2.7.7
-build.scala.versions=2.8.1
-project.initialize=false
diff --git a/web/project/build/LiftProject.scala b/web/project/build/LiftProject.scala
deleted file mode 100644
index 8e9b38d86d27729a763defcdcf1dac9919ad33b0..0000000000000000000000000000000000000000
--- a/web/project/build/LiftProject.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-import sbt._
-
-class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) {
-  val liftVersion = "2.2"
-
-  // uncomment the following if you want to use the snapshot repo
-  // val scalatoolsSnapshot = ScalaToolsSnapshots
-
-  // If you're using JRebel for Lift development, uncomment
-  // this line
-  // override def scanDirectories = Nil
-
-  override def libraryDependencies = Set(
-    "net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",
-    "net.liftweb" %% "lift-mapper" % liftVersion % "compile->default",
-    "org.mortbay.jetty" % "jetty" % "6.1.22" % "test->default",
-    "junit" % "junit" % "4.5" % "test->default",
-    "ch.qos.logback" % "logback-classic" % "0.9.26",
-    "org.scala-tools.testing" %% "specs" % "1.6.6" % "test->default",
-    "com.h2database" % "h2" % "1.2.138"
-  ) ++ super.libraryDependencies
-}
diff --git a/web/src/main/resources/.keep b/web/src/main/resources/.keep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/web/src/main/resources/props/default.props b/web/src/main/resources/props/default.props
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/web/src/main/scala/bootstrap/liftweb/Boot.scala b/web/src/main/scala/bootstrap/liftweb/Boot.scala
deleted file mode 100644
index 70630c59d03eee1308730f6670f1e5b026020465..0000000000000000000000000000000000000000
--- a/web/src/main/scala/bootstrap/liftweb/Boot.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-package bootstrap.liftweb
-
-import net.liftweb._
-import util._
-import Helpers._
-
-import common._
-import http._
-import sitemap._
-import Loc._
-import mapper._
-
-import code.model._
-
-
-/**
- * A class that's instantiated early and run.  It allows the application
- * to modify lift's environment
- */
-class Boot {
-  def boot {
-    if (!DB.jndiJdbcConnAvailable_?) {
-      val vendor = 
-	new StandardDBVendor(Props.get("db.driver") openOr "org.h2.Driver",
-			     Props.get("db.url") openOr 
-			     "jdbc:h2:lift_proto.db;AUTO_SERVER=TRUE",
-			     Props.get("db.user"), Props.get("db.password"))
-
-      LiftRules.unloadHooks.append(vendor.closeAllConnections_! _)
-
-      DB.defineConnectionManager(DefaultConnectionIdentifier, vendor)
-    }
-
-    // where to search snippet
-    LiftRules.addToPackages("code")
-
-    // Build SiteMap
-    def sitemap = SiteMap(
-      Menu.i("Home") / "index"
-    )
-
-    // Force the request to be UTF-8
-    LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
-
-    // What is the function to test if a user is logged in?
-    //LiftRules.loggedInTest = Full(() => User.loggedIn_?)
-
-    // Use HTML5 for rendering
-    LiftRules.htmlProperties.default.set((r: Req) =>
-      new Html5Properties(r.userAgent))
-
-    // Make laraserver happy with itself.
-    // LiftRules.ajaxPath  = "leon/ajax_request"
-    // LiftRules.cometPath = "leon/comet_request"
-
-    // Make a transaction span the whole HTTP request
-    S.addAround(DB.buildLoanWrapper)
-  }
-}
diff --git a/web/src/main/scala/code/comet/.keep b/web/src/main/scala/code/comet/.keep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/web/src/main/scala/code/comet/Chat.scala b/web/src/main/scala/code/comet/Chat.scala
deleted file mode 100644
index aa8146f2ebab9003dbe476b7b4417c6667810df9..0000000000000000000000000000000000000000
--- a/web/src/main/scala/code/comet/Chat.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*package code
-package comet
- 
-import net.liftweb._
-import http._
-import actor._
-import util.Helpers._
-import js._
-import JsCmds._
-import JE._
- 
-object ChatServer extends LiftActor with ListenerManager {
-  private var messages = Vector("Welcome")
- 
-  def createUpdate = messages
- 
-  override def lowPriority = {
-    case s: String => messages :+= s; updateListeners()
-  }
-}
- 
-class Chat extends CometActor with CometListener {
-  private var msgs: Vector[String] = Vector()
- 
-  def registerWith = ChatServer
- 
-  override def lowPriority = {
-    case v: Vector[String] => msgs = v; reRender()
-  }
- 
-  def render = "li *" #> msgs
- 
-  override def fixedRender = {
-    <lift:form>
-    {
-      SHtml.text("", s => {
-        ChatServer ! s
-        SetValById("chat_box", "")
-      }, "id" -> "chat_box")
-    }
-    <input type="submit" value="Chat"/>
-    </lift:form>
-  }
- 
-}
-
-*/
diff --git a/web/src/main/scala/code/comet/CodeProcessor.scala b/web/src/main/scala/code/comet/CodeProcessor.scala
deleted file mode 100644
index dbba6238e3c43bf9430bfd47841ddddc4301f51e..0000000000000000000000000000000000000000
--- a/web/src/main/scala/code/comet/CodeProcessor.scala
+++ /dev/null
@@ -1,135 +0,0 @@
-package code
-package comet
-
-import scala.xml._
-
-import scala.actors._
-import scala.actors.Actor._
-
-import net.liftweb._
-import net.liftweb.common._
-import net.liftweb.http._
-import net.liftweb.actor._
-import net.liftweb.util.Helpers._
-import net.liftweb.http.js._
-import net.liftweb.http.js.JsCmds._
-import net.liftweb.http.js.JE._
-
-import purescala.Reporter
-import purescala.Definitions._
-import funcheck.{Main=>FuncheckMain}
-
-// A query contains a whole program :D
-case class Query(editor : CodeProcessor, string : String)
-case class Message(string : String)
-case object Clear
-
-// A funcheck/purescala compliant reporter that sends the
-// strings to an actor rather than printing them.
-class ActorReporter(dest : CodeProcessor) extends Reporter {
-  private val BUFSZ : Int = 10
-  private val buffer : Array[String] = new Array[String](BUFSZ)
-  private var id : Int = 0
-
-  def output(msg : Any) : Unit = {
-    val str = msg.toString
-    val trimmed = str.trim
-    val exclude = trimmed.startsWith("-") || trimmed.startsWith("Trying")
-
-    if(!exclude) {
-      buffer(id) = str
-      id += 1
-      if(id == BUFSZ) {
-        send()
-        id = 0
-      }
-    }
-  }
-
-  def flush : Unit = {
-    send(id)
-    id = 0
-  }
-
-  private def send(num : Int = BUFSZ) : Unit = {
-    val msg = buffer.take(num).mkString("\n")
-    dest ! Message(msg)
-  }
-
-  def error(msg: Any) = output(msg)
-  def warning(msg: Any) = output(msg)
-  def info(msg: Any) = output(msg)
-  def fatalError(msg: Any) = {
-    output(msg)
-    throw new Exception("Fatal error.")
-  }
-}
-
-object QueryHandler extends LiftActor {
-  private val cpdir = "/localhome/liftweb/leonscalaccp/"
-  private val classpath = List(
-    cpdir + "scala-library.jar" + ":" +
-    cpdir + "funcheck.jar" + ":" +
-    cpdir + "multisets-lib.jar"
-  )
-  private val funcheckOptions : Array[String] = Array(
-    "--CAV",
-    "--timeout=5"
-  )
-
-  def messageHandler = {
-    case Query(editor, string) => {
-      editor ! Clear
-      editor ! Message("Query received.")
-      editor ! Message("")
-
-      val reporter = new ActorReporter(editor)
-      try {
-        FuncheckMain.runFromString(string, funcheckOptions, reporter, Some(classpath))
-      } catch {
-        case e : Exception => editor ! Message(e.getMessage)
-      }
-      reporter.flush
-      editor ! Message("Done.")
-    }
-  }
-}
-
-class CodeProcessor extends CometActor {
-  override def defaultPrefix = Full("codeprocessor")
-  private var msgs : List[String] = Nil
-
-  override def lowPriority : PartialFunction[Any,Unit] = {
-    case Clear => {
-      msgs = Nil
-      partialUpdate(
-        SetValById("consolebox", "Cleared.")
-      )
-    }
-
-    case Message(msg) => {
-      msgs = msg :: msgs
-      partialUpdate(
-        SetValById("consolebox", msgs.reverse.mkString("\n"))
-      )
-    }
-  }
-
-  def render = <span></span>
-
-  override def fixedRender = bind("inputbox" ->
-      <lift:form>
-        {
-          SHtml.textarea("", s => {
-              QueryHandler ! Query(this, s)
-            }, "id" -> "codebox")
-        }
-        {
-          SHtml.submit("Verify !", () => {}, "id" -> "clicker", "onClick" -> "editor.save();")
-        }
-        {
-          SHtml.textarea("Console.\n", s => {}, "id" -> "consolebox", "onChange" -> "document.getElementById('consolebox').scrollTop=document.getElementById('consolebox').scrollHeight;")
-        }
-      </lift:form>
-    )
-}
diff --git a/web/src/main/scala/code/comet/Editor.scala b/web/src/main/scala/code/comet/Editor.scala
deleted file mode 100644
index f03fdaf0a52731cc24966119fb01ca4a7013b9bb..0000000000000000000000000000000000000000
--- a/web/src/main/scala/code/comet/Editor.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-package code
-package comet
-
-import scala.actors._
-import scala.actors.Actor._
-
-import net.liftweb._
-import net.liftweb.http._
-import net.liftweb.actor._
-import net.liftweb.util.Helpers._
-import net.liftweb.http.js._
-import net.liftweb.http.js.JsCmds._
-import net.liftweb.http.js.JE._
-
-case class Query(editor : Editor, string : String)
-case class Ack(string : String)
-
-object QueryHandler extends LiftActor {
-
-  def messageHandler = {
-    case Query(editor, string) => {
-      val shorter = if(string.length > 5) {
-        string.substring(0,5) + "..."
-      } else {
-        string
-      }
-      editor ! Ack("I got your message: " + shorter)
-    }
-  }
-}
-
-class Editor extends CometActor {
-  private var msgs : List[String] = List("first msg.")
-
-  override def lowPriority : PartialFunction[Any,Unit] = {
-    case Ack(msg) => msgs = msg :: msgs; reRender()
-  }
-
-  def render = "li *" #> msgs
-
-  override def fixedRender = {
-      <lift:form>
-        {
-          SHtml.textarea("", s => {
-              QueryHandler ! Query(this, s)
-            }, "id" -> "code_box", "cols" -> "120", "rows" -> "40")
-        }
-        <input type="submit" onClick="editor.save();" value="Code" />
-      </lift:form>
-  }
-}
-
-*/
diff --git a/web/src/main/scala/code/lib/DependencyFactory.scala b/web/src/main/scala/code/lib/DependencyFactory.scala
deleted file mode 100644
index 4d4fab593be8158a7ecf0f6275765f563767e36e..0000000000000000000000000000000000000000
--- a/web/src/main/scala/code/lib/DependencyFactory.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-package code {
-package lib {
-
-import net.liftweb._
-import http._
-import util._
-import common._
-import _root_.java.util.Date
-
-/**
- * A factory for generating new instances of Date.  You can create
- * factories for each kind of thing you want to vend in your application.
- * An example is a payment gateway.  You can change the default implementation,
- * or override the default implementation on a session, request or current call
- * stack basis.
- */
-object DependencyFactory extends Factory {
-  implicit object time extends FactoryMaker(Helpers.now _)
-
-  /**
-   * objects in Scala are lazily created.  The init()
-   * method creates a List of all the objects.  This
-   * results in all the objects getting initialized and
-   * registering their types with the dependency injector
-   */
-  private def init() {
-    List(time)
-  }
-  init()
-}
-
-/*
-/**
- * Examples of changing the implementation
- */
-sealed abstract class Changer {
-  def changeDefaultImplementation() {
-    DependencyFactory.time.default.set(() => new Date())
-  }
-
-  def changeSessionImplementation() {
-    DependencyFactory.time.session.set(() => new Date())
-  }
-
-  def changeRequestImplementation() {
-    DependencyFactory.time.request.set(() => new Date())
-  }
-
-  def changeJustForCall(d: Date) {
-    DependencyFactory.time.doWith(d) {
-      // perform some calculations here
-    }
-  }
-}
-*/
-}
-}
diff --git a/web/src/main/scala/code/snippet/Z3Snippet.scala b/web/src/main/scala/code/snippet/Z3Snippet.scala
deleted file mode 100644
index 9019fab7e49d1f5b9e568643d1906606031bc581..0000000000000000000000000000000000000000
--- a/web/src/main/scala/code/snippet/Z3Snippet.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-package code
-package snippet
-
-import scala.xml.{NodeSeq,Text}
-
-class Z3Snippet {
-  def versionString(xhtml : NodeSeq) : NodeSeq = {
-    Text(z3.scala.version)
-  }
-}
diff --git a/web/src/main/scala/code/view/.keep b/web/src/main/scala/code/view/.keep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/web/src/main/webapp/WEB-INF/web.xml b/web/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 677471014eaf6a84fe974aee40b2636ac7f3f60d..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!DOCTYPE web-app
-PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-"http://java.sun.com/dtd/web-app_2_3.dtd">
-
-<web-app>
-<filter>
-  <filter-name>LiftFilter</filter-name>
-  <display-name>Lift Filter</display-name>
-  <description>The Filter that intercepts lift calls</description>
-  <filter-class>net.liftweb.http.LiftFilter</filter-class>
-</filter>
-  	
-
-<filter-mapping>
-  <filter-name>LiftFilter</filter-name>
-  <url-pattern>/*</url-pattern>
-</filter-mapping>
-
-</web-app>
diff --git a/web/src/main/webapp/codemirror/codemirror.js b/web/src/main/webapp/codemirror/codemirror.js
deleted file mode 100644
index 5f5aea58145c75f56ca39101df9ba56790959992..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/codemirror.js
+++ /dev/null
@@ -1,585 +0,0 @@
-/* CodeMirror main module (http://codemirror.net/)
- *
- * Implements the CodeMirror constructor and prototype, which take care
- * of initializing the editor frame, and providing the outside interface.
- */
-
-// The CodeMirrorConfig object is used to specify a default
-// configuration. If you specify such an object before loading this
-// file, the values you put into it will override the defaults given
-// below. You can also assign to it after loading.
-var CodeMirrorConfig = window.CodeMirrorConfig || {};
-
-var CodeMirror = (function(){
-  function setDefaults(object, defaults) {
-    for (var option in defaults) {
-      if (!object.hasOwnProperty(option))
-        object[option] = defaults[option];
-    }
-  }
-  function forEach(array, action) {
-    for (var i = 0; i < array.length; i++)
-      action(array[i]);
-  }
-  function createHTMLElement(el) {
-    if (document.createElementNS && document.documentElement.namespaceURI !== null)
-      return document.createElementNS("http://www.w3.org/1999/xhtml", el)
-    else
-      return document.createElement(el)
-  }
-
-  // These default options can be overridden by passing a set of
-  // options to a specific CodeMirror constructor. See manual.html for
-  // their meaning.
-  setDefaults(CodeMirrorConfig, {
-    stylesheet: [],
-    path: "",
-    parserfile: [],
-    basefiles: ["util.js", "stringstream.js", "select.js", "undo.js", "editor.js", "tokenize.js"],
-    iframeClass: null,
-    passDelay: 200,
-    passTime: 50,
-    lineNumberDelay: 200,
-    lineNumberTime: 50,
-    continuousScanning: false,
-    saveFunction: null,
-    onLoad: null,
-    onChange: null,
-    undoDepth: 50,
-    undoDelay: 800,
-    disableSpellcheck: true,
-    textWrapping: true,
-    readOnly: false,
-    width: "",
-    height: "300px",
-    minHeight: 100,
-    autoMatchParens: false,
-    markParen: null,
-    unmarkParen: null,
-    parserConfig: null,
-    tabMode: "indent", // or "spaces", "default", "shift"
-    enterMode: "indent", // or "keep", "flat"
-    electricChars: true,
-    reindentOnLoad: false,
-    activeTokens: null,
-    onCursorActivity: null,
-    lineNumbers: false,
-    firstLineNumber: 1,
-    onLineNumberClick: null,
-    indentUnit: 2,
-    domain: null,
-    noScriptCaching: false,
-    incrementalLoading: false
-  });
-
-  function addLineNumberDiv(container, firstNum) {
-    var nums = createHTMLElement("div"),
-        scroller = createHTMLElement("div");
-    nums.style.position = "absolute";
-    nums.style.height = "100%";
-    if (nums.style.setExpression) {
-      try {nums.style.setExpression("height", "this.previousSibling.offsetHeight + 'px'");}
-      catch(e) {} // Seems to throw 'Not Implemented' on some IE8 versions
-    }
-    nums.style.top = "0px";
-    nums.style.left = "0px";
-    nums.style.overflow = "hidden";
-    container.appendChild(nums);
-    scroller.className = "CodeMirror-line-numbers";
-    nums.appendChild(scroller);
-    scroller.innerHTML = "<div>" + firstNum + "</div>";
-    return nums;
-  }
-
-  function frameHTML(options) {
-    if (typeof options.parserfile == "string")
-      options.parserfile = [options.parserfile];
-    if (typeof options.basefiles == "string")
-      options.basefiles = [options.basefiles];
-    if (typeof options.stylesheet == "string")
-      options.stylesheet = [options.stylesheet];
-
-    var sp = " spellcheck=\"" + (options.disableSpellcheck ? "false" : "true") + "\"";
-    var html = ["<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html" + sp + "><head>"];
-    // Hack to work around a bunch of IE8-specific problems.
-    html.push("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\"/>");
-    var queryStr = options.noScriptCaching ? "?nocache=" + new Date().getTime().toString(16) : "";
-    forEach(options.stylesheet, function(file) {
-      html.push("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + file + queryStr + "\"/>");
-    });
-    forEach(options.basefiles.concat(options.parserfile), function(file) {
-      if (!/^https?:/.test(file)) file = options.path + file;
-      html.push("<script type=\"text/javascript\" src=\"" + file + queryStr + "\"><" + "/script>");
-    });
-    html.push("</head><body style=\"border-width: 0;\" class=\"editbox\"" + sp + "></body></html>");
-    return html.join("");
-  }
-
-  var internetExplorer = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent);
-
-  function CodeMirror(place, options) {
-    // Use passed options, if any, to override defaults.
-    this.options = options = options || {};
-    setDefaults(options, CodeMirrorConfig);
-
-    // Backward compatibility for deprecated options.
-    if (options.dumbTabs) options.tabMode = "spaces";
-    else if (options.normalTab) options.tabMode = "default";
-    if (options.cursorActivity) options.onCursorActivity = options.cursorActivity;
-
-    var frame = this.frame = createHTMLElement("iframe");
-    if (options.iframeClass) frame.className = options.iframeClass;
-    frame.frameBorder = 0;
-    frame.style.border = "0";
-    frame.style.width = '100%';
-    frame.style.height = '100%';
-    // display: block occasionally suppresses some Firefox bugs, so we
-    // always add it, redundant as it sounds.
-    frame.style.display = "block";
-
-    var div = this.wrapping = createHTMLElement("div");
-    div.style.position = "relative";
-    div.className = "CodeMirror-wrapping";
-    div.style.width = options.width;
-    div.style.height = (options.height == "dynamic") ? options.minHeight + "px" : options.height;
-    // This is used by Editor.reroutePasteEvent
-    var teHack = this.textareaHack = createHTMLElement("textarea");
-    div.appendChild(teHack);
-    teHack.style.position = "absolute";
-    teHack.style.left = "-10000px";
-    teHack.style.width = "10px";
-    teHack.tabIndex = 100000;
-
-    // Link back to this object, so that the editor can fetch options
-    // and add a reference to itself.
-    frame.CodeMirror = this;
-    if (options.domain && internetExplorer) {
-      this.html = frameHTML(options);
-      frame.src = "javascript:(function(){document.open();" +
-        (options.domain ? "document.domain=\"" + options.domain + "\";" : "") +
-        "document.write(window.frameElement.CodeMirror.html);document.close();})()";
-    }
-    else {
-      frame.src = "javascript:;";
-    }
-
-    if (place.appendChild) place.appendChild(div);
-    else place(div);
-    div.appendChild(frame);
-    if (options.lineNumbers) this.lineNumbers = addLineNumberDiv(div, options.firstLineNumber);
-
-    this.win = frame.contentWindow;
-    if (!options.domain || !internetExplorer) {
-      this.win.document.open();
-      this.win.document.write(frameHTML(options));
-      this.win.document.close();
-    }
-  }
-
-  CodeMirror.prototype = {
-    init: function() {
-      // Deprecated, but still supported.
-      if (this.options.initCallback) this.options.initCallback(this);
-      if (this.options.onLoad) this.options.onLoad(this);
-      if (this.options.lineNumbers) this.activateLineNumbers();
-      if (this.options.reindentOnLoad) this.reindent();
-      if (this.options.height == "dynamic") this.setDynamicHeight();
-    },
-
-    getCode: function() {return this.editor.getCode();},
-    setCode: function(code) {this.editor.importCode(code);},
-    selection: function() {this.focusIfIE(); return this.editor.selectedText();},
-    reindent: function() {this.editor.reindent();},
-    reindentSelection: function() {this.focusIfIE(); this.editor.reindentSelection(null);},
-
-    focusIfIE: function() {
-      // in IE, a lot of selection-related functionality only works when the frame is focused
-      if (this.win.select.ie_selection && document.activeElement != this.frame)
-        this.focus();
-    },
-    focus: function() {
-      this.win.focus();
-      if (this.editor.selectionSnapshot) // IE hack
-        this.win.select.setBookmark(this.win.document.body, this.editor.selectionSnapshot);
-    },
-    replaceSelection: function(text) {
-      this.focus();
-      this.editor.replaceSelection(text);
-      return true;
-    },
-    replaceChars: function(text, start, end) {
-      this.editor.replaceChars(text, start, end);
-    },
-    getSearchCursor: function(string, fromCursor, caseFold) {
-      return this.editor.getSearchCursor(string, fromCursor, caseFold);
-    },
-
-    undo: function() {this.editor.history.undo();},
-    redo: function() {this.editor.history.redo();},
-    historySize: function() {return this.editor.history.historySize();},
-    clearHistory: function() {this.editor.history.clear();},
-
-    grabKeys: function(callback, filter) {this.editor.grabKeys(callback, filter);},
-    ungrabKeys: function() {this.editor.ungrabKeys();},
-
-    setParser: function(name, parserConfig) {this.editor.setParser(name, parserConfig);},
-    setSpellcheck: function(on) {this.win.document.body.spellcheck = on;},
-    setStylesheet: function(names) {
-      if (typeof names === "string") names = [names];
-      var activeStylesheets = {};
-      var matchedNames = {};
-      var links = this.win.document.getElementsByTagName("link");
-      // Create hashes of active stylesheets and matched names.
-      // This is O(n^2) but n is expected to be very small.
-      for (var x = 0, link; link = links[x]; x++) {
-        if (link.rel.indexOf("stylesheet") !== -1) {
-          for (var y = 0; y < names.length; y++) {
-            var name = names[y];
-            if (link.href.substring(link.href.length - name.length) === name) {
-              activeStylesheets[link.href] = true;
-              matchedNames[name] = true;
-            }
-          }
-        }
-      }
-      // Activate the selected stylesheets and disable the rest.
-      for (var x = 0, link; link = links[x]; x++) {
-        if (link.rel.indexOf("stylesheet") !== -1) {
-          link.disabled = !(link.href in activeStylesheets);
-        }
-      }
-      // Create any new stylesheets.
-      for (var y = 0; y < names.length; y++) {
-        var name = names[y];
-        if (!(name in matchedNames)) {
-          var link = this.win.document.createElement("link");
-          link.rel = "stylesheet";
-          link.type = "text/css";
-          link.href = name;
-          this.win.document.getElementsByTagName('head')[0].appendChild(link);
-        }
-      }
-    },
-    setTextWrapping: function(on) {
-      if (on == this.options.textWrapping) return;
-      this.win.document.body.style.whiteSpace = on ? "" : "nowrap";
-      this.options.textWrapping = on;
-      if (this.lineNumbers) {
-        this.setLineNumbers(false);
-        this.setLineNumbers(true);
-      }
-    },
-    setIndentUnit: function(unit) {this.win.indentUnit = unit;},
-    setUndoDepth: function(depth) {this.editor.history.maxDepth = depth;},
-    setTabMode: function(mode) {this.options.tabMode = mode;},
-    setEnterMode: function(mode) {this.options.enterMode = mode;},
-    setLineNumbers: function(on) {
-      if (on && !this.lineNumbers) {
-        this.lineNumbers = addLineNumberDiv(this.wrapping,this.options.firstLineNumber);
-        this.activateLineNumbers();
-      }
-      else if (!on && this.lineNumbers) {
-        this.wrapping.removeChild(this.lineNumbers);
-        this.wrapping.style.paddingLeft = "";
-        this.lineNumbers = null;
-      }
-    },
-
-    cursorPosition: function(start) {this.focusIfIE(); return this.editor.cursorPosition(start);},
-    firstLine: function() {return this.editor.firstLine();},
-    lastLine: function() {return this.editor.lastLine();},
-    nextLine: function(line) {return this.editor.nextLine(line);},
-    prevLine: function(line) {return this.editor.prevLine(line);},
-    lineContent: function(line) {return this.editor.lineContent(line);},
-    setLineContent: function(line, content) {this.editor.setLineContent(line, content);},
-    removeLine: function(line){this.editor.removeLine(line);},
-    insertIntoLine: function(line, position, content) {this.editor.insertIntoLine(line, position, content);},
-    selectLines: function(startLine, startOffset, endLine, endOffset) {
-      this.win.focus();
-      this.editor.selectLines(startLine, startOffset, endLine, endOffset);
-    },
-    nthLine: function(n) {
-      var line = this.firstLine();
-      for (; n > 1 && line !== false; n--)
-        line = this.nextLine(line);
-      return line;
-    },
-    lineNumber: function(line) {
-      var num = 0;
-      while (line !== false) {
-        num++;
-        line = this.prevLine(line);
-      }
-      return num;
-    },
-    jumpToLine: function(line) {
-      if (typeof line == "number") line = this.nthLine(line);
-      this.selectLines(line, 0);
-      this.win.focus();
-    },
-    currentLine: function() { // Deprecated, but still there for backward compatibility
-      return this.lineNumber(this.cursorLine());
-    },
-    cursorLine: function() {
-      return this.cursorPosition().line;
-    },
-    cursorCoords: function(start) {return this.editor.cursorCoords(start);},
-
-    activateLineNumbers: function() {
-      var frame = this.frame, win = frame.contentWindow, doc = win.document, body = doc.body,
-          nums = this.lineNumbers, scroller = nums.firstChild, self = this;
-      var barWidth = null;
-
-      nums.onclick = function(e) {
-        var handler = self.options.onLineNumberClick;
-        if (handler) {
-          var div = (e || window.event).target || (e || window.event).srcElement;
-          var num = div == nums ? NaN : Number(div.innerHTML);
-          if (!isNaN(num)) handler(num, div);
-        }
-      };
-
-      function sizeBar() {
-        if (frame.offsetWidth == 0) return;
-        for (var root = frame; root.parentNode; root = root.parentNode){}
-        if (!nums.parentNode || root != document || !win.Editor) {
-          // Clear event handlers (their nodes might already be collected, so try/catch)
-          try{clear();}catch(e){}
-          clearInterval(sizeInterval);
-          return;
-        }
-
-        if (nums.offsetWidth != barWidth) {
-          barWidth = nums.offsetWidth;
-          frame.parentNode.style.paddingLeft = barWidth + "px";
-        }
-      }
-      function doScroll() {
-        nums.scrollTop = body.scrollTop || doc.documentElement.scrollTop || 0;
-      }
-      // Cleanup function, registered by nonWrapping and wrapping.
-      var clear = function(){};
-      sizeBar();
-      var sizeInterval = setInterval(sizeBar, 500);
-
-      function ensureEnoughLineNumbers(fill) {
-        var lineHeight = scroller.firstChild.offsetHeight;
-        if (lineHeight == 0) return;
-        var targetHeight = 50 + Math.max(body.offsetHeight, Math.max(frame.offsetHeight, body.scrollHeight || 0)),
-            lastNumber = Math.ceil(targetHeight / lineHeight);
-        for (var i = scroller.childNodes.length; i <= lastNumber; i++) {
-          var div = createHTMLElement("div");
-          div.appendChild(document.createTextNode(fill ? String(i + self.options.firstLineNumber) : "\u00a0"));
-          scroller.appendChild(div);
-        }
-      }
-
-      function nonWrapping() {
-        function update() {
-          ensureEnoughLineNumbers(true);
-          doScroll();
-        }
-        self.updateNumbers = update;
-        var onScroll = win.addEventHandler(win, "scroll", doScroll, true),
-            onResize = win.addEventHandler(win, "resize", update, true);
-        clear = function(){
-          onScroll(); onResize();
-          if (self.updateNumbers == update) self.updateNumbers = null;
-        };
-        update();
-      }
-
-      function wrapping() {
-        var node, lineNum, next, pos, changes = [], styleNums = self.options.styleNumbers;
-
-        function setNum(n, node) {
-          // Does not typically happen (but can, if you mess with the
-          // document during the numbering)
-          if (!lineNum) lineNum = scroller.appendChild(createHTMLElement("div"));
-          if (styleNums) styleNums(lineNum, node, n);
-          // Changes are accumulated, so that the document layout
-          // doesn't have to be recomputed during the pass
-          changes.push(lineNum); changes.push(n);
-          pos = lineNum.offsetHeight + lineNum.offsetTop;
-          lineNum = lineNum.nextSibling;
-        }
-        function commitChanges() {
-          for (var i = 0; i < changes.length; i += 2)
-            changes[i].innerHTML = changes[i + 1];
-          changes = [];
-        }
-        function work() {
-          if (!scroller.parentNode || scroller.parentNode != self.lineNumbers) return;
-
-          var endTime = new Date().getTime() + self.options.lineNumberTime;
-          while (node) {
-            setNum(next++, node.previousSibling);
-            for (; node && !win.isBR(node); node = node.nextSibling) {
-              var bott = node.offsetTop + node.offsetHeight;
-              while (scroller.offsetHeight && bott - 3 > pos) {
-                var oldPos = pos;
-                setNum("&nbsp;");
-                if (pos <= oldPos) break;
-              }
-            }
-            if (node) node = node.nextSibling;
-            if (new Date().getTime() > endTime) {
-              commitChanges();
-              pending = setTimeout(work, self.options.lineNumberDelay);
-              return;
-            }
-          }
-          while (lineNum) setNum(next++);
-          commitChanges();
-          doScroll();
-        }
-        function start(firstTime) {
-          doScroll();
-          ensureEnoughLineNumbers(firstTime);
-          node = body.firstChild;
-          lineNum = scroller.firstChild;
-          pos = 0;
-          next = self.options.firstLineNumber;
-          work();
-        }
-
-        start(true);
-        var pending = null;
-        function update() {
-          if (pending) clearTimeout(pending);
-          if (self.editor.allClean()) start();
-          else pending = setTimeout(update, 200);
-        }
-        self.updateNumbers = update;
-        var onScroll = win.addEventHandler(win, "scroll", doScroll, true),
-            onResize = win.addEventHandler(win, "resize", update, true);
-        clear = function(){
-          if (pending) clearTimeout(pending);
-          if (self.updateNumbers == update) self.updateNumbers = null;
-          onScroll();
-          onResize();
-        };
-      }
-      (this.options.textWrapping || this.options.styleNumbers ? wrapping : nonWrapping)();
-    },
-
-    setDynamicHeight: function() {
-      var self = this, activity = self.options.onCursorActivity, win = self.win, body = win.document.body,
-          lineHeight = null, timeout = null, vmargin = 2 * self.frame.offsetTop;
-      body.style.overflowY = "hidden";
-      win.document.documentElement.style.overflowY = "hidden";
-      this.frame.scrolling = "no";
-
-      function updateHeight() {
-        var trailingLines = 0, node = body.lastChild, computedHeight;
-        while (node && win.isBR(node)) {
-          if (!node.hackBR) trailingLines++;
-          node = node.previousSibling;
-        }
-        if (node) {
-          lineHeight = node.offsetHeight;
-          computedHeight = node.offsetTop + (1 + trailingLines) * lineHeight;
-        }
-        else if (lineHeight) {
-          computedHeight = trailingLines * lineHeight;
-        }
-        if (computedHeight)
-          self.wrapping.style.height = Math.max(vmargin + computedHeight, self.options.minHeight) + "px";
-      }
-      setTimeout(updateHeight, 300);
-      self.options.onCursorActivity = function(x) {
-        if (activity) activity(x);
-        clearTimeout(timeout);
-        timeout = setTimeout(updateHeight, 100);
-      };
-    }
-  };
-
-  CodeMirror.InvalidLineHandle = {toString: function(){return "CodeMirror.InvalidLineHandle";}};
-
-  CodeMirror.replace = function(element) {
-    if (typeof element == "string")
-      element = document.getElementById(element);
-    return function(newElement) {
-      element.parentNode.replaceChild(newElement, element);
-    };
-  };
-
-  CodeMirror.fromTextArea = function(area, options) {
-    if (typeof area == "string")
-      area = document.getElementById(area);
-
-    options = options || {};
-    if (area.style.width && options.width == null)
-      options.width = area.style.width;
-    if (area.style.height && options.height == null)
-      options.height = area.style.height;
-    if (options.content == null) options.content = area.value;
-
-    function updateField() {
-      area.value = mirror.getCode();
-    }
-    if (area.form) {
-      if (typeof area.form.addEventListener == "function")
-        area.form.addEventListener("submit", updateField, false);
-      else
-        area.form.attachEvent("onsubmit", updateField);
-      if (typeof area.form.submit == "function") {
-        var realSubmit = area.form.submit;
-        function wrapSubmit() {
-          updateField();
-          // Can't use realSubmit.apply because IE6 is too stupid
-          area.form.submit = realSubmit;
-          area.form.submit();
-          area.form.submit = wrapSubmit;
-        }
-        area.form.submit = wrapSubmit;
-      }
-    }
-
-    function insert(frame) {
-      if (area.nextSibling)
-        area.parentNode.insertBefore(frame, area.nextSibling);
-      else
-        area.parentNode.appendChild(frame);
-    }
-
-    area.style.display = "none";
-    var mirror = new CodeMirror(insert, options);
-    mirror.save = updateField;
-    mirror.toTextArea = function() {
-      updateField();
-      area.parentNode.removeChild(mirror.wrapping);
-      area.style.display = "";
-      if (area.form) {
-        if (typeof area.form.submit == "function")
-          area.form.submit = realSubmit;
-        if (typeof area.form.removeEventListener == "function")
-          area.form.removeEventListener("submit", updateField, false);
-        else
-          area.form.detachEvent("onsubmit", updateField);
-      }
-    };
-
-    return mirror;
-  };
-
-  CodeMirror.isProbablySupported = function() {
-    // This is rather awful, but can be useful.
-    var match;
-    if (window.opera)
-      return Number(window.opera.version()) >= 9.52;
-    else if (/Apple Computer, Inc/.test(navigator.vendor) && (match = navigator.userAgent.match(/Version\/(\d+(?:\.\d+)?)\./)))
-      return Number(match[1]) >= 3;
-    else if (document.selection && window.ActiveXObject && (match = navigator.userAgent.match(/MSIE (\d+(?:\.\d*)?)\b/)))
-      return Number(match[1]) >= 6;
-    else if (match = navigator.userAgent.match(/gecko\/(\d{8})/i))
-      return Number(match[1]) >= 20050901;
-    else if (match = navigator.userAgent.match(/AppleWebKit\/(\d+)/))
-      return Number(match[1]) >= 525;
-    else
-      return null;
-  };
-
-  return CodeMirror;
-})();
diff --git a/web/src/main/webapp/codemirror/editor.js b/web/src/main/webapp/codemirror/editor.js
deleted file mode 100644
index f5092ce500f2da0e679a2933385a9947ec258da6..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/editor.js
+++ /dev/null
@@ -1,1671 +0,0 @@
-/* The Editor object manages the content of the editable frame. It
- * catches events, colours nodes, and indents lines. This file also
- * holds some functions for transforming arbitrary DOM structures into
- * plain sequences of <span> and <br> elements
- */
-
-var internetExplorer = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent);
-var webkit = /AppleWebKit/.test(navigator.userAgent);
-var safari = /Apple Computer, Inc/.test(navigator.vendor);
-var gecko = navigator.userAgent.match(/gecko\/(\d{8})/i);
-if (gecko) gecko = Number(gecko[1]);
-var mac = /Mac/.test(navigator.platform);
-
-// TODO this is related to the backspace-at-end-of-line bug. Remove
-// this if Opera gets their act together, make the version check more
-// broad if they don't.
-var brokenOpera = window.opera && /Version\/10.[56]/.test(navigator.userAgent);
-// TODO remove this once WebKit 533 becomes less common.
-var slowWebkit = /AppleWebKit\/533/.test(navigator.userAgent);
-
-// Make sure a string does not contain two consecutive 'collapseable'
-// whitespace characters.
-function makeWhiteSpace(n) {
-  var buffer = [], nb = true;
-  for (; n > 0; n--) {
-    buffer.push((nb || n == 1) ? nbsp : " ");
-    nb ^= true;
-  }
-  return buffer.join("");
-}
-
-// Create a set of white-space characters that will not be collapsed
-// by the browser, but will not break text-wrapping either.
-function fixSpaces(string) {
-  if (string.charAt(0) == " ") string = nbsp + string.slice(1);
-  return string.replace(/\t/g, function() {return makeWhiteSpace(indentUnit);})
-    .replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);});
-}
-
-function cleanText(text) {
-  return text.replace(/\u00a0/g, " ").replace(/\u200b/g, "");
-}
-
-// Create a SPAN node with the expected properties for document part
-// spans.
-function makePartSpan(value) {
-  var text = value;
-  if (value.nodeType == 3) text = value.nodeValue;
-  else value = document.createTextNode(text);
-
-  var span = document.createElement("span");
-  span.isPart = true;
-  span.appendChild(value);
-  span.currentText = text;
-  return span;
-}
-
-function alwaysZero() {return 0;}
-
-// On webkit, when the last BR of the document does not have text
-// behind it, the cursor can not be put on the line after it. This
-// makes pressing enter at the end of the document occasionally do
-// nothing (or at least seem to do nothing). To work around it, this
-// function makes sure the document ends with a span containing a
-// zero-width space character. The traverseDOM iterator filters such
-// character out again, so that the parsers won't see them. This
-// function is called from a few strategic places to make sure the
-// zwsp is restored after the highlighting process eats it.
-var webkitLastLineHack = webkit ?
-  function(container) {
-    var last = container.lastChild;
-    if (!last || !last.hackBR) {
-      var br = document.createElement("br");
-      br.hackBR = true;
-      container.appendChild(br);
-    }
-  } : function() {};
-
-function asEditorLines(string) {
-  var tab = makeWhiteSpace(indentUnit);
-  return map(string.replace(/\t/g, tab).replace(/\u00a0/g, " ").replace(/\r\n?/g, "\n").split("\n"), fixSpaces);
-}
-
-var Editor = (function(){
-  // The HTML elements whose content should be suffixed by a newline
-  // when converting them to flat text.
-  var newlineElements = {"P": true, "DIV": true, "LI": true};
-
-  // Helper function for traverseDOM. Flattens an arbitrary DOM node
-  // into an array of textnodes and <br> tags.
-  function simplifyDOM(root, atEnd) {
-    var result = [];
-    var leaving = true;
-
-    function simplifyNode(node, top) {
-      if (node.nodeType == 3) {
-        var text = node.nodeValue = fixSpaces(node.nodeValue.replace(/[\r\u200b]/g, "").replace(/\n/g, " "));
-        if (text.length) leaving = false;
-        result.push(node);
-      }
-      else if (isBR(node) && node.childNodes.length == 0) {
-        leaving = true;
-        result.push(node);
-      }
-      else {
-        for (var n = node.firstChild; n; n = n.nextSibling) simplifyNode(n);
-        if (!leaving && newlineElements.hasOwnProperty(node.nodeName.toUpperCase())) {
-          leaving = true;
-          if (!atEnd || !top)
-            result.push(document.createElement("br"));
-        }
-      }
-    }
-
-    simplifyNode(root, true);
-    return result;
-  }
-
-  // Creates a MochiKit-style iterator that goes over a series of DOM
-  // nodes. The values it yields are strings, the textual content of
-  // the nodes. It makes sure that all nodes up to and including the
-  // one whose text is being yielded have been 'normalized' to be just
-  // <span> and <br> elements.
-  function traverseDOM(start){
-    var nodeQueue = [];
-
-    // Create a function that can be used to insert nodes after the
-    // one given as argument.
-    function pointAt(node){
-      var parent = node.parentNode;
-      var next = node.nextSibling;
-      return function(newnode) {
-        parent.insertBefore(newnode, next);
-      };
-    }
-    var point = null;
-
-    // This an Opera-specific hack -- always insert an empty span
-    // between two BRs, because Opera's cursor code gets terribly
-    // confused when the cursor is between two BRs.
-    var afterBR = true;
-
-    // Insert a normalized node at the current point. If it is a text
-    // node, wrap it in a <span>, and give that span a currentText
-    // property -- this is used to cache the nodeValue, because
-    // directly accessing nodeValue is horribly slow on some browsers.
-    // The dirty property is used by the highlighter to determine
-    // which parts of the document have to be re-highlighted.
-    function insertPart(part){
-      var text = "\n";
-      if (part.nodeType == 3) {
-        select.snapshotChanged();
-        part = makePartSpan(part);
-        text = part.currentText;
-        afterBR = false;
-      }
-      else {
-        if (afterBR && window.opera)
-          point(makePartSpan(""));
-        afterBR = true;
-      }
-      part.dirty = true;
-      nodeQueue.push(part);
-      point(part);
-      return text;
-    }
-
-    // Extract the text and newlines from a DOM node, insert them into
-    // the document, and return the textual content. Used to replace
-    // non-normalized nodes.
-    function writeNode(node, end) {
-      var simplified = simplifyDOM(node, end);
-      for (var i = 0; i < simplified.length; i++)
-        simplified[i] = insertPart(simplified[i]);
-      return simplified.join("");
-    }
-
-    // Check whether a node is a normalized <span> element.
-    function partNode(node){
-      if (node.isPart && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
-        var text = node.firstChild.nodeValue;
-        node.dirty = node.dirty || text != node.currentText;
-        node.currentText = text;
-        return !/[\n\t\r]/.test(node.currentText);
-      }
-      return false;
-    }
-
-    // Advance to next node, return string for current node.
-    function next() {
-      if (!start) throw StopIteration;
-      var node = start;
-      start = node.nextSibling;
-
-      if (partNode(node)){
-        nodeQueue.push(node);
-        afterBR = false;
-        return node.currentText;
-      }
-      else if (isBR(node)) {
-        if (afterBR && window.opera)
-          node.parentNode.insertBefore(makePartSpan(""), node);
-        nodeQueue.push(node);
-        afterBR = true;
-        return "\n";
-      }
-      else {
-        var end = !node.nextSibling;
-        point = pointAt(node);
-        removeElement(node);
-        return writeNode(node, end);
-      }
-    }
-
-    // MochiKit iterators are objects with a next function that
-    // returns the next value or throws StopIteration when there are
-    // no more values.
-    return {next: next, nodes: nodeQueue};
-  }
-
-  // Determine the text size of a processed node.
-  function nodeSize(node) {
-    return isBR(node) ? 1 : node.currentText.length;
-  }
-
-  // Search backwards through the top-level nodes until the next BR or
-  // the start of the frame.
-  function startOfLine(node) {
-    while (node && !isBR(node)) node = node.previousSibling;
-    return node;
-  }
-  function endOfLine(node, container) {
-    if (!node) node = container.firstChild;
-    else if (isBR(node)) node = node.nextSibling;
-
-    while (node && !isBR(node)) node = node.nextSibling;
-    return node;
-  }
-
-  function time() {return new Date().getTime();}
-
-  // Client interface for searching the content of the editor. Create
-  // these by calling CodeMirror.getSearchCursor. To use, call
-  // findNext on the resulting object -- this returns a boolean
-  // indicating whether anything was found, and can be called again to
-  // skip to the next find. Use the select and replace methods to
-  // actually do something with the found locations.
-  function SearchCursor(editor, pattern, from, caseFold) {
-    this.editor = editor;
-    this.history = editor.history;
-    this.history.commit();
-    this.valid = !!pattern;
-    this.atOccurrence = false;
-    if (caseFold == undefined) caseFold = typeof pattern == "string" && pattern == pattern.toLowerCase();
-
-    function getText(node){
-      var line = cleanText(editor.history.textAfter(node));
-      return (caseFold ? line.toLowerCase() : line);
-    }
-
-    var topPos = {node: null, offset: 0}, self = this;
-    if (from && typeof from == "object" && typeof from.character == "number") {
-      editor.checkLine(from.line);
-      var pos = {node: from.line, offset: from.character};
-      this.pos = {from: pos, to: pos};
-    }
-    else if (from) {
-      this.pos = {from: select.cursorPos(editor.container, true) || topPos,
-                  to: select.cursorPos(editor.container, false) || topPos};
-    }
-    else {
-      this.pos = {from: topPos, to: topPos};
-    }
-
-    if (typeof pattern != "string") { // Regexp match
-      this.matches = function(reverse, node, offset) {
-        if (reverse) {
-          var line = getText(node).slice(0, offset), match = line.match(pattern), start = 0;
-          while (match) {
-            var ind = line.indexOf(match[0]);
-            start += ind;
-            line = line.slice(ind + 1);
-            var newmatch = line.match(pattern);
-            if (newmatch) match = newmatch;
-            else break;
-          }
-        }
-        else {
-          var line = getText(node).slice(offset), match = line.match(pattern),
-              start = match && offset + line.indexOf(match[0]);
-        }
-        if (match) {
-          self.currentMatch = match;
-          return {from: {node: node, offset: start},
-                  to: {node: node, offset: start + match[0].length}};
-        }
-      };
-      return;
-    }
-
-    if (caseFold) pattern = pattern.toLowerCase();
-    // Create a matcher function based on the kind of string we have.
-    var target = pattern.split("\n");
-    this.matches = (target.length == 1) ?
-      // For one-line strings, searching can be done simply by calling
-      // indexOf or lastIndexOf on the current line.
-      function(reverse, node, offset) {
-        var line = getText(node), len = pattern.length, match;
-        if (reverse ? (offset >= len && (match = line.lastIndexOf(pattern, offset - len)) != -1)
-                    : (match = line.indexOf(pattern, offset)) != -1)
-          return {from: {node: node, offset: match},
-                  to: {node: node, offset: match + len}};
-      } :
-      // Multi-line strings require internal iteration over lines, and
-      // some clunky checks to make sure the first match ends at the
-      // end of the line and the last match starts at the start.
-      function(reverse, node, offset) {
-        var idx = (reverse ? target.length - 1 : 0), match = target[idx], line = getText(node);
-        var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
-        if (reverse ? offsetA >= offset || offsetA != match.length
-                    : offsetA <= offset || offsetA != line.length - match.length)
-          return;
-
-        var pos = node;
-        while (true) {
-          if (reverse && !pos) return;
-          pos = (reverse ? this.history.nodeBefore(pos) : this.history.nodeAfter(pos) );
-          if (!reverse && !pos) return;
-
-          line = getText(pos);
-          match = target[reverse ? --idx : ++idx];
-
-          if (idx > 0 && idx < target.length - 1) {
-            if (line != match) return;
-            else continue;
-          }
-          var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
-          if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
-            return;
-          return {from: {node: reverse ? pos : node, offset: reverse ? offsetB : offsetA},
-                  to: {node: reverse ? node : pos, offset: reverse ? offsetA : offsetB}};
-        }
-      };
-  }
-
-  SearchCursor.prototype = {
-    findNext: function() {return this.find(false);},
-    findPrevious: function() {return this.find(true);},
-
-    find: function(reverse) {
-      if (!this.valid) return false;
-
-      var self = this, pos = reverse ? this.pos.from : this.pos.to,
-          node = pos.node, offset = pos.offset;
-      // Reset the cursor if the current line is no longer in the DOM tree.
-      if (node && !node.parentNode) {
-        node = null; offset = 0;
-      }
-      function savePosAndFail() {
-        var pos = {node: node, offset: offset};
-        self.pos = {from: pos, to: pos};
-        self.atOccurrence = false;
-        return false;
-      }
-
-      while (true) {
-        if (this.pos = this.matches(reverse, node, offset)) {
-          this.atOccurrence = true;
-          return true;
-        }
-
-        if (reverse) {
-          if (!node) return savePosAndFail();
-          node = this.history.nodeBefore(node);
-          offset = this.history.textAfter(node).length;
-        }
-        else {
-          var next = this.history.nodeAfter(node);
-          if (!next) {
-            offset = this.history.textAfter(node).length;
-            return savePosAndFail();
-          }
-          node = next;
-          offset = 0;
-        }        
-      }
-    },
-
-    select: function() {
-      if (this.atOccurrence) {
-        select.setCursorPos(this.editor.container, this.pos.from, this.pos.to);
-        select.scrollToCursor(this.editor.container);
-      }
-    },
-
-    replace: function(string) {
-      if (this.atOccurrence) {
-        var fragments = this.currentMatch;
-        if (fragments)
-          string = string.replace(/\\(\d)/, function(m, i){return fragments[i];});
-        var end = this.editor.replaceRange(this.pos.from, this.pos.to, string);
-        this.pos.to = end;
-        this.atOccurrence = false;
-      }
-    },
-
-    position: function() {
-      if (this.atOccurrence)
-        return {line: this.pos.from.node, character: this.pos.from.offset};
-    }
-  };
-
-  // The Editor object is the main inside-the-iframe interface.
-  function Editor(options) {
-    this.options = options;
-    window.indentUnit = options.indentUnit;
-    var container = this.container = document.body;
-    this.history = new UndoHistory(container, options.undoDepth, options.undoDelay, this);
-    var self = this;
-
-    if (!Editor.Parser)
-      throw "No parser loaded.";
-    if (options.parserConfig && Editor.Parser.configure)
-      Editor.Parser.configure(options.parserConfig);
-
-    if (!options.readOnly && !internetExplorer)
-      select.setCursorPos(container, {node: null, offset: 0});
-
-    this.dirty = [];
-    this.importCode(options.content || "");
-    this.history.onChange = options.onChange;
-
-    if (!options.readOnly) {
-      if (options.continuousScanning !== false) {
-        this.scanner = this.documentScanner(options.passTime);
-        this.delayScanning();
-      }
-
-      function setEditable() {
-        // Use contentEditable instead of designMode on IE, since designMode frames
-        // can not run any scripts. It would be nice if we could use contentEditable
-        // everywhere, but it is significantly flakier than designMode on every
-        // single non-IE browser.
-        if (document.body.contentEditable != undefined && internetExplorer)
-          document.body.contentEditable = "true";
-        else
-          document.designMode = "on";
-
-        // Work around issue where you have to click on the actual
-        // body of the document to focus it in IE, making focusing
-        // hard when the document is small.
-        if (internetExplorer && options.height != "dynamic")
-          document.body.style.minHeight = (
-            window.frameElement.clientHeight - 2 * document.body.offsetTop - 5) + "px";
-
-        document.documentElement.style.borderWidth = "0";
-        if (!options.textWrapping)
-          container.style.whiteSpace = "nowrap";
-      }
-
-      // If setting the frame editable fails, try again when the user
-      // focus it (happens when the frame is not visible on
-      // initialisation, in Firefox).
-      try {
-        setEditable();
-      }
-      catch(e) {
-        var focusEvent = addEventHandler(document, "focus", function() {
-          focusEvent();
-          setEditable();
-        }, true);
-      }
-
-      addEventHandler(document, "keydown", method(this, "keyDown"));
-      addEventHandler(document, "keypress", method(this, "keyPress"));
-      addEventHandler(document, "keyup", method(this, "keyUp"));
-
-      function cursorActivity() {self.cursorActivity(false);}
-      addEventHandler(internetExplorer ? document.body : window, "mouseup", cursorActivity);
-      addEventHandler(document.body, "cut", cursorActivity);
-
-      // workaround for a gecko bug [?] where going forward and then
-      // back again breaks designmode (no more cursor)
-      if (gecko)
-        addEventHandler(window, "pagehide", function(){self.unloaded = true;});
-
-      addEventHandler(document.body, "paste", function(event) {
-        cursorActivity();
-        var text = null;
-        try {
-          var clipboardData = event.clipboardData || window.clipboardData;
-          if (clipboardData) text = clipboardData.getData('Text');
-        }
-        catch(e) {}
-        if (text !== null) {
-          event.stop();
-          self.replaceSelection(text);
-          select.scrollToCursor(self.container);
-        }
-      });
-
-      if (this.options.autoMatchParens)
-        addEventHandler(document.body, "click", method(this, "scheduleParenHighlight"));
-    }
-    else if (!options.textWrapping) {
-      container.style.whiteSpace = "nowrap";
-    }
-  }
-
-  function isSafeKey(code) {
-    return (code >= 16 && code <= 18) || // shift, control, alt
-           (code >= 33 && code <= 40); // arrows, home, end
-  }
-
-  Editor.prototype = {
-    // Import a piece of code into the editor.
-    importCode: function(code) {
-      var lines = asEditorLines(code), chunk = 1000;
-      if (!this.options.incrementalLoading || lines.length < chunk) {
-        this.history.push(null, null, lines);
-        this.history.reset();
-      }
-      else {
-        var cur = 0, self = this;
-        function addChunk() {
-          var chunklines = lines.slice(cur, cur + chunk);
-          chunklines.push("");
-          self.history.push(self.history.nodeBefore(null), null, chunklines);
-          self.history.reset();
-          cur += chunk;
-          if (cur < lines.length)
-            parent.setTimeout(addChunk, 1000);
-        }
-        addChunk();
-      }
-    },
-
-    // Extract the code from the editor.
-    getCode: function() {
-      if (!this.container.firstChild)
-        return "";
-
-      var accum = [];
-      select.markSelection();
-      forEach(traverseDOM(this.container.firstChild), method(accum, "push"));
-      select.selectMarked();
-      // On webkit, don't count last (empty) line if the webkitLastLineHack BR is present
-      if (webkit && this.container.lastChild.hackBR)
-        accum.pop();
-      webkitLastLineHack(this.container);
-      return cleanText(accum.join(""));
-    },
-
-    checkLine: function(node) {
-      if (node === false || !(node == null || node.parentNode == this.container || node.hackBR))
-        throw parent.CodeMirror.InvalidLineHandle;
-    },
-
-    cursorPosition: function(start) {
-      if (start == null) start = true;
-      var pos = select.cursorPos(this.container, start);
-      if (pos) return {line: pos.node, character: pos.offset};
-      else return {line: null, character: 0};
-    },
-
-    firstLine: function() {
-      return null;
-    },
-
-    lastLine: function() {
-      var last = this.container.lastChild;
-      if (last) last = startOfLine(last);
-      if (last && last.hackBR) last = startOfLine(last.previousSibling);
-      return last;
-    },
-
-    nextLine: function(line) {
-      this.checkLine(line);
-      var end = endOfLine(line, this.container);
-      if (!end || end.hackBR) return false;
-      else return end;
-    },
-
-    prevLine: function(line) {
-      this.checkLine(line);
-      if (line == null) return false;
-      return startOfLine(line.previousSibling);
-    },
-
-    visibleLineCount: function() {
-      var line = this.container.firstChild;
-      while (line && isBR(line)) line = line.nextSibling; // BR heights are unreliable
-      if (!line) return false;
-      var innerHeight = (window.innerHeight
-                         || document.documentElement.clientHeight
-                         || document.body.clientHeight);
-      return Math.floor(innerHeight / line.offsetHeight);
-    },
-
-    selectLines: function(startLine, startOffset, endLine, endOffset) {
-      this.checkLine(startLine);
-      var start = {node: startLine, offset: startOffset}, end = null;
-      if (endOffset !== undefined) {
-        this.checkLine(endLine);
-        end = {node: endLine, offset: endOffset};
-      }
-      select.setCursorPos(this.container, start, end);
-      select.scrollToCursor(this.container);
-    },
-
-    lineContent: function(line) {
-      var accum = [];
-      for (line = line ? line.nextSibling : this.container.firstChild;
-           line && !isBR(line); line = line.nextSibling)
-        accum.push(nodeText(line));
-      return cleanText(accum.join(""));
-    },
-
-    setLineContent: function(line, content) {
-      this.history.commit();
-      this.replaceRange({node: line, offset: 0},
-                        {node: line, offset: this.history.textAfter(line).length},
-                        content);
-      this.addDirtyNode(line);
-      this.scheduleHighlight();
-    },
-
-    removeLine: function(line) {
-      var node = line ? line.nextSibling : this.container.firstChild;
-      while (node) {
-        var next = node.nextSibling;
-        removeElement(node);
-        if (isBR(node)) break;
-        node = next;
-      }
-      this.addDirtyNode(line);
-      this.scheduleHighlight();
-    },
-
-    insertIntoLine: function(line, position, content) {
-      var before = null;
-      if (position == "end") {
-        before = endOfLine(line, this.container);
-      }
-      else {
-        for (var cur = line ? line.nextSibling : this.container.firstChild; cur; cur = cur.nextSibling) {
-          if (position == 0) {
-            before = cur;
-            break;
-          }
-          var text = nodeText(cur);
-          if (text.length > position) {
-            before = cur.nextSibling;
-            content = text.slice(0, position) + content + text.slice(position);
-            removeElement(cur);
-            break;
-          }
-          position -= text.length;
-        }
-      }
-
-      var lines = asEditorLines(content);
-      for (var i = 0; i < lines.length; i++) {
-        if (i > 0) this.container.insertBefore(document.createElement("BR"), before);
-        this.container.insertBefore(makePartSpan(lines[i]), before);
-      }
-      this.addDirtyNode(line);
-      this.scheduleHighlight();
-    },
-
-    // Retrieve the selected text.
-    selectedText: function() {
-      var h = this.history;
-      h.commit();
-
-      var start = select.cursorPos(this.container, true),
-          end = select.cursorPos(this.container, false);
-      if (!start || !end) return "";
-
-      if (start.node == end.node)
-        return h.textAfter(start.node).slice(start.offset, end.offset);
-
-      var text = [h.textAfter(start.node).slice(start.offset)];
-      for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos))
-        text.push(h.textAfter(pos));
-      text.push(h.textAfter(end.node).slice(0, end.offset));
-      return cleanText(text.join("\n"));
-    },
-
-    // Replace the selection with another piece of text.
-    replaceSelection: function(text) {
-      this.history.commit();
-
-      var start = select.cursorPos(this.container, true),
-          end = select.cursorPos(this.container, false);
-      if (!start || !end) return;
-
-      end = this.replaceRange(start, end, text);
-      select.setCursorPos(this.container, end);
-      webkitLastLineHack(this.container);
-    },
-
-    cursorCoords: function(start, internal) {
-      var sel = select.cursorPos(this.container, start);
-      if (!sel) return null;
-      var off = sel.offset, node = sel.node, self = this;
-      function measureFromNode(node, xOffset) {
-        var y = -(document.body.scrollTop || document.documentElement.scrollTop || 0),
-            x = -(document.body.scrollLeft || document.documentElement.scrollLeft || 0) + xOffset;
-        forEach([node, internal ? null : window.frameElement], function(n) {
-          while (n) {x += n.offsetLeft; y += n.offsetTop;n = n.offsetParent;}
-        });
-        return {x: x, y: y, yBot: y + node.offsetHeight};
-      }
-      function withTempNode(text, f) {
-        var node = document.createElement("SPAN");
-        node.appendChild(document.createTextNode(text));
-        try {return f(node);}
-        finally {if (node.parentNode) node.parentNode.removeChild(node);}
-      }
-
-      while (off) {
-        node = node ? node.nextSibling : this.container.firstChild;
-        var txt = nodeText(node);
-        if (off < txt.length)
-          return withTempNode(txt.substr(0, off), function(tmp) {
-            tmp.style.position = "absolute"; tmp.style.visibility = "hidden";
-            tmp.className = node.className;
-            self.container.appendChild(tmp);
-            return measureFromNode(node, tmp.offsetWidth);
-          });
-        off -= txt.length;
-      }
-      if (node && isSpan(node))
-        return measureFromNode(node, node.offsetWidth);
-      else if (node && node.nextSibling && isSpan(node.nextSibling))
-        return measureFromNode(node.nextSibling, 0);
-      else
-        return withTempNode("\u200b", function(tmp) {
-          if (node) node.parentNode.insertBefore(tmp, node.nextSibling);
-          else self.container.insertBefore(tmp, self.container.firstChild);
-          return measureFromNode(tmp, 0);
-        });
-    },
-
-    reroutePasteEvent: function() {
-      if (this.capturingPaste || window.opera || (gecko && gecko >= 20101026)) return;
-      this.capturingPaste = true;
-      var te = window.frameElement.CodeMirror.textareaHack;
-      var coords = this.cursorCoords(true, true);
-      te.style.top = coords.y + "px";
-      if (internetExplorer) {
-        var snapshot = select.getBookmark(this.container);
-        if (snapshot) this.selectionSnapshot = snapshot;
-      }
-      parent.focus();
-      te.value = "";
-      te.focus();
-
-      var self = this;
-      parent.setTimeout(function() {
-        self.capturingPaste = false;
-        window.focus();
-        if (self.selectionSnapshot) // IE hack
-          window.select.setBookmark(self.container, self.selectionSnapshot);
-        var text = te.value;
-        if (text) {
-          self.replaceSelection(text);
-          select.scrollToCursor(self.container);
-        }
-      }, 10);
-    },
-
-    replaceRange: function(from, to, text) {
-      var lines = asEditorLines(text);
-      lines[0] = this.history.textAfter(from.node).slice(0, from.offset) + lines[0];
-      var lastLine = lines[lines.length - 1];
-      lines[lines.length - 1] = lastLine + this.history.textAfter(to.node).slice(to.offset);
-      var end = this.history.nodeAfter(to.node);
-      this.history.push(from.node, end, lines);
-      return {node: this.history.nodeBefore(end),
-              offset: lastLine.length};
-    },
-
-    getSearchCursor: function(string, fromCursor, caseFold) {
-      return new SearchCursor(this, string, fromCursor, caseFold);
-    },
-
-    // Re-indent the whole buffer
-    reindent: function() {
-      if (this.container.firstChild)
-        this.indentRegion(null, this.container.lastChild);
-    },
-
-    reindentSelection: function(direction) {
-      if (!select.somethingSelected()) {
-        this.indentAtCursor(direction);
-      }
-      else {
-        var start = select.selectionTopNode(this.container, true),
-            end = select.selectionTopNode(this.container, false);
-        if (start === false || end === false) return;
-        this.indentRegion(start, end, direction, true);
-      }
-    },
-
-    grabKeys: function(eventHandler, filter) {
-      this.frozen = eventHandler;
-      this.keyFilter = filter;
-    },
-    ungrabKeys: function() {
-      this.frozen = "leave";
-    },
-
-    setParser: function(name, parserConfig) {
-      Editor.Parser = window[name];
-      parserConfig = parserConfig || this.options.parserConfig;
-      if (parserConfig && Editor.Parser.configure)
-        Editor.Parser.configure(parserConfig);
-
-      if (this.container.firstChild) {
-        forEach(this.container.childNodes, function(n) {
-          if (n.nodeType != 3) n.dirty = true;
-        });
-        this.addDirtyNode(this.firstChild);
-        this.scheduleHighlight();
-      }
-    },
-
-    // Intercept enter and tab, and assign their new functions.
-    keyDown: function(event) {
-      if (this.frozen == "leave") {this.frozen = null; this.keyFilter = null;}
-      if (this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode, event))) {
-        event.stop();
-        this.frozen(event);
-        return;
-      }
-
-      var code = event.keyCode;
-      // Don't scan when the user is typing.
-      this.delayScanning();
-      // Schedule a paren-highlight event, if configured.
-      if (this.options.autoMatchParens)
-        this.scheduleParenHighlight();
-
-      // The various checks for !altKey are there because AltGr sets both
-      // ctrlKey and altKey to true, and should not be recognised as
-      // Control.
-      if (code == 13) { // enter
-        if (event.ctrlKey && !event.altKey) {
-          this.reparseBuffer();
-        }
-        else {
-          select.insertNewlineAtCursor();
-          var mode = this.options.enterMode;
-          if (mode != "flat") this.indentAtCursor(mode == "keep" ? "keep" : undefined);
-          select.scrollToCursor(this.container);
-        }
-        event.stop();
-      }
-      else if (code == 9 && this.options.tabMode != "default" && !event.ctrlKey) { // tab
-        this.handleTab(!event.shiftKey);
-        event.stop();
-      }
-      else if (code == 32 && event.shiftKey && this.options.tabMode == "default") { // space
-        this.handleTab(true);
-        event.stop();
-      }
-      else if (code == 36 && !event.shiftKey && !event.ctrlKey) { // home
-        if (this.home()) event.stop();
-      }
-      else if (code == 35 && !event.shiftKey && !event.ctrlKey) { // end
-        if (this.end()) event.stop();
-      }
-      // Only in Firefox is the default behavior for PgUp/PgDn correct.
-      else if (code == 33 && !event.shiftKey && !event.ctrlKey && !gecko) { // PgUp
-        if (this.pageUp()) event.stop();
-      }
-      else if (code == 34 && !event.shiftKey && !event.ctrlKey && !gecko) {  // PgDn
-        if (this.pageDown()) event.stop();
-      }
-      else if ((code == 219 || code == 221) && event.ctrlKey && !event.altKey) { // [, ]
-        this.highlightParens(event.shiftKey, true);
-        event.stop();
-      }
-      else if (event.metaKey && !event.shiftKey && (code == 37 || code == 39)) { // Meta-left/right
-        var cursor = select.selectionTopNode(this.container);
-        if (cursor === false || !this.container.firstChild) return;
-
-        if (code == 37) select.focusAfterNode(startOfLine(cursor), this.container);
-        else {
-          var end = endOfLine(cursor, this.container);
-          select.focusAfterNode(end ? end.previousSibling : this.container.lastChild, this.container);
-        }
-        event.stop();
-      }
-      else if ((event.ctrlKey || event.metaKey) && !event.altKey) {
-        if ((event.shiftKey && code == 90) || code == 89) { // shift-Z, Y
-          select.scrollToNode(this.history.redo());
-          event.stop();
-        }
-        else if (code == 90 || (safari && code == 8)) { // Z, backspace
-          select.scrollToNode(this.history.undo());
-          event.stop();
-        }
-        else if (code == 83 && this.options.saveFunction) { // S
-          this.options.saveFunction();
-          event.stop();
-        }
-        else if (code == 86 && !mac) { // V
-          this.reroutePasteEvent();
-        }
-      }
-    },
-
-    // Check for characters that should re-indent the current line,
-    // and prevent Opera from handling enter and tab anyway.
-    keyPress: function(event) {
-      var electric = this.options.electricChars && Editor.Parser.electricChars, self = this;
-      // Hack for Opera, and Firefox on OS X, in which stopping a
-      // keydown event does not prevent the associated keypress event
-      // from happening, so we have to cancel enter and tab again
-      // here.
-      if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode || event.code, event))) ||
-          event.code == 13 || (event.code == 9 && this.options.tabMode != "default") ||
-          (event.code == 32 && event.shiftKey && this.options.tabMode == "default"))
-        event.stop();
-      else if (mac && (event.ctrlKey || event.metaKey) && event.character == "v") {
-        this.reroutePasteEvent();
-      }
-      else if (electric && electric.indexOf(event.character) != -1)
-        parent.setTimeout(function(){self.indentAtCursor(null);}, 0);
-      // Work around a bug where pressing backspace at the end of a
-      // line, or delete at the start, often causes the cursor to jump
-      // to the start of the line in Opera 10.60.
-      else if (brokenOpera) {
-        if (event.code == 8) { // backspace
-          var sel = select.selectionTopNode(this.container), self = this,
-              next = sel ? sel.nextSibling : this.container.firstChild;
-          if (sel !== false && next && isBR(next))
-            parent.setTimeout(function(){
-              if (select.selectionTopNode(self.container) == next)
-                select.focusAfterNode(next.previousSibling, self.container);
-            }, 20);
-        }
-        else if (event.code == 46) { // delete
-          var sel = select.selectionTopNode(this.container), self = this;
-          if (sel && isBR(sel)) {
-            parent.setTimeout(function(){
-              if (select.selectionTopNode(self.container) != sel)
-                select.focusAfterNode(sel, self.container);
-            }, 20);
-          }
-        }
-      }
-      // In 533.* WebKit versions, when the document is big, typing
-      // something at the end of a line causes the browser to do some
-      // kind of stupid heavy operation, creating delays of several
-      // seconds before the typed characters appear. This very crude
-      // hack inserts a temporary zero-width space after the cursor to
-      // make it not be at the end of the line.
-      else if (slowWebkit) {
-        var sel = select.selectionTopNode(this.container),
-            next = sel ? sel.nextSibling : this.container.firstChild;
-        // Doesn't work on empty lines, for some reason those always
-        // trigger the delay.
-        if (sel && next && isBR(next) && !isBR(sel)) {
-          var cheat = document.createTextNode("\u200b");
-          this.container.insertBefore(cheat, next);
-          parent.setTimeout(function() {
-            if (cheat.nodeValue == "\u200b") removeElement(cheat);
-            else cheat.nodeValue = cheat.nodeValue.replace("\u200b", "");
-          }, 20);
-        }
-      }
-
-      // Magic incantation that works abound a webkit bug when you
-      // can't type on a blank line following a line that's wider than
-      // the window.
-      if (webkit && !this.options.textWrapping)
-        setTimeout(function () {
-          var node = select.selectionTopNode(self.container, true);
-          if (node && node.nodeType == 3 && node.previousSibling && isBR(node.previousSibling)
-              && node.nextSibling && isBR(node.nextSibling))
-            node.parentNode.replaceChild(document.createElement("BR"), node.previousSibling);
-        }, 50);
-    },
-
-    // Mark the node at the cursor dirty when a non-safe key is
-    // released.
-    keyUp: function(event) {
-      this.cursorActivity(isSafeKey(event.keyCode));
-    },
-
-    // Indent the line following a given <br>, or null for the first
-    // line. If given a <br> element, this must have been highlighted
-    // so that it has an indentation method. Returns the whitespace
-    // element that has been modified or created (if any).
-    indentLineAfter: function(start, direction) {
-      function whiteSpaceAfter(node) {
-        var ws = node ? node.nextSibling : self.container.firstChild;
-        if (!ws || !hasClass(ws, "whitespace")) return null;
-        return ws;
-      }
-
-      // whiteSpace is the whitespace span at the start of the line,
-      // or null if there is no such node.
-      var self = this, whiteSpace = whiteSpaceAfter(start);
-      var newIndent = 0, curIndent = whiteSpace ? whiteSpace.currentText.length : 0;
-
-      var firstText = whiteSpace ? whiteSpace.nextSibling : (start ? start.nextSibling : this.container.firstChild);
-      if (direction == "keep") {
-        if (start) {
-          var prevWS = whiteSpaceAfter(startOfLine(start.previousSibling))
-          if (prevWS) newIndent = prevWS.currentText.length;
-        }
-      }
-      else {
-        // Sometimes the start of the line can influence the correct
-        // indentation, so we retrieve it.
-        var nextChars = (start && firstText && firstText.currentText) ? firstText.currentText : "";
-
-        // Ask the lexical context for the correct indentation, and
-        // compute how much this differs from the current indentation.
-        if (direction != null && this.options.tabMode != "indent")
-          newIndent = direction ? curIndent + indentUnit : Math.max(0, curIndent - indentUnit)
-        else if (start)
-          newIndent = start.indentation(nextChars, curIndent, direction, firstText);
-        else if (Editor.Parser.firstIndentation)
-          newIndent = Editor.Parser.firstIndentation(nextChars, curIndent, direction, firstText);
-      }
-      
-      var indentDiff = newIndent - curIndent;
-
-      // If there is too much, this is just a matter of shrinking a span.
-      if (indentDiff < 0) {
-        if (newIndent == 0) {
-          if (firstText) select.snapshotMove(whiteSpace.firstChild, firstText.firstChild || firstText, 0);
-          removeElement(whiteSpace);
-          whiteSpace = null;
-        }
-        else {
-          select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, indentDiff, true);
-          whiteSpace.currentText = makeWhiteSpace(newIndent);
-          whiteSpace.firstChild.nodeValue = whiteSpace.currentText;
-        }
-      }
-      // Not enough...
-      else if (indentDiff > 0) {
-        // If there is whitespace, we grow it.
-        if (whiteSpace) {
-          whiteSpace.currentText = makeWhiteSpace(newIndent);
-          whiteSpace.firstChild.nodeValue = whiteSpace.currentText;
-          select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, indentDiff, true);
-        }
-        // Otherwise, we have to add a new whitespace node.
-        else {
-          whiteSpace = makePartSpan(makeWhiteSpace(newIndent));
-          whiteSpace.className = "whitespace";
-          if (start) insertAfter(whiteSpace, start);
-          else this.container.insertBefore(whiteSpace, this.container.firstChild);
-          select.snapshotMove(firstText && (firstText.firstChild || firstText),
-                              whiteSpace.firstChild, newIndent, false, true);
-        }
-      }
-      // Make sure cursor ends up after the whitespace
-      else if (whiteSpace) {
-	select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, newIndent, false);
-      }
-      if (indentDiff != 0) this.addDirtyNode(start);
-    },
-
-    // Re-highlight the selected part of the document.
-    highlightAtCursor: function() {
-      var pos = select.selectionTopNode(this.container, true);
-      var to = select.selectionTopNode(this.container, false);
-      if (pos === false || to === false) return false;
-
-      select.markSelection();
-      if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false)
-        return false;
-      select.selectMarked();
-      return true;
-    },
-
-    // When tab is pressed with text selected, the whole selection is
-    // re-indented, when nothing is selected, the line with the cursor
-    // is re-indented.
-    handleTab: function(direction) {
-      if (this.options.tabMode == "spaces" && !select.somethingSelected())
-        select.insertTabAtCursor();
-      else
-        this.reindentSelection(direction);
-    },
-
-    // Custom home behaviour that doesn't land the cursor in front of
-    // leading whitespace unless pressed twice.
-    home: function() {
-      var cur = select.selectionTopNode(this.container, true), start = cur;
-      if (cur === false || !(!cur || cur.isPart || isBR(cur)) || !this.container.firstChild)
-        return false;
-
-      while (cur && !isBR(cur)) cur = cur.previousSibling;
-      var next = cur ? cur.nextSibling : this.container.firstChild;
-      if (next && next != start && next.isPart && hasClass(next, "whitespace"))
-        select.focusAfterNode(next, this.container);
-      else
-        select.focusAfterNode(cur, this.container);
-
-      select.scrollToCursor(this.container);
-      return true;
-    },
-
-    // Some browsers (Opera) don't manage to handle the end key
-    // properly in the face of vertical scrolling.
-    end: function() {
-      var cur = select.selectionTopNode(this.container, true);
-      if (cur === false) return false;
-      cur = endOfLine(cur, this.container);
-      if (!cur) return false;
-      select.focusAfterNode(cur.previousSibling, this.container);
-      select.scrollToCursor(this.container);
-      return true;
-    },
-
-    pageUp: function() {
-      var line = this.cursorPosition().line, scrollAmount = this.visibleLineCount();
-      if (line === false || scrollAmount === false) return false;
-      // Try to keep one line on the screen.
-      scrollAmount -= 2;
-      for (var i = 0; i < scrollAmount; i++) {
-        line = this.prevLine(line);
-        if (line === false) break;
-      }
-      if (i == 0) return false; // Already at first line
-      select.setCursorPos(this.container, {node: line, offset: 0});
-      select.scrollToCursor(this.container);
-      return true;
-    },
-
-    pageDown: function() {
-      var line = this.cursorPosition().line, scrollAmount = this.visibleLineCount();
-      if (line === false || scrollAmount === false) return false;
-      // Try to move to the last line of the current page.
-      scrollAmount -= 2;
-      for (var i = 0; i < scrollAmount; i++) {
-        var nextLine = this.nextLine(line);
-        if (nextLine === false) break;
-        line = nextLine;
-      }
-      if (i == 0) return false; // Already at last line
-      select.setCursorPos(this.container, {node: line, offset: 0});
-      select.scrollToCursor(this.container);
-      return true;
-    },
-
-    // Delay (or initiate) the next paren highlight event.
-    scheduleParenHighlight: function() {
-      if (this.parenEvent) parent.clearTimeout(this.parenEvent);
-      var self = this;
-      this.parenEvent = parent.setTimeout(function(){self.highlightParens();}, 300);
-    },
-
-    // Take the token before the cursor. If it contains a character in
-    // '()[]{}', search for the matching paren/brace/bracket, and
-    // highlight them in green for a moment, or red if no proper match
-    // was found.
-    highlightParens: function(jump, fromKey) {
-      var self = this, mark = this.options.markParen;
-      if (typeof mark == "string") mark = [mark, mark];
-      // give the relevant nodes a colour.
-      function highlight(node, ok) {
-        if (!node) return;
-        if (!mark) {
-          node.style.fontWeight = "bold";
-          node.style.color = ok ? "#8F8" : "#F88";
-        }
-        else if (mark.call) mark(node, ok);
-        else node.className += " " + mark[ok ? 0 : 1];
-      }
-      function unhighlight(node) {
-        if (!node) return;
-        if (mark && !mark.call)
-          removeClass(removeClass(node, mark[0]), mark[1]);
-        else if (self.options.unmarkParen)
-          self.options.unmarkParen(node);
-        else {
-          node.style.fontWeight = "";
-          node.style.color = "";
-        }
-      }
-      if (!fromKey && self.highlighted) {
-        unhighlight(self.highlighted[0]);
-        unhighlight(self.highlighted[1]);
-      }
-
-      if (!window || !window.parent || !window.select) return;
-      // Clear the event property.
-      if (this.parenEvent) parent.clearTimeout(this.parenEvent);
-      this.parenEvent = null;
-
-      // Extract a 'paren' from a piece of text.
-      function paren(node) {
-        if (node.currentText) {
-          var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/);
-          return match && match[1];
-        }
-      }
-      // Determine the direction a paren is facing.
-      function forward(ch) {
-        return /[\(\[\{]/.test(ch);
-      }
-
-      var ch, cursor = select.selectionTopNode(this.container, true);
-      if (!cursor || !this.highlightAtCursor()) return;
-      cursor = select.selectionTopNode(this.container, true);
-      if (!(cursor && ((ch = paren(cursor)) || (cursor = cursor.nextSibling) && (ch = paren(cursor)))))
-        return;
-      // We only look for tokens with the same className.
-      var className = cursor.className, dir = forward(ch), match = matching[ch];
-
-      // Since parts of the document might not have been properly
-      // highlighted, and it is hard to know in advance which part we
-      // have to scan, we just try, and when we find dirty nodes we
-      // abort, parse them, and re-try.
-      function tryFindMatch() {
-        var stack = [], ch, ok = true;
-        for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) {
-          if (runner.className == className && isSpan(runner) && (ch = paren(runner))) {
-            if (forward(ch) == dir)
-              stack.push(ch);
-            else if (!stack.length)
-              ok = false;
-            else if (stack.pop() != matching[ch])
-              ok = false;
-            if (!stack.length) break;
-          }
-          else if (runner.dirty || !isSpan(runner) && !isBR(runner)) {
-            return {node: runner, status: "dirty"};
-          }
-        }
-        return {node: runner, status: runner && ok};
-      }
-
-      while (true) {
-        var found = tryFindMatch();
-        if (found.status == "dirty") {
-          this.highlight(found.node, endOfLine(found.node));
-          // Needed because in some corner cases a highlight does not
-          // reach a node.
-          found.node.dirty = false;
-          continue;
-        }
-        else {
-          highlight(cursor, found.status);
-          highlight(found.node, found.status);
-          if (fromKey)
-            parent.setTimeout(function() {unhighlight(cursor); unhighlight(found.node);}, 500);
-          else
-            self.highlighted = [cursor, found.node];
-          if (jump && found.node)
-            select.focusAfterNode(found.node.previousSibling, this.container);
-          break;
-        }
-      }
-    },
-
-    // Adjust the amount of whitespace at the start of the line that
-    // the cursor is on so that it is indented properly.
-    indentAtCursor: function(direction) {
-      if (!this.container.firstChild) return;
-      // The line has to have up-to-date lexical information, so we
-      // highlight it first.
-      if (!this.highlightAtCursor()) return;
-      var cursor = select.selectionTopNode(this.container, false);
-      // If we couldn't determine the place of the cursor,
-      // there's nothing to indent.
-      if (cursor === false)
-        return;
-      select.markSelection();
-      this.indentLineAfter(startOfLine(cursor), direction);
-      select.selectMarked();
-    },
-
-    // Indent all lines whose start falls inside of the current
-    // selection.
-    indentRegion: function(start, end, direction, selectAfter) {
-      var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling);
-      if (!isBR(end)) end = endOfLine(end, this.container);
-      this.addDirtyNode(start);
-
-      do {
-        var next = endOfLine(current, this.container);
-        if (current) this.highlight(before, next, true);
-        this.indentLineAfter(current, direction);
-        before = current;
-        current = next;
-      } while (current != end);
-      if (selectAfter)
-        select.setCursorPos(this.container, {node: start, offset: 0}, {node: end, offset: 0});
-    },
-
-    // Find the node that the cursor is in, mark it as dirty, and make
-    // sure a highlight pass is scheduled.
-    cursorActivity: function(safe) {
-      // pagehide event hack above
-      if (this.unloaded) {
-        window.document.designMode = "off";
-        window.document.designMode = "on";
-        this.unloaded = false;
-      }
-
-      if (internetExplorer) {
-        this.container.createTextRange().execCommand("unlink");
-        clearTimeout(this.saveSelectionSnapshot);
-        var self = this;
-        this.saveSelectionSnapshot = setTimeout(function() {
-          var snapshot = select.getBookmark(self.container);
-          if (snapshot) self.selectionSnapshot = snapshot;
-        }, 200);
-      }
-
-      var activity = this.options.onCursorActivity;
-      if (!safe || activity) {
-        var cursor = select.selectionTopNode(this.container, false);
-        if (cursor === false || !this.container.firstChild) return;
-        cursor = cursor || this.container.firstChild;
-        if (activity) activity(cursor);
-        if (!safe) {
-          this.scheduleHighlight();
-          this.addDirtyNode(cursor);
-        }
-      }
-    },
-
-    reparseBuffer: function() {
-      forEach(this.container.childNodes, function(node) {node.dirty = true;});
-      if (this.container.firstChild)
-        this.addDirtyNode(this.container.firstChild);
-    },
-
-    // Add a node to the set of dirty nodes, if it isn't already in
-    // there.
-    addDirtyNode: function(node) {
-      node = node || this.container.firstChild;
-      if (!node) return;
-
-      for (var i = 0; i < this.dirty.length; i++)
-        if (this.dirty[i] == node) return;
-
-      if (node.nodeType != 3)
-        node.dirty = true;
-      this.dirty.push(node);
-    },
-
-    allClean: function() {
-      return !this.dirty.length;
-    },
-
-    // Cause a highlight pass to happen in options.passDelay
-    // milliseconds. Clear the existing timeout, if one exists. This
-    // way, the passes do not happen while the user is typing, and
-    // should as unobtrusive as possible.
-    scheduleHighlight: function() {
-      // Timeouts are routed through the parent window, because on
-      // some browsers designMode windows do not fire timeouts.
-      var self = this;
-      parent.clearTimeout(this.highlightTimeout);
-      this.highlightTimeout = parent.setTimeout(function(){self.highlightDirty();}, this.options.passDelay);
-    },
-
-    // Fetch one dirty node, and remove it from the dirty set.
-    getDirtyNode: function() {
-      while (this.dirty.length > 0) {
-        var found = this.dirty.pop();
-        // IE8 sometimes throws an unexplainable 'invalid argument'
-        // exception for found.parentNode
-        try {
-          // If the node has been coloured in the meantime, or is no
-          // longer in the document, it should not be returned.
-          while (found && found.parentNode != this.container)
-            found = found.parentNode;
-          if (found && (found.dirty || found.nodeType == 3))
-            return found;
-        } catch (e) {}
-      }
-      return null;
-    },
-
-    // Pick dirty nodes, and highlight them, until options.passTime
-    // milliseconds have gone by. The highlight method will continue
-    // to next lines as long as it finds dirty nodes. It returns
-    // information about the place where it stopped. If there are
-    // dirty nodes left after this function has spent all its lines,
-    // it shedules another highlight to finish the job.
-    highlightDirty: function(force) {
-      // Prevent FF from raising an error when it is firing timeouts
-      // on a page that's no longer loaded.
-      if (!window || !window.parent || !window.select) return false;
-
-      if (!this.options.readOnly) select.markSelection();
-      var start, endTime = force ? null : time() + this.options.passTime;
-      while ((time() < endTime || force) && (start = this.getDirtyNode())) {
-        var result = this.highlight(start, endTime);
-        if (result && result.node && result.dirty)
-          this.addDirtyNode(result.node.nextSibling);
-      }
-      if (!this.options.readOnly) select.selectMarked();
-      if (start) this.scheduleHighlight();
-      return this.dirty.length == 0;
-    },
-
-    // Creates a function that, when called through a timeout, will
-    // continuously re-parse the document.
-    documentScanner: function(passTime) {
-      var self = this, pos = null;
-      return function() {
-        // FF timeout weirdness workaround.
-        if (!window || !window.parent || !window.select) return;
-        // If the current node is no longer in the document... oh
-        // well, we start over.
-        if (pos && pos.parentNode != self.container)
-          pos = null;
-        select.markSelection();
-        var result = self.highlight(pos, time() + passTime, true);
-        select.selectMarked();
-        var newPos = result ? (result.node && result.node.nextSibling) : null;
-        pos = (pos == newPos) ? null : newPos;
-        self.delayScanning();
-      };
-    },
-
-    // Starts the continuous scanning process for this document after
-    // a given interval.
-    delayScanning: function() {
-      if (this.scanner) {
-        parent.clearTimeout(this.documentScan);
-        this.documentScan = parent.setTimeout(this.scanner, this.options.continuousScanning);
-      }
-    },
-
-    // The function that does the actual highlighting/colouring (with
-    // help from the parser and the DOM normalizer). Its interface is
-    // rather overcomplicated, because it is used in different
-    // situations: ensuring that a certain line is highlighted, or
-    // highlighting up to X milliseconds starting from a certain
-    // point. The 'from' argument gives the node at which it should
-    // start. If this is null, it will start at the beginning of the
-    // document. When a timestamp is given with the 'target' argument,
-    // it will stop highlighting at that time. If this argument holds
-    // a DOM node, it will highlight until it reaches that node. If at
-    // any time it comes across two 'clean' lines (no dirty nodes), it
-    // will stop, except when 'cleanLines' is true. maxBacktrack is
-    // the maximum number of lines to backtrack to find an existing
-    // parser instance. This is used to give up in situations where a
-    // highlight would take too long and freeze the browser interface.
-    highlight: function(from, target, cleanLines, maxBacktrack){
-      var container = this.container, self = this, active = this.options.activeTokens;
-      var endTime = (typeof target == "number" ? target : null);
-
-      if (!container.firstChild)
-        return false;
-      // Backtrack to the first node before from that has a partial
-      // parse stored.
-      while (from && (!from.parserFromHere || from.dirty)) {
-        if (maxBacktrack != null && isBR(from) && (--maxBacktrack) < 0)
-          return false;
-        from = from.previousSibling;
-      }
-      // If we are at the end of the document, do nothing.
-      if (from && !from.nextSibling)
-        return false;
-
-      // Check whether a part (<span> node) and the corresponding token
-      // match.
-      function correctPart(token, part){
-        return !part.reduced && part.currentText == token.value && part.className == token.style;
-      }
-      // Shorten the text associated with a part by chopping off
-      // characters from the front. Note that only the currentText
-      // property gets changed. For efficiency reasons, we leave the
-      // nodeValue alone -- we set the reduced flag to indicate that
-      // this part must be replaced.
-      function shortenPart(part, minus){
-        part.currentText = part.currentText.substring(minus);
-        part.reduced = true;
-      }
-      // Create a part corresponding to a given token.
-      function tokenPart(token){
-        var part = makePartSpan(token.value);     
-        part.className = token.style;
-        return part;
-      }
-
-      function maybeTouch(node) {
-        if (node) {
-          var old = node.oldNextSibling;
-          if (lineDirty || old === undefined || node.nextSibling != old)
-            self.history.touch(node);
-          node.oldNextSibling = node.nextSibling;
-        }
-        else {
-          var old = self.container.oldFirstChild;
-          if (lineDirty || old === undefined || self.container.firstChild != old)
-            self.history.touch(null);
-          self.container.oldFirstChild = self.container.firstChild;
-        }
-      }
-
-      // Get the token stream. If from is null, we start with a new
-      // parser from the start of the frame, otherwise a partial parse
-      // is resumed.
-      var traversal = traverseDOM(from ? from.nextSibling : container.firstChild),
-          stream = stringStream(traversal),
-          parsed = from ? from.parserFromHere(stream) : Editor.Parser.make(stream);
-
-      function surroundedByBRs(node) {
-        return (node.previousSibling == null || isBR(node.previousSibling)) &&
-               (node.nextSibling == null || isBR(node.nextSibling));
-      }
-
-      // parts is an interface to make it possible to 'delay' fetching
-      // the next DOM node until we are completely done with the one
-      // before it. This is necessary because often the next node is
-      // not yet available when we want to proceed past the current
-      // one.
-      var parts = {
-        current: null,
-        // Fetch current node.
-        get: function(){
-          if (!this.current)
-            this.current = traversal.nodes.shift();
-          return this.current;
-        },
-        // Advance to the next part (do not fetch it yet).
-        next: function(){
-          this.current = null;
-        },
-        // Remove the current part from the DOM tree, and move to the
-        // next.
-        remove: function(){
-          container.removeChild(this.get());
-          this.current = null;
-        },
-        // Advance to the next part that is not empty, discarding empty
-        // parts.
-        getNonEmpty: function(){
-          var part = this.get();
-          // Allow empty nodes when they are alone on a line, needed
-          // for the FF cursor bug workaround (see select.js,
-          // insertNewlineAtCursor).
-          while (part && isSpan(part) && part.currentText == "") {
-            // Leave empty nodes that are alone on a line alone in
-            // Opera, since that browsers doesn't deal well with
-            // having 2 BRs in a row.
-            if (window.opera && surroundedByBRs(part)) {
-              this.next();
-              part = this.get();
-            }
-            else {
-              var old = part;
-              this.remove();
-              part = this.get();
-              // Adjust selection information, if any. See select.js for details.
-              select.snapshotMove(old.firstChild, part && (part.firstChild || part), 0);
-            }
-          }
-          
-          return part;
-        }
-      };
-
-      var lineDirty = false, prevLineDirty = true, lineNodes = 0;
-
-      // This forEach loops over the tokens from the parsed stream, and
-      // at the same time uses the parts object to proceed through the
-      // corresponding DOM nodes.
-      forEach(parsed, function(token){
-        var part = parts.getNonEmpty();
-
-        if (token.value == "\n"){
-          // The idea of the two streams actually staying synchronized
-          // is such a long shot that we explicitly check.
-          if (!isBR(part))
-            throw "Parser out of sync. Expected BR.";
-
-          if (part.dirty || !part.indentation) lineDirty = true;
-          maybeTouch(from);
-          from = part;
-
-          // Every <br> gets a copy of the parser state and a lexical
-          // context assigned to it. The first is used to be able to
-          // later resume parsing from this point, the second is used
-          // for indentation.
-          part.parserFromHere = parsed.copy();
-          part.indentation = token.indentation || alwaysZero;
-          part.dirty = false;
-
-          // If the target argument wasn't an integer, go at least
-          // until that node.
-          if (endTime == null && part == target) throw StopIteration;
-
-          // A clean line with more than one node means we are done.
-          // Throwing a StopIteration is the way to break out of a
-          // MochiKit forEach loop.
-          if ((endTime != null && time() >= endTime) || (!lineDirty && !prevLineDirty && lineNodes > 1 && !cleanLines))
-            throw StopIteration;
-          prevLineDirty = lineDirty; lineDirty = false; lineNodes = 0;
-          parts.next();
-        }
-        else {
-          if (!isSpan(part))
-            throw "Parser out of sync. Expected SPAN.";
-          if (part.dirty)
-            lineDirty = true;
-          lineNodes++;
-
-          // If the part matches the token, we can leave it alone.
-          if (correctPart(token, part)){
-            if (active && part.dirty) active(part, token, self);
-            part.dirty = false;
-            parts.next();
-          }
-          // Otherwise, we have to fix it.
-          else {
-            lineDirty = true;
-            // Insert the correct part.
-            var newPart = tokenPart(token);
-            container.insertBefore(newPart, part);
-            if (active) active(newPart, token, self);
-            var tokensize = token.value.length;
-            var offset = 0;
-            // Eat up parts until the text for this token has been
-            // removed, adjusting the stored selection info (see
-            // select.js) in the process.
-            while (tokensize > 0) {
-              part = parts.get();
-              var partsize = part.currentText.length;
-              select.snapshotReplaceNode(part.firstChild, newPart.firstChild, tokensize, offset);
-              if (partsize > tokensize){
-                shortenPart(part, tokensize);
-                tokensize = 0;
-              }
-              else {
-                tokensize -= partsize;
-                offset += partsize;
-                parts.remove();
-              }
-            }
-          }
-        }
-      });
-      maybeTouch(from);
-      webkitLastLineHack(this.container);
-
-      // The function returns some status information that is used by
-      // hightlightDirty to determine whether and where it has to
-      // continue.
-      return {node: parts.getNonEmpty(),
-              dirty: lineDirty};
-    }
-  };
-
-  return Editor;
-})();
-
-addEventHandler(window, "load", function() {
-  var CodeMirror = window.frameElement.CodeMirror;
-  var e = CodeMirror.editor = new Editor(CodeMirror.options);
-  parent.setTimeout(method(CodeMirror, "init"), 0);
-});
diff --git a/web/src/main/webapp/codemirror/highlight.js b/web/src/main/webapp/codemirror/highlight.js
deleted file mode 100644
index e6333c234109bd5b4187c205df2f5ab87ceb4509..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/highlight.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// Minimal framing needed to use CodeMirror-style parsers to highlight
-// code. Load this along with tokenize.js, stringstream.js, and your
-// parser. Then call highlightText, passing a string as the first
-// argument, and as the second argument either a callback function
-// that will be called with an array of SPAN nodes for every line in
-// the code, or a DOM node to which to append these spans, and
-// optionally (not needed if you only loaded one parser) a parser
-// object.
-
-// Stuff from util.js that the parsers are using.
-var StopIteration = {toString: function() {return "StopIteration"}};
-
-var Editor = {};
-var indentUnit = 2;
-
-(function(){
-  function normaliseString(string) {
-    var tab = "";
-    for (var i = 0; i < indentUnit; i++) tab += " ";
-
-    string = string.replace(/\t/g, tab).replace(/\u00a0/g, " ").replace(/\r\n?/g, "\n");
-    var pos = 0, parts = [], lines = string.split("\n");
-    for (var line = 0; line < lines.length; line++) {
-      if (line != 0) parts.push("\n");
-      parts.push(lines[line]);
-    }
-
-    return {
-      next: function() {
-        if (pos < parts.length) return parts[pos++];
-        else throw StopIteration;
-      }
-    };
-  }
-
-  window.highlightText = function(string, callback, parser) {
-    parser = (parser || Editor.Parser).make(stringStream(normaliseString(string)));
-    var line = [];
-    if (callback.nodeType == 1) {
-      var node = callback;
-      callback = function(line) {
-        for (var i = 0; i < line.length; i++)
-          node.appendChild(line[i]);
-        node.appendChild(document.createElement("br"));
-      };
-    }
-
-    try {
-      while (true) {
-        var token = parser.next();
-        if (token.value == "\n") {
-          callback(line);
-          line = [];
-        }
-        else {
-          var span = document.createElement("span");
-          span.className = token.style;
-          span.appendChild(document.createTextNode(token.value));
-          line.push(span);
-        }
-      }
-    }
-    catch (e) {
-      if (e != StopIteration) throw e;
-    }
-    if (line.length) callback(line);
-  }
-})();
diff --git a/web/src/main/webapp/codemirror/mirrorframe.js b/web/src/main/webapp/codemirror/mirrorframe.js
deleted file mode 100644
index bd0ec761123221dc51e4a26011232531a9e059a3..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/mirrorframe.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Demonstration of embedding CodeMirror in a bigger application. The
- * interface defined here is a mess of prompts and confirms, and
- * should probably not be used in a real project.
- */
-
-function MirrorFrame(place, options) {
-  this.home = document.createElement("div");
-  if (place.appendChild)
-    place.appendChild(this.home);
-  else
-    place(this.home);
-
-  var self = this;
-  function makeButton(name, action) {
-    var button = document.createElement("input");
-    button.type = "button";
-    button.value = name;
-    self.home.appendChild(button);
-    button.onclick = function(){self[action].call(self);};
-  }
-
-  makeButton("Search", "search");
-  makeButton("Replace", "replace");
-  makeButton("Current line", "line");
-  makeButton("Jump to line", "jump");
-  makeButton("Insert constructor", "macro");
-  makeButton("Indent all", "reindent");
-
-  this.mirror = new CodeMirror(this.home, options);
-}
-
-MirrorFrame.prototype = {
-  search: function() {
-    var text = prompt("Enter search term:", "");
-    if (!text) return;
-
-    var first = true;
-    do {
-      var cursor = this.mirror.getSearchCursor(text, first);
-      first = false;
-      while (cursor.findNext()) {
-        cursor.select();
-        if (!confirm("Search again?"))
-          return;
-      }
-    } while (confirm("End of document reached. Start over?"));
-  },
-
-  replace: function() {
-    // This is a replace-all, but it is possible to implement a
-    // prompting replace.
-    var from = prompt("Enter search string:", ""), to;
-    if (from) to = prompt("What should it be replaced with?", "");
-    if (to == null) return;
-
-    var cursor = this.mirror.getSearchCursor(from, false);
-    while (cursor.findNext())
-      cursor.replace(to);
-  },
-
-  jump: function() {
-    var line = prompt("Jump to line:", "");
-    if (line && !isNaN(Number(line)))
-      this.mirror.jumpToLine(Number(line));
-  },
-
-  line: function() {
-    alert("The cursor is currently at line " + this.mirror.currentLine());
-    this.mirror.focus();
-  },
-
-  macro: function() {
-    var name = prompt("Name your constructor:", "");
-    if (name)
-      this.mirror.replaceSelection("function " + name + "() {\n  \n}\n\n" + name + ".prototype = {\n  \n};\n");
-  },
-
-  reindent: function() {
-    this.mirror.reindent();
-  }
-};
diff --git a/web/src/main/webapp/codemirror/parsescala.js b/web/src/main/webapp/codemirror/parsescala.js
deleted file mode 100644
index 3c79294540215a0b01c0e48a37b6c6eb29b78364..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/parsescala.js
+++ /dev/null
@@ -1,359 +0,0 @@
-/* Parse function for JavaScript. Makes use of the tokenizer from
- * tokenizejavascript.js. Note that your parsers do not have to be
- * this complicated -- if you don't want to recognize local variables,
- * in many languages it is enough to just look for braces, semicolons,
- * parentheses, etc, and know when you are inside a string or comment.
- *
- * See manual.html for more info about the parser interface.
- */
-
-/* copy/change from parsejavascript.js
- * used in scripster: http://scripster.razie.com
- * Razvan Cojocaru
- */
-
-var JSParser = Editor.Parser = (function() {
-  // Token types that can be considered to be atoms.
-  var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
-  // Setting that can be used to have JSON data indent properly.
-  var json = false;
-  // Constructor for the lexical context objects.
-  function JSLexical(indented, column, type, align, prev, info) {
-    // indentation at start of this line
-    this.indented = indented;
-    // column at which this scope was opened
-    this.column = column;
-    // type of scope ('vardef', 'stat' (statement), 'form' (special form), '[', '{', or '(')
-    this.type = type;
-    // '[', '{', or '(' blocks that have any text after their opening
-    // character are said to be 'aligned' -- any lines below are
-    // indented all the way to the opening character.
-    if (align != null)
-      this.align = align;
-    // Parent scope, if any.
-    this.prev = prev;
-    this.info = info;
-  }
-
-  // My favourite JavaScript indentation rules.
-  function indentJS(lexical) {
-    return function(firstChars) {
-      var firstChar = firstChars && firstChars.charAt(0), type = lexical.type;
-      var closing = firstChar == type;
-      if (type == "vardef")
-        return lexical.indented + 4;
-      else if (type == "form" && firstChar == "{")
-        return lexical.indented;
-      else if (type == "stat" || type == "form")
-        return lexical.indented + indentUnit;
-      else if (lexical.info == "switch" && !closing)
-        return lexical.indented + (/^(?:case|default)\b/.test(firstChars) ? indentUnit : 2 * indentUnit);
-      else if (lexical.align)
-        return lexical.column - (closing ? 1 : 0);
-      else
-        return lexical.indented + (closing ? 0 : indentUnit);
-    };
-  }
-
-  // The parser-iterator-producing function itself.
-  function parseJS(input, basecolumn) {
-    // Wrap the input in a token stream
-    var tokens = tokenizeJavaScript(input);
-    // The parser state. cc is a stack of actions that have to be
-    // performed to finish the current statement. For example we might
-    // know that we still need to find a closing parenthesis and a
-    // semicolon. Actions at the end of the stack go first. It is
-    // initialized with an infinitely looping action that consumes
-    // whole statements.
-    var cc = [statements];
-    // Context contains information about the current local scope, the
-    // variables defined in that, and the scopes above it.
-    var context = null;
-    // The lexical scope, used mostly for indentation.
-    var lexical = new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false);
-    // Current column, and the indentation at the start of the current
-    // line. Used to create lexical scope objects.
-    var column = 0;
-    var indented = 0;
-    // Variables which are used by the mark, cont, and pass functions
-    // below to communicate with the driver loop in the 'next'
-    // function.
-    var consume, marked;
-  
-    // The iterator object.
-    var parser = {next: next, copy: copy};
-
-    function next(){
-      // Start by performing any 'lexical' actions (adjusting the
-      // lexical variable), or the operations below will be working
-      // with the wrong lexical state.
-      while(cc[cc.length - 1].lex)
-        cc.pop()();
-
-      // Fetch a token.
-      var token = tokens.next();
-
-      // Adjust column and indented.
-      if (token.type == "whitespace" && column == 0)
-        indented = token.value.length;
-      column += token.value.length;
-      if (token.content == "\n"){
-        indented = column = 0;
-        // If the lexical scope's align property is still undefined at
-        // the end of the line, it is an un-aligned scope.
-        if (!("align" in lexical))
-          lexical.align = false;
-        // Newline tokens get an indentation function associated with
-        // them.
-        token.indentation = indentJS(lexical);
-      }
-      // No more processing for meaningless tokens.
-      if (token.type == "whitespace" || token.type == "comment")
-        return token;
-      // When a meaningful token is found and the lexical scope's
-      // align is undefined, it is an aligned scope.
-      if (!("align" in lexical))
-        lexical.align = true;
-
-      // Execute actions until one 'consumes' the token and we can
-      // return it.
-      while(true) {
-        consume = marked = false;
-        // Take and execute the topmost action.
-        cc.pop()(token.type, token.content);
-        if (consume){
-          // Marked is used to change the style of the current token.
-          if (marked)
-            token.style = marked;
-          // Here we differentiate between local and global variables.
-          else if (token.type == "variable" && inScope(token.content))
-            token.style = "js-localvariable";
-          return token;
-        }
-      }
-    }
-
-    // This makes a copy of the parser state. It stores all the
-    // stateful variables in a closure, and returns a function that
-    // will restore them when called with a new input stream. Note
-    // that the cc array has to be copied, because it is contantly
-    // being modified. Lexical objects are not mutated, and context
-    // objects are not mutated in a harmful way, so they can be shared
-    // between runs of the parser.
-    function copy(){
-      var _context = context, _lexical = lexical, _cc = cc.concat([]), _tokenState = tokens.state;
-  
-      return function copyParser(input){
-        context = _context;
-        lexical = _lexical;
-        cc = _cc.concat([]); // copies the array
-        column = indented = 0;
-        tokens = tokenizeJavaScript(input, _tokenState);
-        return parser;
-      };
-    }
-
-    // Helper function for pushing a number of actions onto the cc
-    // stack in reverse order.
-    function push(fs){
-      for (var i = fs.length - 1; i >= 0; i--)
-        cc.push(fs[i]);
-    }
-    // cont and pass are used by the action functions to add other
-    // actions to the stack. cont will cause the current token to be
-    // consumed, pass will leave it for the next action.
-    function cont(){
-      push(arguments);
-      consume = true;
-    }
-    function pass(){
-      push(arguments);
-      consume = false;
-    }
-    // Used to change the style of the current token.
-    function mark(style){
-      marked = style;
-    }
-
-    // Push a new scope. Will automatically link the current scope.
-    function pushcontext(){
-      context = {prev: context, vars: {"this": true, "arguments": true}};
-    }
-    // Pop off the current scope.
-    function popcontext(){
-      context = context.prev;
-    }
-    // Register a variable in the current scope.
-    function register(varname){
-      if (context){
-        mark("js-variabledef");
-        context.vars[varname] = true;
-      }
-    }
-    // Check whether a variable is defined in the current scope.
-    function inScope(varname){
-      var cursor = context;
-      while (cursor) {
-        if (cursor.vars[varname])
-          return true;
-        cursor = cursor.prev;
-      }
-      return false;
-    }
-  
-    // Push a new lexical context of the given type.
-    function pushlex(type, info) {
-      var result = function(){
-        lexical = new JSLexical(indented, column, type, null, lexical, info)
-      };
-      result.lex = true;
-      return result;
-    }
-    // Pop off the current lexical context.
-    function poplex(){
-      lexical = lexical.prev;
-    }
-    poplex.lex = true;
-    // The 'lex' flag on these actions is used by the 'next' function
-    // to know they can (and have to) be ran before moving on to the
-    // next token.
-  
-    // Creates an action that discards tokens until it finds one of
-    // the given type.
-    function expect(wanted){
-      return function expecting(type){
-        if (type == wanted) cont();
-        else cont(arguments.callee);
-      };
-    }
-
-    // Looks for a statement, and then calls itself.
-    function statements(type){
-      return pass(statement, statements);
-    }
-    // Dispatches various types of statements based on the type of the
-    // current token.
-    function statement(type){
-      if (type == "var") cont(pushlex("vardef"), vardef1, expect(";"), poplex);
-      else if (type == "keyword a") cont(pushlex("form"), expression, statement, poplex);
-      else if (type == "keyword b") cont(pushlex("form"), statement, poplex);
-      else if (type == "{" && json) cont(pushlex("}"), commasep(objprop, "}"), poplex);
-      else if (type == "{") cont(pushlex("}"), block, poplex);
-      else if (type == "function") cont(functiondef);
-      else if (type == "for") cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"), poplex, statement, poplex);
-      else if (type == "variable") cont(pushlex("stat"), maybelabel);
-      else if (type == "switch") cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), block, poplex, poplex);
- 
- // vvv RAZ     
- // ^^^ RAZ     
-
-      else if (type == "case") cont(expression, expect(":"));
-      else if (type == "default") cont(expect(":"));
-      else if (type == "catch") cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), statement, poplex, popcontext);
-      else pass(pushlex("stat"), expression, expect(";"), poplex);
-    }
-    // Dispatch expression types.
-    function expression(type){
-      if (atomicTypes.hasOwnProperty(type)) cont(maybeoperator);
-      else if (type == "function") cont(functiondef);
-      else if (type == "keyword c") cont(expression);
-      else if (type == "(") cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator);
-      else if (type == "operator") cont(expression);
-      else if (type == "[") cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
-      else if (type == "{") cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
-    }
-    // Called for places where operators, function calls, or
-    // subscripts are valid. Will skip on to the next action if none
-    // is found.
-    function maybeoperator(type){
-      if (type == "operator") cont(expression);
-      else if (type == "(") cont(pushlex(")"), expression, commasep(expression, ")"), poplex, maybeoperator);
-      else if (type == ".") cont(property, maybeoperator);
-      else if (type == "[") cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
-    }
-    // When a statement starts with a variable name, it might be a
-    // label. If no colon follows, it's a regular statement.
-    function maybelabel(type){
-      if (type == ":") cont(poplex, statement);
-      else pass(maybeoperator, expect(";"), poplex);
-    }
-    // Property names need to have their style adjusted -- the
-    // tokenizer thinks they are variables.
-    function property(type){
-      if (type == "variable") {mark("js-property"); cont();}
-    }
-    // This parses a property and its value in an object literal.
-    function objprop(type){
-      if (type == "variable") mark("js-property");
-      if (atomicTypes.hasOwnProperty(type)) cont(expect(":"), expression);
-    }
-    // Parses a comma-separated list of the things that are recognized
-    // by the 'what' argument.
-    function commasep(what, end){
-      function proceed(type) {
-        if (type == ",") cont(what, proceed);
-        else if (type == end) cont();
-        else cont(expect(end));
-      }
-      return function commaSeparated(type) {
-        if (type == end) cont();
-        else pass(what, proceed);
-      };
-    }
-    // Look for statements until a closing brace is found.
-    function block(type){
-      if (type == "}") cont();
-      else pass(statement, block);
-    }
-    // Variable definitions are split into two actions -- 1 looks for
-    // a name or the end of the definition, 2 looks for an '=' sign or
-    // a comma.
-    function vardef1(type, value){
-      if (type == "variable"){register(value); cont(vardef2);}
-      else cont();
-    }
-    function vardef2(type, value){
-      if (value == "=") cont(expression, vardef2);
-      else if (type == ",") cont(vardef1);
-    }
-    // For loops.
-    function forspec1(type){
-      if (type == "var") cont(vardef1, forspec2);
-      else if (type == ";") pass(forspec2);
-      else if (type == "variable") cont(formaybein);
-      else pass(forspec2);
-    }
-    function formaybein(type, value){
-      if (value == "in") cont(expression);
-      else cont(maybeoperator, forspec2);
-    }
-    function forspec2(type, value){
-      if (type == ";") cont(forspec3);
-      else if (value == "in") cont(expression);
-      else cont(expression, expect(";"), forspec3);
-    }
-    function forspec3(type) {
-      if (type == ")") pass();
-      else cont(expression);
-    }
-    // A function definition creates a new context, and the variables
-    // in its argument list have to be added to this context.
-    function functiondef(type, value){
-      if (type == "variable"){register(value); cont(functiondef);}
-      else if (type == "(") cont(pushcontext, commasep(funarg, ")"), statement, popcontext);
-    }
-    function funarg(type, value){
-      if (type == "variable"){register(value); cont();}
-    }
-  
-    return parser;
-  }
-
-  return {
-    make: parseJS,
-    electricChars: "{}:",
-    configure: function(obj) {
-      if (obj.json != null) json = obj.json;
-    }
-  };
-})();
diff --git a/web/src/main/webapp/codemirror/scalacolors.css b/web/src/main/webapp/codemirror/scalacolors.css
deleted file mode 100644
index 2f3bf440bba4158abcecc2beae23f39db944b815..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/scalacolors.css
+++ /dev/null
@@ -1,60 +0,0 @@
-html {
-  cursor: text;
-}
-
-.editbox {
-  margin: .4em;
-  padding: 0;
-  font-family: monospace;
-  background-image: transparent;
-  font-size: 10pt;
-  color: black;
-}
-
-pre.code, .editbox {
-  color: #666666; 
-}
-
-.editbox p {
-  margin: 0;
-}
-
-span.js-punctuation {
-  color: #666666;
-}
-
-span.js-operator {
-  color: #666666;
-}
-
-span.js-keyword {
-  color: #770088; font-weight: bold;
-}
-
-span.js-atom {
-  color: #228811;
-}
-
-span.js-variable {
-  color: black;
-}
-
-span.js-variabledef {
-  color: #0000FF;
-}
-
-span.js-localvariable {
-  color: #004499;
-}
-
-span.js-property {
-  color: black;
-}
-
-span.js-comment {
-  color: #AA7700;
-}
-
-span.js-string {
-  color: #AA2222;
-}
diff --git a/web/src/main/webapp/codemirror/select.js b/web/src/main/webapp/codemirror/select.js
deleted file mode 100644
index 79c3d5426de3a2f0901c3cacd505bfb710717342..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/select.js
+++ /dev/null
@@ -1,699 +0,0 @@
-/* Functionality for finding, storing, and restoring selections
- *
- * This does not provide a generic API, just the minimal functionality
- * required by the CodeMirror system.
- */
-
-// Namespace object.
-var select = {};
-
-(function() {
-  select.ie_selection = document.selection && document.selection.createRangeCollection;
-
-  // Find the 'top-level' (defined as 'a direct child of the node
-  // passed as the top argument') node that the given node is
-  // contained in. Return null if the given node is not inside the top
-  // node.
-  function topLevelNodeAt(node, top) {
-    while (node && node.parentNode != top)
-      node = node.parentNode;
-    return node;
-  }
-
-  // Find the top-level node that contains the node before this one.
-  function topLevelNodeBefore(node, top) {
-    while (!node.previousSibling && node.parentNode != top)
-      node = node.parentNode;
-    return topLevelNodeAt(node.previousSibling, top);
-  }
-
-  var fourSpaces = "\u00a0\u00a0\u00a0\u00a0";
-
-  select.scrollToNode = function(node, cursor) {
-    if (!node) return;
-    var element = node, body = document.body,
-        html = document.documentElement,
-        atEnd = !element.nextSibling || !element.nextSibling.nextSibling
-                || !element.nextSibling.nextSibling.nextSibling;
-    // In Opera (and recent Webkit versions), BR elements *always*
-    // have a offsetTop property of zero.
-    var compensateHack = 0;
-    while (element && !element.offsetTop) {
-      compensateHack++;
-      element = element.previousSibling;
-    }
-    // atEnd is another kludge for these browsers -- if the cursor is
-    // at the end of the document, and the node doesn't have an
-    // offset, just scroll to the end.
-    if (compensateHack == 0) atEnd = false;
-
-    // WebKit has a bad habit of (sometimes) happily returning bogus
-    // offsets when the document has just been changed. This seems to
-    // always be 5/5, so we don't use those.
-    if (webkit && element && element.offsetTop == 5 && element.offsetLeft == 5)
-      return;
-
-    var y = compensateHack * (element ? element.offsetHeight : 0), x = 0,
-        width = (node ? node.offsetWidth : 0), pos = element;
-    while (pos && pos.offsetParent) {
-      y += pos.offsetTop;
-      // Don't count X offset for <br> nodes
-      if (!isBR(pos))
-        x += pos.offsetLeft;
-      pos = pos.offsetParent;
-    }
-
-    var scroll_x = body.scrollLeft || html.scrollLeft || 0,
-        scroll_y = body.scrollTop || html.scrollTop || 0,
-        scroll = false, screen_width = window.innerWidth || html.clientWidth || 0;
-
-    if (cursor || width < screen_width) {
-      if (cursor) {
-        var off = select.offsetInNode(node), size = nodeText(node).length;
-        if (size) x += width * (off / size);
-      }
-      var screen_x = x - scroll_x;
-      if (screen_x < 0 || screen_x > screen_width) {
-        scroll_x = x;
-        scroll = true;
-      }
-    }
-    var screen_y = y - scroll_y;
-    if (screen_y < 0 || atEnd || screen_y > (window.innerHeight || html.clientHeight || 0) - 50) {
-      scroll_y = atEnd ? 1e6 : y;
-      scroll = true;
-    }
-    if (scroll) window.scrollTo(scroll_x, scroll_y);
-  };
-
-  select.scrollToCursor = function(container) {
-    select.scrollToNode(select.selectionTopNode(container, true) || container.firstChild, true);
-  };
-
-  // Used to prevent restoring a selection when we do not need to.
-  var currentSelection = null;
-
-  select.snapshotChanged = function() {
-    if (currentSelection) currentSelection.changed = true;
-  };
-
-  // Find the 'leaf' node (BR or text) after the given one.
-  function baseNodeAfter(node) {
-    var next = node.nextSibling;
-    if (next) {
-      while (next.firstChild) next = next.firstChild;
-      if (next.nodeType == 3 || isBR(next)) return next;
-      else return baseNodeAfter(next);
-    }
-    else {
-      var parent = node.parentNode;
-      while (parent && !parent.nextSibling) parent = parent.parentNode;
-      return parent && baseNodeAfter(parent);
-    }
-  }
-
-  // This is called by the code in editor.js whenever it is replacing
-  // a text node. The function sees whether the given oldNode is part
-  // of the current selection, and updates this selection if it is.
-  // Because nodes are often only partially replaced, the length of
-  // the part that gets replaced has to be taken into account -- the
-  // selection might stay in the oldNode if the newNode is smaller
-  // than the selection's offset. The offset argument is needed in
-  // case the selection does move to the new object, and the given
-  // length is not the whole length of the new node (part of it might
-  // have been used to replace another node).
-  select.snapshotReplaceNode = function(from, to, length, offset) {
-    if (!currentSelection) return;
-
-    function replace(point) {
-      if (from == point.node) {
-        currentSelection.changed = true;
-        if (length && point.offset > length) {
-          point.offset -= length;
-        }
-        else {
-          point.node = to;
-          point.offset += (offset || 0);
-        }
-      }
-      else if (select.ie_selection && point.offset == 0 && point.node == baseNodeAfter(from)) {
-        currentSelection.changed = true;
-      }
-    }
-    replace(currentSelection.start);
-    replace(currentSelection.end);
-  };
-
-  select.snapshotMove = function(from, to, distance, relative, ifAtStart) {
-    if (!currentSelection) return;
-
-    function move(point) {
-      if (from == point.node && (!ifAtStart || point.offset == 0)) {
-        currentSelection.changed = true;
-        point.node = to;
-        if (relative) point.offset = Math.max(0, point.offset + distance);
-        else point.offset = distance;
-      }
-    }
-    move(currentSelection.start);
-    move(currentSelection.end);
-  };
-
-  // Most functions are defined in two ways, one for the IE selection
-  // model, one for the W3C one.
-  if (select.ie_selection) {
-    function selRange() {
-      var sel = document.selection;
-      if (!sel) return null;
-      if (sel.createRange) return sel.createRange();
-      else return sel.createTextRange();
-    }
-
-    function selectionNode(start) {
-      var range = selRange();
-      range.collapse(start);
-
-      function nodeAfter(node) {
-        var found = null;
-        while (!found && node) {
-          found = node.nextSibling;
-          node = node.parentNode;
-        }
-        return nodeAtStartOf(found);
-      }
-
-      function nodeAtStartOf(node) {
-        while (node && node.firstChild) node = node.firstChild;
-        return {node: node, offset: 0};
-      }
-
-      var containing = range.parentElement();
-      if (!isAncestor(document.body, containing)) return null;
-      if (!containing.firstChild) return nodeAtStartOf(containing);
-
-      var working = range.duplicate();
-      working.moveToElementText(containing);
-      working.collapse(true);
-      for (var cur = containing.firstChild; cur; cur = cur.nextSibling) {
-        if (cur.nodeType == 3) {
-          var size = cur.nodeValue.length;
-          working.move("character", size);
-        }
-        else {
-          working.moveToElementText(cur);
-          working.collapse(false);
-        }
-
-        var dir = range.compareEndPoints("StartToStart", working);
-        if (dir == 0) return nodeAfter(cur);
-        if (dir == 1) continue;
-        if (cur.nodeType != 3) return nodeAtStartOf(cur);
-
-        working.setEndPoint("StartToEnd", range);
-        return {node: cur, offset: size - working.text.length};
-      }
-      return nodeAfter(containing);
-    }
-
-    select.markSelection = function() {
-      currentSelection = null;
-      var sel = document.selection;
-      if (!sel) return;
-      var start = selectionNode(true),
-          end = selectionNode(false);
-      if (!start || !end) return;
-      currentSelection = {start: start, end: end, changed: false};
-    };
-
-    select.selectMarked = function() {
-      if (!currentSelection || !currentSelection.changed) return;
-
-      function makeRange(point) {
-        var range = document.body.createTextRange(),
-            node = point.node;
-        if (!node) {
-          range.moveToElementText(document.body);
-          range.collapse(false);
-        }
-        else if (node.nodeType == 3) {
-          range.moveToElementText(node.parentNode);
-          var offset = point.offset;
-          while (node.previousSibling) {
-            node = node.previousSibling;
-            offset += (node.innerText || "").length;
-          }
-          range.move("character", offset);
-        }
-        else {
-          range.moveToElementText(node);
-          range.collapse(true);
-        }
-        return range;
-      }
-
-      var start = makeRange(currentSelection.start), end = makeRange(currentSelection.end);
-      start.setEndPoint("StartToEnd", end);
-      start.select();
-    };
-
-    select.offsetInNode = function(node) {
-      var range = selRange();
-      if (!range) return 0;
-      var range2 = range.duplicate();
-      try {range2.moveToElementText(node);} catch(e){return 0;}
-      range.setEndPoint("StartToStart", range2);
-      return range.text.length;
-    };
-
-    // Get the top-level node that one end of the cursor is inside or
-    // after. Note that this returns false for 'no cursor', and null
-    // for 'start of document'.
-    select.selectionTopNode = function(container, start) {
-      var range = selRange();
-      if (!range) return false;
-      var range2 = range.duplicate();
-      range.collapse(start);
-      var around = range.parentElement();
-      if (around && isAncestor(container, around)) {
-        // Only use this node if the selection is not at its start.
-        range2.moveToElementText(around);
-        if (range.compareEndPoints("StartToStart", range2) == 1)
-          return topLevelNodeAt(around, container);
-      }
-
-      // Move the start of a range to the start of a node,
-      // compensating for the fact that you can't call
-      // moveToElementText with text nodes.
-      function moveToNodeStart(range, node) {
-        if (node.nodeType == 3) {
-          var count = 0, cur = node.previousSibling;
-          while (cur && cur.nodeType == 3) {
-            count += cur.nodeValue.length;
-            cur = cur.previousSibling;
-          }
-          if (cur) {
-            try{range.moveToElementText(cur);}
-            catch(e){return false;}
-            range.collapse(false);
-          }
-          else range.moveToElementText(node.parentNode);
-          if (count) range.move("character", count);
-        }
-        else {
-          try{range.moveToElementText(node);}
-          catch(e){return false;}
-        }
-        return true;
-      }
-
-      // Do a binary search through the container object, comparing
-      // the start of each node to the selection
-      var start = 0, end = container.childNodes.length - 1;
-      while (start < end) {
-        var middle = Math.ceil((end + start) / 2), node = container.childNodes[middle];
-        if (!node) return false; // Don't ask. IE6 manages this sometimes.
-        if (!moveToNodeStart(range2, node)) return false;
-        if (range.compareEndPoints("StartToStart", range2) == 1)
-          start = middle;
-        else
-          end = middle - 1;
-      }
-      
-      if (start == 0) {
-        var test1 = selRange(), test2 = test1.duplicate();
-        try {
-          test2.moveToElementText(container);
-        } catch(exception) {
-          return null;
-        }
-        if (test1.compareEndPoints("StartToStart", test2) == 0)
-          return null;
-      }
-      return container.childNodes[start] || null;
-    };
-
-    // Place the cursor after this.start. This is only useful when
-    // manually moving the cursor instead of restoring it to its old
-    // position.
-    select.focusAfterNode = function(node, container) {
-      var range = document.body.createTextRange();
-      range.moveToElementText(node || container);
-      range.collapse(!node);
-      range.select();
-    };
-
-    select.somethingSelected = function() {
-      var range = selRange();
-      return range && (range.text != "");
-    };
-
-    function insertAtCursor(html) {
-      var range = selRange();
-      if (range) {
-        range.pasteHTML(html);
-        range.collapse(false);
-        range.select();
-      }
-    }
-
-    // Used to normalize the effect of the enter key, since browsers
-    // do widely different things when pressing enter in designMode.
-    select.insertNewlineAtCursor = function() {
-      insertAtCursor("<br>");
-    };
-
-    select.insertTabAtCursor = function() {
-      insertAtCursor(fourSpaces);
-    };
-
-    // Get the BR node at the start of the line on which the cursor
-    // currently is, and the offset into the line. Returns null as
-    // node if cursor is on first line.
-    select.cursorPos = function(container, start) {
-      var range = selRange();
-      if (!range) return null;
-
-      var topNode = select.selectionTopNode(container, start);
-      while (topNode && !isBR(topNode))
-        topNode = topNode.previousSibling;
-
-      var range2 = range.duplicate();
-      range.collapse(start);
-      if (topNode) {
-        range2.moveToElementText(topNode);
-        range2.collapse(false);
-      }
-      else {
-        // When nothing is selected, we can get all kinds of funky errors here.
-        try { range2.moveToElementText(container); }
-        catch (e) { return null; }
-        range2.collapse(true);
-      }
-      range.setEndPoint("StartToStart", range2);
-
-      return {node: topNode, offset: range.text.length};
-    };
-
-    select.setCursorPos = function(container, from, to) {
-      function rangeAt(pos) {
-        var range = document.body.createTextRange();
-        if (!pos.node) {
-          range.moveToElementText(container);
-          range.collapse(true);
-        }
-        else {
-          range.moveToElementText(pos.node);
-          range.collapse(false);
-        }
-        range.move("character", pos.offset);
-        return range;
-      }
-
-      var range = rangeAt(from);
-      if (to && to != from)
-        range.setEndPoint("EndToEnd", rangeAt(to));
-      range.select();
-    }
-
-    // Some hacks for storing and re-storing the selection when the editor loses and regains focus.
-    select.getBookmark = function (container) {
-      var from = select.cursorPos(container, true), to = select.cursorPos(container, false);
-      if (from && to) return {from: from, to: to};
-    };
-
-    // Restore a stored selection.
-    select.setBookmark = function(container, mark) {
-      if (!mark) return;
-      select.setCursorPos(container, mark.from, mark.to);
-    };
-  }
-  // W3C model
-  else {
-    // Find the node right at the cursor, not one of its
-    // ancestors with a suitable offset. This goes down the DOM tree
-    // until a 'leaf' is reached (or is it *up* the DOM tree?).
-    function innerNode(node, offset) {
-      while (node.nodeType != 3 && !isBR(node)) {
-        var newNode = node.childNodes[offset] || node.nextSibling;
-        offset = 0;
-        while (!newNode && node.parentNode) {
-          node = node.parentNode;
-          newNode = node.nextSibling;
-        }
-        node = newNode;
-        if (!newNode) break;
-      }
-      return {node: node, offset: offset};
-    }
-
-    // Store start and end nodes, and offsets within these, and refer
-    // back to the selection object from those nodes, so that this
-    // object can be updated when the nodes are replaced before the
-    // selection is restored.
-    select.markSelection = function () {
-      var selection = window.getSelection();
-      if (!selection || selection.rangeCount == 0)
-        return (currentSelection = null);
-      var range = selection.getRangeAt(0);
-
-      currentSelection = {
-        start: innerNode(range.startContainer, range.startOffset),
-        end: innerNode(range.endContainer, range.endOffset),
-        changed: false
-      };
-    };
-
-    select.selectMarked = function () {
-      var cs = currentSelection;
-      // on webkit-based browsers, it is apparently possible that the
-      // selection gets reset even when a node that is not one of the
-      // endpoints get messed with. the most common situation where
-      // this occurs is when a selection is deleted or overwitten. we
-      // check for that here.
-      function focusIssue() {
-        if (cs.start.node == cs.end.node && cs.start.offset == cs.end.offset) {
-          var selection = window.getSelection();
-          if (!selection || selection.rangeCount == 0) return true;
-          var range = selection.getRangeAt(0), point = innerNode(range.startContainer, range.startOffset);
-          return cs.start.node != point.node || cs.start.offset != point.offset;
-        }
-      }
-      if (!cs || !(cs.changed || (webkit && focusIssue()))) return;
-      var range = document.createRange();
-
-      function setPoint(point, which) {
-        if (point.node) {
-          // Some magic to generalize the setting of the start and end
-          // of a range.
-          if (point.offset == 0)
-            range["set" + which + "Before"](point.node);
-          else
-            range["set" + which](point.node, point.offset);
-        }
-        else {
-          range.setStartAfter(document.body.lastChild || document.body);
-        }
-      }
-
-      setPoint(cs.end, "End");
-      setPoint(cs.start, "Start");
-      selectRange(range);
-    };
-
-    // Helper for selecting a range object.
-    function selectRange(range) {
-      var selection = window.getSelection();
-      if (!selection) return;
-      selection.removeAllRanges();
-      selection.addRange(range);
-    }
-    function selectionRange() {
-      var selection = window.getSelection();
-      if (!selection || selection.rangeCount == 0)
-        return false;
-      else
-        return selection.getRangeAt(0);
-    }
-
-    // Finding the top-level node at the cursor in the W3C is, as you
-    // can see, quite an involved process.
-    select.selectionTopNode = function(container, start) {
-      var range = selectionRange();
-      if (!range) return false;
-
-      var node = start ? range.startContainer : range.endContainer;
-      var offset = start ? range.startOffset : range.endOffset;
-      // Work around (yet another) bug in Opera's selection model.
-      if (window.opera && !start && range.endContainer == container && range.endOffset == range.startOffset + 1 &&
-          container.childNodes[range.startOffset] && isBR(container.childNodes[range.startOffset]))
-        offset--;
-
-      // For text nodes, we look at the node itself if the cursor is
-      // inside, or at the node before it if the cursor is at the
-      // start.
-      if (node.nodeType == 3){
-        if (offset > 0)
-          return topLevelNodeAt(node, container);
-        else
-          return topLevelNodeBefore(node, container);
-      }
-      // Occasionally, browsers will return the HTML node as
-      // selection. If the offset is 0, we take the start of the frame
-      // ('after null'), otherwise, we take the last node.
-      else if (node.nodeName.toUpperCase() == "HTML") {
-        return (offset == 1 ? null : container.lastChild);
-      }
-      // If the given node is our 'container', we just look up the
-      // correct node by using the offset.
-      else if (node == container) {
-        return (offset == 0) ? null : node.childNodes[offset - 1];
-      }
-      // In any other case, we have a regular node. If the cursor is
-      // at the end of the node, we use the node itself, if it is at
-      // the start, we use the node before it, and in any other
-      // case, we look up the child before the cursor and use that.
-      else {
-        if (offset == node.childNodes.length)
-          return topLevelNodeAt(node, container);
-        else if (offset == 0)
-          return topLevelNodeBefore(node, container);
-        else
-          return topLevelNodeAt(node.childNodes[offset - 1], container);
-      }
-    };
-
-    select.focusAfterNode = function(node, container) {
-      var range = document.createRange();
-      range.setStartBefore(container.firstChild || container);
-      // In Opera, setting the end of a range at the end of a line
-      // (before a BR) will cause the cursor to appear on the next
-      // line, so we set the end inside of the start node when
-      // possible.
-      if (node && !node.firstChild)
-        range.setEndAfter(node);
-      else if (node)
-        range.setEnd(node, node.childNodes.length);
-      else
-        range.setEndBefore(container.firstChild || container);
-      range.collapse(false);
-      selectRange(range);
-    };
-
-    select.somethingSelected = function() {
-      var range = selectionRange();
-      return range && !range.collapsed;
-    };
-
-    select.offsetInNode = function(node) {
-      var range = selectionRange();
-      if (!range) return 0;
-      range = range.cloneRange();
-      range.setStartBefore(node);
-      return range.toString().length;
-    };
-
-    select.insertNodeAtCursor = function(node) {
-      var range = selectionRange();
-      if (!range) return;
-
-      range.deleteContents();
-      range.insertNode(node);
-      webkitLastLineHack(document.body);
-
-      // work around weirdness where Opera will magically insert a new
-      // BR node when a BR node inside a span is moved around. makes
-      // sure the BR ends up outside of spans.
-      if (window.opera && isBR(node) && isSpan(node.parentNode)) {
-        var next = node.nextSibling, p = node.parentNode, outer = p.parentNode;
-        outer.insertBefore(node, p.nextSibling);
-        var textAfter = "";
-        for (; next && next.nodeType == 3; next = next.nextSibling) {
-          textAfter += next.nodeValue;
-          removeElement(next);
-        }
-        outer.insertBefore(makePartSpan(textAfter, document), node.nextSibling);
-      }
-      range = document.createRange();
-      range.selectNode(node);
-      range.collapse(false);
-      selectRange(range);
-    }
-
-    select.insertNewlineAtCursor = function() {
-      select.insertNodeAtCursor(document.createElement("BR"));
-    };
-
-    select.insertTabAtCursor = function() {
-      select.insertNodeAtCursor(document.createTextNode(fourSpaces));
-    };
-
-    select.cursorPos = function(container, start) {
-      var range = selectionRange();
-      if (!range) return;
-
-      var topNode = select.selectionTopNode(container, start);
-      while (topNode && !isBR(topNode))
-        topNode = topNode.previousSibling;
-
-      range = range.cloneRange();
-      range.collapse(start);
-      if (topNode)
-        range.setStartAfter(topNode);
-      else
-        range.setStartBefore(container);
-
-      var text = range.toString();
-      return {node: topNode, offset: text.length};
-    };
-
-    select.setCursorPos = function(container, from, to) {
-      var range = document.createRange();
-
-      function setPoint(node, offset, side) {
-        if (offset == 0 && node && !node.nextSibling) {
-          range["set" + side + "After"](node);
-          return true;
-        }
-
-        if (!node)
-          node = container.firstChild;
-        else
-          node = node.nextSibling;
-
-        if (!node) return;
-
-        if (offset == 0) {
-          range["set" + side + "Before"](node);
-          return true;
-        }
-
-        var backlog = []
-        function decompose(node) {
-          if (node.nodeType == 3)
-            backlog.push(node);
-          else
-            forEach(node.childNodes, decompose);
-        }
-        while (true) {
-          while (node && !backlog.length) {
-            decompose(node);
-            node = node.nextSibling;
-          }
-          var cur = backlog.shift();
-          if (!cur) return false;
-
-          var length = cur.nodeValue.length;
-          if (length >= offset) {
-            range["set" + side](cur, offset);
-            return true;
-          }
-          offset -= length;
-        }
-      }
-
-      to = to || from;
-      if (setPoint(to.node, to.offset, "End") && setPoint(from.node, from.offset, "Start"))
-        selectRange(range);
-    };
-  }
-})();
diff --git a/web/src/main/webapp/codemirror/stringstream.js b/web/src/main/webapp/codemirror/stringstream.js
deleted file mode 100644
index 0d0c869c982b5e38c289653c717362a08e6b8e4c..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/stringstream.js
+++ /dev/null
@@ -1,159 +0,0 @@
-/* String streams are the things fed to parsers (which can feed them
- * to a tokenizer if they want). They provide peek and next methods
- * for looking at the current character (next 'consumes' this
- * character, peek does not), and a get method for retrieving all the
- * text that was consumed since the last time get was called.
- *
- * An easy mistake to make is to let a StopIteration exception finish
- * the token stream while there are still characters pending in the
- * string stream (hitting the end of the buffer while parsing a
- * token). To make it easier to detect such errors, the stringstreams
- * throw an exception when this happens.
- */
-
-// Make a stringstream stream out of an iterator that returns strings.
-// This is applied to the result of traverseDOM (see codemirror.js),
-// and the resulting stream is fed to the parser.
-var stringStream = function(source){
-  // String that's currently being iterated over.
-  var current = "";
-  // Position in that string.
-  var pos = 0;
-  // Accumulator for strings that have been iterated over but not
-  // get()-ed yet.
-  var accum = "";
-  // Make sure there are more characters ready, or throw
-  // StopIteration.
-  function ensureChars() {
-    while (pos == current.length) {
-      accum += current;
-      current = ""; // In case source.next() throws
-      pos = 0;
-      try {current = source.next();}
-      catch (e) {
-        if (e != StopIteration) throw e;
-        else return false;
-      }
-    }
-    return true;
-  }
-
-  return {
-    // peek: -> character
-    // Return the next character in the stream.
-    peek: function() {
-      if (!ensureChars()) return null;
-      return current.charAt(pos);
-    },
-    // next: -> character
-    // Get the next character, throw StopIteration if at end, check
-    // for unused content.
-    next: function() {
-      if (!ensureChars()) {
-        if (accum.length > 0)
-          throw "End of stringstream reached without emptying buffer ('" + accum + "').";
-        else
-          throw StopIteration;
-      }
-      return current.charAt(pos++);
-    },
-    // get(): -> string
-    // Return the characters iterated over since the last call to
-    // .get().
-    get: function() {
-      var temp = accum;
-      accum = "";
-      if (pos > 0){
-        temp += current.slice(0, pos);
-        current = current.slice(pos);
-        pos = 0;
-      }
-      return temp;
-    },
-    // Push a string back into the stream.
-    push: function(str) {
-      current = current.slice(0, pos) + str + current.slice(pos);
-    },
-    lookAhead: function(str, consume, skipSpaces, caseInsensitive) {
-      function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
-      str = cased(str);
-      var found = false;
-
-      var _accum = accum, _pos = pos;
-      if (skipSpaces) this.nextWhileMatches(/[\s\u00a0]/);
-
-      while (true) {
-        var end = pos + str.length, left = current.length - pos;
-        if (end <= current.length) {
-          found = str == cased(current.slice(pos, end));
-          pos = end;
-          break;
-        }
-        else if (str.slice(0, left) == cased(current.slice(pos))) {
-          accum += current; current = "";
-          try {current = source.next();}
-          catch (e) {if (e != StopIteration) throw e; break;}
-          pos = 0;
-          str = str.slice(left);
-        }
-        else {
-          break;
-        }
-      }
-
-      if (!(found && consume)) {
-        current = accum.slice(_accum.length) + current;
-        pos = _pos;
-        accum = _accum;
-      }
-
-      return found;
-    },
-    // Wont't match past end of line.
-    lookAheadRegex: function(regex, consume) {
-      if (regex.source.charAt(0) != "^")
-        throw new Error("Regexps passed to lookAheadRegex must start with ^");
-
-      // Fetch the rest of the line
-      while (current.indexOf("\n", pos) == -1) {
-        try {current += source.next();}
-        catch (e) {if (e != StopIteration) throw e; break;}
-      }
-      var matched = current.slice(pos).match(regex);
-      if (matched && consume) pos += matched[0].length;
-      return matched;
-    },
-
-    // Utils built on top of the above
-    // more: -> boolean
-    // Produce true if the stream isn't empty.
-    more: function() {
-      return this.peek() !== null;
-    },
-    applies: function(test) {
-      var next = this.peek();
-      return (next !== null && test(next));
-    },
-    nextWhile: function(test) {
-      var next;
-      while ((next = this.peek()) !== null && test(next))
-        this.next();
-    },
-    matches: function(re) {
-      var next = this.peek();
-      return (next !== null && re.test(next));
-    },
-    nextWhileMatches: function(re) {
-      var next;
-      while ((next = this.peek()) !== null && re.test(next))
-        this.next();
-    },
-    equals: function(ch) {
-      return ch === this.peek();
-    },
-    endOfLine: function() {
-      var next = this.peek();
-      return next == null || next == "\n";
-    }
-  };
-};
diff --git a/web/src/main/webapp/codemirror/tokenize.js b/web/src/main/webapp/codemirror/tokenize.js
deleted file mode 100644
index 071970ce3d89c825cf6cb8ccac5e27b36926b667..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/tokenize.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// A framework for simple tokenizers. Takes care of newlines and
-// white-space, and of getting the text from the source stream into
-// the token object. A state is a function of two arguments -- a
-// string stream and a setState function. The second can be used to
-// change the tokenizer's state, and can be ignored for stateless
-// tokenizers. This function should advance the stream over a token
-// and return a string or object containing information about the next
-// token, or null to pass and have the (new) state be called to finish
-// the token. When a string is given, it is wrapped in a {style, type}
-// object. In the resulting object, the characters consumed are stored
-// under the content property. Any whitespace following them is also
-// automatically consumed, and added to the value property. (Thus,
-// content is the actual meaningful part of the token, while value
-// contains all the text it spans.)
-
-function tokenizer(source, state) {
-  // Newlines are always a separate token.
-  function isWhiteSpace(ch) {
-    // The messy regexp is because IE's regexp matcher is of the
-    // opinion that non-breaking spaces are no whitespace.
-    return ch != "\n" && /^[\s\u00a0]*$/.test(ch);
-  }
-
-  var tokenizer = {
-    state: state,
-
-    take: function(type) {
-      if (typeof(type) == "string")
-        type = {style: type, type: type};
-
-      type.content = (type.content || "") + source.get();
-      if (!/\n$/.test(type.content))
-        source.nextWhile(isWhiteSpace);
-      type.value = type.content + source.get();
-      return type;
-    },
-
-    next: function () {
-      if (!source.more()) throw StopIteration;
-
-      var type;
-      if (source.equals("\n")) {
-        source.next();
-        return this.take("whitespace");
-      }
-      
-      if (source.applies(isWhiteSpace))
-        type = "whitespace";
-      else
-        while (!type)
-          type = this.state(source, function(s) {tokenizer.state = s;});
-
-      return this.take(type);
-    }
-  };
-  return tokenizer;
-}
diff --git a/web/src/main/webapp/codemirror/tokenizescala.js b/web/src/main/webapp/codemirror/tokenizescala.js
deleted file mode 100644
index 94281d4e276a50a24ca06ce38fb8ea8afa601a4a..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/tokenizescala.js
+++ /dev/null
@@ -1,197 +0,0 @@
-/* Tokenizer for JavaScript code */
-
-/* copy/change from parsejavascript.js
- * used in scripster: http://scripster.razie.com
- * Razvan Cojocaru
- */
-
-var tokenizeJavaScript = (function() {
-  // Advance the stream until the given character (not preceded by a
-  // backslash) is encountered, or the end of the line is reached.
-  function nextUntilUnescaped(source, end) {
-    var escaped = false;
-    while (!source.endOfLine()) {
-      var next = source.next();
-      if (next == end && !escaped)
-        return false;
-      escaped = !escaped && next == "\\";
-    }
-    return escaped;
-  }
-
-  // A map of JavaScript's keywords. The a/b/c keyword distinction is
-  // very rough, but it gives the parser enough information to parse
-  // correct code correctly (we don't care that much how we parse
-  // incorrect code). The style information included in these objects
-  // is used by the highlighter to pick the correct CSS style for a
-  // token.
-  var keywords = function(){
-    function result(type, style){
-      return {type: type, style: "js-" + style};
-    }
-    // keywords that take a parenthised expression, and then a
-    // statement (if)
-    var keywordA = result("keyword a", "keyword");
-    // keywords that take just a statement (else)
-    var keywordB = result("keyword b", "keyword");
-    // keywords that optionally take an expression, and form a
-    // statement (return)
-    var keywordC = result("keyword c", "keyword");
-    var operator = result("operator", "keyword");
-    var atom = result("atom", "atom");
-    return {
-      "if": keywordA, "while": keywordA, "with": keywordA,
-      "else": keywordB, "do": keywordB, "try": keywordB, "finally": keywordB,
-      "return": keywordC, "break": keywordC, "continue": keywordC, "new": keywordC, "delete": keywordC, "throw": keywordC,
-      "in": operator, "typeof": operator, "instanceof": operator,
-      "var": result("var", "keyword"),
-      
- // vvv RAZ     
-      "val": result("val", "keyword"), "def": result("def", "keyword"),
-      "class": result("class", "keyword"), "object": result("object", "keyword"),
-      "import": result("import", "keyword"), "package": result("package", "keyword"),
-      "extends": result("extends", "keyword"),
-      "abstract": result("abstract", "keyword"),
-      "sealed": result("sealed", "keyword"),
-      "override": result("override", "keyword"),
-      "trait": result("trait", "keyword"),
-      "yield": keywordB, "match": keywordB, 
-      "Unit" : atom, "Nothing" : atom, //"Nil" : atom,
-      "Any" : atom, "AnyRef" : atom,
-      "String" : atom, "Int" : atom, "Boolean" : atom,
- // ^^^ RAZ     
-
-      "catch": result("catch", "keyword"),
-      "for": result("for", "keyword"), "switch": result("switch", "keyword"),
-      "case": result("case", "keyword"), "default": result("default", "keyword"),
-      "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
-      
-    };
-  }();
-
-  // Some helper regexps
-  var isOperatorChar = /[+\-*&%=<>!?|]/;
-  var isHexDigit = /[0-9A-Fa-f]/;
-  var isWordChar = /[\w\$_]/;
-
-  // Wrapper around jsToken that helps maintain parser state (whether
-  // we are inside of a multi-line comment and whether the next token
-  // could be a regular expression).
-  function jsTokenState(inside, regexp) {
-    return function(source, setState) {
-      var newInside = inside;
-      var type = jsToken(inside, regexp, source, function(c) {newInside = c;});
-      var newRegexp = type.type == "operator" || type.type == "keyword c" || type.type.match(/^[\[{}\(,;:]$/);
-      if (newRegexp != regexp || newInside != inside)
-        setState(jsTokenState(newInside, newRegexp));
-      return type;
-    };
-  }
-
-  // The token reader, inteded to be used by the tokenizer from
-  // tokenize.js (through jsTokenState). Advances the source stream
-  // over a token, and returns an object containing the type and style
-  // of that token.
-  function jsToken(inside, regexp, source, setInside) {
-    function readHexNumber(){
-      source.next(); // skip the 'x'
-      source.nextWhileMatches(isHexDigit);
-      return {type: "number", style: "js-atom"};
-    }
-
-    function readNumber() {
-      source.nextWhileMatches(/[0-9]/);
-      if (source.equals(".")){
-        source.next();
-        source.nextWhileMatches(/[0-9]/);
-      }
-      if (source.equals("e") || source.equals("E")){
-        source.next();
-        if (source.equals("-"))
-          source.next();
-        source.nextWhileMatches(/[0-9]/);
-      }
-      return {type: "number", style: "js-atom"};
-    }
-    // Read a word, look it up in keywords. If not found, it is a
-    // variable, otherwise it is a keyword of the type found.
-    function readWord() {
-      source.nextWhileMatches(isWordChar);
-      var word = source.get();
-      var known = keywords.hasOwnProperty(word) && keywords.propertyIsEnumerable(word) && keywords[word];
-      return known ? {type: known.type, style: known.style, content: word} :
-      {type: "variable", style: "js-variable", content: word};
-    }
-    function readRegexp() {
-      nextUntilUnescaped(source, "/");
-      source.nextWhileMatches(/[gi]/);
-      return {type: "regexp", style: "js-string"};
-    }
-    // Mutli-line comments are tricky. We want to return the newlines
-    // embedded in them as regular newline tokens, and then continue
-    // returning a comment token for every line of the comment. So
-    // some state has to be saved (inside) to indicate whether we are
-    // inside a /* */ sequence.
-    function readMultilineComment(start){
-      var newInside = "/*";
-      var maybeEnd = (start == "*");
-      while (true) {
-        if (source.endOfLine())
-          break;
-        var next = source.next();
-        if (next == "/" && maybeEnd){
-          newInside = null;
-          break;
-        }
-        maybeEnd = (next == "*");
-      }
-      setInside(newInside);
-      return {type: "comment", style: "js-comment"};
-    }
-    function readOperator() {
-      source.nextWhileMatches(isOperatorChar);
-      return {type: "operator", style: "js-operator"};
-    }
-    function readString(quote) {
-      var endBackSlash = nextUntilUnescaped(source, quote);
-      setInside(endBackSlash ? quote : null);
-      return {type: "string", style: "js-string"};
-    }
-
-    // Fetch the next token. Dispatches on first character in the
-    // stream, or first two characters when the first is a slash.
-    if (inside == "\"" || inside == "'")
-      return readString(inside);
-    var ch = source.next();
-    if (inside == "/*")
-      return readMultilineComment(ch);
-    else if (ch == "\"" || ch == "'")
-      return readString(ch);
-    // with punctuation, the type of the token is the symbol itself
-    else if (/[\[\]{}\(\),;\:\.]/.test(ch))
-      return {type: ch, style: "js-punctuation"};
-    else if (ch == "0" && (source.equals("x") || source.equals("X")))
-      return readHexNumber();
-    else if (/[0-9]/.test(ch))
-      return readNumber();
-    else if (ch == "/"){
-      if (source.equals("*"))
-      { source.next(); return readMultilineComment(ch); }
-      else if (source.equals("/"))
-      { nextUntilUnescaped(source, null); return {type: "comment", style: "js-comment"};}
-      else if (regexp)
-        return readRegexp();
-      else
-        return readOperator();
-    }
-    else if (isOperatorChar.test(ch))
-      return readOperator();
-    else
-      return readWord();
-  }
-
-  // The external interface to the tokenizer.
-  return function(source, startState) {
-    return tokenizer(source, startState || jsTokenState(false, true));
-  };
-})();
diff --git a/web/src/main/webapp/codemirror/undo.js b/web/src/main/webapp/codemirror/undo.js
deleted file mode 100644
index f2cd84fc151b20fdc1f0e62ee44d800ce1225583..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/undo.js
+++ /dev/null
@@ -1,413 +0,0 @@
-/**
- * Storage and control for undo information within a CodeMirror
- * editor. 'Why on earth is such a complicated mess required for
- * that?', I hear you ask. The goal, in implementing this, was to make
- * the complexity of storing and reverting undo information depend
- * only on the size of the edited or restored content, not on the size
- * of the whole document. This makes it necessary to use a kind of
- * 'diff' system, which, when applied to a DOM tree, causes some
- * complexity and hackery.
- *
- * In short, the editor 'touches' BR elements as it parses them, and
- * the UndoHistory stores these. When nothing is touched in commitDelay
- * milliseconds, the changes are committed: It goes over all touched
- * nodes, throws out the ones that did not change since last commit or
- * are no longer in the document, and assembles the rest into zero or
- * more 'chains' -- arrays of adjacent lines. Links back to these
- * chains are added to the BR nodes, while the chain that previously
- * spanned these nodes is added to the undo history. Undoing a change
- * means taking such a chain off the undo history, restoring its
- * content (text is saved per line) and linking it back into the
- * document.
- */
-
-// A history object needs to know about the DOM container holding the
-// document, the maximum amount of undo levels it should store, the
-// delay (of no input) after which it commits a set of changes, and,
-// unfortunately, the 'parent' window -- a window that is not in
-// designMode, and on which setTimeout works in every browser.
-function UndoHistory(container, maxDepth, commitDelay, editor) {
-  this.container = container;
-  this.maxDepth = maxDepth; this.commitDelay = commitDelay;
-  this.editor = editor;
-  // This line object represents the initial, empty editor.
-  var initial = {text: "", from: null, to: null};
-  // As the borders between lines are represented by BR elements, the
-  // start of the first line and the end of the last one are
-  // represented by null. Since you can not store any properties
-  // (links to line objects) in null, these properties are used in
-  // those cases.
-  this.first = initial; this.last = initial;
-  // Similarly, a 'historyTouched' property is added to the BR in
-  // front of lines that have already been touched, and 'firstTouched'
-  // is used for the first line.
-  this.firstTouched = false;
-  // History is the set of committed changes, touched is the set of
-  // nodes touched since the last commit.
-  this.history = []; this.redoHistory = []; this.touched = []; this.lostundo = 0;
-}
-
-UndoHistory.prototype = {
-  // Schedule a commit (if no other touches come in for commitDelay
-  // milliseconds).
-  scheduleCommit: function() {
-    var self = this;
-    parent.clearTimeout(this.commitTimeout);
-    this.commitTimeout = parent.setTimeout(function(){self.tryCommit();}, this.commitDelay);
-  },
-
-  // Mark a node as touched. Null is a valid argument.
-  touch: function(node) {
-    this.setTouched(node);
-    this.scheduleCommit();
-  },
-
-  // Undo the last change.
-  undo: function() {
-    // Make sure pending changes have been committed.
-    this.commit();
-
-    if (this.history.length) {
-      // Take the top diff from the history, apply it, and store its
-      // shadow in the redo history.
-      var item = this.history.pop();
-      this.redoHistory.push(this.updateTo(item, "applyChain"));
-      this.notifyEnvironment();
-      return this.chainNode(item);
-    }
-  },
-
-  // Redo the last undone change.
-  redo: function() {
-    this.commit();
-    if (this.redoHistory.length) {
-      // The inverse of undo, basically.
-      var item = this.redoHistory.pop();
-      this.addUndoLevel(this.updateTo(item, "applyChain"));
-      this.notifyEnvironment();
-      return this.chainNode(item);
-    }
-  },
-
-  clear: function() {
-    this.history = [];
-    this.redoHistory = [];
-    this.lostundo = 0;
-  },
-
-  // Ask for the size of the un/redo histories.
-  historySize: function() {
-    return {undo: this.history.length, redo: this.redoHistory.length, lostundo: this.lostundo};
-  },
-
-  // Push a changeset into the document.
-  push: function(from, to, lines) {
-    var chain = [];
-    for (var i = 0; i < lines.length; i++) {
-      var end = (i == lines.length - 1) ? to : document.createElement("br");
-      chain.push({from: from, to: end, text: cleanText(lines[i])});
-      from = end;
-    }
-    this.pushChains([chain], from == null && to == null);
-    this.notifyEnvironment();
-  },
-
-  pushChains: function(chains, doNotHighlight) {
-    this.commit(doNotHighlight);
-    this.addUndoLevel(this.updateTo(chains, "applyChain"));
-    this.redoHistory = [];
-  },
-
-  // Retrieve a DOM node from a chain (for scrolling to it after undo/redo).
-  chainNode: function(chains) {
-    for (var i = 0; i < chains.length; i++) {
-      var start = chains[i][0], node = start && (start.from || start.to);
-      if (node) return node;
-    }
-  },
-
-  // Clear the undo history, make the current document the start
-  // position.
-  reset: function() {
-    this.history = []; this.redoHistory = []; this.lostundo = 0;
-  },
-
-  textAfter: function(br) {
-    return this.after(br).text;
-  },
-
-  nodeAfter: function(br) {
-    return this.after(br).to;
-  },
-
-  nodeBefore: function(br) {
-    return this.before(br).from;
-  },
-
-  // Commit unless there are pending dirty nodes.
-  tryCommit: function() {
-    if (!window || !window.parent || !window.UndoHistory) return; // Stop when frame has been unloaded
-    if (this.editor.highlightDirty()) this.commit(true);
-    else this.scheduleCommit();
-  },
-
-  // Check whether the touched nodes hold any changes, if so, commit
-  // them.
-  commit: function(doNotHighlight) {
-    parent.clearTimeout(this.commitTimeout);
-    // Make sure there are no pending dirty nodes.
-    if (!doNotHighlight) this.editor.highlightDirty(true);
-    // Build set of chains.
-    var chains = this.touchedChains(), self = this;
-
-    if (chains.length) {
-      this.addUndoLevel(this.updateTo(chains, "linkChain"));
-      this.redoHistory = [];
-      this.notifyEnvironment();
-    }
-  },
-
-  // [ end of public interface ]
-
-  // Update the document with a given set of chains, return its
-  // shadow. updateFunc should be "applyChain" or "linkChain". In the
-  // second case, the chains are taken to correspond the the current
-  // document, and only the state of the line data is updated. In the
-  // first case, the content of the chains is also pushed iinto the
-  // document.
-  updateTo: function(chains, updateFunc) {
-    var shadows = [], dirty = [];
-    for (var i = 0; i < chains.length; i++) {
-      shadows.push(this.shadowChain(chains[i]));
-      dirty.push(this[updateFunc](chains[i]));
-    }
-    if (updateFunc == "applyChain")
-      this.notifyDirty(dirty);
-    return shadows;
-  },
-
-  // Notify the editor that some nodes have changed.
-  notifyDirty: function(nodes) {
-    forEach(nodes, method(this.editor, "addDirtyNode"))
-    this.editor.scheduleHighlight();
-  },
-
-  notifyEnvironment: function() {
-    if (this.onChange) this.onChange(this.editor);
-    // Used by the line-wrapping line-numbering code.
-    if (window.frameElement && window.frameElement.CodeMirror.updateNumbers)
-      window.frameElement.CodeMirror.updateNumbers();
-  },
-
-  // Link a chain into the DOM nodes (or the first/last links for null
-  // nodes).
-  linkChain: function(chain) {
-    for (var i = 0; i < chain.length; i++) {
-      var line = chain[i];
-      if (line.from) line.from.historyAfter = line;
-      else this.first = line;
-      if (line.to) line.to.historyBefore = line;
-      else this.last = line;
-    }
-  },
-
-  // Get the line object after/before a given node.
-  after: function(node) {
-    return node ? node.historyAfter : this.first;
-  },
-  before: function(node) {
-    return node ? node.historyBefore : this.last;
-  },
-
-  // Mark a node as touched if it has not already been marked.
-  setTouched: function(node) {
-    if (node) {
-      if (!node.historyTouched) {
-        this.touched.push(node);
-        node.historyTouched = true;
-      }
-    }
-    else {
-      this.firstTouched = true;
-    }
-  },
-
-  // Store a new set of undo info, throw away info if there is more of
-  // it than allowed.
-  addUndoLevel: function(diffs) {
-    this.history.push(diffs);
-    if (this.history.length > this.maxDepth) {
-      this.history.shift();
-      this.lostundo += 1;
-    }
-  },
-
-  // Build chains from a set of touched nodes.
-  touchedChains: function() {
-    var self = this;
-
-    // The temp system is a crummy hack to speed up determining
-    // whether a (currently touched) node has a line object associated
-    // with it. nullTemp is used to store the object for the first
-    // line, other nodes get it stored in their historyTemp property.
-    var nullTemp = null;
-    function temp(node) {return node ? node.historyTemp : nullTemp;}
-    function setTemp(node, line) {
-      if (node) node.historyTemp = line;
-      else nullTemp = line;
-    }
-
-    function buildLine(node) {
-      var text = [];
-      for (var cur = node ? node.nextSibling : self.container.firstChild;
-           cur && (!isBR(cur) || cur.hackBR); cur = cur.nextSibling)
-        if (!cur.hackBR && cur.currentText) text.push(cur.currentText);
-      return {from: node, to: cur, text: cleanText(text.join(""))};
-    }
-
-    // Filter out unchanged lines and nodes that are no longer in the
-    // document. Build up line objects for remaining nodes.
-    var lines = [];
-    if (self.firstTouched) self.touched.push(null);
-    forEach(self.touched, function(node) {
-      if (node && (node.parentNode != self.container || node.hackBR)) return;
-
-      if (node) node.historyTouched = false;
-      else self.firstTouched = false;
-
-      var line = buildLine(node), shadow = self.after(node);
-      if (!shadow || shadow.text != line.text || shadow.to != line.to) {
-        lines.push(line);
-        setTemp(node, line);
-      }
-    });
-
-    // Get the BR element after/before the given node.
-    function nextBR(node, dir) {
-      var link = dir + "Sibling", search = node[link];
-      while (search && !isBR(search))
-        search = search[link];
-      return search;
-    }
-
-    // Assemble line objects into chains by scanning the DOM tree
-    // around them.
-    var chains = []; self.touched = [];
-    forEach(lines, function(line) {
-      // Note that this makes the loop skip line objects that have
-      // been pulled into chains by lines before them.
-      if (!temp(line.from)) return;
-
-      var chain = [], curNode = line.from, safe = true;
-      // Put any line objects (referred to by temp info) before this
-      // one on the front of the array.
-      while (true) {
-        var curLine = temp(curNode);
-        if (!curLine) {
-          if (safe) break;
-          else curLine = buildLine(curNode);
-        }
-        chain.unshift(curLine);
-        setTemp(curNode, null);
-        if (!curNode) break;
-        safe = self.after(curNode);
-        curNode = nextBR(curNode, "previous");
-      }
-      curNode = line.to; safe = self.before(line.from);
-      // Add lines after this one at end of array.
-      while (true) {
-        if (!curNode) break;
-        var curLine = temp(curNode);
-        if (!curLine) {
-          if (safe) break;
-          else curLine = buildLine(curNode);
-        }
-        chain.push(curLine);
-        setTemp(curNode, null);
-        safe = self.before(curNode);
-        curNode = nextBR(curNode, "next");
-      }
-      chains.push(chain);
-    });
-
-    return chains;
-  },
-
-  // Find the 'shadow' of a given chain by following the links in the
-  // DOM nodes at its start and end.
-  shadowChain: function(chain) {
-    var shadows = [], next = this.after(chain[0].from), end = chain[chain.length - 1].to;
-    while (true) {
-      shadows.push(next);
-      var nextNode = next.to;
-      if (!nextNode || nextNode == end)
-        break;
-      else
-        next = nextNode.historyAfter || this.before(end);
-      // (The this.before(end) is a hack -- FF sometimes removes
-      // properties from BR nodes, in which case the best we can hope
-      // for is to not break.)
-    }
-    return shadows;
-  },
-
-  // Update the DOM tree to contain the lines specified in a given
-  // chain, link this chain into the DOM nodes.
-  applyChain: function(chain) {
-    // Some attempt is made to prevent the cursor from jumping
-    // randomly when an undo or redo happens. It still behaves a bit
-    // strange sometimes.
-    var cursor = select.cursorPos(this.container, false), self = this;
-
-    // Remove all nodes in the DOM tree between from and to (null for
-    // start/end of container).
-    function removeRange(from, to) {
-      var pos = from ? from.nextSibling : self.container.firstChild;
-      while (pos != to) {
-        var temp = pos.nextSibling;
-        removeElement(pos);
-        pos = temp;
-      }
-    }
-
-    var start = chain[0].from, end = chain[chain.length - 1].to;
-    // Clear the space where this change has to be made.
-    removeRange(start, end);
-
-    // Insert the content specified by the chain into the DOM tree.
-    for (var i = 0; i < chain.length; i++) {
-      var line = chain[i];
-      // The start and end of the space are already correct, but BR
-      // tags inside it have to be put back.
-      if (i > 0)
-        self.container.insertBefore(line.from, end);
-
-      // Add the text.
-      var node = makePartSpan(fixSpaces(line.text));
-      self.container.insertBefore(node, end);
-      // See if the cursor was on this line. Put it back, adjusting
-      // for changed line length, if it was.
-      if (cursor && cursor.node == line.from) {
-        var cursordiff = 0;
-        var prev = this.after(line.from);
-        if (prev && i == chain.length - 1) {
-          // Only adjust if the cursor is after the unchanged part of
-          // the line.
-          for (var match = 0; match < cursor.offset &&
-               line.text.charAt(match) == prev.text.charAt(match); match++){}
-          if (cursor.offset > match)
-            cursordiff = line.text.length - prev.text.length;
-        }
-        select.setCursorPos(this.container, {node: line.from, offset: Math.max(0, cursor.offset + cursordiff)});
-      }
-      // Cursor was in removed line, this is last new line.
-      else if (cursor && (i == chain.length - 1) && cursor.node && cursor.node.parentNode != this.container) {
-        select.setCursorPos(this.container, {node: line.from, offset: line.text.length});
-      }
-    }
-
-    // Anchor the chain in the DOM tree.
-    this.linkChain(chain);
-    return start;
-  }
-};
diff --git a/web/src/main/webapp/codemirror/util.js b/web/src/main/webapp/codemirror/util.js
deleted file mode 100644
index 56358d5a42581d2cafff6577c023ff19f958111e..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/codemirror/util.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/* A few useful utility functions. */
-
-// Capture a method on an object.
-function method(obj, name) {
-  return function() {obj[name].apply(obj, arguments);};
-}
-
-// The value used to signal the end of a sequence in iterators.
-var StopIteration = {toString: function() {return "StopIteration"}};
-
-// Apply a function to each element in a sequence.
-function forEach(iter, f) {
-  if (iter.next) {
-    try {while (true) f(iter.next());}
-    catch (e) {if (e != StopIteration) throw e;}
-  }
-  else {
-    for (var i = 0; i < iter.length; i++)
-      f(iter[i]);
-  }
-}
-
-// Map a function over a sequence, producing an array of results.
-function map(iter, f) {
-  var accum = [];
-  forEach(iter, function(val) {accum.push(f(val));});
-  return accum;
-}
-
-// Create a predicate function that tests a string againsts a given
-// regular expression. No longer used but might be used by 3rd party
-// parsers.
-function matcher(regexp){
-  return function(value){return regexp.test(value);};
-}
-
-// Test whether a DOM node has a certain CSS class.
-function hasClass(element, className) {
-  var classes = element.className;
-  return classes && new RegExp("(^| )" + className + "($| )").test(classes);
-}
-function removeClass(element, className) {
-  element.className = element.className.replace(new RegExp(" " + className + "\\b", "g"), "");
-  return element;
-}
-
-// Insert a DOM node after another node.
-function insertAfter(newNode, oldNode) {
-  var parent = oldNode.parentNode;
-  parent.insertBefore(newNode, oldNode.nextSibling);
-  return newNode;
-}
-
-function removeElement(node) {
-  if (node.parentNode)
-    node.parentNode.removeChild(node);
-}
-
-function clearElement(node) {
-  while (node.firstChild)
-    node.removeChild(node.firstChild);
-}
-
-// Check whether a node is contained in another one.
-function isAncestor(node, child) {
-  while (child = child.parentNode) {
-    if (node == child)
-      return true;
-  }
-  return false;
-}
-
-// The non-breaking space character.
-var nbsp = "\u00a0";
-var matching = {"{": "}", "[": "]", "(": ")",
-                "}": "{", "]": "[", ")": "("};
-
-// Standardize a few unportable event properties.
-function normalizeEvent(event) {
-  if (!event.stopPropagation) {
-    event.stopPropagation = function() {this.cancelBubble = true;};
-    event.preventDefault = function() {this.returnValue = false;};
-  }
-  if (!event.stop) {
-    event.stop = function() {
-      this.stopPropagation();
-      this.preventDefault();
-    };
-  }
-
-  if (event.type == "keypress") {
-    event.code = (event.charCode == null) ? event.keyCode : event.charCode;
-    event.character = String.fromCharCode(event.code);
-  }
-  return event;
-}
-
-// Portably register event handlers.
-function addEventHandler(node, type, handler, removeFunc) {
-  function wrapHandler(event) {
-    handler(normalizeEvent(event || window.event));
-  }
-  if (typeof node.addEventListener == "function") {
-    node.addEventListener(type, wrapHandler, false);
-    if (removeFunc) return function() {node.removeEventListener(type, wrapHandler, false);};
-  }
-  else {
-    node.attachEvent("on" + type, wrapHandler);
-    if (removeFunc) return function() {node.detachEvent("on" + type, wrapHandler);};
-  }
-}
-
-function nodeText(node) {
-  return node.textContent || node.innerText || node.nodeValue || "";
-}
-
-function nodeTop(node) {
-  var top = 0;
-  while (node.offsetParent) {
-    top += node.offsetTop;
-    node = node.offsetParent;
-  }
-  return top;
-}
-
-function isBR(node) {
-  var nn = node.nodeName;
-  return nn == "BR" || nn == "br";
-}
-function isSpan(node) {
-  var nn = node.nodeName;
-  return nn == "SPAN" || nn == "span";
-}
diff --git a/web/src/main/webapp/images/ajax-loader.gif b/web/src/main/webapp/images/ajax-loader.gif
deleted file mode 100644
index 7c12c21fcb05ccbc90eb90202c96fb4578f8066d..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/ajax-loader.gif and /dev/null differ
diff --git a/web/src/main/webapp/images/codemirrorlogo.png b/web/src/main/webapp/images/codemirrorlogo.png
deleted file mode 100644
index 5a576545d062e5367555d723a9b18062aa2a1331..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/codemirrorlogo.png and /dev/null differ
diff --git a/web/src/main/webapp/images/epfllogo.png b/web/src/main/webapp/images/epfllogo.png
deleted file mode 100644
index d6f857f8cf1ea8a7c9a7dcda9ee73f26e50bb8da..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/epfllogo.png and /dev/null differ
diff --git a/web/src/main/webapp/images/lambda-ico.png b/web/src/main/webapp/images/lambda-ico.png
deleted file mode 100644
index d87d0876a1d3308a44bf6e53feac00e0c7e0c13a..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/lambda-ico.png and /dev/null differ
diff --git a/web/src/main/webapp/images/leonlogo.png b/web/src/main/webapp/images/leonlogo.png
deleted file mode 100644
index 3ed2861d496fbe2a14da33a18ec4579d40280eda..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/leonlogo.png and /dev/null differ
diff --git a/web/src/main/webapp/images/liftlogo.png b/web/src/main/webapp/images/liftlogo.png
deleted file mode 100644
index 01c4367ed5902dbb83f5af75b0ee00e278a1ba6a..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/liftlogo.png and /dev/null differ
diff --git a/web/src/main/webapp/images/lionbkg.png b/web/src/main/webapp/images/lionbkg.png
deleted file mode 100644
index ac1132b132c08414df7adbc295692be2c4d8c7aa..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/lionbkg.png and /dev/null differ
diff --git a/web/src/main/webapp/images/lionbkgtr.png b/web/src/main/webapp/images/lionbkgtr.png
deleted file mode 100644
index a4431b6790c43d80aea2203bd1e042b1278c1347..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/lionbkgtr.png and /dev/null differ
diff --git a/web/src/main/webapp/images/scalalogo.png b/web/src/main/webapp/images/scalalogo.png
deleted file mode 100644
index 2e14a230f884189b869194a0394efe4b5b47bad6..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/scalalogo.png and /dev/null differ
diff --git a/web/src/main/webapp/images/z3logo.png b/web/src/main/webapp/images/z3logo.png
deleted file mode 100644
index 230210b1fbcfc7b9b479dd365d231d05a0865f5f..0000000000000000000000000000000000000000
Binary files a/web/src/main/webapp/images/z3logo.png and /dev/null differ
diff --git a/web/src/main/webapp/index.html b/web/src/main/webapp/index.html
deleted file mode 100644
index e9eef3909a5dc8c7d8edc33a2b2def67e3c55742..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/index.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<lift:surround with="funcheck" at="content">
-    <head_merge>
-        <title>LeonOnline</title>
-        <script type="text/javascript" src="codemirror/codemirror.js" id="codemirror"></script>
-        <style>
-                .CodeMirror-wrapping {
-                    border: 1px dashed #000;
-                    background-image: url('images/lionbkgtr.png');
-                    background-color: #FFFFFF;
-                    background-repeat: no-repeat;
-                    background-position: -295px -65px;
-                }
-        </style>
-    </head_merge>
-
-    <lift:comet type="CodeProcessor">
-    <div class="contentbox" id="leonmain">
-        <codeprocessor:inputbox></codeprocessor:inputbox>
-        <script type="text/javascript">
-// <![CDATA[
-var editor = new CodeMirror.fromTextArea("codebox", {
-width: "697px",
-height: "450px",
-parserfile: ["tokenizescala.js", "parsescala.js"],
-path: "codemirror/",
-stylesheet: "codemirror/scalacolors.css"
-});
-// ]]>
-        </script>
-<!-- Server is running <lift:snippet type="Z3Snippet:versionString"></lift:snippet>
-<codeprocessor:consolelines>Additional console lines</codeprocessor:consolelines> -->
-    </div>
-    </lift:comet>
-
-</lift:surround>
diff --git a/web/src/main/webapp/index3.html b/web/src/main/webapp/index3.html
deleted file mode 100644
index cf833dd2b2658d03c2728c0bd83b2930db099c00..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/index3.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
-        <title>Home</title>
-    </head>
-    <body class="lift:content_id=main">
-        <div id="main" class="lift:surround?with=default;at=content">
-            <div class="lift:comet?type=Editor">
-                <div class="column span-6 last" id="editorRightPanel">
-                    <ul>
-                        <li>line</li>
-                    </ul>
-                </div>
-            </div>
-           <script type="text/javascript">
-var editor = new CodeMirror.fromTextArea("code_box", {
-    height: "350px",
-    parserfile: ["tokenizescala.js", "parsescala.js"],
-    path: "static/codemirror/",
-    stylesheet: "static/codemirror/scalacolors.css"
-});
-           </script>
-         </div>
-    </body>
-</html>
-
diff --git a/web/src/main/webapp/style.css b/web/src/main/webapp/style.css
deleted file mode 100644
index 314a8344c3b90df9b045fac4403ac5788b6a9687..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/style.css
+++ /dev/null
@@ -1,153 +0,0 @@
-html {
-    height: 100%;
-}
-
-body {
-    font-family: Arial, Helvetica, Sans-serif;
-    margin: 0px;
-    padding: 0px;
-    background-image: url('images/lionbkg.png');
-    background-color: #FFFFFF;
-    background-repeat: no-repeat;
-    background-position: 25px 15px;
-    height: 100%;
-}
-
-h2 {
-    margin-top: 20px;
-    margin-bottom: 0px;
-}
-
-h3 {
-    margin-top: 0px;
-    margin-bottom: 0px;
-    font-weight: normal;
-}
-
-p, li {
-    text-align: justify;
-}
-
-a {
-    color: #1133CC;
-}
-
-a:link, a:visited {
-    text-decoration: none;
-}
-
-a:hover {
-    text-decoration: underline;
-}
-
-div.contentbox {
-    position: relative;
-    left: 320px;
-    width: 700px;
-    padding: 0px;
-    margin: 0px;
-}
-
-div#title {
-    height: 80px;
-    min-height: 80px;
-    max-height: 80px;
-    background-image: url('images/leonlogo.png');
-    background-repeat: no-repeat;
-    background-position: right bottom;
-}
-
-div#leonmain {
-}
-
-div#console {
-    background-color: #EEEEEE;
-}
-
-div#contact {
-    position: absolute;
-    top: 410px; 
-    left: 25px;
-    width: 290px;
-}
-
-div#allcontent {
-    height: 100%;
-    min-height: 100%;
-}
-
-div#poweredby {
-    position: fixed;
-    left: 0px;
-    bottom: 0px;
-    width: 1020px;
-    height: 50px;
-    text-align: center;
-    display: table-cell;
-    background-color: #FFFFFF;
-}
-
-div#beforefooter {
-    margin-bottom: 50px;
-}
-
-.smallnote {
-    font-size: 10px;
-}
-
-img {
-    border-style: none;
-    border-width: 0px;
-    margin: 0px;
-}
-
-hr {
-    border: none 0;
-    border-top: 1px dashed #000;
-    height: 1px;
-    margin-top: 0px;
-    margin-bottom: 10px;
-}
-
-ul {
-    list-style-type: square;
-}
-
-li {
-    margin-bottom: 5px;
-}
-
-#clicker {
-    margin: 5px 0px;
-    background-color: transparent;
-    border: 1px solid #666666;
-    width: 100%;
-}
-
-td.date {
-    text-align:right;
-}
-
-textarea#codebox {
-    border-style: none;
-    background-color: pink;
-    width: 700px;
-    height: 450px;
-}
-
-textarea#consolebox {
-    font-family: "Lucida Console", monospace;                                                     
-    font-size: 11px;                                                                              
-    width: 700px;                                                                                 
-    height: 250px;
-    border: none;                                                                                 
-    background-color: #EEEEEE;
-    padding: 0px;
-    margin: 0px; 
-    resize: vertical;
-}
-
-.consoletext {
-    font-family: "Lucida Console", monospace;                                                     
-    font-size: 11px;
-}
diff --git a/web/src/main/webapp/templates-hidden/default.html b/web/src/main/webapp/templates-hidden/default.html
deleted file mode 100644
index cae8056ab03046960573607eff83fbaecccbc761..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/templates-hidden/default.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:lift="http://liftweb.net/">
-  <head>
-    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-    <meta name="description" content="" />
-    <meta name="keywords" content="" />
-    <title class="lift:Menu.title">App: </title>
-    <style class="lift:CSS.blueprint"></style>
-    <style class="lift:CSS.fancyType"></style>
-    <script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
-    <script id="json" src="/classpath/json.js" type="text/javascript"></script>
-    <style type="text/css">
-/* <![CDATA[ */
-.edit_error_class {
-  display: block;
-  color: red;
-}
-
-.sidebar ul {
-	margin:0;
-	padding:0;
-	border-bottom:1px solid #ccc;
-}
-	 
-
-.sidebar ul li {
-	margin:0;
-	padding:0;
-	list-style:none;
-	border:1px solid #ccc;
-	border-bottom:none;
-}
-
-.sidebar ul li a {
-	display:block;
-	padding:3px;
-	text-indent:30px;
-	text-decoration:none;
-}
-
-.sidebar ul li span {
-	display:block;
-	padding:3px;
-	text-indent:30px;
-	text-decoration:none;
-}
-
-.sidebar ul li a:hover {
-	background-color: #eee;
-}
-
-
-  /* ]]> */
-  </style>
-  </head>
-  <body>
-    <div class="container">
-      <div class="column span-12 last" style="text-align: right">
-        <h1 class="alt">app<img alt="" id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"></h1>
-      </div>
-
-      <hr>
-
-      <div class="column span-6 colborder sidebar">
-        <hr class="space" >
-
-	<span class="lift:Menu.builder"></span>
-
-        <div class="lift:Msgs?showAll=true"></div>
-        <hr class="space" />
-      </div>
-
-      <div class="column span-17 last">
-        <div id="content">The main content will get bound here</div>
-      </div>
-
-      <hr />
-      <div class="column span-23 last" style="text-align: center">
-        <h4 class="alt">
-          <a href="http://www.liftweb.net"><i>Lift</i></a> 
-	  is Copyright 2007-2010 WorldWide Conferencing, LLC.
-	  Distributed under an Apache 2.0 License.</h4>
-      </div>
-    </div>
-  </body>
-</html>
diff --git a/web/src/main/webapp/templates-hidden/funcheck.html b/web/src/main/webapp/templates-hidden/funcheck.html
deleted file mode 100644
index 5a126177b5c50c71d6cad94b538b9f35907c4178..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/templates-hidden/funcheck.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:lift="http://liftweb.net/" xml:lang="en">
-    <head>
-        <link rel="stylesheet" href="style.css" />
-        <link rel="icon" type="image/png" href="images/lambda-ico.png" />
-        <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
-        <script id="jquery" src="classpath/jquery.js" type="text/javascript"></script>
-        <script id="json" src="classpath/json.js" type="text/javascript"></script>
-        <script type="text/javascript">
-            var _gaq = _gaq || [];
-            _gaq.push(['_setAccount', 'UA-13198482-2']);
-            _gaq.push(['_trackPageview']);
-            (function() {
-             var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-             ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-             var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-             })();
-         </script>
-    </head>
-    <body>
-        <div id="allcontent">
-        <div id="beforefooter">
-
-        <div class="contentbox" id="title"></div>
-
-        <div id="contact">
-            <p><i>Leon</i> is developed by the <a href="http://lara.epfl.ch" alt="LARA Group EPFL">LARA</a> group at <a href="http://www.epfl.ch">EPFL</a>. A good starting point is to copy-paste the source from an example in <a href="http://lara.epfl.ch/~psuter/leonexamples/" alt="Leon Examples">this list</a> and to click the <i>Verify&nbsp;!</i> button.</p>
-        </div>
-
-        <div id="content">The main content will get bound here</div>
-
-        </div>
-
-        <div id="poweredby">
-            <hr />
-            <span style="vertical-align: middle;" class="smallnote"><i>Leon</i>Online is powered by:</span>&nbsp;&nbsp;&nbsp;
-            <a href="http://www.scala-lang.org"><img class="middiv" alt="Scala" src="images/scalalogo.png" /></a>&nbsp;&nbsp;&nbsp;
-            <a href="http://research.microsoft.com/en-us/um/redmond/projects/z3/"><img class="middiv" alt="Z3" src="images/z3logo.png" /></a>&nbsp;&nbsp;&nbsp;
-            <a href="http://liftweb.net"><img class="middiv" alt="Lift" src="images/liftlogo.png" /></a>&nbsp;&nbsp;&nbsp;
-            <a href="http://codemirror.net"><img class="middiv" alt="CodeMirror" src="images/codemirrorlogo.png" /></a>&nbsp;&nbsp;&nbsp;
-            <a href="http://www.epfl.ch"><img class="middiv" alt="EPFL" src="images/epfllogo.png" /></a>
-        </div>
-       </div>
-    </body>
-</html>
diff --git a/web/src/main/webapp/templates-hidden/wizard-all.html b/web/src/main/webapp/templates-hidden/wizard-all.html
deleted file mode 100644
index e1ea72738ef3e9107a9d7861a4dbf6bf4bed7fa8..0000000000000000000000000000000000000000
--- a/web/src/main/webapp/templates-hidden/wizard-all.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<div>
-  <wizard:screen_info><div>Page <wizard:screen_number></wizard:screen_number> of <wizard:total_screens></wizard:total_screens></div></wizard:screen_info>
-  <wizard:wizard_top> <div> <wizard:bind></wizard:bind> </div> </wizard:wizard_top>
-  <wizard:screen_top> <div> <wizard:bind></wizard:bind> </div> </wizard:screen_top>
-  <wizard:errors> <div> <ul> <wizard:item> <li> <wizard:bind></wizard:bind> </li> </wizard:item> </ul> </div> </wizard:errors>
-  <div>
-    <wizard:fields>
-      <table>
-	<tbody>
-            <tr lift:bind="wizard:line">
-              <td>
-		<wizard:label>
-		  <label wizard:for="">
-		    <wizard:bind></wizard:bind>
-		  </label>
-		</wizard:label>
-		<wizard:help>
-		  <span>
-		    <wizard:bind></wizard:bind>
-		  </span>
-		</wizard:help>
-		<wizard:field_errors>
-		  <ul>
-		    <wizard:error>
-		      <li>
-			<wizard:bind></wizard:bind>
-		      </li>
-		    </wizard:error> 
-		  </ul>
-		</wizard:field_errors>
-              </td>
-              <td>
-		<wizard:form></wizard:form>
-	      </td>
-            </tr>
-	</tbody>
-      </table>
-    </wizard:fields>
-  </div>
-  <div>
-    <table>
-      <tr> 
-	<td>
-	  <wizard:prev></wizard:prev> 
-	</td>
-	<td>
-	  <wizard:cancel></wizard:cancel>
-	</td>
-	<td>
-	  <wizard:next></wizard:next>
-	</td>
-      </tr>
-    </table>
-  </div>
-  <wizard:screen_bottom> <div> <wizard:bind></wizard:bind> </div> </wizard:screen_bottom>
-  <wizard:wizard_bottom> <div> <wizard:bind></wizard:bind> </div> </wizard:wizard_bottom>
-</div>
diff --git a/web/src/test/resources/.keep b/web/src/test/resources/.keep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/web/src/test/scala/LiftConsole.scala b/web/src/test/scala/LiftConsole.scala
deleted file mode 100644
index f8f517e97a15f27edb5c9d8edb7e33a627ed357c..0000000000000000000000000000000000000000
--- a/web/src/test/scala/LiftConsole.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-import _root_.bootstrap.liftweb.Boot
-import _root_.scala.tools.nsc.MainGenericRunner
-
-object LiftConsole {
-  def main(args : Array[String]) {
-    // Instantiate your project's Boot file
-    val b = new Boot()
-    // Boot your project
-    b.boot
-    // Now run the MainGenericRunner to get your repl
-    MainGenericRunner.main(args)
-    // After the repl exits, then exit the scala script
-    exit(0)
-  }
-}
diff --git a/web/src/test/scala/RunWebApp.scala b/web/src/test/scala/RunWebApp.scala
deleted file mode 100644
index d2c592a16e0bf6f9a52d10496b680780bc3de888..0000000000000000000000000000000000000000
--- a/web/src/test/scala/RunWebApp.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-import _root_.org.mortbay.jetty.Connector
-import _root_.org.mortbay.jetty.Server
-import _root_.org.mortbay.jetty.webapp.WebAppContext
-import org.mortbay.jetty.nio._
-
-object RunWebApp extends Application {
-  val server = new Server
-  val scc = new SelectChannelConnector
-  scc.setPort(8080)
-  server.setConnectors(Array(scc))
-
-  val context = new WebAppContext()
-  context.setServer(server)
-  context.setContextPath("/")
-  context.setWar("src/main/webapp")
-
-  server.addHandler(context)
-
-  try {
-    println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP")
-    server.start()
-    while (System.in.available() == 0) {
-      Thread.sleep(5000)
-    }
-    server.stop()
-    server.join()
-  } catch {
-    case exc : Exception => {
-      exc.printStackTrace()
-      System.exit(100)
-    }
-  }
-}
diff --git a/web/src/test/scala/code/AppTest.scala b/web/src/test/scala/code/AppTest.scala
deleted file mode 100644
index 2414ee026220186247f910bccc67b72cea130cf9..0000000000000000000000000000000000000000
--- a/web/src/test/scala/code/AppTest.scala
+++ /dev/null
@@ -1,76 +0,0 @@
-package code
-
-import _root_.java.io.File
-import _root_.junit.framework._
-import Assert._
-import _root_.scala.xml.XML
-import _root_.net.liftweb.util._
-import _root_.net.liftweb.common._
-
-object AppTest {
-  def suite: Test = {
-    val suite = new TestSuite(classOf[AppTest])
-    suite
-  }
-
-  def main(args : Array[String]) {
-    _root_.junit.textui.TestRunner.run(suite)
-  }
-}
-
-/**
- * Unit test for simple App.
- */
-class AppTest extends TestCase("app") {
-
-  /**
-   * Rigourous Tests :-)
-   */
-  def testOK() = assertTrue(true)
-  // def testKO() = assertTrue(false);
-
-  /**
-   * Tests to make sure the project's XML files are well-formed.
-   *
-   * Finds every *.html and *.xml file in src/main/webapp (and its
-   * subdirectories) and tests to make sure they are well-formed.
-   */
-  def testXml() = {
-    var failed: List[File] = Nil
-
-    def handledXml(file: String) =
-      file.endsWith(".xml")
-
-    def handledXHtml(file: String) =
-      file.endsWith(".html") || file.endsWith(".htm") || file.endsWith(".xhtml")
-
-    def wellFormed(file: File) {
-      if (file.isDirectory)
-        for (f <- file.listFiles) wellFormed(f)
-
-      if (file.isFile && handledXml(file.getName)) {
-        try {
-          XML.loadFile(file)
-        } catch {
-          case e: _root_.org.xml.sax.SAXParseException => failed = file :: failed
-        }
-      }
-      if (file.isFile && handledXHtml(file.getName)) {
-        PCDataXmlParser(new _root_.java.io.FileInputStream(file.getAbsolutePath)) match {
-          case Full(_) => // file is ok
-          case _ => failed = file :: failed
-        }
-      }
-    }
-
-    wellFormed(new File("src/main/webapp"))
-
-    val numFails = failed.size
-    if (numFails > 0) {
-      val fileStr = if (numFails == 1) "file" else "files"
-      val msg = "Malformed XML in " + numFails + " " + fileStr + ": " + failed.mkString(", ")
-      println(msg)
-      fail(msg)
-    }
-  }
-}
diff --git a/web/src/test/scala/code/XmlSourceSpecs.scala b/web/src/test/scala/code/XmlSourceSpecs.scala
deleted file mode 100644
index 77aa806dc80c6d6397b47cfdc5bfa930b842fafb..0000000000000000000000000000000000000000
--- a/web/src/test/scala/code/XmlSourceSpecs.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-package code
-
-import java.io.File
-
-import scala.xml.XML
-
-import org.specs.Specification
-import org.specs.runner.JUnit4
-
-import net.liftweb.common.Full
-import net.liftweb.util.PCDataXmlParser
-
-class XmlSourceSpecsTest extends JUnit4(XmlSourceSpecs)
-
-object XmlSourceSpecs extends Specification {
-
-  "XML Sources" should {
-    "be well-formed" in {
-      /**
-       * Tests to make sure the project's XML files are well-formed.
-       *
-       * Finds every *.html and *.xml file in src/main/webapp (and its
-       * subdirectories) and tests to make sure they are well-formed.
-       */
-      var failed: List[File] = Nil
-      
-      def handledXml(file: String) =
-	file.endsWith(".xml")
-      
-      def handledXHtml(file: String) =
-	file.endsWith(".html") || file.endsWith(".htm") || file.endsWith(".xhtml")
-      
-      def wellFormed(file: File) {
-	if (file.isDirectory)
-	  for (f <- file.listFiles) wellFormed(f)
-        
-	if (file.isFile && handledXml(file.getName)) {
-	  try {
-	    XML.loadFile(file)
-	  } catch {
-	    case e: _root_.org.xml.sax.SAXParseException => failed = file :: failed
-	  }
-	}
-	if (file.isFile && handledXHtml(file.getName)) {
-	  PCDataXmlParser(new java.io.FileInputStream(file.getAbsolutePath)) match {
-	    case Full(_) => // file is ok
-	      case _ => failed = file :: failed
-	  }
-	}
-      }
-      
-      wellFormed(new File("src/main/webapp"))
-      
-      val numFails = failed.size
-      if (numFails > 0) {
-	val fileStr = if (numFails == 1) "file" else "files"
-	val msg = "Malformed XML in " + numFails + " " + fileStr + ": " + failed.mkString(", ")
-	fail(msg)
-      }
-      
-      numFails must_== 0
-    }
-  }
-}
diff --git a/web/src/test/scala/code/snippet/HelloWorldTest.scala b/web/src/test/scala/code/snippet/HelloWorldTest.scala
deleted file mode 100644
index a71a5a7238da30f81090592c6a3b065658fdafe7..0000000000000000000000000000000000000000
--- a/web/src/test/scala/code/snippet/HelloWorldTest.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-package code {
-package snippet {
-
-import org.specs._
-import org.specs.runner.JUnit4
-import org.specs.runner.ConsoleRunner
-import net.liftweb._
-import http._
-import net.liftweb.util._
-import net.liftweb.common._
-import org.specs.matcher._
-import org.specs.specification._
-import Helpers._
-import lib._
-
-
-class HelloWorldTestSpecsAsTest extends JUnit4(HelloWorldTestSpecs)
-object HelloWorldTestSpecsRunner extends ConsoleRunner(HelloWorldTestSpecs)
-
-object HelloWorldTestSpecs extends Specification {
-  val session = new LiftSession("", randomString(20), Empty)
-  val stableTime = now
-
-  override def executeExpectations(ex: Examples, t: =>Any): Any = {
-    S.initIfUninitted(session) {
-      DependencyFactory.time.doWith(stableTime) {
-        super.executeExpectations(ex, t)
-      }
-    }
-  }
-
-  "HelloWorld Snippet" should {
-    "Put the time in the node" in {
-      val hello = new HelloWorld
-      Thread.sleep(1000) // make sure the time changes
-
-      val str = hello.howdy(<span>Welcome to your Lift app at <span id="time">Time goes here</span></span>).toString
-
-      str.indexOf(stableTime.toString) must be >= 0
-      str.indexOf("Hello at") must be >= 0
-    }
-  }
-}
-
-}
-}