diff --git a/src/main/java/de/tla2b/TLA2B.java b/src/main/java/de/tla2b/TLA2B.java
index 51758a52fcb7412c507534205467d761e694aa94..37396954cd3f1e1b43d5212ad26e56c7ec29ba13 100644
--- a/src/main/java/de/tla2b/TLA2B.java
+++ b/src/main/java/de/tla2b/TLA2B.java
@@ -1,94 +1,94 @@
-package de.tla2b;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.NotImplementedException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.global.TranslationGlobals;
-import de.tla2bAst.Translator;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-
-public class TLA2B implements TranslationGlobals {
-	public final static String VERSION = "version";
-
-	private String mainFile;
-
-	private static boolean error = false;
-
-	public static boolean hasError() {
-		return error;
-	}
-
-	public void handleParameter(String[] args) {
-		DefaultParser parser = new DefaultParser();
-		Options options = getCommandlineOptions();
-		try {
-			CommandLine line = parser.parse(options, args);
-			String[] remainingArgs = line.getArgs();
-			if (line.hasOption(VERSION)) {
-				System.out.println("TLA2B version: " + VERSION_NUMBER);
-			}
-			if (remainingArgs.length != 1) {
-				System.out.println("Error: expected a module file.");
-				HelpFormatter formatter = new HelpFormatter();
-				formatter.printHelp("java -jar TLA2B.jar [file]", options);
-				System.exit(-1);
-			} else {
-				mainFile = remainingArgs[0];
-			}
-		} catch (ParseException e) {
-			System.out.println(e.getMessage());
-			HelpFormatter formatter = new HelpFormatter();
-			formatter.printHelp("java -jar TLA2B.jar [file]", options);
-			System.exit(-1);
-		}
-
-	}
-
-	public static void main(String[] args) {
-		// To indicate an error we use the exit code -1
-		TLA2B tla2b = new TLA2B();
-
-		tla2b.handleParameter(args);
-
-		Translator translator = null;
-		try {
-			translator = new Translator(tla2b.mainFile);
-		} catch (FrontEndException e) {
-			System.exit(-1);
-		}
-		try {
-			translator.translate();
-		} catch (NotImplementedException e) {
-			System.err.print("**** Translation Error ****\n");
-			System.err.print("Not implemented:\n");
-			System.err.println(e.getMessage());
-			System.exit(-1);
-		} catch (TLA2BException e) {
-			System.err.print("**** Translation Error ****\n");
-			System.err.println(e.getMessage());
-			//e.printStackTrace();
-			System.exit(-1);
-		}
-		translator.createMachineFile();
-		translator.createProbFile();
-	}
-
-	private static Options getCommandlineOptions() {
-		Options options = new Options();
-		options.addOption(VERSION, false, "prints the current version of TLA2B");
-		
-		Option config = Option.builder("config")
-			.argName("file")
-			.hasArg()
-			.desc("config file")
-			.build();
-		options.addOption(config);
-		return options;
-	}
-}
+package de.tla2b;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.NotImplementedException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.global.TranslationGlobals;
+import de.tla2bAst.Translator;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+
+public class TLA2B implements TranslationGlobals {
+	public final static String VERSION = "version";
+
+	private String mainFile;
+
+	private static boolean error = false;
+
+	public static boolean hasError() {
+		return error;
+	}
+
+	public void handleParameter(String[] args) {
+		DefaultParser parser = new DefaultParser();
+		Options options = getCommandlineOptions();
+		try {
+			CommandLine line = parser.parse(options, args);
+			String[] remainingArgs = line.getArgs();
+			if (line.hasOption(VERSION)) {
+				System.out.println("TLA2B version: " + VERSION_NUMBER);
+			}
+			if (remainingArgs.length != 1) {
+				System.out.println("Error: expected a module file.");
+				HelpFormatter formatter = new HelpFormatter();
+				formatter.printHelp("java -jar TLA2B.jar [file]", options);
+				System.exit(-1);
+			} else {
+				mainFile = remainingArgs[0];
+			}
+		} catch (ParseException e) {
+			System.out.println(e.getMessage());
+			HelpFormatter formatter = new HelpFormatter();
+			formatter.printHelp("java -jar TLA2B.jar [file]", options);
+			System.exit(-1);
+		}
+
+	}
+
+	public static void main(String[] args) {
+		// To indicate an error we use the exit code -1
+		TLA2B tla2b = new TLA2B();
+
+		tla2b.handleParameter(args);
+
+		Translator translator = null;
+		try {
+			translator = new Translator(tla2b.mainFile);
+		} catch (FrontEndException e) {
+			System.exit(-1);
+		}
+		try {
+			translator.translate();
+		} catch (NotImplementedException e) {
+			System.err.print("**** Translation Error ****\n");
+			System.err.print("Not implemented:\n");
+			System.err.println(e.getMessage());
+			System.exit(-1);
+		} catch (TLA2BException e) {
+			System.err.print("**** Translation Error ****\n");
+			System.err.println(e.getMessage());
+			//e.printStackTrace();
+			System.exit(-1);
+		}
+		translator.createMachineFile();
+		translator.createProbFile();
+	}
+
+	private static Options getCommandlineOptions() {
+		Options options = new Options();
+		options.addOption(VERSION, false, "prints the current version of TLA2B");
+		
+		Option config = Option.builder("config")
+			.argName("file")
+			.hasArg()
+			.desc("config file")
+			.build();
+		options.addOption(config);
+		return options;
+	}
+}
diff --git a/src/main/java/de/tla2b/analysis/BOperation.java b/src/main/java/de/tla2b/analysis/BOperation.java
index 91dd132214b63279b5a6770c6a8b61e26b11704c..106d7b7ad7e2726f4b9c0db615af6b95e1ee6f5d 100644
--- a/src/main/java/de/tla2b/analysis/BOperation.java
+++ b/src/main/java/de/tla2b/analysis/BOperation.java
@@ -1,459 +1,459 @@
-package de.tla2b.analysis;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import de.be4.classicalb.core.parser.node.AAnySubstitution;
-import de.be4.classicalb.core.parser.node.AAssignSubstitution;
-import de.be4.classicalb.core.parser.node.ABlockSubstitution;
-import de.be4.classicalb.core.parser.node.AMemberPredicate;
-import de.be4.classicalb.core.parser.node.AOperation;
-import de.be4.classicalb.core.parser.node.ASelectSubstitution;
-import de.be4.classicalb.core.parser.node.ASkipSubstitution;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.be4.classicalb.core.parser.node.PPredicate;
-import de.tla2b.global.BBuiltInOPs;
-import de.tla2b.global.TranslationGlobals;
-import de.tla2b.types.TLAType;
-import de.tla2bAst.BAstCreator;
-import tla2sany.semantic.ASTConstants;
-import tla2sany.semantic.ExprNode;
-import tla2sany.semantic.ExprOrOpArgNode;
-import tla2sany.semantic.FormalParamNode;
-import tla2sany.semantic.LetInNode;
-import tla2sany.semantic.OpApplNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-import tla2sany.semantic.SemanticNode;
-import tla2sany.semantic.SubstInNode;
-import tla2sany.semantic.SymbolNode;
-import tlc2.tool.BuiltInOPs;
-import tlc2.tool.ToolGlobals;
-
-public class BOperation extends BuiltInOPs implements ASTConstants,
-		ToolGlobals, TranslationGlobals {
-	private final String name;
-	private final ExprNode node;
-	private final ArrayList<OpApplNode> existQuans;
-	private ArrayList<String> opParams;
-	private ArrayList<FormalParamNode> formalParams;
-	private ArrayList<String> unchangedVariables;
-	private final ArrayList<OpDeclNode> unchangedVariablesList;
-	private final ArrayList<ExprOrOpArgNode> guards;
-	private final ArrayList<ExprOrOpArgNode> beforeAfterPredicates;
-	private LinkedHashMap<SymbolNode, ExprOrOpArgNode> assignments = new LinkedHashMap<SymbolNode, ExprOrOpArgNode>();
-	private List<OpDeclNode> anyVariables;
-	private final SpecAnalyser specAnalyser;
-
-	public BOperation(String name, ExprNode n,
-			ArrayList<OpApplNode> existQuans, SpecAnalyser specAnalyser) {
-		this.name = name;
-		this.node = n;
-		this.existQuans = existQuans;
-		this.specAnalyser = specAnalyser;
-		this.unchangedVariablesList = new ArrayList<OpDeclNode>();
-		this.guards = new ArrayList<ExprOrOpArgNode>();
-		this.beforeAfterPredicates = new ArrayList<ExprOrOpArgNode>();
-		anyVariables = new ArrayList<OpDeclNode>(Arrays.asList(specAnalyser
-				.getModuleNode().getVariableDecls()));
-
-		evalParams();
-		findUnchangedVariables();
-		separateGuardsAndBeforeAfterPredicates(node);
-		findAssignments();
-	}
-
-	public AOperation getBOperation(BAstCreator bASTCreator) {
-		AOperation operation = new AOperation();
-		List<PExpression> paramList = new ArrayList<PExpression>();
-		ArrayList<PPredicate> whereList = new ArrayList<PPredicate>();
-		for (int j = 0; j < this.getFormalParams().size(); j++) {
-			paramList.add(bASTCreator.createIdentifierNode(this
-					.getFormalParams().get(j)));
-		}
-		for (int j = 0; j < this.getExistQuans().size(); j++) {
-			OpApplNode o = this.getExistQuans().get(j);
-			whereList.add(bASTCreator.visitBoundsOfLocalVariables(o));
-		}
-
-		operation.setOpName(BAstCreator.createTIdentifierLiteral(name));
-		operation.setParameters(paramList);
-		operation.setReturnValues(new ArrayList<PExpression>());
-
-		for (ExprOrOpArgNode g : guards) {
-			whereList.add(bASTCreator.visitExprOrOpArgNodePredicate(g));
-		}
-
-		ArrayList<PExpression> leftSideOfAssigment = new ArrayList<PExpression>();
-		ArrayList<PExpression> rightSideOfAssigment = new ArrayList<PExpression>();
-		for (Entry<SymbolNode, ExprOrOpArgNode> entry : assignments.entrySet()) {
-			leftSideOfAssigment.add(bASTCreator.createIdentifierNode(entry
-					.getKey()));
-			rightSideOfAssigment.add(bASTCreator
-					.visitExprOrOpArgNodeExpression(entry.getValue()));
-		}
-		AAssignSubstitution assign = new AAssignSubstitution();
-		if (anyVariables.size() > 0) { // ANY x_n WHERE P THEN A END
-			AAnySubstitution any = new AAnySubstitution();
-			any = new AAnySubstitution();
-			List<PExpression> anyParams = new ArrayList<PExpression>();
-			for (OpDeclNode var : anyVariables) {
-				String varName = var.getName().toString();
-				String nextName = varName + "_n";
-				anyParams.add(BAstCreator.createIdentifierNode(nextName));
-
-				AMemberPredicate member = new AMemberPredicate();
-				member.setLeft(BAstCreator.createIdentifierNode(nextName));
-				TLAType t = (TLAType) var.getToolObject(TYPE_ID);
-				member.setRight(t.getBNode());
-				whereList.add(member);
-				leftSideOfAssigment.add(bASTCreator.createIdentifierNode(var));
-				rightSideOfAssigment.add(BAstCreator
-						.createIdentifierNode(nextName));
-
-			}
-			any.setIdentifiers(anyParams);
-			whereList.addAll(createBeforeAfterPredicates(bASTCreator));
-			any.setWhere(bASTCreator.createConjunction(whereList));
-			any.setThen(assign);
-			operation.setOperationBody(any);
-		} else if (whereList.size() > 0) { // SELECT P THEN A END
-			ASelectSubstitution select = new ASelectSubstitution();
-			whereList.addAll(createBeforeAfterPredicates(bASTCreator));
-			for (ExprOrOpArgNode e : beforeAfterPredicates) {
-				whereList.add(bASTCreator.visitExprOrOpArgNodePredicate(e));
-			}
-			select.setCondition(bASTCreator.createConjunction(whereList));
-			select.setThen(assign);
-			operation.setOperationBody(select);
-		} else { // BEGIN A END
-			ABlockSubstitution block = new ABlockSubstitution(assign);
-			operation.setOperationBody(block);
-		}
-
-		if (leftSideOfAssigment.size() > 0) {
-			assign.setLhsExpression(leftSideOfAssigment);
-			assign.setRhsExpressions(rightSideOfAssigment);
-		} else { // skip
-			assign.replaceBy(new ASkipSubstitution());
-		}
-
-		return operation;
-	}
-
-	private ArrayList<PPredicate> createBeforeAfterPredicates(
-			BAstCreator bAstCreator) {
-		ArrayList<PPredicate> predicates = new ArrayList<PPredicate>();
-		for (ExprOrOpArgNode e : beforeAfterPredicates) {
-			PPredicate body = null;
-			if (e instanceof OpApplNode) {
-				OpApplNode opApplNode = (OpApplNode) e;
-				if (opApplNode.getOperator().getKind() == UserDefinedOpKind
-						&& !BBuiltInOPs.contains(opApplNode.getOperator()
-								.getName())) {
-					OpDefNode def = (OpDefNode) opApplNode.getOperator();
-					FormalParamNode[] params = def.getParams();
-					for (int j = 0; j < params.length; j++) {
-						FormalParamNode param = params[j];
-						param.setToolObject(SUBSTITUTE_PARAM,
-								opApplNode.getArgs()[j]);
-					}
-					body = bAstCreator.visitExprNodePredicate(def.getBody());
-				}
-			}
-			if (body == null) {
-				body = bAstCreator.visitExprOrOpArgNodePredicate(e);
-			}
-			predicates.add(body);
-		}
-		return predicates;
-	}
-
-	private void findAssignments() {
-		PrimedVariablesFinder primedVariablesFinder = new PrimedVariablesFinder(
-				beforeAfterPredicates);
-		for (ExprOrOpArgNode node : new ArrayList<ExprOrOpArgNode>(
-				beforeAfterPredicates)) {
-			if (node instanceof OpApplNode) {
-				OpApplNode opApplNode = (OpApplNode) node;
-				if (opApplNode.getOperator().getKind() == BuiltInKind) {
-
-					if (OPCODE_eq == getOpCode(opApplNode.getOperator()
-							.getName())) {
-						ExprOrOpArgNode arg1 = opApplNode.getArgs()[0];
-						try {
-							OpApplNode arg11 = (OpApplNode) arg1;
-							if (getOpCode(arg11.getOperator().getName()) == OPCODE_prime) {
-								OpApplNode v = (OpApplNode) arg11.getArgs()[0];
-								SymbolNode var = v.getOperator();
-								if (!primedVariablesFinder
-										.getTwiceUsedVariables().contains(var)) {
-									// var is only used once in all before after
-									// predicates
-									assignments.put(v.getOperator(),
-											opApplNode.getArgs()[1]);
-									beforeAfterPredicates.remove(node);
-								}
-
-							}
-						} catch (ClassCastException e) {
-						}
-					}
-
-				}
-			}
-		}
-		anyVariables = new ArrayList<OpDeclNode>();
-		for (OpDeclNode var : specAnalyser.getModuleNode().getVariableDecls()) {
-			anyVariables.add(var);
-		}
-
-		// for (SymbolNode symbol : primedVariablesFinder.getAllVariables()) {
-		// anyVariables.add((OpDeclNode) symbol);
-		// }
-		anyVariables.removeAll(assignments.keySet());
-		//anyVariables.removeAll(unchangedVariablesList);
-	}
-
-	private void separateGuardsAndBeforeAfterPredicates(ExprOrOpArgNode node) {
-		if (node instanceof OpApplNode) {
-			OpApplNode opApplNode = (OpApplNode) node;
-			if (opApplNode.getOperator().getKind() == BuiltInKind) {
-				switch (getOpCode(opApplNode.getOperator().getName())) {
-				case OPCODE_land: // \land
-				{
-					separateGuardsAndBeforeAfterPredicates(opApplNode.getArgs()[0]);
-					separateGuardsAndBeforeAfterPredicates(opApplNode.getArgs()[1]);
-					return;
-				}
-				case OPCODE_cl: // $ConjList
-				{
-					for (int i = 0; i < opApplNode.getArgs().length; i++) {
-						separateGuardsAndBeforeAfterPredicates(opApplNode
-								.getArgs()[i]);
-					}
-					return;
-				}
-				default: {
-					if (opApplNode.level < 2) {
-						guards.add(node);
-						return;
-					} else {
-						beforeAfterPredicates.add(node);
-						return;
-					}
-				}
-
-				}
-			}
-		}
-		if (node.level < 2) {
-			guards.add(node);
-			return;
-		} else {
-			beforeAfterPredicates.add(node);
-			return;
-		}
-		// beforeAfterPredicates.add(node);
-	}
-
-	private void evalParams() {
-		opParams = new ArrayList<String>();
-		formalParams = new ArrayList<FormalParamNode>();
-		for (int i = 0; i < existQuans.size(); i++) {
-			OpApplNode n = existQuans.get(i);
-			FormalParamNode[][] params = n.getBdedQuantSymbolLists();
-			for (int k = 0; k < params.length; k++) {
-				for (int j = 0; j < params[k].length; j++) {
-					formalParams.add(params[k][j]);
-					opParams.add(params[k][j].getName().toString());
-				}
-			}
-		}
-	}
-
-	public SymbolNode getSymbolNode() {
-		if (node instanceof OpApplNode) {
-			OpApplNode n = ((OpApplNode) node);
-			if (n.getOperator().getKind() == UserDefinedOpKind) {
-				return ((OpApplNode) node).getOperator();
-			}
-		}
-		return null;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public ExprNode getNode() {
-		return node;
-	}
-
-	public ArrayList<OpApplNode> getExistQuans() {
-		return new ArrayList<OpApplNode>(existQuans);
-	}
-
-	public ArrayList<String> getOpParams() {
-		return opParams;
-	}
-
-	public ArrayList<FormalParamNode> getFormalParams() {
-		return formalParams;
-	}
-
-	public ArrayList<String> getUnchangedVariables() {
-		return unchangedVariables;
-	}
-
-	private void findUnchangedVariables() {
-		unchangedVariables = new ArrayList<String>();
-		findUnchangedVaribalesInSemanticNode(node);
-	}
-
-	private void findUnchangedVaribalesInSemanticNode(SemanticNode node) {
-		switch (node.getKind()) {
-		case OpApplKind: {
-			findUnchangedVariablesInOpApplNode((OpApplNode) node);
-			return;
-		}
-		case LetInKind: {
-			LetInNode letNode = (LetInNode) node;
-			findUnchangedVaribalesInSemanticNode(letNode.getBody());
-			return;
-		}
-
-		case SubstInKind: {
-			SubstInNode substInNode = (SubstInNode) node;
-			findUnchangedVaribalesInSemanticNode(substInNode.getBody());
-			return;
-		}
-		}
-	}
-
-	private void findUnchangedVariablesInOpApplNode(OpApplNode n) {
-
-		int kind = n.getOperator().getKind();
-		if (kind == UserDefinedOpKind
-				&& !BBuiltInOPs.contains(n.getOperator().getName())) {
-			OpDefNode def = (OpDefNode) n.getOperator();
-			findUnchangedVaribalesInSemanticNode(def.getBody());
-			return;
-		} else if (kind == BuiltInKind) {
-			int opcode = BuiltInOPs.getOpCode(n.getOperator().getName());
-			switch (opcode) {
-			case OPCODE_land: // \land
-			case OPCODE_cl: { // $ConjList
-				for (int i = 0; i < n.getArgs().length; i++) {
-					findUnchangedVaribalesInSemanticNode(n.getArgs()[i]);
-				}
-				return;
-			}
-			case OPCODE_unchanged: {
-				n.setToolObject(USED, false);
-				OpApplNode k = (OpApplNode) n.getArgs()[0];
-				if (k.getOperator().getKind() == VariableDeclKind) {
-					unchangedVariablesList.add((OpDeclNode) k.getOperator());
-					String name = k.getOperator().getName().toString();
-					unchangedVariables.add(name);
-				} else {
-					// Tuple
-					for (int i = 0; i < k.getArgs().length; i++) {
-						OpApplNode var = (OpApplNode) k.getArgs()[i];
-						//findUnchangedVariablesInOpApplNode(var);
-						// System.out.println("var.getOperator() = " + var.getOperator().getName() + " at " + var.getOperator() + " of class " + var.getOperator().getClass().getSimpleName());
-						if(var.getOperator() instanceof OpDefNode) {
-						    // we have a definition
-					        OpDefNode def = (OpDefNode) var.getOperator();
-						    if(def.getParams().length > 0) {
-						       // we do not support definitions with arguments yet
-							   throw new RuntimeException("Declaration with parameters not supported for UNCHANGED: " + var.getOperator().getName() + " " + var.getLocation());
-						    }
-						    ExprNode body = def.getBody();
-							// System.out.println("Body = " + body + " of class " + body.getClass().getSimpleName());
-						    if(body instanceof OpApplNode) {
-						       OpApplNode obody = (OpApplNode) body;
-						       // System.out.println("Operator = " + obody.getOperator()); // In module --TLA+ BUILTINS--
-						       findUnchangedVariablesInOpApplNode(obody);
-						    }
-						} else if(!(var.getOperator() instanceof OpDeclNode)) {
-							throw new RuntimeException("Cannot convert to list of UNCHANGED variables: " + var.getOperator().getName() + " " + var.getLocation());
-						} else {
-							unchangedVariablesList.add((OpDeclNode) var
-									.getOperator());
-							String name = var.getOperator().getName().toString();
-							unchangedVariables.add(name);
-						}
-					}
-				}
-			}
-
-			}
-		}
-	}
-	
-
-}
-
-class PrimedVariablesFinder extends AbstractASTVisitor {
-	private final Set<SymbolNode> all;
-	private final Set<SymbolNode> twiceUsedVariables;
-	private final Hashtable<SemanticNode, Set<SymbolNode>> table;
-	private Set<SymbolNode> currentSet;
-
-	public PrimedVariablesFinder(ArrayList<ExprOrOpArgNode> list) {
-		this.all = new HashSet<SymbolNode>();
-		this.twiceUsedVariables = new HashSet<SymbolNode>();
-		this.table = new Hashtable<SemanticNode, Set<SymbolNode>>();
-
-		for (ExprOrOpArgNode exprOrOpArgNode : list) {
-			findPrimedVariables(exprOrOpArgNode);
-		}
-	}
-
-	public void findPrimedVariables(ExprOrOpArgNode n) {
-		currentSet = new HashSet<SymbolNode>();
-		this.visitExprOrOpArgNode(n);
-		table.put(n, currentSet);
-	}
-
-	public void visitBuiltInNode(OpApplNode n) {
-		switch (getOpCode(n.getOperator().getName())) {
-
-		case OPCODE_prime: // prime
-		{
-			if (n.getArgs()[0] instanceof OpApplNode) {
-				OpApplNode varNode = (OpApplNode) n.getArgs()[0];
-				SymbolNode var = varNode.getOperator();
-
-				currentSet.add(var);
-
-				if (all.contains(var)) {
-					twiceUsedVariables.add(var);
-				} else {
-					all.add(var);
-				}
-			}
-		}
-
-		default: {
-			super.visitBuiltInNode(n);
-		}
-
-		}
-	}
-
-	public Set<SymbolNode> getTwiceUsedVariables() {
-		return this.twiceUsedVariables;
-	}
-
-	public Set<SymbolNode> getAllVariables() {
-		return this.all;
-	}
-}
+package de.tla2b.analysis;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import de.be4.classicalb.core.parser.node.AAnySubstitution;
+import de.be4.classicalb.core.parser.node.AAssignSubstitution;
+import de.be4.classicalb.core.parser.node.ABlockSubstitution;
+import de.be4.classicalb.core.parser.node.AMemberPredicate;
+import de.be4.classicalb.core.parser.node.AOperation;
+import de.be4.classicalb.core.parser.node.ASelectSubstitution;
+import de.be4.classicalb.core.parser.node.ASkipSubstitution;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.be4.classicalb.core.parser.node.PPredicate;
+import de.tla2b.global.BBuiltInOPs;
+import de.tla2b.global.TranslationGlobals;
+import de.tla2b.types.TLAType;
+import de.tla2bAst.BAstCreator;
+import tla2sany.semantic.ASTConstants;
+import tla2sany.semantic.ExprNode;
+import tla2sany.semantic.ExprOrOpArgNode;
+import tla2sany.semantic.FormalParamNode;
+import tla2sany.semantic.LetInNode;
+import tla2sany.semantic.OpApplNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+import tla2sany.semantic.SemanticNode;
+import tla2sany.semantic.SubstInNode;
+import tla2sany.semantic.SymbolNode;
+import tlc2.tool.BuiltInOPs;
+import tlc2.tool.ToolGlobals;
+
+public class BOperation extends BuiltInOPs implements ASTConstants,
+		ToolGlobals, TranslationGlobals {
+	private final String name;
+	private final ExprNode node;
+	private final ArrayList<OpApplNode> existQuans;
+	private ArrayList<String> opParams;
+	private ArrayList<FormalParamNode> formalParams;
+	private ArrayList<String> unchangedVariables;
+	private final ArrayList<OpDeclNode> unchangedVariablesList;
+	private final ArrayList<ExprOrOpArgNode> guards;
+	private final ArrayList<ExprOrOpArgNode> beforeAfterPredicates;
+	private LinkedHashMap<SymbolNode, ExprOrOpArgNode> assignments = new LinkedHashMap<SymbolNode, ExprOrOpArgNode>();
+	private List<OpDeclNode> anyVariables;
+	private final SpecAnalyser specAnalyser;
+
+	public BOperation(String name, ExprNode n,
+			ArrayList<OpApplNode> existQuans, SpecAnalyser specAnalyser) {
+		this.name = name;
+		this.node = n;
+		this.existQuans = existQuans;
+		this.specAnalyser = specAnalyser;
+		this.unchangedVariablesList = new ArrayList<OpDeclNode>();
+		this.guards = new ArrayList<ExprOrOpArgNode>();
+		this.beforeAfterPredicates = new ArrayList<ExprOrOpArgNode>();
+		anyVariables = new ArrayList<OpDeclNode>(Arrays.asList(specAnalyser
+				.getModuleNode().getVariableDecls()));
+
+		evalParams();
+		findUnchangedVariables();
+		separateGuardsAndBeforeAfterPredicates(node);
+		findAssignments();
+	}
+
+	public AOperation getBOperation(BAstCreator bASTCreator) {
+		AOperation operation = new AOperation();
+		List<PExpression> paramList = new ArrayList<PExpression>();
+		ArrayList<PPredicate> whereList = new ArrayList<PPredicate>();
+		for (int j = 0; j < this.getFormalParams().size(); j++) {
+			paramList.add(bASTCreator.createIdentifierNode(this
+					.getFormalParams().get(j)));
+		}
+		for (int j = 0; j < this.getExistQuans().size(); j++) {
+			OpApplNode o = this.getExistQuans().get(j);
+			whereList.add(bASTCreator.visitBoundsOfLocalVariables(o));
+		}
+
+		operation.setOpName(BAstCreator.createTIdentifierLiteral(name));
+		operation.setParameters(paramList);
+		operation.setReturnValues(new ArrayList<PExpression>());
+
+		for (ExprOrOpArgNode g : guards) {
+			whereList.add(bASTCreator.visitExprOrOpArgNodePredicate(g));
+		}
+
+		ArrayList<PExpression> leftSideOfAssigment = new ArrayList<PExpression>();
+		ArrayList<PExpression> rightSideOfAssigment = new ArrayList<PExpression>();
+		for (Entry<SymbolNode, ExprOrOpArgNode> entry : assignments.entrySet()) {
+			leftSideOfAssigment.add(bASTCreator.createIdentifierNode(entry
+					.getKey()));
+			rightSideOfAssigment.add(bASTCreator
+					.visitExprOrOpArgNodeExpression(entry.getValue()));
+		}
+		AAssignSubstitution assign = new AAssignSubstitution();
+		if (anyVariables.size() > 0) { // ANY x_n WHERE P THEN A END
+			AAnySubstitution any = new AAnySubstitution();
+			any = new AAnySubstitution();
+			List<PExpression> anyParams = new ArrayList<PExpression>();
+			for (OpDeclNode var : anyVariables) {
+				String varName = var.getName().toString();
+				String nextName = varName + "_n";
+				anyParams.add(BAstCreator.createIdentifierNode(nextName));
+
+				AMemberPredicate member = new AMemberPredicate();
+				member.setLeft(BAstCreator.createIdentifierNode(nextName));
+				TLAType t = (TLAType) var.getToolObject(TYPE_ID);
+				member.setRight(t.getBNode());
+				whereList.add(member);
+				leftSideOfAssigment.add(bASTCreator.createIdentifierNode(var));
+				rightSideOfAssigment.add(BAstCreator
+						.createIdentifierNode(nextName));
+
+			}
+			any.setIdentifiers(anyParams);
+			whereList.addAll(createBeforeAfterPredicates(bASTCreator));
+			any.setWhere(bASTCreator.createConjunction(whereList));
+			any.setThen(assign);
+			operation.setOperationBody(any);
+		} else if (whereList.size() > 0) { // SELECT P THEN A END
+			ASelectSubstitution select = new ASelectSubstitution();
+			whereList.addAll(createBeforeAfterPredicates(bASTCreator));
+			for (ExprOrOpArgNode e : beforeAfterPredicates) {
+				whereList.add(bASTCreator.visitExprOrOpArgNodePredicate(e));
+			}
+			select.setCondition(bASTCreator.createConjunction(whereList));
+			select.setThen(assign);
+			operation.setOperationBody(select);
+		} else { // BEGIN A END
+			ABlockSubstitution block = new ABlockSubstitution(assign);
+			operation.setOperationBody(block);
+		}
+
+		if (leftSideOfAssigment.size() > 0) {
+			assign.setLhsExpression(leftSideOfAssigment);
+			assign.setRhsExpressions(rightSideOfAssigment);
+		} else { // skip
+			assign.replaceBy(new ASkipSubstitution());
+		}
+
+		return operation;
+	}
+
+	private ArrayList<PPredicate> createBeforeAfterPredicates(
+			BAstCreator bAstCreator) {
+		ArrayList<PPredicate> predicates = new ArrayList<PPredicate>();
+		for (ExprOrOpArgNode e : beforeAfterPredicates) {
+			PPredicate body = null;
+			if (e instanceof OpApplNode) {
+				OpApplNode opApplNode = (OpApplNode) e;
+				if (opApplNode.getOperator().getKind() == UserDefinedOpKind
+						&& !BBuiltInOPs.contains(opApplNode.getOperator()
+								.getName())) {
+					OpDefNode def = (OpDefNode) opApplNode.getOperator();
+					FormalParamNode[] params = def.getParams();
+					for (int j = 0; j < params.length; j++) {
+						FormalParamNode param = params[j];
+						param.setToolObject(SUBSTITUTE_PARAM,
+								opApplNode.getArgs()[j]);
+					}
+					body = bAstCreator.visitExprNodePredicate(def.getBody());
+				}
+			}
+			if (body == null) {
+				body = bAstCreator.visitExprOrOpArgNodePredicate(e);
+			}
+			predicates.add(body);
+		}
+		return predicates;
+	}
+
+	private void findAssignments() {
+		PrimedVariablesFinder primedVariablesFinder = new PrimedVariablesFinder(
+				beforeAfterPredicates);
+		for (ExprOrOpArgNode node : new ArrayList<ExprOrOpArgNode>(
+				beforeAfterPredicates)) {
+			if (node instanceof OpApplNode) {
+				OpApplNode opApplNode = (OpApplNode) node;
+				if (opApplNode.getOperator().getKind() == BuiltInKind) {
+
+					if (OPCODE_eq == getOpCode(opApplNode.getOperator()
+							.getName())) {
+						ExprOrOpArgNode arg1 = opApplNode.getArgs()[0];
+						try {
+							OpApplNode arg11 = (OpApplNode) arg1;
+							if (getOpCode(arg11.getOperator().getName()) == OPCODE_prime) {
+								OpApplNode v = (OpApplNode) arg11.getArgs()[0];
+								SymbolNode var = v.getOperator();
+								if (!primedVariablesFinder
+										.getTwiceUsedVariables().contains(var)) {
+									// var is only used once in all before after
+									// predicates
+									assignments.put(v.getOperator(),
+											opApplNode.getArgs()[1]);
+									beforeAfterPredicates.remove(node);
+								}
+
+							}
+						} catch (ClassCastException e) {
+						}
+					}
+
+				}
+			}
+		}
+		anyVariables = new ArrayList<OpDeclNode>();
+		for (OpDeclNode var : specAnalyser.getModuleNode().getVariableDecls()) {
+			anyVariables.add(var);
+		}
+
+		// for (SymbolNode symbol : primedVariablesFinder.getAllVariables()) {
+		// anyVariables.add((OpDeclNode) symbol);
+		// }
+		anyVariables.removeAll(assignments.keySet());
+		//anyVariables.removeAll(unchangedVariablesList);
+	}
+
+	private void separateGuardsAndBeforeAfterPredicates(ExprOrOpArgNode node) {
+		if (node instanceof OpApplNode) {
+			OpApplNode opApplNode = (OpApplNode) node;
+			if (opApplNode.getOperator().getKind() == BuiltInKind) {
+				switch (getOpCode(opApplNode.getOperator().getName())) {
+				case OPCODE_land: // \land
+				{
+					separateGuardsAndBeforeAfterPredicates(opApplNode.getArgs()[0]);
+					separateGuardsAndBeforeAfterPredicates(opApplNode.getArgs()[1]);
+					return;
+				}
+				case OPCODE_cl: // $ConjList
+				{
+					for (int i = 0; i < opApplNode.getArgs().length; i++) {
+						separateGuardsAndBeforeAfterPredicates(opApplNode
+								.getArgs()[i]);
+					}
+					return;
+				}
+				default: {
+					if (opApplNode.level < 2) {
+						guards.add(node);
+						return;
+					} else {
+						beforeAfterPredicates.add(node);
+						return;
+					}
+				}
+
+				}
+			}
+		}
+		if (node.level < 2) {
+			guards.add(node);
+			return;
+		} else {
+			beforeAfterPredicates.add(node);
+			return;
+		}
+		// beforeAfterPredicates.add(node);
+	}
+
+	private void evalParams() {
+		opParams = new ArrayList<String>();
+		formalParams = new ArrayList<FormalParamNode>();
+		for (int i = 0; i < existQuans.size(); i++) {
+			OpApplNode n = existQuans.get(i);
+			FormalParamNode[][] params = n.getBdedQuantSymbolLists();
+			for (int k = 0; k < params.length; k++) {
+				for (int j = 0; j < params[k].length; j++) {
+					formalParams.add(params[k][j]);
+					opParams.add(params[k][j].getName().toString());
+				}
+			}
+		}
+	}
+
+	public SymbolNode getSymbolNode() {
+		if (node instanceof OpApplNode) {
+			OpApplNode n = ((OpApplNode) node);
+			if (n.getOperator().getKind() == UserDefinedOpKind) {
+				return ((OpApplNode) node).getOperator();
+			}
+		}
+		return null;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public ExprNode getNode() {
+		return node;
+	}
+
+	public ArrayList<OpApplNode> getExistQuans() {
+		return new ArrayList<OpApplNode>(existQuans);
+	}
+
+	public ArrayList<String> getOpParams() {
+		return opParams;
+	}
+
+	public ArrayList<FormalParamNode> getFormalParams() {
+		return formalParams;
+	}
+
+	public ArrayList<String> getUnchangedVariables() {
+		return unchangedVariables;
+	}
+
+	private void findUnchangedVariables() {
+		unchangedVariables = new ArrayList<String>();
+		findUnchangedVaribalesInSemanticNode(node);
+	}
+
+	private void findUnchangedVaribalesInSemanticNode(SemanticNode node) {
+		switch (node.getKind()) {
+		case OpApplKind: {
+			findUnchangedVariablesInOpApplNode((OpApplNode) node);
+			return;
+		}
+		case LetInKind: {
+			LetInNode letNode = (LetInNode) node;
+			findUnchangedVaribalesInSemanticNode(letNode.getBody());
+			return;
+		}
+
+		case SubstInKind: {
+			SubstInNode substInNode = (SubstInNode) node;
+			findUnchangedVaribalesInSemanticNode(substInNode.getBody());
+			return;
+		}
+		}
+	}
+
+	private void findUnchangedVariablesInOpApplNode(OpApplNode n) {
+
+		int kind = n.getOperator().getKind();
+		if (kind == UserDefinedOpKind
+				&& !BBuiltInOPs.contains(n.getOperator().getName())) {
+			OpDefNode def = (OpDefNode) n.getOperator();
+			findUnchangedVaribalesInSemanticNode(def.getBody());
+			return;
+		} else if (kind == BuiltInKind) {
+			int opcode = BuiltInOPs.getOpCode(n.getOperator().getName());
+			switch (opcode) {
+			case OPCODE_land: // \land
+			case OPCODE_cl: { // $ConjList
+				for (int i = 0; i < n.getArgs().length; i++) {
+					findUnchangedVaribalesInSemanticNode(n.getArgs()[i]);
+				}
+				return;
+			}
+			case OPCODE_unchanged: {
+				n.setToolObject(USED, false);
+				OpApplNode k = (OpApplNode) n.getArgs()[0];
+				if (k.getOperator().getKind() == VariableDeclKind) {
+					unchangedVariablesList.add((OpDeclNode) k.getOperator());
+					String name = k.getOperator().getName().toString();
+					unchangedVariables.add(name);
+				} else {
+					// Tuple
+					for (int i = 0; i < k.getArgs().length; i++) {
+						OpApplNode var = (OpApplNode) k.getArgs()[i];
+						//findUnchangedVariablesInOpApplNode(var);
+						// System.out.println("var.getOperator() = " + var.getOperator().getName() + " at " + var.getOperator() + " of class " + var.getOperator().getClass().getSimpleName());
+						if(var.getOperator() instanceof OpDefNode) {
+						    // we have a definition
+					        OpDefNode def = (OpDefNode) var.getOperator();
+						    if(def.getParams().length > 0) {
+						       // we do not support definitions with arguments yet
+							   throw new RuntimeException("Declaration with parameters not supported for UNCHANGED: " + var.getOperator().getName() + " " + var.getLocation());
+						    }
+						    ExprNode body = def.getBody();
+							// System.out.println("Body = " + body + " of class " + body.getClass().getSimpleName());
+						    if(body instanceof OpApplNode) {
+						       OpApplNode obody = (OpApplNode) body;
+						       // System.out.println("Operator = " + obody.getOperator()); // In module --TLA+ BUILTINS--
+						       findUnchangedVariablesInOpApplNode(obody);
+						    }
+						} else if(!(var.getOperator() instanceof OpDeclNode)) {
+							throw new RuntimeException("Cannot convert to list of UNCHANGED variables: " + var.getOperator().getName() + " " + var.getLocation());
+						} else {
+							unchangedVariablesList.add((OpDeclNode) var
+									.getOperator());
+							String name = var.getOperator().getName().toString();
+							unchangedVariables.add(name);
+						}
+					}
+				}
+			}
+
+			}
+		}
+	}
+	
+
+}
+
+class PrimedVariablesFinder extends AbstractASTVisitor {
+	private final Set<SymbolNode> all;
+	private final Set<SymbolNode> twiceUsedVariables;
+	private final Hashtable<SemanticNode, Set<SymbolNode>> table;
+	private Set<SymbolNode> currentSet;
+
+	public PrimedVariablesFinder(ArrayList<ExprOrOpArgNode> list) {
+		this.all = new HashSet<SymbolNode>();
+		this.twiceUsedVariables = new HashSet<SymbolNode>();
+		this.table = new Hashtable<SemanticNode, Set<SymbolNode>>();
+
+		for (ExprOrOpArgNode exprOrOpArgNode : list) {
+			findPrimedVariables(exprOrOpArgNode);
+		}
+	}
+
+	public void findPrimedVariables(ExprOrOpArgNode n) {
+		currentSet = new HashSet<SymbolNode>();
+		this.visitExprOrOpArgNode(n);
+		table.put(n, currentSet);
+	}
+
+	public void visitBuiltInNode(OpApplNode n) {
+		switch (getOpCode(n.getOperator().getName())) {
+
+		case OPCODE_prime: // prime
+		{
+			if (n.getArgs()[0] instanceof OpApplNode) {
+				OpApplNode varNode = (OpApplNode) n.getArgs()[0];
+				SymbolNode var = varNode.getOperator();
+
+				currentSet.add(var);
+
+				if (all.contains(var)) {
+					twiceUsedVariables.add(var);
+				} else {
+					all.add(var);
+				}
+			}
+		}
+
+		default: {
+			super.visitBuiltInNode(n);
+		}
+
+		}
+	}
+
+	public Set<SymbolNode> getTwiceUsedVariables() {
+		return this.twiceUsedVariables;
+	}
+
+	public Set<SymbolNode> getAllVariables() {
+		return this.all;
+	}
+}
diff --git a/src/main/java/de/tla2b/analysis/InstanceTransformation.java b/src/main/java/de/tla2b/analysis/InstanceTransformation.java
index 2d0b92bd694949a17c79a546d9dd7dd6404dec08..5a21093d6988631ff6e33b9387bb9ca1e5c1b019 100644
--- a/src/main/java/de/tla2b/analysis/InstanceTransformation.java
+++ b/src/main/java/de/tla2b/analysis/InstanceTransformation.java
@@ -1,318 +1,318 @@
-package de.tla2b.analysis;
-
-import java.util.Hashtable;
-
-import de.tla2b.global.BBuiltInOPs;
-import tla2sany.semantic.ASTConstants;
-import tla2sany.semantic.AbortException;
-import tla2sany.semantic.AtNode;
-import tla2sany.semantic.Context;
-import tla2sany.semantic.ExprNode;
-import tla2sany.semantic.ExprOrOpArgNode;
-import tla2sany.semantic.FormalParamNode;
-import tla2sany.semantic.LetInNode;
-import tla2sany.semantic.ModuleNode;
-import tla2sany.semantic.NumeralNode;
-import tla2sany.semantic.OpApplNode;
-import tla2sany.semantic.OpArgNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-import tla2sany.semantic.StringNode;
-import tla2sany.semantic.Subst;
-import tla2sany.semantic.SubstInNode;
-import tlc2.tool.BuiltInOPs;
-import util.UniqueString;
-
-public class InstanceTransformation extends BuiltInOPs implements ASTConstants {
-
-	OpDefNode[] defs;
-	Hashtable<String, OpDefNode> defsHash;
-	private int substitutionId = 11;
-
-
-	public InstanceTransformation(ModuleNode moduleNode) {
-		defs = moduleNode.getOpDefs();
-		defsHash = new Hashtable<String, OpDefNode>();
-		for (int i = 0; i < defs.length; i++) {
-			OpDefNode def = defs[i];
-			defsHash.put(def.getName().toString(), def);
-		}
-	}
-
-	public void start() {
-		for (int i = 0; i < defs.length; i++) {
-			OpDefNode def = defs[i];
-			if (def.getSource() != def
-					&& !BBuiltInOPs.contains(def.getSource().getName())) {
-				// instance
-				String defName = def.getName().toString();
-
-				if (def.getBody() instanceof SubstInNode) {
-					String prefix = defName.substring(0,
-							defName.lastIndexOf('!') + 1);
-					def.setParams(generateNewParams(def.getParams()));
-					ExprNode body;
-					try {
-						body = generateNewExprNode(def.getBody(), prefix);
-					} catch (AbortException e) {
-						throw new RuntimeException();
-					}
-					def.setBody(body);
-				}
-			}
-		}
-	}
-
-	private ExprOrOpArgNode generateNewExprOrOpArgNode(ExprOrOpArgNode n,
-			String prefix) throws AbortException {
-		if (n instanceof ExprNode) {
-			return generateNewExprNode((ExprNode) n, prefix);
-		} else {
-			throw new RuntimeException("OpArgNode not implemented jet");
-		}
-	}
-
-	private ExprNode generateNewExprNode(ExprNode n, String prefix)
-			throws AbortException {
-		switch (n.getKind()) {
-		case OpApplKind: {
-			return generateNewOpApplNode((OpApplNode) n, prefix);
-		}
-
-		case NumeralKind: {
-			NumeralNode num = (NumeralNode) n;
-			return new NumeralNode(num.toString(), n.getTreeNode());
-		}
-
-		case StringKind: {
-			StringNode str = (StringNode) n;
-			return new StringNode(str.getTreeNode(), false);
-		}
-
-		case SubstInKind: {
-			SubstInNode substInNode = (SubstInNode) n;
-
-			Subst[] subs = substInNode.getSubsts();
-			for (int i = 0; i < subs.length; i++) {
-				OpDeclNode op = subs[i].getOp();
-				ExprOrOpArgNode expr = subs[i].getExpr();
-				op.setToolObject(substitutionId, expr);
-			}
-			return generateNewExprNode(substInNode.getBody(), prefix);
-		}
-		case AtNodeKind: { // @
-			AtNode old = (AtNode) n;
-			OpApplNode oldExcept = old.getExceptRef();
-			OpApplNode newExcept = (OpApplNode) oldExcept
-					.getToolObject(substitutionId);
-			OpApplNode oldComponent = old.getExceptComponentRef();
-			OpApplNode newComponent = (OpApplNode) oldComponent
-					.getToolObject(substitutionId);
-			return new AtNode(newExcept, newComponent);
-		}
-
-		case LetInKind: {
-			LetInNode oldLetNode = (LetInNode) n;
-			OpDefNode[] newLets = new OpDefNode[oldLetNode.getLets().length];
-			Context cc = oldLetNode.context;
-			for (int i = 0; i < oldLetNode.getLets().length; i++) {
-				OpDefNode let = oldLetNode.getLets()[i];
-				UniqueString newName = UniqueString.uniqueStringOf(prefix
-						+ let.getName().toString());
-				OpDefNode newLet = new OpDefNode(newName, let.getKind(),
-						generateNewParams(let.getParams()), let.isLocal(),
-						generateNewExprNode(let.getBody(), prefix),
-						let.getOriginallyDefinedInModuleNode(), null,
-						let.getTreeNode(), true, let.getSource());
-				let.setToolObject(substitutionId, newLet);
-				newLets[i] = newLet;
-				cc.addSymbolToContext(newName, newLet);
-			}
-
-			LetInNode newLetNode = new LetInNode(oldLetNode.getTreeNode(),
-					newLets, null, generateNewExprNode(oldLetNode.getBody(),
-							prefix), cc);
-			return newLetNode;
-		}
-
-		}
-		throw new RuntimeException();
-	}
-
-	private ExprNode generateNewOpApplNode(OpApplNode n, String prefix)
-			throws AbortException {
-		switch (n.getOperator().getKind()) {
-		case VariableDeclKind:
-		case ConstantDeclKind: {
-			ExprOrOpArgNode e = (ExprOrOpArgNode) n.getOperator()
-					.getToolObject(substitutionId);
-			if (e != null) {
-				if (e instanceof ExprNode) {
-					// TODO newprefix, witout last prefix
-					return generateNewExprNode((ExprNode) e, "");
-				} else {
-					OpArgNode opArg = (OpArgNode) e;
-					while (opArg.getOp().getToolObject(substitutionId) != null) {
-						opArg = (OpArgNode) opArg.getOp().getToolObject(
-								substitutionId);
-					}
-					return new OpApplNode(opArg.getOp(), generateNewArgs(
-							n.getArgs(), prefix), n.getTreeNode(), null);
-				}
-			} else {
-				return new OpApplNode(n.getOperator(), generateNewArgs(
-						n.getArgs(), prefix), n.getTreeNode(), null);
-			}
-		}
-
-		case FormalParamKind: {
-			FormalParamNode f = (FormalParamNode) n.getOperator()
-					.getToolObject(substitutionId);
-			if (f == null) {
-				throw new RuntimeException();
-			}
-			return new OpApplNode(f, generateNewArgs(n.getArgs(), prefix),
-					n.getTreeNode(), null);
-		}
-
-		case BuiltInKind: {
-			return generateNewBuiltInNode(n, prefix);
-		}
-
-		case UserDefinedOpKind: {
-			// in case of a call of a LetInNode
-			OpDefNode letOp = (OpDefNode) n.getOperator().getToolObject(
-					substitutionId);
-			if (letOp != null) {
-				return new OpApplNode(letOp, generateNewArgs(n.getArgs(),
-						prefix), n.getTreeNode(), null);
-			}
-
-			// in case of a call of BBuiltInOp e.g. +, -
-			if (BBuiltInOPs.contains(n.getOperator().getName())) {
-				return new OpApplNode(n.getOperator(), generateNewArgs(
-						n.getArgs(), prefix), n.stn, null);
-			}
-
-			// normal userdefined Operator
-			String opName = prefix + n.getOperator().getName().toString();
-			OpDefNode op = defsHash.get(opName);
-			if (op == null) {
-				throw new RuntimeException();
-			}
-			return new OpApplNode(op, generateNewArgs(n.getArgs(),
-					prefix), n.getTreeNode(), null);
-		}
-		}
-		throw new RuntimeException("OpApplkind not implemented jet");
-	}
-
-	private ExprNode generateNewBuiltInNode(OpApplNode n, String prefix)
-			throws AbortException {
-		switch (getOpCode(n.getOperator().getName())) {
-
-		case OPCODE_exc: { // Except
-			OpApplNode newNode = new OpApplNode(n.getOperator().getName(),
-					null, n.getTreeNode(), null);
-			n.setToolObject(substitutionId, newNode); // needed for @ node
-			ExprOrOpArgNode[] newArgs = new ExprOrOpArgNode[n.getArgs().length];
-			newArgs[0] = generateNewExprOrOpArgNode(n.getArgs()[0], prefix);
-
-			for (int i = 1; i < n.getArgs().length; i++) {
-				OpApplNode pair = (OpApplNode) n.getArgs()[i];
-				OpApplNode newPair = new OpApplNode(pair.getOperator()
-						.getName(), null, pair.getTreeNode(), null);
-				// needed for @ node: we have to set a reference from the old
-				// pair to the new pair
-				// before evaluation the arguments which may be contains a @
-				// node
-				pair.setToolObject(substitutionId, newPair);
-				newPair.setArgs(generateNewArgs(pair.getArgs(), prefix));
-				newArgs[i] = newPair;
-			}
-			newNode.setArgs(newArgs);
-			return newNode;
-
-		}
-		case OPCODE_uc: { // CHOOSE x : P
-			FormalParamNode[] oldSymbols = n.getUnbdedQuantSymbols();
-			FormalParamNode[] newSymbols = new FormalParamNode[oldSymbols.length];
-			for (int i = 0; i < n.getUnbdedQuantSymbols().length; i++) {
-				FormalParamNode f = oldSymbols[i];
-				newSymbols[i] = new FormalParamNode(f.getName(), f.getArity(),
-						f.getTreeNode(), null, null);
-				f.setToolObject(substitutionId, newSymbols[i]);
-			}
-			OpApplNode newNode = new OpApplNode(n.getOperator().getName(),
-					newSymbols, generateNewArgs(n.getArgs(), prefix), null,
-					null, null, n.getTreeNode(), null);
-			return newNode;
-		}
-
-		case OPCODE_rfs:
-		case OPCODE_nrfs:
-		case OPCODE_fc: // Represents [x \in S |-> e]
-		case OPCODE_be: // \E x \in S : P
-		case OPCODE_bf: // \A x \in S : P
-		case OPCODE_bc: // CHOOSE x \in S: P
-		case OPCODE_sso: // $SubsetOf Represents {x \in S : P}
-		case OPCODE_soa: // $SetOfAll Represents {e : p1 \in S, p2,p3 \in S2}
-		{
-			// new formalparamnodes
-			FormalParamNode[][] oldParams = n.getBdedQuantSymbolLists();
-			FormalParamNode[][] newParams = new FormalParamNode[oldParams.length][0];
-			for (int i = 0; i < oldParams.length; i++) {
-				FormalParamNode[] temp = new FormalParamNode[oldParams[i].length];
-				for (int j = 0; j < oldParams[i].length; j++) {
-					FormalParamNode f = oldParams[i][j];
-					temp[j] = new FormalParamNode(f.getName(), f.getArity(),
-							f.getTreeNode(), null, null);
-					// set reference the old param to the new
-					f.setToolObject(substitutionId, temp[j]);
-				}
-				newParams[i] = temp;
-			}
-
-			// new ranges
-			ExprNode[] ranges = new ExprNode[n.getBdedQuantBounds().length];
-			for (int i = 0; i < n.getBdedQuantBounds().length; i++) {
-				ranges[i] = generateNewExprNode(n.getBdedQuantBounds()[i],
-						prefix);
-			}
-			OpApplNode newNode = new OpApplNode(n.getOperator().getName(),
-					null, generateNewArgs(n.getArgs(), prefix), newParams,
-					n.isBdedQuantATuple(), ranges, n.getTreeNode(), null);
-			return newNode;
-		}
-
-		default: { // =
-			OpApplNode newNode = new OpApplNode(n.getOperator(),
-					generateNewArgs(n.getArgs(), prefix), n.getTreeNode(), null);
-			return newNode;
-		}
-		}
-	}
-
-	private ExprOrOpArgNode[] generateNewArgs(ExprOrOpArgNode[] args,
-			String prefix) throws AbortException {
-		ExprOrOpArgNode[] res = new ExprOrOpArgNode[args.length];
-		for (int i = 0; i < args.length; i++) {
-			res[i] = generateNewExprOrOpArgNode(args[i], prefix);
-		}
-		return res;
-	}
-
-	private FormalParamNode[] generateNewParams(FormalParamNode[] oldParams) {
-		FormalParamNode[] newParams = new FormalParamNode[oldParams.length];
-		for (int i = 0; i < oldParams.length; i++) {
-			FormalParamNode oldParam = oldParams[i];
-			FormalParamNode newParam = new FormalParamNode(oldParam.getName(),
-					oldParam.getArity(), oldParam.getTreeNode(), null, null);
-			// set reference to the old param to the new
-			oldParam.setToolObject(substitutionId, newParam);
-			newParams[i] = newParam;
-		}
-		return newParams;
-	}
-
-}
+package de.tla2b.analysis;
+
+import java.util.Hashtable;
+
+import de.tla2b.global.BBuiltInOPs;
+import tla2sany.semantic.ASTConstants;
+import tla2sany.semantic.AbortException;
+import tla2sany.semantic.AtNode;
+import tla2sany.semantic.Context;
+import tla2sany.semantic.ExprNode;
+import tla2sany.semantic.ExprOrOpArgNode;
+import tla2sany.semantic.FormalParamNode;
+import tla2sany.semantic.LetInNode;
+import tla2sany.semantic.ModuleNode;
+import tla2sany.semantic.NumeralNode;
+import tla2sany.semantic.OpApplNode;
+import tla2sany.semantic.OpArgNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+import tla2sany.semantic.StringNode;
+import tla2sany.semantic.Subst;
+import tla2sany.semantic.SubstInNode;
+import tlc2.tool.BuiltInOPs;
+import util.UniqueString;
+
+public class InstanceTransformation extends BuiltInOPs implements ASTConstants {
+
+	OpDefNode[] defs;
+	Hashtable<String, OpDefNode> defsHash;
+	private int substitutionId = 11;
+
+
+	public InstanceTransformation(ModuleNode moduleNode) {
+		defs = moduleNode.getOpDefs();
+		defsHash = new Hashtable<String, OpDefNode>();
+		for (int i = 0; i < defs.length; i++) {
+			OpDefNode def = defs[i];
+			defsHash.put(def.getName().toString(), def);
+		}
+	}
+
+	public void start() {
+		for (int i = 0; i < defs.length; i++) {
+			OpDefNode def = defs[i];
+			if (def.getSource() != def
+					&& !BBuiltInOPs.contains(def.getSource().getName())) {
+				// instance
+				String defName = def.getName().toString();
+
+				if (def.getBody() instanceof SubstInNode) {
+					String prefix = defName.substring(0,
+							defName.lastIndexOf('!') + 1);
+					def.setParams(generateNewParams(def.getParams()));
+					ExprNode body;
+					try {
+						body = generateNewExprNode(def.getBody(), prefix);
+					} catch (AbortException e) {
+						throw new RuntimeException();
+					}
+					def.setBody(body);
+				}
+			}
+		}
+	}
+
+	private ExprOrOpArgNode generateNewExprOrOpArgNode(ExprOrOpArgNode n,
+			String prefix) throws AbortException {
+		if (n instanceof ExprNode) {
+			return generateNewExprNode((ExprNode) n, prefix);
+		} else {
+			throw new RuntimeException("OpArgNode not implemented jet");
+		}
+	}
+
+	private ExprNode generateNewExprNode(ExprNode n, String prefix)
+			throws AbortException {
+		switch (n.getKind()) {
+		case OpApplKind: {
+			return generateNewOpApplNode((OpApplNode) n, prefix);
+		}
+
+		case NumeralKind: {
+			NumeralNode num = (NumeralNode) n;
+			return new NumeralNode(num.toString(), n.getTreeNode());
+		}
+
+		case StringKind: {
+			StringNode str = (StringNode) n;
+			return new StringNode(str.getTreeNode(), false);
+		}
+
+		case SubstInKind: {
+			SubstInNode substInNode = (SubstInNode) n;
+
+			Subst[] subs = substInNode.getSubsts();
+			for (int i = 0; i < subs.length; i++) {
+				OpDeclNode op = subs[i].getOp();
+				ExprOrOpArgNode expr = subs[i].getExpr();
+				op.setToolObject(substitutionId, expr);
+			}
+			return generateNewExprNode(substInNode.getBody(), prefix);
+		}
+		case AtNodeKind: { // @
+			AtNode old = (AtNode) n;
+			OpApplNode oldExcept = old.getExceptRef();
+			OpApplNode newExcept = (OpApplNode) oldExcept
+					.getToolObject(substitutionId);
+			OpApplNode oldComponent = old.getExceptComponentRef();
+			OpApplNode newComponent = (OpApplNode) oldComponent
+					.getToolObject(substitutionId);
+			return new AtNode(newExcept, newComponent);
+		}
+
+		case LetInKind: {
+			LetInNode oldLetNode = (LetInNode) n;
+			OpDefNode[] newLets = new OpDefNode[oldLetNode.getLets().length];
+			Context cc = oldLetNode.context;
+			for (int i = 0; i < oldLetNode.getLets().length; i++) {
+				OpDefNode let = oldLetNode.getLets()[i];
+				UniqueString newName = UniqueString.uniqueStringOf(prefix
+						+ let.getName().toString());
+				OpDefNode newLet = new OpDefNode(newName, let.getKind(),
+						generateNewParams(let.getParams()), let.isLocal(),
+						generateNewExprNode(let.getBody(), prefix),
+						let.getOriginallyDefinedInModuleNode(), null,
+						let.getTreeNode(), true, let.getSource());
+				let.setToolObject(substitutionId, newLet);
+				newLets[i] = newLet;
+				cc.addSymbolToContext(newName, newLet);
+			}
+
+			LetInNode newLetNode = new LetInNode(oldLetNode.getTreeNode(),
+					newLets, null, generateNewExprNode(oldLetNode.getBody(),
+							prefix), cc);
+			return newLetNode;
+		}
+
+		}
+		throw new RuntimeException();
+	}
+
+	private ExprNode generateNewOpApplNode(OpApplNode n, String prefix)
+			throws AbortException {
+		switch (n.getOperator().getKind()) {
+		case VariableDeclKind:
+		case ConstantDeclKind: {
+			ExprOrOpArgNode e = (ExprOrOpArgNode) n.getOperator()
+					.getToolObject(substitutionId);
+			if (e != null) {
+				if (e instanceof ExprNode) {
+					// TODO newprefix, witout last prefix
+					return generateNewExprNode((ExprNode) e, "");
+				} else {
+					OpArgNode opArg = (OpArgNode) e;
+					while (opArg.getOp().getToolObject(substitutionId) != null) {
+						opArg = (OpArgNode) opArg.getOp().getToolObject(
+								substitutionId);
+					}
+					return new OpApplNode(opArg.getOp(), generateNewArgs(
+							n.getArgs(), prefix), n.getTreeNode(), null);
+				}
+			} else {
+				return new OpApplNode(n.getOperator(), generateNewArgs(
+						n.getArgs(), prefix), n.getTreeNode(), null);
+			}
+		}
+
+		case FormalParamKind: {
+			FormalParamNode f = (FormalParamNode) n.getOperator()
+					.getToolObject(substitutionId);
+			if (f == null) {
+				throw new RuntimeException();
+			}
+			return new OpApplNode(f, generateNewArgs(n.getArgs(), prefix),
+					n.getTreeNode(), null);
+		}
+
+		case BuiltInKind: {
+			return generateNewBuiltInNode(n, prefix);
+		}
+
+		case UserDefinedOpKind: {
+			// in case of a call of a LetInNode
+			OpDefNode letOp = (OpDefNode) n.getOperator().getToolObject(
+					substitutionId);
+			if (letOp != null) {
+				return new OpApplNode(letOp, generateNewArgs(n.getArgs(),
+						prefix), n.getTreeNode(), null);
+			}
+
+			// in case of a call of BBuiltInOp e.g. +, -
+			if (BBuiltInOPs.contains(n.getOperator().getName())) {
+				return new OpApplNode(n.getOperator(), generateNewArgs(
+						n.getArgs(), prefix), n.stn, null);
+			}
+
+			// normal userdefined Operator
+			String opName = prefix + n.getOperator().getName().toString();
+			OpDefNode op = defsHash.get(opName);
+			if (op == null) {
+				throw new RuntimeException();
+			}
+			return new OpApplNode(op, generateNewArgs(n.getArgs(),
+					prefix), n.getTreeNode(), null);
+		}
+		}
+		throw new RuntimeException("OpApplkind not implemented jet");
+	}
+
+	private ExprNode generateNewBuiltInNode(OpApplNode n, String prefix)
+			throws AbortException {
+		switch (getOpCode(n.getOperator().getName())) {
+
+		case OPCODE_exc: { // Except
+			OpApplNode newNode = new OpApplNode(n.getOperator().getName(),
+					null, n.getTreeNode(), null);
+			n.setToolObject(substitutionId, newNode); // needed for @ node
+			ExprOrOpArgNode[] newArgs = new ExprOrOpArgNode[n.getArgs().length];
+			newArgs[0] = generateNewExprOrOpArgNode(n.getArgs()[0], prefix);
+
+			for (int i = 1; i < n.getArgs().length; i++) {
+				OpApplNode pair = (OpApplNode) n.getArgs()[i];
+				OpApplNode newPair = new OpApplNode(pair.getOperator()
+						.getName(), null, pair.getTreeNode(), null);
+				// needed for @ node: we have to set a reference from the old
+				// pair to the new pair
+				// before evaluation the arguments which may be contains a @
+				// node
+				pair.setToolObject(substitutionId, newPair);
+				newPair.setArgs(generateNewArgs(pair.getArgs(), prefix));
+				newArgs[i] = newPair;
+			}
+			newNode.setArgs(newArgs);
+			return newNode;
+
+		}
+		case OPCODE_uc: { // CHOOSE x : P
+			FormalParamNode[] oldSymbols = n.getUnbdedQuantSymbols();
+			FormalParamNode[] newSymbols = new FormalParamNode[oldSymbols.length];
+			for (int i = 0; i < n.getUnbdedQuantSymbols().length; i++) {
+				FormalParamNode f = oldSymbols[i];
+				newSymbols[i] = new FormalParamNode(f.getName(), f.getArity(),
+						f.getTreeNode(), null, null);
+				f.setToolObject(substitutionId, newSymbols[i]);
+			}
+			OpApplNode newNode = new OpApplNode(n.getOperator().getName(),
+					newSymbols, generateNewArgs(n.getArgs(), prefix), null,
+					null, null, n.getTreeNode(), null);
+			return newNode;
+		}
+
+		case OPCODE_rfs:
+		case OPCODE_nrfs:
+		case OPCODE_fc: // Represents [x \in S |-> e]
+		case OPCODE_be: // \E x \in S : P
+		case OPCODE_bf: // \A x \in S : P
+		case OPCODE_bc: // CHOOSE x \in S: P
+		case OPCODE_sso: // $SubsetOf Represents {x \in S : P}
+		case OPCODE_soa: // $SetOfAll Represents {e : p1 \in S, p2,p3 \in S2}
+		{
+			// new formalparamnodes
+			FormalParamNode[][] oldParams = n.getBdedQuantSymbolLists();
+			FormalParamNode[][] newParams = new FormalParamNode[oldParams.length][0];
+			for (int i = 0; i < oldParams.length; i++) {
+				FormalParamNode[] temp = new FormalParamNode[oldParams[i].length];
+				for (int j = 0; j < oldParams[i].length; j++) {
+					FormalParamNode f = oldParams[i][j];
+					temp[j] = new FormalParamNode(f.getName(), f.getArity(),
+							f.getTreeNode(), null, null);
+					// set reference the old param to the new
+					f.setToolObject(substitutionId, temp[j]);
+				}
+				newParams[i] = temp;
+			}
+
+			// new ranges
+			ExprNode[] ranges = new ExprNode[n.getBdedQuantBounds().length];
+			for (int i = 0; i < n.getBdedQuantBounds().length; i++) {
+				ranges[i] = generateNewExprNode(n.getBdedQuantBounds()[i],
+						prefix);
+			}
+			OpApplNode newNode = new OpApplNode(n.getOperator().getName(),
+					null, generateNewArgs(n.getArgs(), prefix), newParams,
+					n.isBdedQuantATuple(), ranges, n.getTreeNode(), null);
+			return newNode;
+		}
+
+		default: { // =
+			OpApplNode newNode = new OpApplNode(n.getOperator(),
+					generateNewArgs(n.getArgs(), prefix), n.getTreeNode(), null);
+			return newNode;
+		}
+		}
+	}
+
+	private ExprOrOpArgNode[] generateNewArgs(ExprOrOpArgNode[] args,
+			String prefix) throws AbortException {
+		ExprOrOpArgNode[] res = new ExprOrOpArgNode[args.length];
+		for (int i = 0; i < args.length; i++) {
+			res[i] = generateNewExprOrOpArgNode(args[i], prefix);
+		}
+		return res;
+	}
+
+	private FormalParamNode[] generateNewParams(FormalParamNode[] oldParams) {
+		FormalParamNode[] newParams = new FormalParamNode[oldParams.length];
+		for (int i = 0; i < oldParams.length; i++) {
+			FormalParamNode oldParam = oldParams[i];
+			FormalParamNode newParam = new FormalParamNode(oldParam.getName(),
+					oldParam.getArity(), oldParam.getTreeNode(), null, null);
+			// set reference to the old param to the new
+			oldParam.setToolObject(substitutionId, newParam);
+			newParams[i] = newParam;
+		}
+		return newParams;
+	}
+
+}
diff --git a/src/main/java/de/tla2b/analysis/RecursiveFunktion.java b/src/main/java/de/tla2b/analysis/RecursiveFunktion.java
index 97c9bfc95f4d44ef3f031a3e58c2eff0db5c042f..70c18ffc5af4a3e2e9d4229af27d1d27ab817915 100644
--- a/src/main/java/de/tla2b/analysis/RecursiveFunktion.java
+++ b/src/main/java/de/tla2b/analysis/RecursiveFunktion.java
@@ -1,56 +1,56 @@
-package de.tla2b.analysis;
-
-import de.tla2b.exceptions.NotImplementedException;
-import tla2sany.semantic.OpApplNode;
-import tla2sany.semantic.OpDefNode;
-import tlc2.tool.BuiltInOPs;
-
-public class RecursiveFunktion extends BuiltInOPs {
-
-	private OpDefNode def;
-	private OpApplNode rfs;
-	private OpApplNode ifThenElse;
-
-	public RecursiveFunktion(OpDefNode n, OpApplNode rfs)
-			throws NotImplementedException {
-		def = n;
-		this.rfs = rfs;
-		//evalDef();
-	}
-
-
-//	/**
-//	 * @throws NotImplementedException
-//	 * 
-//	 */
-//	private void evalDef() throws NotImplementedException {
-//		ExprOrOpArgNode e = rfs.getArgs()[0];
-//		//System.out.println(rfs.toString(5));
-//		if (e instanceof OpApplNode) {
-//			OpApplNode o = (OpApplNode) e;
-//			switch (getOpCode(o.getOperator().getName())) {
-//			case OPCODE_ite: { // IF THEN ELSE
-//				ifThenElse = o;
-//				return;
-//			}
-//			}
-//			throw new NotImplementedException(
-//					"Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function.");
-//		} else {
-//			throw new NotImplementedException(
-//					"Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function.");
-//		}
-//	}
-
-	public OpDefNode getOpDefNode() {
-		return def;
-	}
-
-	public OpApplNode getRF() {
-		return rfs;
-	}
-
-	public OpApplNode getIfThenElse() {
-		return ifThenElse;
-	}
-}
+package de.tla2b.analysis;
+
+import de.tla2b.exceptions.NotImplementedException;
+import tla2sany.semantic.OpApplNode;
+import tla2sany.semantic.OpDefNode;
+import tlc2.tool.BuiltInOPs;
+
+public class RecursiveFunktion extends BuiltInOPs {
+
+	private OpDefNode def;
+	private OpApplNode rfs;
+	private OpApplNode ifThenElse;
+
+	public RecursiveFunktion(OpDefNode n, OpApplNode rfs)
+			throws NotImplementedException {
+		def = n;
+		this.rfs = rfs;
+		//evalDef();
+	}
+
+
+//	/**
+//	 * @throws NotImplementedException
+//	 * 
+//	 */
+//	private void evalDef() throws NotImplementedException {
+//		ExprOrOpArgNode e = rfs.getArgs()[0];
+//		//System.out.println(rfs.toString(5));
+//		if (e instanceof OpApplNode) {
+//			OpApplNode o = (OpApplNode) e;
+//			switch (getOpCode(o.getOperator().getName())) {
+//			case OPCODE_ite: { // IF THEN ELSE
+//				ifThenElse = o;
+//				return;
+//			}
+//			}
+//			throw new NotImplementedException(
+//					"Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function.");
+//		} else {
+//			throw new NotImplementedException(
+//					"Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function.");
+//		}
+//	}
+
+	public OpDefNode getOpDefNode() {
+		return def;
+	}
+
+	public OpApplNode getRF() {
+		return rfs;
+	}
+
+	public OpApplNode getIfThenElse() {
+		return ifThenElse;
+	}
+}
diff --git a/src/main/java/de/tla2b/analysis/SpecAnalyser.java b/src/main/java/de/tla2b/analysis/SpecAnalyser.java
index 2bb80655c96c2d87aa6f626da56b07ce0e278a18..73b9a016c055225f0d396cdfa5a7d0eb47a897a3 100644
--- a/src/main/java/de/tla2b/analysis/SpecAnalyser.java
+++ b/src/main/java/de/tla2b/analysis/SpecAnalyser.java
@@ -1,327 +1,327 @@
-package de.tla2b.analysis;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-
-import de.tla2b.config.ConfigfileEvaluator;
-import de.tla2b.exceptions.ConfigFileErrorException;
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.NotImplementedException;
-import de.tla2b.exceptions.SemanticErrorException;
-import de.tla2b.global.BBuiltInOPs;
-import de.tla2b.global.TranslationGlobals;
-import de.tla2b.translation.BDefinitionsFinder;
-import de.tla2b.translation.OperationsFinder;
-import de.tla2b.translation.UsedDefinitionsFinder;
-import tla2sany.semantic.ASTConstants;
-import tla2sany.semantic.ExprNode;
-import tla2sany.semantic.ExprOrOpArgNode;
-import tla2sany.semantic.FormalParamNode;
-import tla2sany.semantic.ModuleNode;
-import tla2sany.semantic.OpApplNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-import tla2sany.semantic.SemanticNode;
-import tla2sany.semantic.SymbolNode;
-import tlc2.tool.BuiltInOPs;
-import tlc2.tool.ToolGlobals;
-
-public class SpecAnalyser extends BuiltInOPs implements ASTConstants, ToolGlobals, TranslationGlobals {
-	private OpDefNode spec;
-	private OpDefNode init;
-	private OpDefNode next;
-	private ArrayList<OpDefNode> invariants = new ArrayList<>();
-
-	private OpDefNode expressionOpdefNode;
-	private Hashtable<String, SymbolNode> namingHashTable = new Hashtable<>();
-
-	private final ModuleNode moduleNode;
-	private ExprNode nextExpr;
-
-	private ArrayList<OpDeclNode> bConstants;
-	// used to check if a b constant has arguments and is not overriden in the
-	// configfile
-
-	private ArrayList<BOperation> bOperations = new ArrayList<BOperation>();
-	private ArrayList<ExprNode> inits = new ArrayList<ExprNode>();
-
-	private Set<OpDefNode> bDefinitionsSet = new HashSet<OpDefNode>();
-	// set of OpDefNodes which will appear in the resulting B Machine
-	private Set<OpDefNode> usedDefinitions = new HashSet<OpDefNode>();
-	// definitions which are used for the type inference algorithm
-	private Hashtable<OpDefNode, FormalParamNode[]> letParams = new Hashtable<>();
-	// additional parameters of an let Operator, these parameters are from the
-	// surrounding operator
-	private ArrayList<String> definitionMacros = new ArrayList<>();
-
-	private ArrayList<OpDefNode> recursiveFunctions = new ArrayList<>();
-
-	private ArrayList<RecursiveDefinition> recursiveDefinitions = new ArrayList<>();
-
-	private ConfigfileEvaluator configFileEvaluator;
-
-	private SpecAnalyser(ModuleNode m) {
-		this.moduleNode = m;
-		this.bConstants = new ArrayList<OpDeclNode>();
-	}
-
-	public static SpecAnalyser createSpecAnalyser(ModuleNode m, ConfigfileEvaluator conEval) {
-		SpecAnalyser specAnalyser = new SpecAnalyser(m);
-		specAnalyser.spec = conEval.getSpecNode();
-		specAnalyser.init = conEval.getInitNode();
-		specAnalyser.next = conEval.getNextNode();
-		specAnalyser.invariants = conEval.getInvariants();
-		specAnalyser.bConstants = conEval.getbConstantList();
-		specAnalyser.configFileEvaluator = conEval;
-
-		return specAnalyser;
-	}
-
-	public static SpecAnalyser createSpecAnalyserForTlaExpression(ModuleNode m) {
-		SpecAnalyser specAnalyser = new SpecAnalyser(m);
-
-		specAnalyser.expressionOpdefNode = m.getOpDefs()[m.getOpDefs().length - 1];
-		specAnalyser.usedDefinitions.add(specAnalyser.expressionOpdefNode);
-		specAnalyser.bDefinitionsSet.add(specAnalyser.expressionOpdefNode);
-		return specAnalyser;
-	}
-
-	public static SpecAnalyser createSpecAnalyser(ModuleNode m) {
-		SpecAnalyser specAnalyser = new SpecAnalyser(m);
-		Hashtable<String, OpDefNode> definitions = new Hashtable<String, OpDefNode>();
-		for (int i = 0; i < m.getOpDefs().length; i++) {
-			definitions.put(m.getOpDefs()[i].getName().toString(), m.getOpDefs()[i]);
-		}
-		specAnalyser.spec = definitions.get("Spec");
-		specAnalyser.init = definitions.get("Init");
-		specAnalyser.next = definitions.get("Next");
-		if (definitions.containsKey("Inv")) {
-			specAnalyser.invariants.add(definitions.get("Inv"));
-		} else if (definitions.containsKey("Invariant")) {
-			specAnalyser.invariants.add(definitions.get("Invariant"));
-		} else if (definitions.containsKey("Invariants")) {
-			specAnalyser.invariants.add(definitions.get("Invariants"));
-		}
-		// TODO are constant in the right order
-
-		specAnalyser.bConstants.addAll(Arrays.asList(m.getConstantDecls()));
-
-		return specAnalyser;
-	}
-
-	public void start()
-			throws SemanticErrorException, FrontEndException, ConfigFileErrorException, NotImplementedException {
-
-		if (spec != null) {
-			evalSpec();
-		} else {
-			evalInit();
-			evalNext();
-		}
-
-		for (OpDefNode inv : new ArrayList<OpDefNode>(invariants)) {
-			try {
-				OpApplNode opApplNode = (OpApplNode) inv.getBody();
-
-				OpDefNode opDefNode = (OpDefNode) opApplNode.getOperator();
-
-				if (opDefNode.getKind() == UserDefinedOpKind && !BBuiltInOPs.contains(opDefNode.getName())) {
-					int i = invariants.indexOf(inv);
-					invariants.set(i, opDefNode);
-				}
-			} catch (ClassCastException e) {
-			}
-		}
-
-		OperationsFinder operationsFinder = new OperationsFinder(this);
-		bOperations = operationsFinder.getBOperations();
-
-		UsedDefinitionsFinder definitionFinder = new UsedDefinitionsFinder(this);
-		this.usedDefinitions = definitionFinder.getUsedDefinitions();
-
-		BDefinitionsFinder bDefinitionFinder = new BDefinitionsFinder(this);
-		this.bDefinitionsSet = bDefinitionFinder.getBDefinitionsSet();
-		// usedDefinitions.addAll(bDefinitionsSet);
-
-		// test whether there is a init predicate if there is a variable
-		if (moduleNode.getVariableDecls().length > 0 && inits == null) {
-			throw new SemanticErrorException("No initial predicate is defined.");
-		}
-
-		// check if there is B constant with arguments.
-		for (int i = 0; i < bConstants.size(); i++) {
-			OpDeclNode con = bConstants.get(i);
-			if (con.getArity() > 0) {
-				throw new ConfigFileErrorException(
-						String.format("Constant '%s' must be overriden in the configuration file.", con.getName()));
-			}
-		}
-		findRecursiveConstructs();
-
-		for (OpDeclNode var : moduleNode.getVariableDecls()) {
-			namingHashTable.put(var.getName().toString(), var);
-		}
-		for (OpDeclNode con : moduleNode.getConstantDecls()) {
-			namingHashTable.put(con.getName().toString(), con);
-		}
-		for (OpDefNode def : usedDefinitions) {
-			namingHashTable.put(def.getName().toString(), def);
-		}
-
-	}
-
-	private void evalInit() {
-		if (init != null) {
-			inits.add(init.getBody());
-		}
-	}
-
-	private void evalNext() throws FrontEndException {
-		if (next != null) {
-			this.nextExpr = next.getBody();
-		}
-	}
-
-	public void evalSpec() throws SemanticErrorException, FrontEndException {
-		if (spec != null) {
-			processConfigSpec(spec.getBody());
-		}
-
-	}
-
-	private void processConfigSpec(ExprNode exprNode) throws SemanticErrorException, FrontEndException {
-
-		if (exprNode instanceof OpApplNode) {
-			OpApplNode opApp = (OpApplNode) exprNode;
-			ExprOrOpArgNode[] args = opApp.getArgs();
-			if (args.length == 0) {
-				SymbolNode opNode = opApp.getOperator();
-				if (opNode instanceof OpDefNode) {
-					OpDefNode def = (OpDefNode) opNode;
-					ExprNode body = def.getBody();
-					body.levelCheck(1);
-					if (body.getLevel() == 1) {
-						inits.add(exprNode);
-					} else {
-						processConfigSpec(body);
-					}
-					return;
-				}
-				throw new SemanticErrorException("Can not handle specification conjunction.");
-			}
-
-			int opcode = BuiltInOPs.getOpCode(opApp.getOperator().getName());
-			if (opcode == OPCODE_cl || opcode == OPCODE_land) {
-				for (int i = 0; i < args.length; i++) {
-					this.processConfigSpec((ExprNode) args[i]);
-				}
-				return;
-			}
-
-			if (opcode == OPCODE_box) {
-				SemanticNode boxArg = args[0];
-				if ((boxArg instanceof OpApplNode)
-						&& BuiltInOPs.getOpCode(((OpApplNode) boxArg).getOperator().getName()) == OPCODE_sa) {
-					ExprNode next = (ExprNode) ((OpApplNode) boxArg).getArgs()[0];
-					this.nextExpr = next;
-					return;
-				}
-			}
-		}
-		if (exprNode.getLevel() <= 1) {
-			// init
-			inits.add(exprNode);
-		} else if (exprNode.getLevel() == 3) {
-			// temporal
-
-		} else {
-			throw new SemanticErrorException("Can not handle specification conjunction.");
-		}
-
-	}
-
-	private void findRecursiveConstructs() throws NotImplementedException {
-		Set<OpDefNode> set = new HashSet<OpDefNode>(usedDefinitions);
-		for (OpDefNode def : set) {
-			if (def.getInRecursive()) {
-				throw new NotImplementedException("Recursive definitions are currently not supported: " + def.getName()
-						+ "\n" + def.getLocation());
-				// bDefinitionsSet.remove(def);
-				// RecursiveDefinition rd = new RecursiveDefinition(def);
-				// recursiveDefinitions.add(rd);
-			} else if (def.getBody() instanceof OpApplNode) {
-				OpApplNode o = (OpApplNode) def.getBody();
-				switch (getOpCode(o.getOperator().getName())) {
-				case OPCODE_rfs: { // recursive Function
-					bDefinitionsSet.remove(def);
-					recursiveFunctions.add(def);
-				}
-				}
-			}
-		}
-	}
-
-	public ArrayList<BOperation> getBOperations() {
-		return this.bOperations;
-	}
-
-	public ArrayList<ExprNode> getInits() {
-		return this.inits;
-	}
-
-	public ExprNode getNext() {
-		return this.nextExpr;
-	}
-
-	public Set<OpDefNode> getBDefinitions() {
-		return bDefinitionsSet;
-	}
-
-	public Hashtable<OpDefNode, FormalParamNode[]> getLetParams() {
-		return new Hashtable<OpDefNode, FormalParamNode[]>(letParams);
-	}
-
-	public ArrayList<String> getDefinitionMacros() {
-		return definitionMacros;
-	}
-
-	public Set<OpDefNode> getUsedDefinitions() {
-		return usedDefinitions;
-	}
-
-	public ArrayList<OpDefNode> getRecursiveFunctions() {
-		return recursiveFunctions;
-	}
-
-	public ArrayList<RecursiveDefinition> getRecursiveDefinitions() {
-		return recursiveDefinitions;
-	}
-
-	public ModuleNode getModuleNode() {
-		return this.moduleNode;
-	}
-
-	public ConfigfileEvaluator getConfigFileEvaluator() {
-		return configFileEvaluator;
-	}
-
-	public ArrayList<OpDefNode> getInvariants() {
-		return invariants;
-	}
-
-	public OpDefNode getInitDef() {
-		return init;
-	}
-
-	public OpDefNode getExpressionOpdefNode() {
-		return expressionOpdefNode;
-	}
-
-	public SymbolNode getSymbolNodeByName(String name) {
-		return namingHashTable.get(name);
-	}
-
-}
+package de.tla2b.analysis;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import de.tla2b.config.ConfigfileEvaluator;
+import de.tla2b.exceptions.ConfigFileErrorException;
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.NotImplementedException;
+import de.tla2b.exceptions.SemanticErrorException;
+import de.tla2b.global.BBuiltInOPs;
+import de.tla2b.global.TranslationGlobals;
+import de.tla2b.translation.BDefinitionsFinder;
+import de.tla2b.translation.OperationsFinder;
+import de.tla2b.translation.UsedDefinitionsFinder;
+import tla2sany.semantic.ASTConstants;
+import tla2sany.semantic.ExprNode;
+import tla2sany.semantic.ExprOrOpArgNode;
+import tla2sany.semantic.FormalParamNode;
+import tla2sany.semantic.ModuleNode;
+import tla2sany.semantic.OpApplNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+import tla2sany.semantic.SemanticNode;
+import tla2sany.semantic.SymbolNode;
+import tlc2.tool.BuiltInOPs;
+import tlc2.tool.ToolGlobals;
+
+public class SpecAnalyser extends BuiltInOPs implements ASTConstants, ToolGlobals, TranslationGlobals {
+	private OpDefNode spec;
+	private OpDefNode init;
+	private OpDefNode next;
+	private ArrayList<OpDefNode> invariants = new ArrayList<>();
+
+	private OpDefNode expressionOpdefNode;
+	private Hashtable<String, SymbolNode> namingHashTable = new Hashtable<>();
+
+	private final ModuleNode moduleNode;
+	private ExprNode nextExpr;
+
+	private ArrayList<OpDeclNode> bConstants;
+	// used to check if a b constant has arguments and is not overriden in the
+	// configfile
+
+	private ArrayList<BOperation> bOperations = new ArrayList<BOperation>();
+	private ArrayList<ExprNode> inits = new ArrayList<ExprNode>();
+
+	private Set<OpDefNode> bDefinitionsSet = new HashSet<OpDefNode>();
+	// set of OpDefNodes which will appear in the resulting B Machine
+	private Set<OpDefNode> usedDefinitions = new HashSet<OpDefNode>();
+	// definitions which are used for the type inference algorithm
+	private Hashtable<OpDefNode, FormalParamNode[]> letParams = new Hashtable<>();
+	// additional parameters of an let Operator, these parameters are from the
+	// surrounding operator
+	private ArrayList<String> definitionMacros = new ArrayList<>();
+
+	private ArrayList<OpDefNode> recursiveFunctions = new ArrayList<>();
+
+	private ArrayList<RecursiveDefinition> recursiveDefinitions = new ArrayList<>();
+
+	private ConfigfileEvaluator configFileEvaluator;
+
+	private SpecAnalyser(ModuleNode m) {
+		this.moduleNode = m;
+		this.bConstants = new ArrayList<OpDeclNode>();
+	}
+
+	public static SpecAnalyser createSpecAnalyser(ModuleNode m, ConfigfileEvaluator conEval) {
+		SpecAnalyser specAnalyser = new SpecAnalyser(m);
+		specAnalyser.spec = conEval.getSpecNode();
+		specAnalyser.init = conEval.getInitNode();
+		specAnalyser.next = conEval.getNextNode();
+		specAnalyser.invariants = conEval.getInvariants();
+		specAnalyser.bConstants = conEval.getbConstantList();
+		specAnalyser.configFileEvaluator = conEval;
+
+		return specAnalyser;
+	}
+
+	public static SpecAnalyser createSpecAnalyserForTlaExpression(ModuleNode m) {
+		SpecAnalyser specAnalyser = new SpecAnalyser(m);
+
+		specAnalyser.expressionOpdefNode = m.getOpDefs()[m.getOpDefs().length - 1];
+		specAnalyser.usedDefinitions.add(specAnalyser.expressionOpdefNode);
+		specAnalyser.bDefinitionsSet.add(specAnalyser.expressionOpdefNode);
+		return specAnalyser;
+	}
+
+	public static SpecAnalyser createSpecAnalyser(ModuleNode m) {
+		SpecAnalyser specAnalyser = new SpecAnalyser(m);
+		Hashtable<String, OpDefNode> definitions = new Hashtable<String, OpDefNode>();
+		for (int i = 0; i < m.getOpDefs().length; i++) {
+			definitions.put(m.getOpDefs()[i].getName().toString(), m.getOpDefs()[i]);
+		}
+		specAnalyser.spec = definitions.get("Spec");
+		specAnalyser.init = definitions.get("Init");
+		specAnalyser.next = definitions.get("Next");
+		if (definitions.containsKey("Inv")) {
+			specAnalyser.invariants.add(definitions.get("Inv"));
+		} else if (definitions.containsKey("Invariant")) {
+			specAnalyser.invariants.add(definitions.get("Invariant"));
+		} else if (definitions.containsKey("Invariants")) {
+			specAnalyser.invariants.add(definitions.get("Invariants"));
+		}
+		// TODO are constant in the right order
+
+		specAnalyser.bConstants.addAll(Arrays.asList(m.getConstantDecls()));
+
+		return specAnalyser;
+	}
+
+	public void start()
+			throws SemanticErrorException, FrontEndException, ConfigFileErrorException, NotImplementedException {
+
+		if (spec != null) {
+			evalSpec();
+		} else {
+			evalInit();
+			evalNext();
+		}
+
+		for (OpDefNode inv : new ArrayList<OpDefNode>(invariants)) {
+			try {
+				OpApplNode opApplNode = (OpApplNode) inv.getBody();
+
+				OpDefNode opDefNode = (OpDefNode) opApplNode.getOperator();
+
+				if (opDefNode.getKind() == UserDefinedOpKind && !BBuiltInOPs.contains(opDefNode.getName())) {
+					int i = invariants.indexOf(inv);
+					invariants.set(i, opDefNode);
+				}
+			} catch (ClassCastException e) {
+			}
+		}
+
+		OperationsFinder operationsFinder = new OperationsFinder(this);
+		bOperations = operationsFinder.getBOperations();
+
+		UsedDefinitionsFinder definitionFinder = new UsedDefinitionsFinder(this);
+		this.usedDefinitions = definitionFinder.getUsedDefinitions();
+
+		BDefinitionsFinder bDefinitionFinder = new BDefinitionsFinder(this);
+		this.bDefinitionsSet = bDefinitionFinder.getBDefinitionsSet();
+		// usedDefinitions.addAll(bDefinitionsSet);
+
+		// test whether there is a init predicate if there is a variable
+		if (moduleNode.getVariableDecls().length > 0 && inits == null) {
+			throw new SemanticErrorException("No initial predicate is defined.");
+		}
+
+		// check if there is B constant with arguments.
+		for (int i = 0; i < bConstants.size(); i++) {
+			OpDeclNode con = bConstants.get(i);
+			if (con.getArity() > 0) {
+				throw new ConfigFileErrorException(
+						String.format("Constant '%s' must be overriden in the configuration file.", con.getName()));
+			}
+		}
+		findRecursiveConstructs();
+
+		for (OpDeclNode var : moduleNode.getVariableDecls()) {
+			namingHashTable.put(var.getName().toString(), var);
+		}
+		for (OpDeclNode con : moduleNode.getConstantDecls()) {
+			namingHashTable.put(con.getName().toString(), con);
+		}
+		for (OpDefNode def : usedDefinitions) {
+			namingHashTable.put(def.getName().toString(), def);
+		}
+
+	}
+
+	private void evalInit() {
+		if (init != null) {
+			inits.add(init.getBody());
+		}
+	}
+
+	private void evalNext() throws FrontEndException {
+		if (next != null) {
+			this.nextExpr = next.getBody();
+		}
+	}
+
+	public void evalSpec() throws SemanticErrorException, FrontEndException {
+		if (spec != null) {
+			processConfigSpec(spec.getBody());
+		}
+
+	}
+
+	private void processConfigSpec(ExprNode exprNode) throws SemanticErrorException, FrontEndException {
+
+		if (exprNode instanceof OpApplNode) {
+			OpApplNode opApp = (OpApplNode) exprNode;
+			ExprOrOpArgNode[] args = opApp.getArgs();
+			if (args.length == 0) {
+				SymbolNode opNode = opApp.getOperator();
+				if (opNode instanceof OpDefNode) {
+					OpDefNode def = (OpDefNode) opNode;
+					ExprNode body = def.getBody();
+					body.levelCheck(1);
+					if (body.getLevel() == 1) {
+						inits.add(exprNode);
+					} else {
+						processConfigSpec(body);
+					}
+					return;
+				}
+				throw new SemanticErrorException("Can not handle specification conjunction.");
+			}
+
+			int opcode = BuiltInOPs.getOpCode(opApp.getOperator().getName());
+			if (opcode == OPCODE_cl || opcode == OPCODE_land) {
+				for (int i = 0; i < args.length; i++) {
+					this.processConfigSpec((ExprNode) args[i]);
+				}
+				return;
+			}
+
+			if (opcode == OPCODE_box) {
+				SemanticNode boxArg = args[0];
+				if ((boxArg instanceof OpApplNode)
+						&& BuiltInOPs.getOpCode(((OpApplNode) boxArg).getOperator().getName()) == OPCODE_sa) {
+					ExprNode next = (ExprNode) ((OpApplNode) boxArg).getArgs()[0];
+					this.nextExpr = next;
+					return;
+				}
+			}
+		}
+		if (exprNode.getLevel() <= 1) {
+			// init
+			inits.add(exprNode);
+		} else if (exprNode.getLevel() == 3) {
+			// temporal
+
+		} else {
+			throw new SemanticErrorException("Can not handle specification conjunction.");
+		}
+
+	}
+
+	private void findRecursiveConstructs() throws NotImplementedException {
+		Set<OpDefNode> set = new HashSet<OpDefNode>(usedDefinitions);
+		for (OpDefNode def : set) {
+			if (def.getInRecursive()) {
+				throw new NotImplementedException("Recursive definitions are currently not supported: " + def.getName()
+						+ "\n" + def.getLocation());
+				// bDefinitionsSet.remove(def);
+				// RecursiveDefinition rd = new RecursiveDefinition(def);
+				// recursiveDefinitions.add(rd);
+			} else if (def.getBody() instanceof OpApplNode) {
+				OpApplNode o = (OpApplNode) def.getBody();
+				switch (getOpCode(o.getOperator().getName())) {
+				case OPCODE_rfs: { // recursive Function
+					bDefinitionsSet.remove(def);
+					recursiveFunctions.add(def);
+				}
+				}
+			}
+		}
+	}
+
+	public ArrayList<BOperation> getBOperations() {
+		return this.bOperations;
+	}
+
+	public ArrayList<ExprNode> getInits() {
+		return this.inits;
+	}
+
+	public ExprNode getNext() {
+		return this.nextExpr;
+	}
+
+	public Set<OpDefNode> getBDefinitions() {
+		return bDefinitionsSet;
+	}
+
+	public Hashtable<OpDefNode, FormalParamNode[]> getLetParams() {
+		return new Hashtable<OpDefNode, FormalParamNode[]>(letParams);
+	}
+
+	public ArrayList<String> getDefinitionMacros() {
+		return definitionMacros;
+	}
+
+	public Set<OpDefNode> getUsedDefinitions() {
+		return usedDefinitions;
+	}
+
+	public ArrayList<OpDefNode> getRecursiveFunctions() {
+		return recursiveFunctions;
+	}
+
+	public ArrayList<RecursiveDefinition> getRecursiveDefinitions() {
+		return recursiveDefinitions;
+	}
+
+	public ModuleNode getModuleNode() {
+		return this.moduleNode;
+	}
+
+	public ConfigfileEvaluator getConfigFileEvaluator() {
+		return configFileEvaluator;
+	}
+
+	public ArrayList<OpDefNode> getInvariants() {
+		return invariants;
+	}
+
+	public OpDefNode getInitDef() {
+		return init;
+	}
+
+	public OpDefNode getExpressionOpdefNode() {
+		return expressionOpdefNode;
+	}
+
+	public SymbolNode getSymbolNodeByName(String name) {
+		return namingHashTable.get(name);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/analysis/SymbolRenamer.java b/src/main/java/de/tla2b/analysis/SymbolRenamer.java
index 50267aa6e0c5125291b3c4c2cb1097a7bc76c5d6..d2892f66af1c836355711c0c7f0457e76d2fed90 100644
--- a/src/main/java/de/tla2b/analysis/SymbolRenamer.java
+++ b/src/main/java/de/tla2b/analysis/SymbolRenamer.java
@@ -1,354 +1,354 @@
-package de.tla2b.analysis;
-
-
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-
-import de.tla2b.global.BBuiltInOPs;
-import de.tla2b.global.TranslationGlobals;
-import tla2sany.semantic.ASTConstants;
-import tla2sany.semantic.AssumeNode;
-import tla2sany.semantic.FormalParamNode;
-import tla2sany.semantic.LetInNode;
-import tla2sany.semantic.ModuleNode;
-import tla2sany.semantic.OpApplNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-import tla2sany.semantic.SemanticNode;
-import tlc2.tool.BuiltInOPs;
-
-public class SymbolRenamer extends BuiltInOPs implements TranslationGlobals,
-		ASTConstants {
-
-	private final static Set<String> KEYWORDS = new HashSet<String>();
-	static {
-		KEYWORDS.add("seq");
-		KEYWORDS.add("left");
-		KEYWORDS.add("right");
-		KEYWORDS.add("max");
-		KEYWORDS.add("min");
-		KEYWORDS.add("succ");
-		KEYWORDS.add("pred");
-		KEYWORDS.add("dom");
-		KEYWORDS.add("ran");
-		KEYWORDS.add("fnc");
-		KEYWORDS.add("rel");
-		KEYWORDS.add("id");
-		KEYWORDS.add("card");
-		KEYWORDS.add("POW");
-		KEYWORDS.add("POW1");
-		KEYWORDS.add("FIN");
-		KEYWORDS.add("FIN1");
-		KEYWORDS.add("size");
-		KEYWORDS.add("rev");
-		KEYWORDS.add("first");
-		KEYWORDS.add("last");
-		KEYWORDS.add("front");
-		KEYWORDS.add("tail");
-		KEYWORDS.add("conc");
-		KEYWORDS.add("struct");
-		KEYWORDS.add("rec");
-		KEYWORDS.add("tree");
-		KEYWORDS.add("btree");
-		KEYWORDS.add("skip");
-		KEYWORDS.add("ANY");
-		KEYWORDS.add("WHERE");
-		KEYWORDS.add("END");
-		KEYWORDS.add("BE");
-		KEYWORDS.add("VAR");
-		KEYWORDS.add("ASSERT");
-		KEYWORDS.add("CHOICE");
-		KEYWORDS.add("OR");
-		KEYWORDS.add("SELECT");
-		KEYWORDS.add("EITHER");
-		KEYWORDS.add("WHEN");
-		KEYWORDS.add("BEGIN");
-		KEYWORDS.add("MACHINE");
-		KEYWORDS.add("REFINEMENT");
-		KEYWORDS.add("IMPLEMENTATION");
-		KEYWORDS.add("SETS");
-		KEYWORDS.add("CONSTRAINTS");
-		KEYWORDS.add("MODEL");
-		KEYWORDS.add("SYSTEM");
-		KEYWORDS.add("MACHINE");
-		KEYWORDS.add("EVENTS");
-		KEYWORDS.add("OPERATIONS");
-	}
-
-	private final static Hashtable<String, String> INFIX_OPERATOR = new Hashtable<String, String>();
-	static {
-		INFIX_OPERATOR.put("!!", "exclamationmark2");
-		INFIX_OPERATOR.put("??", "questionmark2");
-		INFIX_OPERATOR.put("&", "ampersand1");
-		INFIX_OPERATOR.put("&&", "ampersand2");
-		INFIX_OPERATOR.put("@@", "at2");
-		INFIX_OPERATOR.put("++", "plus2");
-		INFIX_OPERATOR.put("--", "minus2");
-		INFIX_OPERATOR.put("^", "circumflex1");
-		INFIX_OPERATOR.put("^^", "circumflex2");
-		INFIX_OPERATOR.put("##", "hash2");
-		INFIX_OPERATOR.put("%%", "percent2");
-		INFIX_OPERATOR.put("$", "dollar1");
-		INFIX_OPERATOR.put("$$", "dollar2");
-		INFIX_OPERATOR.put("|", "pipe1");
-		INFIX_OPERATOR.put("||", "pipe2");
-		INFIX_OPERATOR.put("//", "slash2");
-		INFIX_OPERATOR.put("**", "mult2");
-		INFIX_OPERATOR.put("...", "dot3");
-	}
-
-	private final static Hashtable<String, String> BBUILTIN_OPERATOR = new Hashtable<String, String>();
-	static {
-		BBUILTIN_OPERATOR.put("+", "plus");
-		BBUILTIN_OPERATOR.put("-", "minus");
-		BBUILTIN_OPERATOR.put("*", "mult");
-		BBUILTIN_OPERATOR.put("^", "power");
-		BBUILTIN_OPERATOR.put("<", "lt");
-		BBUILTIN_OPERATOR.put(">", "gt");
-		BBUILTIN_OPERATOR.put("\\leq", "leq");
-		BBUILTIN_OPERATOR.put("\\geq", "geq");
-		BBUILTIN_OPERATOR.put("%", "modulo");
-		BBUILTIN_OPERATOR.put("\\div", "div");
-		BBUILTIN_OPERATOR.put("..", "dot2");
-	}
-
-	private ModuleNode moduleNode;
-	private Set<OpDefNode> usedDefinitions;
-
-	private Set<String> globalNames = new HashSet<String>();
-	private Hashtable<OpDefNode, Set<String>> usedNamesTable = new Hashtable<OpDefNode, Set<String>>();
-
-	public SymbolRenamer(ModuleNode moduleNode, SpecAnalyser specAnalyser) {
-		this.moduleNode = moduleNode;
-		this.usedDefinitions = specAnalyser.getUsedDefinitions();
-	}
-
-	public SymbolRenamer(ModuleNode moduleNode) {
-		this.moduleNode = moduleNode;
-		usedDefinitions = new HashSet<OpDefNode>();
-		OpDefNode[] defs = moduleNode.getOpDefs();
-		usedDefinitions.add(defs[defs.length - 1]);
-	}
-
-	public void start() {
-		// Variables
-		for (int i = 0; i < moduleNode.getVariableDecls().length; i++) {
-			OpDeclNode v = moduleNode.getVariableDecls()[i];
-			String newName = incName(v.getName().toString());
-			globalNames.add(newName);
-			v.setToolObject(NEW_NAME, newName);
-		}
-
-		// constants
-		for (int i = 0; i < moduleNode.getConstantDecls().length; i++) {
-			OpDeclNode c = moduleNode.getConstantDecls()[i];
-			String newName = incName(c.getName().toString());
-			globalNames.add(newName);
-			c.setToolObject(NEW_NAME, newName);
-		}
-
-		for (int i = 0; i < moduleNode.getOpDefs().length; i++) {
-			OpDefNode def = moduleNode.getOpDefs()[i];
-			String newName = getOperatorName(def);
-			globalNames.add(newName);
-			def.setToolObject(NEW_NAME, newName);
-			usedNamesTable.put(def, new HashSet<String>());
-		}
-
-		for (int i = 0; i < moduleNode.getAssumptions().length; i++) {
-			AssumeNode assumeNode = moduleNode.getAssumptions()[i];
-			visitNode(assumeNode.getAssume(), new HashSet<String>());
-		}
-
-		for (int i = moduleNode.getOpDefs().length - 1; i >= 0; i--) {
-			OpDefNode def = moduleNode.getOpDefs()[i];
-			Set<String> usedNames = usedNamesTable.get(def);
-			for (int j = 0; j < def.getParams().length; j++) {
-				FormalParamNode p = def.getParams()[j];
-				String paramName = p.getName().toString();
-				String newParamName = incName(paramName);
-				p.setToolObject(NEW_NAME, newParamName);
-				//Parameter of different definitions calling each other can have the same name
-				//usedNames.add(newParamName);
-			}
-			visitNode(def.getBody(), usedNames);
-		}
-
-	}
-
-	private void visitNode(SemanticNode n, Set<String> usedNames) {
-		// System.out.println(n.toString(1)+ " "+ n.getKind());
-
-		switch (n.getKind()) {
-
-		case LetInKind: {
-			LetInNode letInNode = (LetInNode) n;
-			OpDefNode[] defs = letInNode.getLets();
-
-			// Initialize all local definitions (get a new name, get an empty
-			// list)
-			for (int i = 0; i < defs.length; i++) {
-				OpDefNode def = defs[i];
-				String newName = getOperatorName(def);
-				globalNames.add(newName);
-				def.setToolObject(NEW_NAME, newName);
-				usedNamesTable.put(def, new HashSet<String>(usedNames));
-			}
-
-			// first visit the IN expression
-			visitNode(letInNode.getBody(), usedNames);
-
-			// visit the definition itself
-			for (int i = defs.length - 1; i >= 0; i--) {
-				OpDefNode def = defs[i];
-				Set<String> usedNamesOfDef = usedNamesTable.get(def);
-				for (int j = 0; j < def.getParams().length; j++) {
-					FormalParamNode p = def.getParams()[j];
-					String paramName = p.getName().toString();
-					String newParamName = incName(paramName);
-					p.setToolObject(NEW_NAME, newParamName);
-					//usedNamesOfDef.add(newParamName);
-				}
-				visitNode(def.getBody(), usedNamesOfDef);
-			}
-			return;
-		}
-
-		case OpApplKind: {
-			OpApplNode opApplNode = (OpApplNode) n;
-			switch (opApplNode.getOperator().getKind()) {
-
-			case BuiltInKind: {
-				visitBuiltinNode(opApplNode, usedNames);
-				return;
-			}
-
-			case UserDefinedOpKind: {
-				OpDefNode def = (OpDefNode) opApplNode.getOperator();
-				if (BBuiltInOPs.contains(def.getName())) {
-					break;
-				}
-				Set<String> set = usedNamesTable.get(def);
-				if (set!=null){
-					usedNamesTable.get(def).addAll(usedNames);
-				}
-				
-				
-				for (int i = 0; i < n.getChildren().length; i++) {
-					visitNode(opApplNode.getArgs()[i], usedNames);
-				}
-				return;
-			}
-			}
-
-			for (int i = 0; i < opApplNode.getArgs().length; i++) {
-				visitNode(opApplNode.getArgs()[i], usedNames);
-			}
-			return;
-		}
-		}
-
-		if (n.getChildren() != null) {
-			for (int i = 0; i < n.getChildren().length; i++) {
-				visitNode(n.getChildren()[i], usedNames);
-			}
-		}
-	}
-
-	private void visitBuiltinNode(OpApplNode opApplNode, Set<String> usedNames) {
-
-		switch (getOpCode(opApplNode.getOperator().getName())) {
-
-		case OPCODE_nrfs:
-		case OPCODE_fc: // Represents [x \in S |-> e]
-		case OPCODE_bc: // CHOOSE x \in S: P
-		case OPCODE_soa: // $SetOfAll Represents {e : p1 \in S, p2,p3 \in S2}
-		case OPCODE_sso: // $SubsetOf Represents {x \in S : P}
-		case OPCODE_bf: // \A x \in S : P
-		case OPCODE_be: // \E x \in S : P
-		{
-			FormalParamNode[][] params = opApplNode.getBdedQuantSymbolLists();
-			Set<String> newUsedNames = new HashSet<String>(usedNames);
-			for (int i = 0; i < params.length; i++) {
-				for (int j = 0; j < params[i].length; j++) {
-					FormalParamNode param = params[i][j];
-					String paramName = param.getName().toString();
-					String newName = incName(paramName, usedNames);
-					param.setToolObject(NEW_NAME, newName);
-					newUsedNames.add(newName);
-				}
-			}
-			for (int i = 0; i < opApplNode.getBdedQuantBounds().length; i++) {
-				visitNode(opApplNode.getBdedQuantBounds()[i], usedNames);
-			}
-
-			visitNode(opApplNode.getArgs()[0], newUsedNames);
-
-			return;
-		}
-
-		default:
-			for (int i = 0; i < opApplNode.getArgs().length; i++) {
-				if (opApplNode.getArgs()[i] != null) {
-					visitNode(opApplNode.getArgs()[i], usedNames);
-				}
-			}
-
-		}
-	}
-
-	private String getOperatorName(OpDefNode def) {
-		String newName = def.getName().toString();
-
-		if (BBUILTIN_OPERATOR.containsKey(newName)) {
-			// a B built-in operator is defined outside of a standard module
-			if (!STANDARD_MODULES.contains(def.getSource()
-					.getOriginallyDefinedInModuleNode().getName().toString())) {
-				return incName(BBUILTIN_OPERATOR.get(newName));
-			}
-		}
-
-		// replace invalid infix operator names
-		for (String e : INFIX_OPERATOR.keySet()) {
-			if (newName.contains(e)) {
-				newName = newName.replace(e, INFIX_OPERATOR.get(e));
-			}
-		}
-
-		// replace exclamation marks
-		if (newName.contains("!")) {
-			newName = newName.replace('!', '_');
-		}
-
-		// replace slashes
-		if (newName.contains("\\")) {
-			newName = newName.replace("\\", "");
-		}
-
-		return incName(newName);
-	}
-
-	private Boolean existingName(String name) {
-		if (globalNames.contains(name) || KEYWORDS.contains(name)) {
-			return true;
-		} else
-			return false;
-	}
-
-	private String incName(String name) {
-		String res = name;
-		for (int i = 1; existingName(res); i++) {
-			res = name + "_" + i;
-		}
-		return res;
-	}
-
-	private String incName(String name, Set<String> tempSet) {
-		String res = name;
-		for (int i = 1; existingName(res) || tempSet.contains(res); i++) {
-			res = name + "_" + i;
-		}
-		return res;
-	}
-}
+package de.tla2b.analysis;
+
+
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import de.tla2b.global.BBuiltInOPs;
+import de.tla2b.global.TranslationGlobals;
+import tla2sany.semantic.ASTConstants;
+import tla2sany.semantic.AssumeNode;
+import tla2sany.semantic.FormalParamNode;
+import tla2sany.semantic.LetInNode;
+import tla2sany.semantic.ModuleNode;
+import tla2sany.semantic.OpApplNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+import tla2sany.semantic.SemanticNode;
+import tlc2.tool.BuiltInOPs;
+
+public class SymbolRenamer extends BuiltInOPs implements TranslationGlobals,
+		ASTConstants {
+
+	private final static Set<String> KEYWORDS = new HashSet<String>();
+	static {
+		KEYWORDS.add("seq");
+		KEYWORDS.add("left");
+		KEYWORDS.add("right");
+		KEYWORDS.add("max");
+		KEYWORDS.add("min");
+		KEYWORDS.add("succ");
+		KEYWORDS.add("pred");
+		KEYWORDS.add("dom");
+		KEYWORDS.add("ran");
+		KEYWORDS.add("fnc");
+		KEYWORDS.add("rel");
+		KEYWORDS.add("id");
+		KEYWORDS.add("card");
+		KEYWORDS.add("POW");
+		KEYWORDS.add("POW1");
+		KEYWORDS.add("FIN");
+		KEYWORDS.add("FIN1");
+		KEYWORDS.add("size");
+		KEYWORDS.add("rev");
+		KEYWORDS.add("first");
+		KEYWORDS.add("last");
+		KEYWORDS.add("front");
+		KEYWORDS.add("tail");
+		KEYWORDS.add("conc");
+		KEYWORDS.add("struct");
+		KEYWORDS.add("rec");
+		KEYWORDS.add("tree");
+		KEYWORDS.add("btree");
+		KEYWORDS.add("skip");
+		KEYWORDS.add("ANY");
+		KEYWORDS.add("WHERE");
+		KEYWORDS.add("END");
+		KEYWORDS.add("BE");
+		KEYWORDS.add("VAR");
+		KEYWORDS.add("ASSERT");
+		KEYWORDS.add("CHOICE");
+		KEYWORDS.add("OR");
+		KEYWORDS.add("SELECT");
+		KEYWORDS.add("EITHER");
+		KEYWORDS.add("WHEN");
+		KEYWORDS.add("BEGIN");
+		KEYWORDS.add("MACHINE");
+		KEYWORDS.add("REFINEMENT");
+		KEYWORDS.add("IMPLEMENTATION");
+		KEYWORDS.add("SETS");
+		KEYWORDS.add("CONSTRAINTS");
+		KEYWORDS.add("MODEL");
+		KEYWORDS.add("SYSTEM");
+		KEYWORDS.add("MACHINE");
+		KEYWORDS.add("EVENTS");
+		KEYWORDS.add("OPERATIONS");
+	}
+
+	private final static Hashtable<String, String> INFIX_OPERATOR = new Hashtable<String, String>();
+	static {
+		INFIX_OPERATOR.put("!!", "exclamationmark2");
+		INFIX_OPERATOR.put("??", "questionmark2");
+		INFIX_OPERATOR.put("&", "ampersand1");
+		INFIX_OPERATOR.put("&&", "ampersand2");
+		INFIX_OPERATOR.put("@@", "at2");
+		INFIX_OPERATOR.put("++", "plus2");
+		INFIX_OPERATOR.put("--", "minus2");
+		INFIX_OPERATOR.put("^", "circumflex1");
+		INFIX_OPERATOR.put("^^", "circumflex2");
+		INFIX_OPERATOR.put("##", "hash2");
+		INFIX_OPERATOR.put("%%", "percent2");
+		INFIX_OPERATOR.put("$", "dollar1");
+		INFIX_OPERATOR.put("$$", "dollar2");
+		INFIX_OPERATOR.put("|", "pipe1");
+		INFIX_OPERATOR.put("||", "pipe2");
+		INFIX_OPERATOR.put("//", "slash2");
+		INFIX_OPERATOR.put("**", "mult2");
+		INFIX_OPERATOR.put("...", "dot3");
+	}
+
+	private final static Hashtable<String, String> BBUILTIN_OPERATOR = new Hashtable<String, String>();
+	static {
+		BBUILTIN_OPERATOR.put("+", "plus");
+		BBUILTIN_OPERATOR.put("-", "minus");
+		BBUILTIN_OPERATOR.put("*", "mult");
+		BBUILTIN_OPERATOR.put("^", "power");
+		BBUILTIN_OPERATOR.put("<", "lt");
+		BBUILTIN_OPERATOR.put(">", "gt");
+		BBUILTIN_OPERATOR.put("\\leq", "leq");
+		BBUILTIN_OPERATOR.put("\\geq", "geq");
+		BBUILTIN_OPERATOR.put("%", "modulo");
+		BBUILTIN_OPERATOR.put("\\div", "div");
+		BBUILTIN_OPERATOR.put("..", "dot2");
+	}
+
+	private ModuleNode moduleNode;
+	private Set<OpDefNode> usedDefinitions;
+
+	private Set<String> globalNames = new HashSet<String>();
+	private Hashtable<OpDefNode, Set<String>> usedNamesTable = new Hashtable<OpDefNode, Set<String>>();
+
+	public SymbolRenamer(ModuleNode moduleNode, SpecAnalyser specAnalyser) {
+		this.moduleNode = moduleNode;
+		this.usedDefinitions = specAnalyser.getUsedDefinitions();
+	}
+
+	public SymbolRenamer(ModuleNode moduleNode) {
+		this.moduleNode = moduleNode;
+		usedDefinitions = new HashSet<OpDefNode>();
+		OpDefNode[] defs = moduleNode.getOpDefs();
+		usedDefinitions.add(defs[defs.length - 1]);
+	}
+
+	public void start() {
+		// Variables
+		for (int i = 0; i < moduleNode.getVariableDecls().length; i++) {
+			OpDeclNode v = moduleNode.getVariableDecls()[i];
+			String newName = incName(v.getName().toString());
+			globalNames.add(newName);
+			v.setToolObject(NEW_NAME, newName);
+		}
+
+		// constants
+		for (int i = 0; i < moduleNode.getConstantDecls().length; i++) {
+			OpDeclNode c = moduleNode.getConstantDecls()[i];
+			String newName = incName(c.getName().toString());
+			globalNames.add(newName);
+			c.setToolObject(NEW_NAME, newName);
+		}
+
+		for (int i = 0; i < moduleNode.getOpDefs().length; i++) {
+			OpDefNode def = moduleNode.getOpDefs()[i];
+			String newName = getOperatorName(def);
+			globalNames.add(newName);
+			def.setToolObject(NEW_NAME, newName);
+			usedNamesTable.put(def, new HashSet<String>());
+		}
+
+		for (int i = 0; i < moduleNode.getAssumptions().length; i++) {
+			AssumeNode assumeNode = moduleNode.getAssumptions()[i];
+			visitNode(assumeNode.getAssume(), new HashSet<String>());
+		}
+
+		for (int i = moduleNode.getOpDefs().length - 1; i >= 0; i--) {
+			OpDefNode def = moduleNode.getOpDefs()[i];
+			Set<String> usedNames = usedNamesTable.get(def);
+			for (int j = 0; j < def.getParams().length; j++) {
+				FormalParamNode p = def.getParams()[j];
+				String paramName = p.getName().toString();
+				String newParamName = incName(paramName);
+				p.setToolObject(NEW_NAME, newParamName);
+				//Parameter of different definitions calling each other can have the same name
+				//usedNames.add(newParamName);
+			}
+			visitNode(def.getBody(), usedNames);
+		}
+
+	}
+
+	private void visitNode(SemanticNode n, Set<String> usedNames) {
+		// System.out.println(n.toString(1)+ " "+ n.getKind());
+
+		switch (n.getKind()) {
+
+		case LetInKind: {
+			LetInNode letInNode = (LetInNode) n;
+			OpDefNode[] defs = letInNode.getLets();
+
+			// Initialize all local definitions (get a new name, get an empty
+			// list)
+			for (int i = 0; i < defs.length; i++) {
+				OpDefNode def = defs[i];
+				String newName = getOperatorName(def);
+				globalNames.add(newName);
+				def.setToolObject(NEW_NAME, newName);
+				usedNamesTable.put(def, new HashSet<String>(usedNames));
+			}
+
+			// first visit the IN expression
+			visitNode(letInNode.getBody(), usedNames);
+
+			// visit the definition itself
+			for (int i = defs.length - 1; i >= 0; i--) {
+				OpDefNode def = defs[i];
+				Set<String> usedNamesOfDef = usedNamesTable.get(def);
+				for (int j = 0; j < def.getParams().length; j++) {
+					FormalParamNode p = def.getParams()[j];
+					String paramName = p.getName().toString();
+					String newParamName = incName(paramName);
+					p.setToolObject(NEW_NAME, newParamName);
+					//usedNamesOfDef.add(newParamName);
+				}
+				visitNode(def.getBody(), usedNamesOfDef);
+			}
+			return;
+		}
+
+		case OpApplKind: {
+			OpApplNode opApplNode = (OpApplNode) n;
+			switch (opApplNode.getOperator().getKind()) {
+
+			case BuiltInKind: {
+				visitBuiltinNode(opApplNode, usedNames);
+				return;
+			}
+
+			case UserDefinedOpKind: {
+				OpDefNode def = (OpDefNode) opApplNode.getOperator();
+				if (BBuiltInOPs.contains(def.getName())) {
+					break;
+				}
+				Set<String> set = usedNamesTable.get(def);
+				if (set!=null){
+					usedNamesTable.get(def).addAll(usedNames);
+				}
+				
+				
+				for (int i = 0; i < n.getChildren().length; i++) {
+					visitNode(opApplNode.getArgs()[i], usedNames);
+				}
+				return;
+			}
+			}
+
+			for (int i = 0; i < opApplNode.getArgs().length; i++) {
+				visitNode(opApplNode.getArgs()[i], usedNames);
+			}
+			return;
+		}
+		}
+
+		if (n.getChildren() != null) {
+			for (int i = 0; i < n.getChildren().length; i++) {
+				visitNode(n.getChildren()[i], usedNames);
+			}
+		}
+	}
+
+	private void visitBuiltinNode(OpApplNode opApplNode, Set<String> usedNames) {
+
+		switch (getOpCode(opApplNode.getOperator().getName())) {
+
+		case OPCODE_nrfs:
+		case OPCODE_fc: // Represents [x \in S |-> e]
+		case OPCODE_bc: // CHOOSE x \in S: P
+		case OPCODE_soa: // $SetOfAll Represents {e : p1 \in S, p2,p3 \in S2}
+		case OPCODE_sso: // $SubsetOf Represents {x \in S : P}
+		case OPCODE_bf: // \A x \in S : P
+		case OPCODE_be: // \E x \in S : P
+		{
+			FormalParamNode[][] params = opApplNode.getBdedQuantSymbolLists();
+			Set<String> newUsedNames = new HashSet<String>(usedNames);
+			for (int i = 0; i < params.length; i++) {
+				for (int j = 0; j < params[i].length; j++) {
+					FormalParamNode param = params[i][j];
+					String paramName = param.getName().toString();
+					String newName = incName(paramName, usedNames);
+					param.setToolObject(NEW_NAME, newName);
+					newUsedNames.add(newName);
+				}
+			}
+			for (int i = 0; i < opApplNode.getBdedQuantBounds().length; i++) {
+				visitNode(opApplNode.getBdedQuantBounds()[i], usedNames);
+			}
+
+			visitNode(opApplNode.getArgs()[0], newUsedNames);
+
+			return;
+		}
+
+		default:
+			for (int i = 0; i < opApplNode.getArgs().length; i++) {
+				if (opApplNode.getArgs()[i] != null) {
+					visitNode(opApplNode.getArgs()[i], usedNames);
+				}
+			}
+
+		}
+	}
+
+	private String getOperatorName(OpDefNode def) {
+		String newName = def.getName().toString();
+
+		if (BBUILTIN_OPERATOR.containsKey(newName)) {
+			// a B built-in operator is defined outside of a standard module
+			if (!STANDARD_MODULES.contains(def.getSource()
+					.getOriginallyDefinedInModuleNode().getName().toString())) {
+				return incName(BBUILTIN_OPERATOR.get(newName));
+			}
+		}
+
+		// replace invalid infix operator names
+		for (String e : INFIX_OPERATOR.keySet()) {
+			if (newName.contains(e)) {
+				newName = newName.replace(e, INFIX_OPERATOR.get(e));
+			}
+		}
+
+		// replace exclamation marks
+		if (newName.contains("!")) {
+			newName = newName.replace('!', '_');
+		}
+
+		// replace slashes
+		if (newName.contains("\\")) {
+			newName = newName.replace("\\", "");
+		}
+
+		return incName(newName);
+	}
+
+	private Boolean existingName(String name) {
+		if (globalNames.contains(name) || KEYWORDS.contains(name)) {
+			return true;
+		} else
+			return false;
+	}
+
+	private String incName(String name) {
+		String res = name;
+		for (int i = 1; existingName(res); i++) {
+			res = name + "_" + i;
+		}
+		return res;
+	}
+
+	private String incName(String name, Set<String> tempSet) {
+		String res = name;
+		for (int i = 1; existingName(res) || tempSet.contains(res); i++) {
+			res = name + "_" + i;
+		}
+		return res;
+	}
+}
diff --git a/src/main/java/de/tla2b/analysis/SymbolSorter.java b/src/main/java/de/tla2b/analysis/SymbolSorter.java
index f32ed64169ad57a4b4413ed8c67ce8a44ab52cbb..b68f74ccdb412d1e86218f19a7f92eb597256928 100644
--- a/src/main/java/de/tla2b/analysis/SymbolSorter.java
+++ b/src/main/java/de/tla2b/analysis/SymbolSorter.java
@@ -1,79 +1,79 @@
-package de.tla2b.analysis;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Hashtable;
-
-import tla2sany.semantic.ModuleNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-
-public class SymbolSorter {
-	private ModuleNode moduleNode;
-
-	public SymbolSorter(ModuleNode moduleNode) {
-		this.moduleNode = moduleNode;
-	}
-
-	public void sort() {
-		// sort constants
-		Arrays.sort(moduleNode.getConstantDecls(), new OpDeclNodeComparator());
-		// sort variables
-		Arrays.sort(moduleNode.getVariableDecls(), new OpDeclNodeComparator());
-		// sort definitions
-		Arrays.sort(moduleNode.getOpDefs(), new OpDefNodeComparator());
-	}
-	
-	public static void sortDeclNodes(OpDeclNode[] opDeclNodes){
-		Arrays.sort(opDeclNodes, new OpDeclNodeComparator());
-	}
-	
-	public static void sortOpDefNodes(OpDefNode[] opDefNodes){
-		Arrays.sort(opDefNodes, new OpDefNodeComparator());
-	}
-
-	public static  Hashtable<String, OpDefNode> getDefsHashTable(OpDefNode[] opDefNodes){
-		 Hashtable<String, OpDefNode> definitions = new Hashtable<String, OpDefNode>();
-		for (int i = 0; i < opDefNodes.length; i++) {
-			OpDefNode def = opDefNodes[i];
-			// Definition in this module
-//			if (StandardModules.contains(def.getOriginallyDefinedInModuleNode()
-//					.getName().toString())
-//					|| StandardModules.contains(def.getSource()
-//							.getOriginallyDefinedInModuleNode().getName()
-//							.toString())) {
-//				continue;
-//			}
-			definitions.put(def.getName().toString(), def);
-		}
-		return definitions;
-	}
-	
-}
-
-class OpDeclNodeComparator implements Comparator<OpDeclNode> {
-	public int compare(OpDeclNode a, OpDeclNode b) {
-		if (a.getUid() < b.getUid())
-			return -1;
-		if (a.getUid() > b.getUid())
-			return 1;
-		return 0;
-	}
-}
-
-class OpDefNodeComparator implements Comparator<OpDefNode> {
-	public int compare(OpDefNode a, OpDefNode b) {
-		if (a.getLocation().equals(b.getLocation())) {
-			if (a.getSource().getUid() < b.getSource().getUid())
-				return -1;
-			if (a.getSource().getUid() > b.getSource().getUid())
-				return 1;
-			return 0;
-		}
-		if (a.getUid() < b.getUid())
-			return -1;
-		if (a.getUid() > b.getUid())
-			return 1;
-		return 0;
-	}
-}
+package de.tla2b.analysis;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Hashtable;
+
+import tla2sany.semantic.ModuleNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+
+public class SymbolSorter {
+	private ModuleNode moduleNode;
+
+	public SymbolSorter(ModuleNode moduleNode) {
+		this.moduleNode = moduleNode;
+	}
+
+	public void sort() {
+		// sort constants
+		Arrays.sort(moduleNode.getConstantDecls(), new OpDeclNodeComparator());
+		// sort variables
+		Arrays.sort(moduleNode.getVariableDecls(), new OpDeclNodeComparator());
+		// sort definitions
+		Arrays.sort(moduleNode.getOpDefs(), new OpDefNodeComparator());
+	}
+	
+	public static void sortDeclNodes(OpDeclNode[] opDeclNodes){
+		Arrays.sort(opDeclNodes, new OpDeclNodeComparator());
+	}
+	
+	public static void sortOpDefNodes(OpDefNode[] opDefNodes){
+		Arrays.sort(opDefNodes, new OpDefNodeComparator());
+	}
+
+	public static  Hashtable<String, OpDefNode> getDefsHashTable(OpDefNode[] opDefNodes){
+		 Hashtable<String, OpDefNode> definitions = new Hashtable<String, OpDefNode>();
+		for (int i = 0; i < opDefNodes.length; i++) {
+			OpDefNode def = opDefNodes[i];
+			// Definition in this module
+//			if (StandardModules.contains(def.getOriginallyDefinedInModuleNode()
+//					.getName().toString())
+//					|| StandardModules.contains(def.getSource()
+//							.getOriginallyDefinedInModuleNode().getName()
+//							.toString())) {
+//				continue;
+//			}
+			definitions.put(def.getName().toString(), def);
+		}
+		return definitions;
+	}
+	
+}
+
+class OpDeclNodeComparator implements Comparator<OpDeclNode> {
+	public int compare(OpDeclNode a, OpDeclNode b) {
+		if (a.getUid() < b.getUid())
+			return -1;
+		if (a.getUid() > b.getUid())
+			return 1;
+		return 0;
+	}
+}
+
+class OpDefNodeComparator implements Comparator<OpDefNode> {
+	public int compare(OpDefNode a, OpDefNode b) {
+		if (a.getLocation().equals(b.getLocation())) {
+			if (a.getSource().getUid() < b.getSource().getUid())
+				return -1;
+			if (a.getSource().getUid() > b.getSource().getUid())
+				return 1;
+			return 0;
+		}
+		if (a.getUid() < b.getUid())
+			return -1;
+		if (a.getUid() > b.getUid())
+			return 1;
+		return 0;
+	}
+}
diff --git a/src/main/java/de/tla2b/analysis/TypeChecker.java b/src/main/java/de/tla2b/analysis/TypeChecker.java
index 5e92c5338ea1c0c271a55f37874d25aaa74e7908..75775ddd4f2dd6a5b4f6f44a9985b8692a7b992b 100644
--- a/src/main/java/de/tla2b/analysis/TypeChecker.java
+++ b/src/main/java/de/tla2b/analysis/TypeChecker.java
@@ -1,1519 +1,1519 @@
-package de.tla2b.analysis;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import de.tla2b.config.ConfigfileEvaluator;
-import de.tla2b.config.TLCValueNode;
-import de.tla2b.config.ValueObj;
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.NotImplementedException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.global.BBuildIns;
-import de.tla2b.global.BBuiltInOPs;
-import de.tla2b.global.TranslationGlobals;
-import de.tla2b.types.*;
-import tla2sany.semantic.ASTConstants;
-import tla2sany.semantic.AssumeNode;
-import tla2sany.semantic.AtNode;
-import tla2sany.semantic.ExprNode;
-import tla2sany.semantic.ExprOrOpArgNode;
-import tla2sany.semantic.FormalParamNode;
-import tla2sany.semantic.LetInNode;
-import tla2sany.semantic.ModuleNode;
-import tla2sany.semantic.NumeralNode;
-import tla2sany.semantic.OpApplNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-import tla2sany.semantic.SemanticNode;
-import tla2sany.semantic.StringNode;
-import tla2sany.semantic.SymbolNode;
-import tlc2.tool.BuiltInOPs;
-
-public class TypeChecker extends BuiltInOPs implements ASTConstants, BBuildIns, TranslationGlobals {
-
-	private static final int TEMP_TYPE_ID = 6;
-	private int paramId;
-
-	private ArrayList<ExprNode> inits;
-	private ExprNode nextExpr;
-	private final Set<OpDefNode> usedDefinitions;
-	private final Set<OpDefNode> bDefinitions;
-
-	private ArrayList<SymbolNode> symbolNodeList = new ArrayList<SymbolNode>();
-	private ArrayList<SemanticNode> tupleNodeList = new ArrayList<SemanticNode>();
-
-	private ModuleNode moduleNode;
-	private ArrayList<OpDeclNode> bConstList;
-	private SpecAnalyser specAnalyser;
-
-	private Hashtable<OpDeclNode, ValueObj> constantAssignments;
-
-	private ConfigfileEvaluator conEval;
-
-	public TypeChecker(ModuleNode moduleNode, ConfigfileEvaluator conEval, SpecAnalyser specAnalyser) {
-		this.moduleNode = moduleNode;
-		this.specAnalyser = specAnalyser;
-		if (conEval != null) {
-			this.bConstList = conEval.getbConstantList();
-			this.constantAssignments = conEval.getConstantAssignments();
-			this.conEval = conEval;
-		}
-		this.inits = specAnalyser.getInits();
-		this.nextExpr = specAnalyser.getNext();
-		usedDefinitions = specAnalyser.getUsedDefinitions();
-		this.bDefinitions = specAnalyser.getBDefinitions();
-
-		paramId = TYPE_ID;
-	}
-
-	public TypeChecker(ModuleNode moduleNode, SpecAnalyser specAnalyser) {
-		this.moduleNode = moduleNode;
-		this.specAnalyser = specAnalyser;
-		Set<OpDefNode> usedDefinitions = new HashSet<OpDefNode>();
-		OpDefNode[] defs = moduleNode.getOpDefs();
-		// used the last definition of the module
-		usedDefinitions.add(defs[defs.length - 1]);
-		this.usedDefinitions = usedDefinitions;
-		this.bDefinitions = specAnalyser.getBDefinitions();
-		paramId = TYPE_ID;
-	}
-
-	public void start() throws TLA2BException {
-		OpDeclNode[] cons = moduleNode.getConstantDecls();
-		for (int i = 0; i < cons.length; i++) {
-			OpDeclNode con = cons[i];
-			if (constantAssignments != null && constantAssignments.containsKey(con)) {
-
-				TLAType t = constantAssignments.get(con).getType();
-				con.setToolObject(TYPE_ID, t);
-				if (t instanceof AbstractHasFollowers) {
-					((AbstractHasFollowers) t).addFollower(con);
-				}
-			} else {
-				UntypedType u = new UntypedType();
-				con.setToolObject(TYPE_ID, u);
-				u.addFollower(con);
-			}
-		}
-
-		OpDeclNode[] vars = moduleNode.getVariableDecls();
-		for (int i = 0; i < vars.length; i++) {
-			OpDeclNode var = vars[i];
-			UntypedType u = new UntypedType();
-			var.setToolObject(TYPE_ID, u);
-			u.addFollower(var);
-		}
-
-		evalDefinitions(moduleNode.getOpDefs());
-
-		if (conEval != null) {
-			Iterator<Entry<OpDeclNode, OpDefNode>> iter = conEval.getConstantOverrideTable().entrySet().iterator();
-			while (iter.hasNext()) {
-				Entry<OpDeclNode, OpDefNode> entry = iter.next();
-				OpDeclNode con = entry.getKey();
-				if (!bConstList.contains(con)) {
-					continue;
-				}
-				OpDefNode def = entry.getValue();
-				TLAType defType = (TLAType) def.getToolObject(TYPE_ID);
-				TLAType conType = (TLAType) con.getToolObject(TYPE_ID);
-
-				try {
-					TLAType result = defType.unify(conType);
-					con.setToolObject(TYPE_ID, result);
-				} catch (UnificationException e) {
-					throw new TypeErrorException(
-							String.format("Expected %s, found %s at constant '%s'.", defType, conType, con.getName()));
-				}
-			}
-		}
-
-		evalAssumptions(moduleNode.getAssumptions());
-
-		if (inits != null) {
-			for (int i = 0; i < inits.size(); i++) {
-				visitExprNode(inits.get(i), BoolType.getInstance());
-			}
-		}
-
-		if (nextExpr != null) {
-			visitExprNode(nextExpr, BoolType.getInstance());
-		}
-
-		checkIfAllIdentifiersHaveAType();
-
-	}
-
-	private void checkIfAllIdentifiersHaveAType() throws TypeErrorException {
-		// check if a variable has no type
-		OpDeclNode[] vars = moduleNode.getVariableDecls();
-		for (int i = 0; i < vars.length; i++) {
-			OpDeclNode var = vars[i];
-			TLAType varType = (TLAType) var.getToolObject(TYPE_ID);
-			if (varType.isUntyped()) {
-				throw new TypeErrorException(
-						"The type of the variable '" + var.getName() + "' can not be inferred: " + varType);
-			}
-		}
-
-		// check if a constant has no type, only constants which will appear in
-		// the resulting B Machine are considered
-		OpDeclNode[] cons = moduleNode.getConstantDecls();
-		for (int i = 0; i < cons.length; i++) {
-			OpDeclNode con = cons[i];
-			if (bConstList == null || bConstList.contains(con)) {
-				TLAType conType = (TLAType) con.getToolObject(TYPE_ID);
-				if (conType.isUntyped()) {
-					throw new TypeErrorException(
-							"The type of constant " + con.getName() + " is still untyped: " + conType);
-				}
-			}
-		}
-
-		for (SymbolNode symbol : symbolNodeList) {
-			TLAType type = (TLAType) symbol.getToolObject(TYPE_ID);
-			if (type.isUntyped()) {
-				throw new TypeErrorException("Symbol '" + symbol.getName() + "' has no type.\n" + symbol.getLocation());
-			}
-		}
-
-		for (SemanticNode tuple : tupleNodeList) {
-			TLAType type = (TLAType) tuple.getToolObject(TYPE_ID);
-			if (type instanceof TupleOrFunction) {
-				TupleOrFunction tOrF = (TupleOrFunction) type;
-				tOrF.getFinalType();
-			}
-		}
-
-	}
-
-	private void evalDefinitions(OpDefNode[] opDefs) throws TLA2BException {
-		for (int i = 0; i < opDefs.length; i++) {
-			OpDefNode def = opDefs[i];
-			// Definition in this module
-			String moduleName1 = def.getOriginallyDefinedInModuleNode().getName().toString();
-			String moduleName2 = def.getSource().getOriginallyDefinedInModuleNode().getName().toString();
-
-			if (STANDARD_MODULES.contains(moduleName1) || STANDARD_MODULES.contains(moduleName2)) {
-				continue;
-			}
-			if (usedDefinitions.contains(def) || bDefinitions.contains(def))
-				visitOpDefNode(def);
-		}
-
-	}
-
-	public void visitOpDefNode(OpDefNode def) throws TLA2BException {
-		FormalParamNode[] params = def.getParams();
-		for (int i = 0; i < params.length; i++) {
-			FormalParamNode p = params[i];
-			if (p.getArity() > 0) {
-				throw new FrontEndException(String.format("TLA2B do not support 2nd-order operators: '%s'%n %s ",
-						def.getName(), def.getLocation()));
-			}
-			UntypedType u = new UntypedType();
-			p.setToolObject(paramId, u);
-			u.addFollower(p);
-		}
-		UntypedType u = new UntypedType();
-		// def.setToolObject(TYPE_ID, u);
-		// u.addFollower(def);
-		TLAType defType = visitExprNode(def.getBody(), u);
-		def.setToolObject(TYPE_ID, defType);
-		if (defType instanceof AbstractHasFollowers) {
-			((AbstractHasFollowers) defType).addFollower(def);
-		}
-
-	}
-
-	private void evalAssumptions(AssumeNode[] assumptions) throws TLA2BException {
-		for (AssumeNode assumeNode : assumptions) {
-			visitExprNode(assumeNode.getAssume(), BoolType.getInstance());
-		}
-	}
-
-	private TLAType visitExprOrOpArgNode(ExprOrOpArgNode n, TLAType expected) throws TLA2BException {
-		if (n instanceof ExprNode) {
-			return visitExprNode((ExprNode) n, expected);
-		} else {
-			throw new NotImplementedException("OpArgNode not implemented jet");
-		}
-
-	}
-
-	private TLAType visitExprNode(ExprNode exprNode, TLAType expected) throws TLA2BException {
-
-		switch (exprNode.getKind()) {
-		case TLCValueKind: {
-			TLCValueNode valueNode = (TLCValueNode) exprNode;
-			try {
-				return valueNode.getType().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at '%s'(assigned in the configuration file),%n%s ",
-								expected, valueNode.getType(), valueNode.getValue(), exprNode.getLocation()));
-			}
-
-		}
-
-		case OpApplKind:
-			return visitOpApplNode((OpApplNode) exprNode, expected);
-
-		case NumeralKind:
-			try {
-				return IntType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found INTEGER at '%s',%n%s ", expected,
-						((NumeralNode) exprNode).val(), exprNode.getLocation()));
-			}
-		case StringKind: {
-			try {
-				return StringType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found STRING at '%s',%n%s ", expected,
-						((StringNode) exprNode).getRep(), exprNode.getLocation()));
-			}
-		}
-		case AtNodeKind: { // @
-			AtNode a = (AtNode) exprNode;
-			OpApplNode pair2 = a.getExceptComponentRef();
-			ExprOrOpArgNode rightside = pair2.getArgs()[1];
-			TLAType type = (TLAType) rightside.getToolObject(TYPE_ID);
-			try {
-				TLAType res = type.unify(expected);
-				setType(exprNode, res);
-				return res;
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at '@',%n%s ", expected, type, exprNode.getLocation()));
-			}
-
-		}
-
-		case LetInKind: {
-			LetInNode l = (LetInNode) exprNode;
-			for (int i = 0; i < l.getLets().length; i++) {
-				visitOpDefNode(l.getLets()[i]);
-			}
-			return visitExprNode(l.getBody(), expected);
-		}
-
-		case SubstInKind: {
-			throw new RuntimeException("SubstInKind should never occur after InstanceTransformation");
-		}
-
-		case DecimalKind: {
-			// currently not supported
-		}
-
-		}
-
-		throw new NotImplementedException(exprNode.toString(2));
-
-	}
-
-	private void setType(SemanticNode node, TLAType type) {
-		node.setToolObject(TYPE_ID, type);
-		if (type instanceof AbstractHasFollowers) {
-			((AbstractHasFollowers) type).addFollower(node);
-		}
-	}
-
-	private TLAType getType(OpApplNode n) {
-		return (TLAType) n.getToolObject(TYPE_ID);
-	}
-
-	private TLAType visitOpApplNode(OpApplNode n, TLAType expected) throws TLA2BException {
-
-		switch (n.getOperator().getKind()) {
-		case ConstantDeclKind: {
-			OpDeclNode con = (OpDeclNode) n.getOperator();
-
-			TLAType c = (TLAType) con.getToolObject(TYPE_ID);
-			if (c == null) {
-				throw new RuntimeException(con.getName() + " has no type yet!");
-			}
-			try {
-				TLAType result = expected.unify(c);
-				con.setToolObject(TYPE_ID, result);
-				return result;
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at constant '%s',%n%s", expected, c,
-						con.getName(), n.getLocation())
-
-				);
-			}
-		}
-
-		case VariableDeclKind: {
-			SymbolNode symbolNode = n.getOperator();
-			String vName = symbolNode.getName().toString();
-			TLAType v = (TLAType) symbolNode.getToolObject(TYPE_ID);
-			if (v == null) {
-				SymbolNode var = this.specAnalyser.getSymbolNodeByName(vName);
-				if (var != null) {
-					// symbolNode is variable of an expression, e.g. v + 1
-					v = (TLAType) var.getToolObject(TYPE_ID);
-				} else {
-					throw new RuntimeException(vName + " has no type yet!");
-				}
-			}
-			try {
-				TLAType result = expected.unify(v);
-				symbolNode.setToolObject(TYPE_ID, result);
-				return result;
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at variable '%s',%n%s", expected, v,
-						vName, n.getLocation()));
-			}
-		}
-
-		case BuiltInKind: {
-			return evalBuiltInKind(n, expected);
-		}
-
-		case FormalParamKind: {
-			SymbolNode symbolNode = n.getOperator();
-			String pName = symbolNode.getName().toString();
-			TLAType t = (TLAType) symbolNode.getToolObject(paramId);
-			if (t == null) {
-				t = (TLAType) symbolNode.getToolObject(TYPE_ID);
-			}
-
-			if (t == null) {
-				t = new UntypedType(); // TODO is this correct?
-				// throw new RuntimeException();
-			}
-			try {
-				TLAType result = expected.unify(t);
-				symbolNode.setToolObject(paramId, result);
-				return result;
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at parameter '%s',%n%s", expected, t,
-						pName, n.getLocation()));
-			}
-		}
-
-		case UserDefinedOpKind: {
-			OpDefNode def = (OpDefNode) n.getOperator();
-
-			// Definition is a BBuilt-in definition
-			String sourceModule = def.getSource().getOriginallyDefinedInModuleNode().getName().toString();
-			if (BBuiltInOPs.contains(def.getName()) && STANDARD_MODULES.contains(sourceModule)) {
-				return evalBBuiltIns(n, expected);
-			}
-
-			TLAType found = ((TLAType) def.getToolObject(TYPE_ID));
-			if (found == null) {
-				found = new UntypedType();
-				// throw new RuntimeException(def.getName() +
-				// " has no type yet!");
-			}
-			if (n.getArgs().length != 0) {
-				found = found.cloneTLAType();
-			}
-
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at definition '%s',%n%s", expected,
-						found, def.getName(), n.getLocation()));
-			}
-			boolean untyped = false;
-			FormalParamNode[] params = def.getParams();
-			for (int i = 0; i < n.getArgs().length; i++) {
-				// clone the parameter type, because the parameter type is not
-				// set/changed at a definition call
-				FormalParamNode p = params[i];
-				TLAType pType = ((TLAType) p.getToolObject(TYPE_ID));
-				if (pType == null) {
-					pType = new UntypedType();
-					// throw new RuntimeException("Parameter " + p.getName()
-					// + " has no type yet!%n" + p.getLocation());
-				}
-				pType = pType.cloneTLAType();
-				if (pType.isUntyped())
-					untyped = true;
-
-				pType = visitExprOrOpArgNode(n.getArgs()[i], pType); // unify
-																		// both
-																		// types
-				// set types of the arguments of the definition call to the
-				// parameters for reevaluation the def body
-				p.setToolObject(TEMP_TYPE_ID, pType);
-			}
-
-			if (found.isUntyped() || untyped || def.getInRecursive() == false) {
-				// evaluate the body of the definition again
-				paramId = TEMP_TYPE_ID;
-				found = visitExprNode(def.getBody(), found);
-				paramId = TYPE_ID;
-			}
-
-			n.setToolObject(TYPE_ID, found);
-
-			return found;
-
-		}
-
-		default: {
-			throw new NotImplementedException(n.getOperator().getName().toString());
-		}
-		}
-
-	}
-
-	private TLAType evalBuiltInKind(OpApplNode n, TLAType expected) throws TLA2BException {
-
-		switch (getOpCode(n.getOperator().getName())) {
-
-		/*
-		 * equality and disequality: =, #, /=
-		 */
-		case OPCODE_eq: // =
-		case OPCODE_noteq: // /=, #
-		{
-			try {
-				BoolType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			TLAType left = visitExprOrOpArgNode(n.getArgs()[0], new de.tla2b.types.UntypedType());
-			visitExprOrOpArgNode(n.getArgs()[1], left);
-			return BoolType.getInstance();
-		}
-
-		/*
-		 * Logic Operators: \neg, \lnot, \land, \cl, \lor, \dl, \equiv, =>
-		 */
-		case OPCODE_neg: // Negation
-		case OPCODE_lnot: // Negation
-		case OPCODE_cl: // $ConjList
-		case OPCODE_dl: // $DisjList
-		case OPCODE_land: // \land
-		case OPCODE_lor: // \lor
-		case OPCODE_equiv: // \equiv
-		case OPCODE_implies: // =>
-		{
-			try {
-				BoolType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			for (int i = 0; i < n.getArgs().length; i++) {
-				visitExprOrOpArgNode(n.getArgs()[i], BoolType.getInstance());
-			}
-			return BoolType.getInstance();
-		}
-
-		/*
-		 * Quantification: \A x \in S : P or \E x \in S : P
-		 */
-		case OPCODE_be: // \E x \in S : P
-		case OPCODE_bf: // \A x \in S : P
-		{
-			try {
-				BoolType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			evalBoundedVariables(n);
-			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
-			return BoolType.getInstance();
-		}
-
-		/*
-		 * Set Operators
-		 */
-		case OPCODE_se: // SetEnumeration {..}
-		{
-			SetType found = new SetType(new UntypedType());
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(_A) at set enumeration,%n%s", expected, n.getLocation()));
-			}
-			TLAType current = found.getSubType();
-			for (int i = 0; i < n.getArgs().length; i++) {
-				current = visitExprOrOpArgNode(n.getArgs()[i], current);
-			}
-			return found;
-		}
-
-		case OPCODE_in: // \in
-		case OPCODE_notin: // \notin
-		{
-			if (!BoolType.getInstance().compare(expected)) {
-				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			TLAType element = visitExprOrOpArgNode(n.getArgs()[0], new UntypedType());
-			visitExprOrOpArgNode(n.getArgs()[1], new SetType(element));
-
-			return BoolType.getInstance();
-		}
-
-		case OPCODE_setdiff: // set difference
-		case OPCODE_cup: // set union
-		case OPCODE_cap: // set intersection
-		{
-			SetType found = new SetType(new UntypedType());
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found POW(_A) at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			TLAType left = visitExprOrOpArgNode(n.getArgs()[0], found);
-			TLAType right = visitExprOrOpArgNode(n.getArgs()[1], left);
-			return right;
-		}
-
-		case OPCODE_subseteq: // \subseteq - subset or equal
-		{
-			try {
-				BoolType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			TLAType left = visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
-			visitExprOrOpArgNode(n.getArgs()[1], left);
-			return BoolType.getInstance();
-		}
-
-		/*
-		 * Set Constructor
-		 */
-		case OPCODE_sso: // $SubsetOf Represents {x \in S : P}
-		{
-
-			TLAType domainType = evalBoundedVariables(n);
-			SetType found = new SetType(domainType);
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at '%s',%n%s", expected, found,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
-			return found;
-		}
-
-		case OPCODE_soa: // $SetOfAll Represents {e : p1 \in S, p2,p3 \in S2}
-		{
-			SetType found = new SetType(new UntypedType());
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found POW(_A) at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			evalBoundedVariables(n);
-			visitExprOrOpArgNode(n.getArgs()[0], found.getSubType());
-			return found;
-		}
-
-		case OPCODE_subset: // SUBSET (conforms POW in B)
-		{
-			SetType found = new SetType(new UntypedType());
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(_A) at 'SUBSET',%n%s", expected, n.getLocation()));
-			}
-			visitExprOrOpArgNode(n.getArgs()[0], found.getSubType());
-			return found;
-		}
-
-		case OPCODE_union: // Union - Union{{1},{2}}
-		{
-			SetType found = new SetType(new UntypedType());
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(_A) at 'SUBSET',%n%s", expected, n.getLocation()));
-			}
-			SetType setOfSet = (SetType) visitExprOrOpArgNode(n.getArgs()[0], new SetType(found));
-			return setOfSet.getSubType();
-		}
-
-		/*
-		 * Prime
-		 */
-		case OPCODE_prime: // prime
-		{
-			try {
-				OpApplNode node = (OpApplNode) n.getArgs()[0];
-				if (node.getOperator().getKind() != VariableDeclKind) {
-					throw new TypeErrorException(
-							"Expected variable at \"" + node.getOperator().getName() + "\":\n" + node.getLocation());
-				}
-				return visitExprOrOpArgNode(n.getArgs()[0], expected);
-			} catch (ClassCastException e) {
-				throw new TypeErrorException(
-						"Expected variable as argument of prime operator:\n" + n.getArgs()[0].getLocation());
-			}
-		}
-
-		/*
-		 * Tuple: Tuple as Function 1..n to Set (Sequence)
-		 */
-		case OPCODE_tup: { // $Tuple
-			ArrayList<TLAType> list = new ArrayList<TLAType>();
-			for (int i = 0; i < n.getArgs().length; i++) {
-				list.add(visitExprOrOpArgNode(n.getArgs()[i], new UntypedType()));
-			}
-			TLAType found = null;
-			if (list.size() == 0) {
-				found = new FunctionType(IntType.getInstance(), new UntypedType());
-			} else if (list.size() == 1) {
-				found = new FunctionType(IntType.getInstance(), list.get(0));
-			} else {
-				found = TupleOrFunction.createTupleOrFunctionType(list);
-				// found = new TupleType(list);
-			}
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at Tuple,%n%s", expected, found, n.getLocation()));
-			}
-			n.setToolObject(TYPE_ID, found);
-			tupleNodeList.add(n);
-			if (found instanceof AbstractHasFollowers) {
-				((AbstractHasFollowers) found).addFollower(n);
-			}
-			return found;
-		}
-
-		/*
-		 * Function constructors
-		 */
-		case OPCODE_rfs: // recursive function ( f[x\in Nat] == IF x = 0 THEN 1
-							// ELSE f[n-1]
-		{
-
-			FormalParamNode recFunc = n.getUnbdedQuantSymbols()[0];
-			symbolNodeList.add(recFunc);
-			FunctionType recType = new FunctionType();
-			recFunc.setToolObject(TYPE_ID, recType);
-			recType.addFollower(recFunc);
-
-			TLAType domainType = evalBoundedVariables(n);
-			FunctionType found = new FunctionType(domainType, new UntypedType());
-			visitExprOrOpArgNode(n.getArgs()[0], found.getRange());
-
-			try {
-				found = (FunctionType) found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException("Expected '" + expected + "', found '" + found + "'.\n" + n.getLocation());
-			}
-
-			TLAType t = null;
-			try {
-				t = (TLAType) recFunc.getToolObject(TYPE_ID);
-				found = (FunctionType) found.unify(t);
-			} catch (UnificationException e) {
-				throw new TypeErrorException("Expected '" + expected + "', found '" + t + "'.\n" + n.getLocation());
-			}
-
-			return found;
-		}
-
-		case OPCODE_nrfs: // succ[n \in Nat] == n + 1
-		case OPCODE_fc: // [n \in Nat |-> n+1]
-		{
-			TLAType domainType = evalBoundedVariables(n);
-			FunctionType found = new FunctionType(domainType, new UntypedType());
-			visitExprOrOpArgNode(n.getArgs()[0], found.getRange());
-
-			try {
-				found = (FunctionType) found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException("Expected '" + expected + "', found '" + found + "'.\n" + n.getLocation());
-			}
-			return found;
-		}
-
-		/*
-		 * Function call
-		 */
-		case OPCODE_fa: // $FcnApply f[1]
-		{
-			TLAType domType;
-			ExprOrOpArgNode dom = n.getArgs()[1];
-			if (dom instanceof OpApplNode && ((OpApplNode) dom).getOperator().getName().toString().equals("$Tuple")) {
-				ArrayList<TLAType> domList = new ArrayList<TLAType>();
-				OpApplNode domOpAppl = (OpApplNode) dom;
-				for (int i = 0; i < domOpAppl.getArgs().length; i++) {
-					TLAType d = visitExprOrOpArgNode(domOpAppl.getArgs()[i], new UntypedType());
-					domList.add(d);
-				}
-
-				if (domList.size() == 1) { // one-tuple
-					domType = new FunctionType(IntType.getInstance(), domList.get(0));
-					FunctionType func = new FunctionType(domType, expected);
-					TLAType res = visitExprOrOpArgNode(n.getArgs()[0], func);
-					return ((FunctionType) res).getRange();
-				} else {
-					domType = new TupleType(domList);
-					FunctionType func = new FunctionType(domType, expected);
-					TLAType res = visitExprOrOpArgNode(n.getArgs()[0], func);
-					return ((FunctionType) res).getRange();
-				}
-			} else {
-				ExprOrOpArgNode arg = n.getArgs()[1];
-				if (arg instanceof NumeralNode) {
-					NumeralNode num = (NumeralNode) arg;
-					UntypedType u = new UntypedType();
-					n.setToolObject(TYPE_ID, u);
-					u.addFollower(n);
-					TupleOrFunction tupleOrFunc = new TupleOrFunction(num.val(), u);
-
-					TLAType res = visitExprOrOpArgNode(n.getArgs()[0], tupleOrFunc);
-					n.getArgs()[0].setToolObject(TYPE_ID, res);
-					tupleNodeList.add(n.getArgs()[0]);
-					if (res instanceof AbstractHasFollowers) {
-						((AbstractHasFollowers) res).addFollower(n.getArgs()[0]);
-					}
-					TLAType found = (TLAType) n.getToolObject(TYPE_ID);
-					try {
-						found = found.unify(expected);
-					} catch (UnificationException e) {
-						throw new TypeErrorException("Expected '" + expected + "', found '" + found + "'.\n"
-								+ n.getArgs()[0].toString(2) + "\n" + n.getLocation());
-					}
-					return found;
-				}
-				domType = visitExprOrOpArgNode(n.getArgs()[1], new UntypedType());
-			}
-			FunctionType func = new FunctionType(domType, expected);
-			TLAType res = visitExprOrOpArgNode(n.getArgs()[0], func);
-			return ((FunctionType) res).getRange();
-
-		}
-
-		/*
-		 * Domain of Function
-		 */
-		case OPCODE_domain: {
-
-			FunctionType func = new FunctionType(new UntypedType(), new UntypedType());
-			func = (FunctionType) visitExprOrOpArgNode(n.getArgs()[0], func);
-			TLAType res = null;
-			try {
-				res = new SetType(func.getDomain()).unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected '%s', found '%s' at 'DOMAIN(..)',%n%s", expected,
-						func, n.getLocation()));
-			}
-			return res;
-		}
-		/*
-		 * Set of Function
-		 */
-		case OPCODE_sof: // [ A -> B]
-		{
-			SetType A = (SetType) visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
-			SetType B = (SetType) visitExprOrOpArgNode(n.getArgs()[1], new SetType(new UntypedType()));
-
-			SetType found = new SetType(new FunctionType(A.getSubType(), B.getSubType()));
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected '%s', found '%s' at Set of Function,%n%s",
-						expected, found, n.getLocation()));
-			}
-			return found;
-		}
-
-		/*
-		 * Except
-		 */
-		case OPCODE_exc: // $Except
-		{
-			return evalExcept(n, expected);
-		}
-
-		/*
-		 * Cartesian Product: A \X B
-		 */
-		case OPCODE_cp: // $CartesianProd A \X B \X C as $CartesianProd(A, B, C)
-		{
-			ArrayList<TLAType> list = new ArrayList<TLAType>();
-			for (int i = 0; i < n.getArgs().length; i++) {
-				SetType t = (SetType) visitExprOrOpArgNode(n.getArgs()[i], new SetType(new UntypedType()));
-				list.add(t.getSubType());
-			}
-			SetType found = new SetType(new TupleType(list));
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at Cartesian Product,%n%s", expected,
-						found, n.getLocation()));
-			}
-
-			return found;
-		}
-
-		/*
-		 * Records
-		 */
-		case OPCODE_sor: // $SetOfRcds [L1 : e1, L2 : e2]
-		{
-			StructType struct = new StructType();
-			for (int i = 0; i < n.getArgs().length; i++) {
-				OpApplNode pair = (OpApplNode) n.getArgs()[i];
-				StringNode field = (StringNode) pair.getArgs()[0];
-				SetType fieldType = (SetType) visitExprOrOpArgNode(pair.getArgs()[1], new SetType(new UntypedType()));
-				struct.add(field.getRep().toString(), fieldType.getSubType());
-			}
-
-			SetType found = new SetType(struct);
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at Set of Records,%n%s", expected,
-						found, n.getLocation()));
-			}
-			n.setToolObject(TYPE_ID, found);
-			found.addFollower(n);
-			return found;
-		}
-
-		case OPCODE_rc: // [h_1 |-> 1, h_2 |-> 2]
-		{
-			StructType found = new StructType();
-			for (int i = 0; i < n.getArgs().length; i++) {
-				OpApplNode pair = (OpApplNode) n.getArgs()[i];
-				StringNode field = (StringNode) pair.getArgs()[0];
-				TLAType fieldType = visitExprOrOpArgNode(pair.getArgs()[1], new UntypedType());
-				found.add(field.getRep().toString(), fieldType);
-			}
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at Record,%n%s", expected, found, n.getLocation()));
-			}
-			n.setToolObject(TYPE_ID, found);
-			found.addFollower(n);
-
-			return found;
-
-		}
-
-		case OPCODE_rs: // $RcdSelect r.c
-		{
-			String fieldName = ((StringNode) n.getArgs()[1]).getRep().toString();
-			StructType r = (StructType) visitExprOrOpArgNode(n.getArgs()[0], StructType.getIncompleteStruct());
-
-			StructType expectedStruct = StructType.getIncompleteStruct();
-			expectedStruct.add(fieldName, expected);
-
-			try {
-				r = r.unify(expectedStruct);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Struct has no field %s with type %s: %s%n%s", fieldName,
-						r.getType(fieldName), r, n.getLocation()));
-			}
-			n.getArgs()[0].setToolObject(TYPE_ID, r);
-			r.addFollower(n.getArgs()[0]);
-			return r.getType(fieldName);
-		}
-
-		/*
-		 * miscellaneous constructs
-		 */
-		case OPCODE_ite: // IF THEN ELSE
-		{
-			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
-			TLAType then = visitExprOrOpArgNode(n.getArgs()[1], expected);
-			TLAType eelse = visitExprOrOpArgNode(n.getArgs()[2], then);
-			n.setToolObject(TYPE_ID, eelse);
-			if (eelse instanceof AbstractHasFollowers) {
-				((AbstractHasFollowers) eelse).addFollower(n);
-			}
-			return eelse;
-		}
-
-		case OPCODE_case: {
-			/*
-			 * CASE p1 -> e1 [] p2 -> e2 represented as $Case( $Pair(p1,
-			 * e1),$Pair(p2, e2) ) and CASE p1 -> e1 [] p2 -> e2 [] OTHER -> e3
-			 * represented as $Case( $Pair(p1, e1), $Pair(p2, e2), $Pair(null,
-			 * e3))
-			 */
-			TLAType found = expected;
-			for (int i = 0; i < n.getArgs().length; i++) {
-				OpApplNode pair = (OpApplNode) n.getArgs()[i];
-				if (pair.getArgs()[0] != null) {
-					visitExprOrOpArgNode(pair.getArgs()[0], BoolType.getInstance());
-				}
-				found = visitExprOrOpArgNode(pair.getArgs()[1], found);
-			}
-			return found;
-
-		}
-
-		case OPCODE_uc: {
-			List<TLAType> list = new ArrayList<TLAType>();
-			for (FormalParamNode param : n.getUnbdedQuantSymbols()) {
-				TLAType paramType = new UntypedType();
-				symbolNodeList.add(param);
-				setType(param, paramType);
-				list.add(paramType);
-			}
-			TLAType found = null;
-			if (list.size() == 1) {
-				found = list.get(0);
-			} else {
-				found = new TupleType(list);
-			}
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at 'CHOOSE',%n%s", expected, found, n.getLocation()));
-			}
-			setType(n, found);
-			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
-
-			return getType(n);
-
-		}
-
-		case OPCODE_bc: { // CHOOSE x \in S: P
-			TLAType found = evalBoundedVariables(n);
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at 'CHOOSE',%n%s", expected, found, n.getLocation()));
-			}
-			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
-			return found;
-		}
-
-		case OPCODE_unchanged: {
-			return BoolType.getInstance().unify(expected);
-		}
-
-		/*
-		 * no TLA+ Built-ins
-		 */
-		case 0: {
-			return evalBBuiltIns(n, expected);
-		}
-		}
-
-		throw new NotImplementedException(
-				"Not supported Operator: " + n.getOperator().getName().toString() + "\n" + n.getLocation());
-	}
-
-	private TLAType evalBoundedVariables(OpApplNode n) throws TLA2BException {
-		ArrayList<TLAType> domList = new ArrayList<TLAType>();
-		FormalParamNode[][] params = n.getBdedQuantSymbolLists();
-		ExprNode[] bounds = n.getBdedQuantBounds();
-		for (int i = 0; i < bounds.length; i++) {
-			SetType boundType = (SetType) visitExprNode(bounds[i], new SetType(new UntypedType()));
-			TLAType subType = boundType.getSubType();
-
-			if (n.isBdedQuantATuple()[i]) {
-				if (params[i].length == 1) {
-					FormalParamNode p = params[i][0];
-					FunctionType expected = new FunctionType(IntType.getInstance(), new UntypedType());
-					try {
-						expected = (FunctionType) expected.unify(subType);
-					} catch (UnificationException e) {
-						throw new TypeErrorException(String.format("Expected %s, found %s at parameter %s,%n%s",
-								expected, subType, p.getName().toString(), bounds[i].getLocation()));
-					}
-					domList.add(expected);
-					symbolNodeList.add(p);
-					p.setToolObject(TYPE_ID, expected.getRange());
-					if (expected.getRange() instanceof AbstractHasFollowers) {
-						((AbstractHasFollowers) expected.getRange()).addFollower(p);
-					}
-				} else {
-					TupleType tuple = new TupleType(params[i].length);
-					try {
-						tuple = (TupleType) tuple.unify(subType);
-					} catch (UnificationException e) {
-						throw new TypeErrorException(String.format("Expected %s, found %s at tuple,%n%s", tuple,
-								subType, bounds[i].getLocation()));
-					}
-					domList.add(tuple);
-					for (int j = 0; j < params[i].length; j++) {
-						FormalParamNode p = params[i][j];
-						symbolNodeList.add(p);
-						TLAType paramType = tuple.getTypes().get(j);
-						p.setToolObject(TYPE_ID, paramType);
-						if (paramType instanceof AbstractHasFollowers) {
-							((AbstractHasFollowers) paramType).addFollower(p);
-						}
-					}
-
-				}
-
-			} else {
-				// is not a tuple: all parameter have the same type
-				for (int j = 0; j < params[i].length; j++) {
-					domList.add(subType);
-					FormalParamNode p = params[i][j];
-					symbolNodeList.add(p);
-					p.setToolObject(TYPE_ID, subType);
-					if (subType instanceof AbstractHasFollowers) {
-						((AbstractHasFollowers) subType).addFollower(p);
-					}
-				}
-			}
-		}
-
-		TLAType domType = null;
-		if (domList.size() == 1) {
-			domType = domList.get(0);
-		} else {
-			domType = new TupleType(domList);
-		}
-		return domType;
-	}
-
-	private TLAType evalExcept(OpApplNode n, TLAType expected) throws TLA2BException {
-		TLAType t = visitExprOrOpArgNode(n.getArgs()[0], expected);
-		n.setToolObject(TYPE_ID, t);
-		if (t instanceof AbstractHasFollowers) {
-			((AbstractHasFollowers) t).addFollower(n);
-		}
-
-		for (int i = 1; i < n.getArgs().length; i++) {
-			OpApplNode pair = (OpApplNode) n.getArgs()[i];
-			ExprOrOpArgNode leftside = pair.getArgs()[0];
-			ExprOrOpArgNode rightside = pair.getArgs()[1];
-			// stored for @ node
-			UntypedType untyped = new UntypedType();
-			rightside.setToolObject(TYPE_ID, untyped);
-			untyped.addFollower(rightside);
-			TLAType valueType = visitExprOrOpArgNode(rightside, untyped);
-
-			OpApplNode seq = (OpApplNode) leftside;
-			LinkedList<ExprOrOpArgNode> list = new LinkedList<ExprOrOpArgNode>();
-			for (int j = 0; j < seq.getArgs().length; j++) {
-				list.add(seq.getArgs()[j]);
-			}
-			ExprOrOpArgNode first = list.poll();
-
-			if (first instanceof StringNode) {
-				String field = ((StringNode) first).getRep().toString();
-				TLAType res = evalType(list, valueType);
-				StructOrFunctionType s = new StructOrFunctionType(field, res);
-				try {
-					t = t.unify(s);
-				} catch (UnificationException e) {
-					throw new TypeErrorException(
-							String.format("Expected %s, found %s at 'EXCEPT',%n%s", t, s, pair.getLocation()));
-				}
-
-			} else {
-				// Function
-				ExprOrOpArgNode domExpr = first;
-				TLAType domType;
-				TLAType rangeType;
-				if (domExpr instanceof OpApplNode
-						&& ((OpApplNode) domExpr).getOperator().getName().toString().equals("$Tuple")) {
-					ArrayList<TLAType> domList = new ArrayList<TLAType>();
-					OpApplNode domOpAppl = (OpApplNode) domExpr;
-					for (int j = 0; j < domOpAppl.getArgs().length; j++) {
-						TLAType d = visitExprOrOpArgNode(domOpAppl.getArgs()[j], new UntypedType());
-						domList.add(d);
-					}
-					domType = new TupleType(domList);
-					domExpr.setToolObject(TYPE_ID, domType); // store type
-				} else {
-					domType = visitExprOrOpArgNode(domExpr, new UntypedType());
-				}
-				rangeType = evalType(list, valueType);
-				FunctionType func = new FunctionType(domType, rangeType);
-				try {
-					t = t.unify(func);
-				} catch (UnificationException e) {
-					throw new TypeErrorException(
-							String.format("Expected %s, found %s at 'EXCEPT',%n%s", t, func, pair.getLocation()));
-				}
-			}
-		}
-		return t;
-
-	}
-
-	private TLAType evalType(LinkedList<ExprOrOpArgNode> list, TLAType valueType) throws TLA2BException {
-		if (list.size() == 0) {
-			return valueType;
-		}
-		ExprOrOpArgNode head = list.poll();
-		if (head instanceof StringNode) {
-			// record or function of strings
-			String name = ((StringNode) head).getRep().toString();
-			StructOrFunctionType res = new StructOrFunctionType(name, evalType(list, valueType));
-			return res;
-		}
-		TLAType t = visitExprOrOpArgNode(head, new UntypedType());
-		FunctionType res = new FunctionType(t, evalType(list, valueType));
-		return res;
-	}
-
-	private TLAType evalBBuiltIns(OpApplNode n, TLAType expected) throws TLA2BException {
-		switch (BBuiltInOPs.getOpcode(n.getOperator().getName())) {
-		// B Builtins
-
-		/*
-		 * Standard Module Naturals
-		 */
-		case B_OPCODE_gt: // >
-		case B_OPCODE_lt: // <
-		case B_OPCODE_leq: // <=
-		case B_OPCODE_geq: // >=
-		{
-			try {
-				BoolType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			for (int i = 0; i < n.getArgs().length; i++) {
-				visitExprOrOpArgNode(n.getArgs()[i], IntType.getInstance());
-			}
-			return BoolType.getInstance();
-		}
-
-		case B_OPCODE_plus: // +
-		case B_OPCODE_minus: // -
-		case B_OPCODE_times: // *
-		case B_OPCODE_div: // /
-		case B_OPCODE_mod: // % modulo
-		case B_OPCODE_exp: { // x hoch y, x^y
-			try {
-				IntType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found INTEGER at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			for (int i = 0; i < n.getArgs().length; i++) {
-				visitExprOrOpArgNode(n.getArgs()[i], IntType.getInstance());
-			}
-			return IntType.getInstance();
-		}
-
-		case B_OPCODE_dotdot: // ..
-		{
-			try {
-				expected.unify(new SetType(IntType.getInstance()));
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(INTEGER) at '..',%n%s", expected, n.getLocation()));
-			}
-
-			for (int i = 0; i < n.getArgs().length; i++) {
-				visitExprOrOpArgNode(n.getArgs()[i], IntType.getInstance());
-			}
-			return new SetType(IntType.getInstance());
-		}
-
-		case B_OPCODE_nat: // Nat
-		{
-			try {
-				SetType found = new SetType(IntType.getInstance());
-				found = found.unify(expected);
-				return found;
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(INTEGER) at 'Nat',%n%s", expected, n.getLocation()));
-			}
-		}
-
-		/*
-		 * Standard Module Integers
-		 */
-		case B_OPCODE_int: // Int
-		{
-			try {
-				SetType found = new SetType(IntType.getInstance());
-				found = found.unify(expected);
-				return found;
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(INTEGER) at 'Int',%n%s", expected, n.getLocation()));
-			}
-		}
-
-		case B_OPCODE_uminus: // -x
-		{
-			try {
-				IntType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found INTEGER at '-',%n%s", expected, n.getLocation()));
-			}
-			visitExprOrOpArgNode(n.getArgs()[0], IntType.getInstance());
-			return IntType.getInstance();
-		}
-
-		/*
-		 * Standard Module FiniteSets
-		 */
-		case B_OPCODE_finite: // IsFiniteSet
-		{
-			try {
-				BoolType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found BOOL at 'IsFiniteSet',%n%s", expected, n.getLocation()));
-			}
-			visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
-			return BoolType.getInstance();
-		}
-
-		case B_OPCODE_card: // Cardinality
-		{
-			try {
-				IntType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found INTEGER at 'Cardinality',%n%s", expected, n.getLocation()));
-			}
-			visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
-			return IntType.getInstance();
-		}
-
-		/*
-		 * Standard Module Sequences
-		 */
-		case B_OPCODE_seq: { // Seq(S) - set of sequences, S must be a set
-
-			SetType S = (SetType) visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
-
-			SetType set_of_seq = new SetType(new FunctionType(IntType.getInstance(), S.getSubType()));
-			try {
-				set_of_seq = set_of_seq.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at 'Seq',%n%s", expected, set_of_seq, n.getLocation()));
-			}
-			return set_of_seq;
-		}
-
-		case B_OPCODE_len: { // lengh of the sequence
-			try {
-				IntType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found INTEGER at 'Len',%n%s", expected, n.getLocation()));
-			}
-			visitExprOrOpArgNode(n.getArgs()[0], new FunctionType(IntType.getInstance(), new UntypedType()));
-			return IntType.getInstance();
-		}
-
-		case B_OPCODE_conc: { // s \o s2 - concatenation of s and s2
-			TLAType found = new FunctionType(IntType.getInstance(), new UntypedType());
-			found = visitExprOrOpArgNode(n.getArgs()[0], found);
-			found = visitExprOrOpArgNode(n.getArgs()[1], found);
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(INTEGER*_A) at '\\o',%n%s", expected, n.getLocation()));
-			}
-			return found;
-		}
-
-		case B_OPCODE_append: // Append(s, e)
-		{
-			FunctionType found = new FunctionType(IntType.getInstance(), new UntypedType());
-			found = (FunctionType) visitExprOrOpArgNode(n.getArgs()[0], found);
-			visitExprOrOpArgNode(n.getArgs()[1], found.getRange());
-			try {
-				found = (FunctionType) found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at 'Append',%n%s", expected, found, n.getLocation()));
-			}
-			return found;
-		}
-
-		case B_OPCODE_head: { // HEAD(s) - the first element of the sequence
-			FunctionType func = new FunctionType(IntType.getInstance(), new UntypedType());
-			func = (FunctionType) visitExprOrOpArgNode(n.getArgs()[0], func);
-
-			TLAType found = func.getRange();
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at 'Head',%n%s", expected, found, n.getLocation()));
-			}
-			return found;
-		}
-
-		case B_OPCODE_tail: { // Tail(s)
-			FunctionType found = new FunctionType(IntType.getInstance(), new UntypedType());
-			found = (FunctionType) visitExprOrOpArgNode(n.getArgs()[0], found);
-			try {
-				found = (FunctionType) found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at 'Tail',%n%s", expected, found, n.getLocation()));
-			}
-			return found;
-		}
-
-		case B_OPCODE_subseq: { // SubSeq(s,m,n)
-			TLAType found = new FunctionType(IntType.getInstance(), new UntypedType());
-			found = visitExprOrOpArgNode(n.getArgs()[0], found);
-			visitExprOrOpArgNode(n.getArgs()[1], IntType.getInstance());
-			visitExprOrOpArgNode(n.getArgs()[2], IntType.getInstance());
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found %s at 'SubSeq',%n%s", expected, found, n.getLocation()));
-			}
-			return found;
-		}
-
-		// TODO add BSeq to tla standard modules
-
-		/*
-		 * Standard Module TLA2B
-		 */
-
-		case B_OPCODE_min: // MinOfSet(S)
-		case B_OPCODE_max: // MaxOfSet(S)
-		case B_OPCODE_setprod: // SetProduct(S)
-		case B_OPCODE_setsum: // SetSummation(S)
-		{
-			try {
-				IntType.getInstance().unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found INTEGER at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			visitExprOrOpArgNode(n.getArgs()[0], new SetType(IntType.getInstance()));
-			return IntType.getInstance();
-		}
-
-		case B_OPCODE_permseq: { // PermutedSequences(S)
-			SetType argType = (SetType) visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
-			SetType found = new SetType(new FunctionType(IntType.getInstance(), argType.getSubType()));
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at 'PermutedSequences',%n%s",
-						expected, found, n.getLocation()));
-			}
-			return found;
-		}
-
-		/*
-		 * Standard Module TLA2B
-		 */
-		case B_OPCODE_pow1: // POW1
-		{
-
-			SetType set = new SetType(new UntypedType());
-			set = (SetType) visitExprOrOpArgNode(n.getArgs()[0], set);
-			SetType found = new SetType(set);
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at '%s',%n%s", expected, found,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			return found;
-		}
-
-		/*
-		 * Standard Module Relations
-		 */
-		case B_OPCODE_rel_inverse: // POW1
-		{
-			SetType set = new SetType(new TupleType(2));
-			set = (SetType) visitExprOrOpArgNode(n.getArgs()[0], set);
-			TupleType t = (TupleType) set.getSubType();
-			ArrayList<TLAType> list = new ArrayList<TLAType>();
-			list.add(t.getTypes().get(1));
-			list.add(t.getTypes().get(0));
-			SetType found = new SetType(new TupleType(list));
-			try {
-				found = found.unify(expected);
-			} catch (UnificationException e) {
-				throw new TypeErrorException(String.format("Expected %s, found %s at '%s',%n%s", expected, found,
-						n.getOperator().getName(), n.getLocation()));
-			}
-			return found;
-		}
-
-		/*
-		 * TLA+ Built-Ins, but not in tlc.tool.BuiltInOPs
-		 */
-		case B_OPCODE_bool: // BOOLEAN
-			try {
-				SetType found = new SetType(BoolType.getInstance());
-				found = found.unify(expected);
-				return found;
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(BOOL) at 'BOOLEAN',%n%s", expected, n.getLocation()));
-			}
-
-		case B_OPCODE_string: // STRING
-			try {
-				SetType found = new SetType(StringType.getInstance());
-				found = found.unify(expected);
-				return found;
-			} catch (UnificationException e) {
-				throw new TypeErrorException(
-						String.format("Expected %s, found POW(STRING) at 'STRING',%n%s", expected, n.getLocation()));
-			}
-
-		case B_OPCODE_true:
-		case B_OPCODE_false:
-			try {
-				BoolType.getInstance().unify(expected);
-				return BoolType.getInstance();
-			} catch (Exception e) {
-				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-
-		case B_OPCODE_assert: {
-			try {
-				BoolType.getInstance().unify(expected);
-				return BoolType.getInstance();
-			} catch (Exception e) {
-				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
-						n.getOperator().getName(), n.getLocation()));
-			}
-		}
-
-		default: {
-			throw new NotImplementedException(n.getOperator().getName().toString());
-		}
-		}
-	}
-}
+package de.tla2b.analysis;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import de.tla2b.config.ConfigfileEvaluator;
+import de.tla2b.config.TLCValueNode;
+import de.tla2b.config.ValueObj;
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.NotImplementedException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.global.BBuildIns;
+import de.tla2b.global.BBuiltInOPs;
+import de.tla2b.global.TranslationGlobals;
+import de.tla2b.types.*;
+import tla2sany.semantic.ASTConstants;
+import tla2sany.semantic.AssumeNode;
+import tla2sany.semantic.AtNode;
+import tla2sany.semantic.ExprNode;
+import tla2sany.semantic.ExprOrOpArgNode;
+import tla2sany.semantic.FormalParamNode;
+import tla2sany.semantic.LetInNode;
+import tla2sany.semantic.ModuleNode;
+import tla2sany.semantic.NumeralNode;
+import tla2sany.semantic.OpApplNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+import tla2sany.semantic.SemanticNode;
+import tla2sany.semantic.StringNode;
+import tla2sany.semantic.SymbolNode;
+import tlc2.tool.BuiltInOPs;
+
+public class TypeChecker extends BuiltInOPs implements ASTConstants, BBuildIns, TranslationGlobals {
+
+	private static final int TEMP_TYPE_ID = 6;
+	private int paramId;
+
+	private ArrayList<ExprNode> inits;
+	private ExprNode nextExpr;
+	private final Set<OpDefNode> usedDefinitions;
+	private final Set<OpDefNode> bDefinitions;
+
+	private ArrayList<SymbolNode> symbolNodeList = new ArrayList<SymbolNode>();
+	private ArrayList<SemanticNode> tupleNodeList = new ArrayList<SemanticNode>();
+
+	private ModuleNode moduleNode;
+	private ArrayList<OpDeclNode> bConstList;
+	private SpecAnalyser specAnalyser;
+
+	private Hashtable<OpDeclNode, ValueObj> constantAssignments;
+
+	private ConfigfileEvaluator conEval;
+
+	public TypeChecker(ModuleNode moduleNode, ConfigfileEvaluator conEval, SpecAnalyser specAnalyser) {
+		this.moduleNode = moduleNode;
+		this.specAnalyser = specAnalyser;
+		if (conEval != null) {
+			this.bConstList = conEval.getbConstantList();
+			this.constantAssignments = conEval.getConstantAssignments();
+			this.conEval = conEval;
+		}
+		this.inits = specAnalyser.getInits();
+		this.nextExpr = specAnalyser.getNext();
+		usedDefinitions = specAnalyser.getUsedDefinitions();
+		this.bDefinitions = specAnalyser.getBDefinitions();
+
+		paramId = TYPE_ID;
+	}
+
+	public TypeChecker(ModuleNode moduleNode, SpecAnalyser specAnalyser) {
+		this.moduleNode = moduleNode;
+		this.specAnalyser = specAnalyser;
+		Set<OpDefNode> usedDefinitions = new HashSet<OpDefNode>();
+		OpDefNode[] defs = moduleNode.getOpDefs();
+		// used the last definition of the module
+		usedDefinitions.add(defs[defs.length - 1]);
+		this.usedDefinitions = usedDefinitions;
+		this.bDefinitions = specAnalyser.getBDefinitions();
+		paramId = TYPE_ID;
+	}
+
+	public void start() throws TLA2BException {
+		OpDeclNode[] cons = moduleNode.getConstantDecls();
+		for (int i = 0; i < cons.length; i++) {
+			OpDeclNode con = cons[i];
+			if (constantAssignments != null && constantAssignments.containsKey(con)) {
+
+				TLAType t = constantAssignments.get(con).getType();
+				con.setToolObject(TYPE_ID, t);
+				if (t instanceof AbstractHasFollowers) {
+					((AbstractHasFollowers) t).addFollower(con);
+				}
+			} else {
+				UntypedType u = new UntypedType();
+				con.setToolObject(TYPE_ID, u);
+				u.addFollower(con);
+			}
+		}
+
+		OpDeclNode[] vars = moduleNode.getVariableDecls();
+		for (int i = 0; i < vars.length; i++) {
+			OpDeclNode var = vars[i];
+			UntypedType u = new UntypedType();
+			var.setToolObject(TYPE_ID, u);
+			u.addFollower(var);
+		}
+
+		evalDefinitions(moduleNode.getOpDefs());
+
+		if (conEval != null) {
+			Iterator<Entry<OpDeclNode, OpDefNode>> iter = conEval.getConstantOverrideTable().entrySet().iterator();
+			while (iter.hasNext()) {
+				Entry<OpDeclNode, OpDefNode> entry = iter.next();
+				OpDeclNode con = entry.getKey();
+				if (!bConstList.contains(con)) {
+					continue;
+				}
+				OpDefNode def = entry.getValue();
+				TLAType defType = (TLAType) def.getToolObject(TYPE_ID);
+				TLAType conType = (TLAType) con.getToolObject(TYPE_ID);
+
+				try {
+					TLAType result = defType.unify(conType);
+					con.setToolObject(TYPE_ID, result);
+				} catch (UnificationException e) {
+					throw new TypeErrorException(
+							String.format("Expected %s, found %s at constant '%s'.", defType, conType, con.getName()));
+				}
+			}
+		}
+
+		evalAssumptions(moduleNode.getAssumptions());
+
+		if (inits != null) {
+			for (int i = 0; i < inits.size(); i++) {
+				visitExprNode(inits.get(i), BoolType.getInstance());
+			}
+		}
+
+		if (nextExpr != null) {
+			visitExprNode(nextExpr, BoolType.getInstance());
+		}
+
+		checkIfAllIdentifiersHaveAType();
+
+	}
+
+	private void checkIfAllIdentifiersHaveAType() throws TypeErrorException {
+		// check if a variable has no type
+		OpDeclNode[] vars = moduleNode.getVariableDecls();
+		for (int i = 0; i < vars.length; i++) {
+			OpDeclNode var = vars[i];
+			TLAType varType = (TLAType) var.getToolObject(TYPE_ID);
+			if (varType.isUntyped()) {
+				throw new TypeErrorException(
+						"The type of the variable '" + var.getName() + "' can not be inferred: " + varType);
+			}
+		}
+
+		// check if a constant has no type, only constants which will appear in
+		// the resulting B Machine are considered
+		OpDeclNode[] cons = moduleNode.getConstantDecls();
+		for (int i = 0; i < cons.length; i++) {
+			OpDeclNode con = cons[i];
+			if (bConstList == null || bConstList.contains(con)) {
+				TLAType conType = (TLAType) con.getToolObject(TYPE_ID);
+				if (conType.isUntyped()) {
+					throw new TypeErrorException(
+							"The type of constant " + con.getName() + " is still untyped: " + conType);
+				}
+			}
+		}
+
+		for (SymbolNode symbol : symbolNodeList) {
+			TLAType type = (TLAType) symbol.getToolObject(TYPE_ID);
+			if (type.isUntyped()) {
+				throw new TypeErrorException("Symbol '" + symbol.getName() + "' has no type.\n" + symbol.getLocation());
+			}
+		}
+
+		for (SemanticNode tuple : tupleNodeList) {
+			TLAType type = (TLAType) tuple.getToolObject(TYPE_ID);
+			if (type instanceof TupleOrFunction) {
+				TupleOrFunction tOrF = (TupleOrFunction) type;
+				tOrF.getFinalType();
+			}
+		}
+
+	}
+
+	private void evalDefinitions(OpDefNode[] opDefs) throws TLA2BException {
+		for (int i = 0; i < opDefs.length; i++) {
+			OpDefNode def = opDefs[i];
+			// Definition in this module
+			String moduleName1 = def.getOriginallyDefinedInModuleNode().getName().toString();
+			String moduleName2 = def.getSource().getOriginallyDefinedInModuleNode().getName().toString();
+
+			if (STANDARD_MODULES.contains(moduleName1) || STANDARD_MODULES.contains(moduleName2)) {
+				continue;
+			}
+			if (usedDefinitions.contains(def) || bDefinitions.contains(def))
+				visitOpDefNode(def);
+		}
+
+	}
+
+	public void visitOpDefNode(OpDefNode def) throws TLA2BException {
+		FormalParamNode[] params = def.getParams();
+		for (int i = 0; i < params.length; i++) {
+			FormalParamNode p = params[i];
+			if (p.getArity() > 0) {
+				throw new FrontEndException(String.format("TLA2B do not support 2nd-order operators: '%s'%n %s ",
+						def.getName(), def.getLocation()));
+			}
+			UntypedType u = new UntypedType();
+			p.setToolObject(paramId, u);
+			u.addFollower(p);
+		}
+		UntypedType u = new UntypedType();
+		// def.setToolObject(TYPE_ID, u);
+		// u.addFollower(def);
+		TLAType defType = visitExprNode(def.getBody(), u);
+		def.setToolObject(TYPE_ID, defType);
+		if (defType instanceof AbstractHasFollowers) {
+			((AbstractHasFollowers) defType).addFollower(def);
+		}
+
+	}
+
+	private void evalAssumptions(AssumeNode[] assumptions) throws TLA2BException {
+		for (AssumeNode assumeNode : assumptions) {
+			visitExprNode(assumeNode.getAssume(), BoolType.getInstance());
+		}
+	}
+
+	private TLAType visitExprOrOpArgNode(ExprOrOpArgNode n, TLAType expected) throws TLA2BException {
+		if (n instanceof ExprNode) {
+			return visitExprNode((ExprNode) n, expected);
+		} else {
+			throw new NotImplementedException("OpArgNode not implemented jet");
+		}
+
+	}
+
+	private TLAType visitExprNode(ExprNode exprNode, TLAType expected) throws TLA2BException {
+
+		switch (exprNode.getKind()) {
+		case TLCValueKind: {
+			TLCValueNode valueNode = (TLCValueNode) exprNode;
+			try {
+				return valueNode.getType().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at '%s'(assigned in the configuration file),%n%s ",
+								expected, valueNode.getType(), valueNode.getValue(), exprNode.getLocation()));
+			}
+
+		}
+
+		case OpApplKind:
+			return visitOpApplNode((OpApplNode) exprNode, expected);
+
+		case NumeralKind:
+			try {
+				return IntType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found INTEGER at '%s',%n%s ", expected,
+						((NumeralNode) exprNode).val(), exprNode.getLocation()));
+			}
+		case StringKind: {
+			try {
+				return StringType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found STRING at '%s',%n%s ", expected,
+						((StringNode) exprNode).getRep(), exprNode.getLocation()));
+			}
+		}
+		case AtNodeKind: { // @
+			AtNode a = (AtNode) exprNode;
+			OpApplNode pair2 = a.getExceptComponentRef();
+			ExprOrOpArgNode rightside = pair2.getArgs()[1];
+			TLAType type = (TLAType) rightside.getToolObject(TYPE_ID);
+			try {
+				TLAType res = type.unify(expected);
+				setType(exprNode, res);
+				return res;
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at '@',%n%s ", expected, type, exprNode.getLocation()));
+			}
+
+		}
+
+		case LetInKind: {
+			LetInNode l = (LetInNode) exprNode;
+			for (int i = 0; i < l.getLets().length; i++) {
+				visitOpDefNode(l.getLets()[i]);
+			}
+			return visitExprNode(l.getBody(), expected);
+		}
+
+		case SubstInKind: {
+			throw new RuntimeException("SubstInKind should never occur after InstanceTransformation");
+		}
+
+		case DecimalKind: {
+			// currently not supported
+		}
+
+		}
+
+		throw new NotImplementedException(exprNode.toString(2));
+
+	}
+
+	private void setType(SemanticNode node, TLAType type) {
+		node.setToolObject(TYPE_ID, type);
+		if (type instanceof AbstractHasFollowers) {
+			((AbstractHasFollowers) type).addFollower(node);
+		}
+	}
+
+	private TLAType getType(OpApplNode n) {
+		return (TLAType) n.getToolObject(TYPE_ID);
+	}
+
+	private TLAType visitOpApplNode(OpApplNode n, TLAType expected) throws TLA2BException {
+
+		switch (n.getOperator().getKind()) {
+		case ConstantDeclKind: {
+			OpDeclNode con = (OpDeclNode) n.getOperator();
+
+			TLAType c = (TLAType) con.getToolObject(TYPE_ID);
+			if (c == null) {
+				throw new RuntimeException(con.getName() + " has no type yet!");
+			}
+			try {
+				TLAType result = expected.unify(c);
+				con.setToolObject(TYPE_ID, result);
+				return result;
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at constant '%s',%n%s", expected, c,
+						con.getName(), n.getLocation())
+
+				);
+			}
+		}
+
+		case VariableDeclKind: {
+			SymbolNode symbolNode = n.getOperator();
+			String vName = symbolNode.getName().toString();
+			TLAType v = (TLAType) symbolNode.getToolObject(TYPE_ID);
+			if (v == null) {
+				SymbolNode var = this.specAnalyser.getSymbolNodeByName(vName);
+				if (var != null) {
+					// symbolNode is variable of an expression, e.g. v + 1
+					v = (TLAType) var.getToolObject(TYPE_ID);
+				} else {
+					throw new RuntimeException(vName + " has no type yet!");
+				}
+			}
+			try {
+				TLAType result = expected.unify(v);
+				symbolNode.setToolObject(TYPE_ID, result);
+				return result;
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at variable '%s',%n%s", expected, v,
+						vName, n.getLocation()));
+			}
+		}
+
+		case BuiltInKind: {
+			return evalBuiltInKind(n, expected);
+		}
+
+		case FormalParamKind: {
+			SymbolNode symbolNode = n.getOperator();
+			String pName = symbolNode.getName().toString();
+			TLAType t = (TLAType) symbolNode.getToolObject(paramId);
+			if (t == null) {
+				t = (TLAType) symbolNode.getToolObject(TYPE_ID);
+			}
+
+			if (t == null) {
+				t = new UntypedType(); // TODO is this correct?
+				// throw new RuntimeException();
+			}
+			try {
+				TLAType result = expected.unify(t);
+				symbolNode.setToolObject(paramId, result);
+				return result;
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at parameter '%s',%n%s", expected, t,
+						pName, n.getLocation()));
+			}
+		}
+
+		case UserDefinedOpKind: {
+			OpDefNode def = (OpDefNode) n.getOperator();
+
+			// Definition is a BBuilt-in definition
+			String sourceModule = def.getSource().getOriginallyDefinedInModuleNode().getName().toString();
+			if (BBuiltInOPs.contains(def.getName()) && STANDARD_MODULES.contains(sourceModule)) {
+				return evalBBuiltIns(n, expected);
+			}
+
+			TLAType found = ((TLAType) def.getToolObject(TYPE_ID));
+			if (found == null) {
+				found = new UntypedType();
+				// throw new RuntimeException(def.getName() +
+				// " has no type yet!");
+			}
+			if (n.getArgs().length != 0) {
+				found = found.cloneTLAType();
+			}
+
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at definition '%s',%n%s", expected,
+						found, def.getName(), n.getLocation()));
+			}
+			boolean untyped = false;
+			FormalParamNode[] params = def.getParams();
+			for (int i = 0; i < n.getArgs().length; i++) {
+				// clone the parameter type, because the parameter type is not
+				// set/changed at a definition call
+				FormalParamNode p = params[i];
+				TLAType pType = ((TLAType) p.getToolObject(TYPE_ID));
+				if (pType == null) {
+					pType = new UntypedType();
+					// throw new RuntimeException("Parameter " + p.getName()
+					// + " has no type yet!%n" + p.getLocation());
+				}
+				pType = pType.cloneTLAType();
+				if (pType.isUntyped())
+					untyped = true;
+
+				pType = visitExprOrOpArgNode(n.getArgs()[i], pType); // unify
+																		// both
+																		// types
+				// set types of the arguments of the definition call to the
+				// parameters for reevaluation the def body
+				p.setToolObject(TEMP_TYPE_ID, pType);
+			}
+
+			if (found.isUntyped() || untyped || def.getInRecursive() == false) {
+				// evaluate the body of the definition again
+				paramId = TEMP_TYPE_ID;
+				found = visitExprNode(def.getBody(), found);
+				paramId = TYPE_ID;
+			}
+
+			n.setToolObject(TYPE_ID, found);
+
+			return found;
+
+		}
+
+		default: {
+			throw new NotImplementedException(n.getOperator().getName().toString());
+		}
+		}
+
+	}
+
+	private TLAType evalBuiltInKind(OpApplNode n, TLAType expected) throws TLA2BException {
+
+		switch (getOpCode(n.getOperator().getName())) {
+
+		/*
+		 * equality and disequality: =, #, /=
+		 */
+		case OPCODE_eq: // =
+		case OPCODE_noteq: // /=, #
+		{
+			try {
+				BoolType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			TLAType left = visitExprOrOpArgNode(n.getArgs()[0], new de.tla2b.types.UntypedType());
+			visitExprOrOpArgNode(n.getArgs()[1], left);
+			return BoolType.getInstance();
+		}
+
+		/*
+		 * Logic Operators: \neg, \lnot, \land, \cl, \lor, \dl, \equiv, =>
+		 */
+		case OPCODE_neg: // Negation
+		case OPCODE_lnot: // Negation
+		case OPCODE_cl: // $ConjList
+		case OPCODE_dl: // $DisjList
+		case OPCODE_land: // \land
+		case OPCODE_lor: // \lor
+		case OPCODE_equiv: // \equiv
+		case OPCODE_implies: // =>
+		{
+			try {
+				BoolType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			for (int i = 0; i < n.getArgs().length; i++) {
+				visitExprOrOpArgNode(n.getArgs()[i], BoolType.getInstance());
+			}
+			return BoolType.getInstance();
+		}
+
+		/*
+		 * Quantification: \A x \in S : P or \E x \in S : P
+		 */
+		case OPCODE_be: // \E x \in S : P
+		case OPCODE_bf: // \A x \in S : P
+		{
+			try {
+				BoolType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			evalBoundedVariables(n);
+			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
+			return BoolType.getInstance();
+		}
+
+		/*
+		 * Set Operators
+		 */
+		case OPCODE_se: // SetEnumeration {..}
+		{
+			SetType found = new SetType(new UntypedType());
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(_A) at set enumeration,%n%s", expected, n.getLocation()));
+			}
+			TLAType current = found.getSubType();
+			for (int i = 0; i < n.getArgs().length; i++) {
+				current = visitExprOrOpArgNode(n.getArgs()[i], current);
+			}
+			return found;
+		}
+
+		case OPCODE_in: // \in
+		case OPCODE_notin: // \notin
+		{
+			if (!BoolType.getInstance().compare(expected)) {
+				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			TLAType element = visitExprOrOpArgNode(n.getArgs()[0], new UntypedType());
+			visitExprOrOpArgNode(n.getArgs()[1], new SetType(element));
+
+			return BoolType.getInstance();
+		}
+
+		case OPCODE_setdiff: // set difference
+		case OPCODE_cup: // set union
+		case OPCODE_cap: // set intersection
+		{
+			SetType found = new SetType(new UntypedType());
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found POW(_A) at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			TLAType left = visitExprOrOpArgNode(n.getArgs()[0], found);
+			TLAType right = visitExprOrOpArgNode(n.getArgs()[1], left);
+			return right;
+		}
+
+		case OPCODE_subseteq: // \subseteq - subset or equal
+		{
+			try {
+				BoolType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			TLAType left = visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
+			visitExprOrOpArgNode(n.getArgs()[1], left);
+			return BoolType.getInstance();
+		}
+
+		/*
+		 * Set Constructor
+		 */
+		case OPCODE_sso: // $SubsetOf Represents {x \in S : P}
+		{
+
+			TLAType domainType = evalBoundedVariables(n);
+			SetType found = new SetType(domainType);
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at '%s',%n%s", expected, found,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
+			return found;
+		}
+
+		case OPCODE_soa: // $SetOfAll Represents {e : p1 \in S, p2,p3 \in S2}
+		{
+			SetType found = new SetType(new UntypedType());
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found POW(_A) at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			evalBoundedVariables(n);
+			visitExprOrOpArgNode(n.getArgs()[0], found.getSubType());
+			return found;
+		}
+
+		case OPCODE_subset: // SUBSET (conforms POW in B)
+		{
+			SetType found = new SetType(new UntypedType());
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(_A) at 'SUBSET',%n%s", expected, n.getLocation()));
+			}
+			visitExprOrOpArgNode(n.getArgs()[0], found.getSubType());
+			return found;
+		}
+
+		case OPCODE_union: // Union - Union{{1},{2}}
+		{
+			SetType found = new SetType(new UntypedType());
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(_A) at 'SUBSET',%n%s", expected, n.getLocation()));
+			}
+			SetType setOfSet = (SetType) visitExprOrOpArgNode(n.getArgs()[0], new SetType(found));
+			return setOfSet.getSubType();
+		}
+
+		/*
+		 * Prime
+		 */
+		case OPCODE_prime: // prime
+		{
+			try {
+				OpApplNode node = (OpApplNode) n.getArgs()[0];
+				if (node.getOperator().getKind() != VariableDeclKind) {
+					throw new TypeErrorException(
+							"Expected variable at \"" + node.getOperator().getName() + "\":\n" + node.getLocation());
+				}
+				return visitExprOrOpArgNode(n.getArgs()[0], expected);
+			} catch (ClassCastException e) {
+				throw new TypeErrorException(
+						"Expected variable as argument of prime operator:\n" + n.getArgs()[0].getLocation());
+			}
+		}
+
+		/*
+		 * Tuple: Tuple as Function 1..n to Set (Sequence)
+		 */
+		case OPCODE_tup: { // $Tuple
+			ArrayList<TLAType> list = new ArrayList<TLAType>();
+			for (int i = 0; i < n.getArgs().length; i++) {
+				list.add(visitExprOrOpArgNode(n.getArgs()[i], new UntypedType()));
+			}
+			TLAType found = null;
+			if (list.size() == 0) {
+				found = new FunctionType(IntType.getInstance(), new UntypedType());
+			} else if (list.size() == 1) {
+				found = new FunctionType(IntType.getInstance(), list.get(0));
+			} else {
+				found = TupleOrFunction.createTupleOrFunctionType(list);
+				// found = new TupleType(list);
+			}
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at Tuple,%n%s", expected, found, n.getLocation()));
+			}
+			n.setToolObject(TYPE_ID, found);
+			tupleNodeList.add(n);
+			if (found instanceof AbstractHasFollowers) {
+				((AbstractHasFollowers) found).addFollower(n);
+			}
+			return found;
+		}
+
+		/*
+		 * Function constructors
+		 */
+		case OPCODE_rfs: // recursive function ( f[x\in Nat] == IF x = 0 THEN 1
+							// ELSE f[n-1]
+		{
+
+			FormalParamNode recFunc = n.getUnbdedQuantSymbols()[0];
+			symbolNodeList.add(recFunc);
+			FunctionType recType = new FunctionType();
+			recFunc.setToolObject(TYPE_ID, recType);
+			recType.addFollower(recFunc);
+
+			TLAType domainType = evalBoundedVariables(n);
+			FunctionType found = new FunctionType(domainType, new UntypedType());
+			visitExprOrOpArgNode(n.getArgs()[0], found.getRange());
+
+			try {
+				found = (FunctionType) found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException("Expected '" + expected + "', found '" + found + "'.\n" + n.getLocation());
+			}
+
+			TLAType t = null;
+			try {
+				t = (TLAType) recFunc.getToolObject(TYPE_ID);
+				found = (FunctionType) found.unify(t);
+			} catch (UnificationException e) {
+				throw new TypeErrorException("Expected '" + expected + "', found '" + t + "'.\n" + n.getLocation());
+			}
+
+			return found;
+		}
+
+		case OPCODE_nrfs: // succ[n \in Nat] == n + 1
+		case OPCODE_fc: // [n \in Nat |-> n+1]
+		{
+			TLAType domainType = evalBoundedVariables(n);
+			FunctionType found = new FunctionType(domainType, new UntypedType());
+			visitExprOrOpArgNode(n.getArgs()[0], found.getRange());
+
+			try {
+				found = (FunctionType) found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException("Expected '" + expected + "', found '" + found + "'.\n" + n.getLocation());
+			}
+			return found;
+		}
+
+		/*
+		 * Function call
+		 */
+		case OPCODE_fa: // $FcnApply f[1]
+		{
+			TLAType domType;
+			ExprOrOpArgNode dom = n.getArgs()[1];
+			if (dom instanceof OpApplNode && ((OpApplNode) dom).getOperator().getName().toString().equals("$Tuple")) {
+				ArrayList<TLAType> domList = new ArrayList<TLAType>();
+				OpApplNode domOpAppl = (OpApplNode) dom;
+				for (int i = 0; i < domOpAppl.getArgs().length; i++) {
+					TLAType d = visitExprOrOpArgNode(domOpAppl.getArgs()[i], new UntypedType());
+					domList.add(d);
+				}
+
+				if (domList.size() == 1) { // one-tuple
+					domType = new FunctionType(IntType.getInstance(), domList.get(0));
+					FunctionType func = new FunctionType(domType, expected);
+					TLAType res = visitExprOrOpArgNode(n.getArgs()[0], func);
+					return ((FunctionType) res).getRange();
+				} else {
+					domType = new TupleType(domList);
+					FunctionType func = new FunctionType(domType, expected);
+					TLAType res = visitExprOrOpArgNode(n.getArgs()[0], func);
+					return ((FunctionType) res).getRange();
+				}
+			} else {
+				ExprOrOpArgNode arg = n.getArgs()[1];
+				if (arg instanceof NumeralNode) {
+					NumeralNode num = (NumeralNode) arg;
+					UntypedType u = new UntypedType();
+					n.setToolObject(TYPE_ID, u);
+					u.addFollower(n);
+					TupleOrFunction tupleOrFunc = new TupleOrFunction(num.val(), u);
+
+					TLAType res = visitExprOrOpArgNode(n.getArgs()[0], tupleOrFunc);
+					n.getArgs()[0].setToolObject(TYPE_ID, res);
+					tupleNodeList.add(n.getArgs()[0]);
+					if (res instanceof AbstractHasFollowers) {
+						((AbstractHasFollowers) res).addFollower(n.getArgs()[0]);
+					}
+					TLAType found = (TLAType) n.getToolObject(TYPE_ID);
+					try {
+						found = found.unify(expected);
+					} catch (UnificationException e) {
+						throw new TypeErrorException("Expected '" + expected + "', found '" + found + "'.\n"
+								+ n.getArgs()[0].toString(2) + "\n" + n.getLocation());
+					}
+					return found;
+				}
+				domType = visitExprOrOpArgNode(n.getArgs()[1], new UntypedType());
+			}
+			FunctionType func = new FunctionType(domType, expected);
+			TLAType res = visitExprOrOpArgNode(n.getArgs()[0], func);
+			return ((FunctionType) res).getRange();
+
+		}
+
+		/*
+		 * Domain of Function
+		 */
+		case OPCODE_domain: {
+
+			FunctionType func = new FunctionType(new UntypedType(), new UntypedType());
+			func = (FunctionType) visitExprOrOpArgNode(n.getArgs()[0], func);
+			TLAType res = null;
+			try {
+				res = new SetType(func.getDomain()).unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected '%s', found '%s' at 'DOMAIN(..)',%n%s", expected,
+						func, n.getLocation()));
+			}
+			return res;
+		}
+		/*
+		 * Set of Function
+		 */
+		case OPCODE_sof: // [ A -> B]
+		{
+			SetType A = (SetType) visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
+			SetType B = (SetType) visitExprOrOpArgNode(n.getArgs()[1], new SetType(new UntypedType()));
+
+			SetType found = new SetType(new FunctionType(A.getSubType(), B.getSubType()));
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected '%s', found '%s' at Set of Function,%n%s",
+						expected, found, n.getLocation()));
+			}
+			return found;
+		}
+
+		/*
+		 * Except
+		 */
+		case OPCODE_exc: // $Except
+		{
+			return evalExcept(n, expected);
+		}
+
+		/*
+		 * Cartesian Product: A \X B
+		 */
+		case OPCODE_cp: // $CartesianProd A \X B \X C as $CartesianProd(A, B, C)
+		{
+			ArrayList<TLAType> list = new ArrayList<TLAType>();
+			for (int i = 0; i < n.getArgs().length; i++) {
+				SetType t = (SetType) visitExprOrOpArgNode(n.getArgs()[i], new SetType(new UntypedType()));
+				list.add(t.getSubType());
+			}
+			SetType found = new SetType(new TupleType(list));
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at Cartesian Product,%n%s", expected,
+						found, n.getLocation()));
+			}
+
+			return found;
+		}
+
+		/*
+		 * Records
+		 */
+		case OPCODE_sor: // $SetOfRcds [L1 : e1, L2 : e2]
+		{
+			StructType struct = new StructType();
+			for (int i = 0; i < n.getArgs().length; i++) {
+				OpApplNode pair = (OpApplNode) n.getArgs()[i];
+				StringNode field = (StringNode) pair.getArgs()[0];
+				SetType fieldType = (SetType) visitExprOrOpArgNode(pair.getArgs()[1], new SetType(new UntypedType()));
+				struct.add(field.getRep().toString(), fieldType.getSubType());
+			}
+
+			SetType found = new SetType(struct);
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at Set of Records,%n%s", expected,
+						found, n.getLocation()));
+			}
+			n.setToolObject(TYPE_ID, found);
+			found.addFollower(n);
+			return found;
+		}
+
+		case OPCODE_rc: // [h_1 |-> 1, h_2 |-> 2]
+		{
+			StructType found = new StructType();
+			for (int i = 0; i < n.getArgs().length; i++) {
+				OpApplNode pair = (OpApplNode) n.getArgs()[i];
+				StringNode field = (StringNode) pair.getArgs()[0];
+				TLAType fieldType = visitExprOrOpArgNode(pair.getArgs()[1], new UntypedType());
+				found.add(field.getRep().toString(), fieldType);
+			}
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at Record,%n%s", expected, found, n.getLocation()));
+			}
+			n.setToolObject(TYPE_ID, found);
+			found.addFollower(n);
+
+			return found;
+
+		}
+
+		case OPCODE_rs: // $RcdSelect r.c
+		{
+			String fieldName = ((StringNode) n.getArgs()[1]).getRep().toString();
+			StructType r = (StructType) visitExprOrOpArgNode(n.getArgs()[0], StructType.getIncompleteStruct());
+
+			StructType expectedStruct = StructType.getIncompleteStruct();
+			expectedStruct.add(fieldName, expected);
+
+			try {
+				r = r.unify(expectedStruct);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Struct has no field %s with type %s: %s%n%s", fieldName,
+						r.getType(fieldName), r, n.getLocation()));
+			}
+			n.getArgs()[0].setToolObject(TYPE_ID, r);
+			r.addFollower(n.getArgs()[0]);
+			return r.getType(fieldName);
+		}
+
+		/*
+		 * miscellaneous constructs
+		 */
+		case OPCODE_ite: // IF THEN ELSE
+		{
+			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
+			TLAType then = visitExprOrOpArgNode(n.getArgs()[1], expected);
+			TLAType eelse = visitExprOrOpArgNode(n.getArgs()[2], then);
+			n.setToolObject(TYPE_ID, eelse);
+			if (eelse instanceof AbstractHasFollowers) {
+				((AbstractHasFollowers) eelse).addFollower(n);
+			}
+			return eelse;
+		}
+
+		case OPCODE_case: {
+			/*
+			 * CASE p1 -> e1 [] p2 -> e2 represented as $Case( $Pair(p1,
+			 * e1),$Pair(p2, e2) ) and CASE p1 -> e1 [] p2 -> e2 [] OTHER -> e3
+			 * represented as $Case( $Pair(p1, e1), $Pair(p2, e2), $Pair(null,
+			 * e3))
+			 */
+			TLAType found = expected;
+			for (int i = 0; i < n.getArgs().length; i++) {
+				OpApplNode pair = (OpApplNode) n.getArgs()[i];
+				if (pair.getArgs()[0] != null) {
+					visitExprOrOpArgNode(pair.getArgs()[0], BoolType.getInstance());
+				}
+				found = visitExprOrOpArgNode(pair.getArgs()[1], found);
+			}
+			return found;
+
+		}
+
+		case OPCODE_uc: {
+			List<TLAType> list = new ArrayList<TLAType>();
+			for (FormalParamNode param : n.getUnbdedQuantSymbols()) {
+				TLAType paramType = new UntypedType();
+				symbolNodeList.add(param);
+				setType(param, paramType);
+				list.add(paramType);
+			}
+			TLAType found = null;
+			if (list.size() == 1) {
+				found = list.get(0);
+			} else {
+				found = new TupleType(list);
+			}
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at 'CHOOSE',%n%s", expected, found, n.getLocation()));
+			}
+			setType(n, found);
+			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
+
+			return getType(n);
+
+		}
+
+		case OPCODE_bc: { // CHOOSE x \in S: P
+			TLAType found = evalBoundedVariables(n);
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at 'CHOOSE',%n%s", expected, found, n.getLocation()));
+			}
+			visitExprOrOpArgNode(n.getArgs()[0], BoolType.getInstance());
+			return found;
+		}
+
+		case OPCODE_unchanged: {
+			return BoolType.getInstance().unify(expected);
+		}
+
+		/*
+		 * no TLA+ Built-ins
+		 */
+		case 0: {
+			return evalBBuiltIns(n, expected);
+		}
+		}
+
+		throw new NotImplementedException(
+				"Not supported Operator: " + n.getOperator().getName().toString() + "\n" + n.getLocation());
+	}
+
+	private TLAType evalBoundedVariables(OpApplNode n) throws TLA2BException {
+		ArrayList<TLAType> domList = new ArrayList<TLAType>();
+		FormalParamNode[][] params = n.getBdedQuantSymbolLists();
+		ExprNode[] bounds = n.getBdedQuantBounds();
+		for (int i = 0; i < bounds.length; i++) {
+			SetType boundType = (SetType) visitExprNode(bounds[i], new SetType(new UntypedType()));
+			TLAType subType = boundType.getSubType();
+
+			if (n.isBdedQuantATuple()[i]) {
+				if (params[i].length == 1) {
+					FormalParamNode p = params[i][0];
+					FunctionType expected = new FunctionType(IntType.getInstance(), new UntypedType());
+					try {
+						expected = (FunctionType) expected.unify(subType);
+					} catch (UnificationException e) {
+						throw new TypeErrorException(String.format("Expected %s, found %s at parameter %s,%n%s",
+								expected, subType, p.getName().toString(), bounds[i].getLocation()));
+					}
+					domList.add(expected);
+					symbolNodeList.add(p);
+					p.setToolObject(TYPE_ID, expected.getRange());
+					if (expected.getRange() instanceof AbstractHasFollowers) {
+						((AbstractHasFollowers) expected.getRange()).addFollower(p);
+					}
+				} else {
+					TupleType tuple = new TupleType(params[i].length);
+					try {
+						tuple = (TupleType) tuple.unify(subType);
+					} catch (UnificationException e) {
+						throw new TypeErrorException(String.format("Expected %s, found %s at tuple,%n%s", tuple,
+								subType, bounds[i].getLocation()));
+					}
+					domList.add(tuple);
+					for (int j = 0; j < params[i].length; j++) {
+						FormalParamNode p = params[i][j];
+						symbolNodeList.add(p);
+						TLAType paramType = tuple.getTypes().get(j);
+						p.setToolObject(TYPE_ID, paramType);
+						if (paramType instanceof AbstractHasFollowers) {
+							((AbstractHasFollowers) paramType).addFollower(p);
+						}
+					}
+
+				}
+
+			} else {
+				// is not a tuple: all parameter have the same type
+				for (int j = 0; j < params[i].length; j++) {
+					domList.add(subType);
+					FormalParamNode p = params[i][j];
+					symbolNodeList.add(p);
+					p.setToolObject(TYPE_ID, subType);
+					if (subType instanceof AbstractHasFollowers) {
+						((AbstractHasFollowers) subType).addFollower(p);
+					}
+				}
+			}
+		}
+
+		TLAType domType = null;
+		if (domList.size() == 1) {
+			domType = domList.get(0);
+		} else {
+			domType = new TupleType(domList);
+		}
+		return domType;
+	}
+
+	private TLAType evalExcept(OpApplNode n, TLAType expected) throws TLA2BException {
+		TLAType t = visitExprOrOpArgNode(n.getArgs()[0], expected);
+		n.setToolObject(TYPE_ID, t);
+		if (t instanceof AbstractHasFollowers) {
+			((AbstractHasFollowers) t).addFollower(n);
+		}
+
+		for (int i = 1; i < n.getArgs().length; i++) {
+			OpApplNode pair = (OpApplNode) n.getArgs()[i];
+			ExprOrOpArgNode leftside = pair.getArgs()[0];
+			ExprOrOpArgNode rightside = pair.getArgs()[1];
+			// stored for @ node
+			UntypedType untyped = new UntypedType();
+			rightside.setToolObject(TYPE_ID, untyped);
+			untyped.addFollower(rightside);
+			TLAType valueType = visitExprOrOpArgNode(rightside, untyped);
+
+			OpApplNode seq = (OpApplNode) leftside;
+			LinkedList<ExprOrOpArgNode> list = new LinkedList<ExprOrOpArgNode>();
+			for (int j = 0; j < seq.getArgs().length; j++) {
+				list.add(seq.getArgs()[j]);
+			}
+			ExprOrOpArgNode first = list.poll();
+
+			if (first instanceof StringNode) {
+				String field = ((StringNode) first).getRep().toString();
+				TLAType res = evalType(list, valueType);
+				StructOrFunctionType s = new StructOrFunctionType(field, res);
+				try {
+					t = t.unify(s);
+				} catch (UnificationException e) {
+					throw new TypeErrorException(
+							String.format("Expected %s, found %s at 'EXCEPT',%n%s", t, s, pair.getLocation()));
+				}
+
+			} else {
+				// Function
+				ExprOrOpArgNode domExpr = first;
+				TLAType domType;
+				TLAType rangeType;
+				if (domExpr instanceof OpApplNode
+						&& ((OpApplNode) domExpr).getOperator().getName().toString().equals("$Tuple")) {
+					ArrayList<TLAType> domList = new ArrayList<TLAType>();
+					OpApplNode domOpAppl = (OpApplNode) domExpr;
+					for (int j = 0; j < domOpAppl.getArgs().length; j++) {
+						TLAType d = visitExprOrOpArgNode(domOpAppl.getArgs()[j], new UntypedType());
+						domList.add(d);
+					}
+					domType = new TupleType(domList);
+					domExpr.setToolObject(TYPE_ID, domType); // store type
+				} else {
+					domType = visitExprOrOpArgNode(domExpr, new UntypedType());
+				}
+				rangeType = evalType(list, valueType);
+				FunctionType func = new FunctionType(domType, rangeType);
+				try {
+					t = t.unify(func);
+				} catch (UnificationException e) {
+					throw new TypeErrorException(
+							String.format("Expected %s, found %s at 'EXCEPT',%n%s", t, func, pair.getLocation()));
+				}
+			}
+		}
+		return t;
+
+	}
+
+	private TLAType evalType(LinkedList<ExprOrOpArgNode> list, TLAType valueType) throws TLA2BException {
+		if (list.size() == 0) {
+			return valueType;
+		}
+		ExprOrOpArgNode head = list.poll();
+		if (head instanceof StringNode) {
+			// record or function of strings
+			String name = ((StringNode) head).getRep().toString();
+			StructOrFunctionType res = new StructOrFunctionType(name, evalType(list, valueType));
+			return res;
+		}
+		TLAType t = visitExprOrOpArgNode(head, new UntypedType());
+		FunctionType res = new FunctionType(t, evalType(list, valueType));
+		return res;
+	}
+
+	private TLAType evalBBuiltIns(OpApplNode n, TLAType expected) throws TLA2BException {
+		switch (BBuiltInOPs.getOpcode(n.getOperator().getName())) {
+		// B Builtins
+
+		/*
+		 * Standard Module Naturals
+		 */
+		case B_OPCODE_gt: // >
+		case B_OPCODE_lt: // <
+		case B_OPCODE_leq: // <=
+		case B_OPCODE_geq: // >=
+		{
+			try {
+				BoolType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			for (int i = 0; i < n.getArgs().length; i++) {
+				visitExprOrOpArgNode(n.getArgs()[i], IntType.getInstance());
+			}
+			return BoolType.getInstance();
+		}
+
+		case B_OPCODE_plus: // +
+		case B_OPCODE_minus: // -
+		case B_OPCODE_times: // *
+		case B_OPCODE_div: // /
+		case B_OPCODE_mod: // % modulo
+		case B_OPCODE_exp: { // x hoch y, x^y
+			try {
+				IntType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found INTEGER at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			for (int i = 0; i < n.getArgs().length; i++) {
+				visitExprOrOpArgNode(n.getArgs()[i], IntType.getInstance());
+			}
+			return IntType.getInstance();
+		}
+
+		case B_OPCODE_dotdot: // ..
+		{
+			try {
+				expected.unify(new SetType(IntType.getInstance()));
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(INTEGER) at '..',%n%s", expected, n.getLocation()));
+			}
+
+			for (int i = 0; i < n.getArgs().length; i++) {
+				visitExprOrOpArgNode(n.getArgs()[i], IntType.getInstance());
+			}
+			return new SetType(IntType.getInstance());
+		}
+
+		case B_OPCODE_nat: // Nat
+		{
+			try {
+				SetType found = new SetType(IntType.getInstance());
+				found = found.unify(expected);
+				return found;
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(INTEGER) at 'Nat',%n%s", expected, n.getLocation()));
+			}
+		}
+
+		/*
+		 * Standard Module Integers
+		 */
+		case B_OPCODE_int: // Int
+		{
+			try {
+				SetType found = new SetType(IntType.getInstance());
+				found = found.unify(expected);
+				return found;
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(INTEGER) at 'Int',%n%s", expected, n.getLocation()));
+			}
+		}
+
+		case B_OPCODE_uminus: // -x
+		{
+			try {
+				IntType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found INTEGER at '-',%n%s", expected, n.getLocation()));
+			}
+			visitExprOrOpArgNode(n.getArgs()[0], IntType.getInstance());
+			return IntType.getInstance();
+		}
+
+		/*
+		 * Standard Module FiniteSets
+		 */
+		case B_OPCODE_finite: // IsFiniteSet
+		{
+			try {
+				BoolType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found BOOL at 'IsFiniteSet',%n%s", expected, n.getLocation()));
+			}
+			visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
+			return BoolType.getInstance();
+		}
+
+		case B_OPCODE_card: // Cardinality
+		{
+			try {
+				IntType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found INTEGER at 'Cardinality',%n%s", expected, n.getLocation()));
+			}
+			visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
+			return IntType.getInstance();
+		}
+
+		/*
+		 * Standard Module Sequences
+		 */
+		case B_OPCODE_seq: { // Seq(S) - set of sequences, S must be a set
+
+			SetType S = (SetType) visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
+
+			SetType set_of_seq = new SetType(new FunctionType(IntType.getInstance(), S.getSubType()));
+			try {
+				set_of_seq = set_of_seq.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at 'Seq',%n%s", expected, set_of_seq, n.getLocation()));
+			}
+			return set_of_seq;
+		}
+
+		case B_OPCODE_len: { // lengh of the sequence
+			try {
+				IntType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found INTEGER at 'Len',%n%s", expected, n.getLocation()));
+			}
+			visitExprOrOpArgNode(n.getArgs()[0], new FunctionType(IntType.getInstance(), new UntypedType()));
+			return IntType.getInstance();
+		}
+
+		case B_OPCODE_conc: { // s \o s2 - concatenation of s and s2
+			TLAType found = new FunctionType(IntType.getInstance(), new UntypedType());
+			found = visitExprOrOpArgNode(n.getArgs()[0], found);
+			found = visitExprOrOpArgNode(n.getArgs()[1], found);
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(INTEGER*_A) at '\\o',%n%s", expected, n.getLocation()));
+			}
+			return found;
+		}
+
+		case B_OPCODE_append: // Append(s, e)
+		{
+			FunctionType found = new FunctionType(IntType.getInstance(), new UntypedType());
+			found = (FunctionType) visitExprOrOpArgNode(n.getArgs()[0], found);
+			visitExprOrOpArgNode(n.getArgs()[1], found.getRange());
+			try {
+				found = (FunctionType) found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at 'Append',%n%s", expected, found, n.getLocation()));
+			}
+			return found;
+		}
+
+		case B_OPCODE_head: { // HEAD(s) - the first element of the sequence
+			FunctionType func = new FunctionType(IntType.getInstance(), new UntypedType());
+			func = (FunctionType) visitExprOrOpArgNode(n.getArgs()[0], func);
+
+			TLAType found = func.getRange();
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at 'Head',%n%s", expected, found, n.getLocation()));
+			}
+			return found;
+		}
+
+		case B_OPCODE_tail: { // Tail(s)
+			FunctionType found = new FunctionType(IntType.getInstance(), new UntypedType());
+			found = (FunctionType) visitExprOrOpArgNode(n.getArgs()[0], found);
+			try {
+				found = (FunctionType) found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at 'Tail',%n%s", expected, found, n.getLocation()));
+			}
+			return found;
+		}
+
+		case B_OPCODE_subseq: { // SubSeq(s,m,n)
+			TLAType found = new FunctionType(IntType.getInstance(), new UntypedType());
+			found = visitExprOrOpArgNode(n.getArgs()[0], found);
+			visitExprOrOpArgNode(n.getArgs()[1], IntType.getInstance());
+			visitExprOrOpArgNode(n.getArgs()[2], IntType.getInstance());
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found %s at 'SubSeq',%n%s", expected, found, n.getLocation()));
+			}
+			return found;
+		}
+
+		// TODO add BSeq to tla standard modules
+
+		/*
+		 * Standard Module TLA2B
+		 */
+
+		case B_OPCODE_min: // MinOfSet(S)
+		case B_OPCODE_max: // MaxOfSet(S)
+		case B_OPCODE_setprod: // SetProduct(S)
+		case B_OPCODE_setsum: // SetSummation(S)
+		{
+			try {
+				IntType.getInstance().unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found INTEGER at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			visitExprOrOpArgNode(n.getArgs()[0], new SetType(IntType.getInstance()));
+			return IntType.getInstance();
+		}
+
+		case B_OPCODE_permseq: { // PermutedSequences(S)
+			SetType argType = (SetType) visitExprOrOpArgNode(n.getArgs()[0], new SetType(new UntypedType()));
+			SetType found = new SetType(new FunctionType(IntType.getInstance(), argType.getSubType()));
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at 'PermutedSequences',%n%s",
+						expected, found, n.getLocation()));
+			}
+			return found;
+		}
+
+		/*
+		 * Standard Module TLA2B
+		 */
+		case B_OPCODE_pow1: // POW1
+		{
+
+			SetType set = new SetType(new UntypedType());
+			set = (SetType) visitExprOrOpArgNode(n.getArgs()[0], set);
+			SetType found = new SetType(set);
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at '%s',%n%s", expected, found,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			return found;
+		}
+
+		/*
+		 * Standard Module Relations
+		 */
+		case B_OPCODE_rel_inverse: // POW1
+		{
+			SetType set = new SetType(new TupleType(2));
+			set = (SetType) visitExprOrOpArgNode(n.getArgs()[0], set);
+			TupleType t = (TupleType) set.getSubType();
+			ArrayList<TLAType> list = new ArrayList<TLAType>();
+			list.add(t.getTypes().get(1));
+			list.add(t.getTypes().get(0));
+			SetType found = new SetType(new TupleType(list));
+			try {
+				found = found.unify(expected);
+			} catch (UnificationException e) {
+				throw new TypeErrorException(String.format("Expected %s, found %s at '%s',%n%s", expected, found,
+						n.getOperator().getName(), n.getLocation()));
+			}
+			return found;
+		}
+
+		/*
+		 * TLA+ Built-Ins, but not in tlc.tool.BuiltInOPs
+		 */
+		case B_OPCODE_bool: // BOOLEAN
+			try {
+				SetType found = new SetType(BoolType.getInstance());
+				found = found.unify(expected);
+				return found;
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(BOOL) at 'BOOLEAN',%n%s", expected, n.getLocation()));
+			}
+
+		case B_OPCODE_string: // STRING
+			try {
+				SetType found = new SetType(StringType.getInstance());
+				found = found.unify(expected);
+				return found;
+			} catch (UnificationException e) {
+				throw new TypeErrorException(
+						String.format("Expected %s, found POW(STRING) at 'STRING',%n%s", expected, n.getLocation()));
+			}
+
+		case B_OPCODE_true:
+		case B_OPCODE_false:
+			try {
+				BoolType.getInstance().unify(expected);
+				return BoolType.getInstance();
+			} catch (Exception e) {
+				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+
+		case B_OPCODE_assert: {
+			try {
+				BoolType.getInstance().unify(expected);
+				return BoolType.getInstance();
+			} catch (Exception e) {
+				throw new TypeErrorException(String.format("Expected %s, found BOOL at '%s',%n%s", expected,
+						n.getOperator().getName(), n.getLocation()));
+			}
+		}
+
+		default: {
+			throw new NotImplementedException(n.getOperator().getName().toString());
+		}
+		}
+	}
+}
diff --git a/src/main/java/de/tla2b/config/ConfigfileEvaluator.java b/src/main/java/de/tla2b/config/ConfigfileEvaluator.java
index 70707605201af2c943ca8528c56a172c76d964fa..e1675dc755ace0b4e41c3b6aab1c447637aeda7a 100644
--- a/src/main/java/de/tla2b/config/ConfigfileEvaluator.java
+++ b/src/main/java/de/tla2b/config/ConfigfileEvaluator.java
@@ -1,612 +1,612 @@
-package de.tla2b.config;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import de.tla2b.exceptions.ConfigFileErrorException;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.types.BoolType;
-import de.tla2b.types.EnumType;
-import de.tla2b.types.IntType;
-import de.tla2b.types.SetType;
-import de.tla2b.types.StringType;
-import de.tla2b.types.TLAType;
-import de.tla2b.types.UntypedType;
-import tla2sany.semantic.InstanceNode;
-import tla2sany.semantic.ModuleNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-import tla2sany.semantic.OpDefOrDeclNode;
-import tlc2.tool.ModelConfig;
-import tlc2.util.Vect;
-import tlc2.value.IntValue;
-import tlc2.value.ModelValue;
-import tlc2.value.SetEnumValue;
-import tlc2.value.Value;
-
-/**
- * This class evaluates the configfile and collects all necessary information of
- * the configfile. All used identifier in the configfile are checked to be valid
- * in the context of the module
- */
-public class ConfigfileEvaluator {
-
-	private ModelConfig configAst;
-	private ModuleNode moduleNode;
-	private Hashtable<String, OpDefNode> definitions;
-	// Hashtable of all definitons in module
-	private Hashtable<String, OpDeclNode> constants;
-	// Hashtable of all constants in the module
-
-	private OpDefNode specNode; // SPECIFICATION node, may be null
-	private OpDefNode nextNode; // NEXT node, may be null
-	private OpDefNode initNode; // INIT node, may be null
-	private final ArrayList<OpDefNode> invariantNodeList = new ArrayList<OpDefNode>();
-	private ArrayList<String> enumeratedSet;
-	private LinkedHashMap<String, EnumType> enumeratedTypes;
-	public Hashtable<OpDeclNode, ValueObj> constantAssignments;
-	// k = 1, the ValueObj describes the right side of the assignment and
-	// contains it type
-	public Hashtable<OpDefNode, ValueObj> operatorAssignments;
-	// def = 1
-
-	private ArrayList<OpDefNode> operatorModelvalues;
-
-	private final ArrayList<OpDeclNode> bConstantList = new ArrayList<OpDeclNode>();
-	// List of constants in the resulting B machine. This list does not contain
-	// a TLA+ constant if the constant is substituted by a modelvalue with the
-	// same name (the constant name is moved to an enumerated set) or if the
-	// constants has arguments and is overriden by an operator
-	public Hashtable<OpDefNode, OpDefNode> operatorOverrideTable;
-	// This table contains mappings for operators which are overridden in the
-	// configuration file
-	public Hashtable<OpDeclNode, OpDefNode> constantOverrideTable;
-
-	// This table contains mappings for constants which are overridden in the
-	// configuration file. All constants with arguments have to be overridden in
-	// the configuration file.
-
-	public ConfigfileEvaluator(ModelConfig configAst, ModuleNode moduleNode) {
-		this.configAst = configAst;
-		this.moduleNode = moduleNode;
-
-		definitions = new Hashtable<String, OpDefNode>();
-		OpDefNode[] defs = moduleNode.getOpDefs();
-		for (int i = 0; i < defs.length; i++) {
-			definitions.put(defs[i].getName().toString(), defs[i]);
-		}
-
-		constants = new Hashtable<String, OpDeclNode>();
-		OpDeclNode[] cons = moduleNode.getConstantDecls();
-		for (int i = 0; i < cons.length; i++) {
-			constants.put(cons[i].getName().toString(), cons[i]);
-			bConstantList.add(cons[i]);
-		}
-
-		initialize();
-	}
-
-	public ConfigfileEvaluator() {
-		initialize();
-	}
-
-	private void initialize() {
-		this.constantOverrideTable = new Hashtable<OpDeclNode, OpDefNode>();
-		this.operatorOverrideTable = new Hashtable<OpDefNode, OpDefNode>();
-
-		this.constantAssignments = new Hashtable<OpDeclNode, ValueObj>();
-		this.operatorAssignments = new Hashtable<OpDefNode, ValueObj>();
-		this.operatorModelvalues = new ArrayList<OpDefNode>();
-
-		this.enumeratedSet = new ArrayList<String>();
-		this.enumeratedTypes = new LinkedHashMap<String, EnumType>();
-	}
-
-	public void start() throws ConfigFileErrorException {
-		evalNext(); // check if NEXT declaration is a valid definition
-		evalInit(); // check if INIT declaration is a valid definition
-		evalSpec(); // check if SPECIFICATION declaration is a valid definition
-
-		if (moduleNode.getVariableDecls().length > 0 && this.initNode == null
-				&& this.specNode == null) {
-			throw new ConfigFileErrorException(
-					"The module contains variables."
-							+ " Hence there must be either a SPECIFICATION or INIT declaration.");
-		}
-
-		evalInvariants();
-		// check if INVARIANT declarations are valid definitions
-
-		evalConstantOrDefOverrides();
-
-		evalConstantOrOperatorAssignments();
-
-		evalModConOrDefAssignments();
-
-		evalModConOrDefOverrides();
-
-	}
-
-
-	private void evalNext() throws ConfigFileErrorException {
-		String next = configAst.getNext();
-		if (!next.equals("")) {
-			if (definitions.containsKey(next)) {
-				this.nextNode = definitions.get(next);
-			} else {
-				throw new ConfigFileErrorException(
-						"Invalid declaration of the next state predicate."
-								+ " Module does not contain the defintion '"
-								+ next + "'");
-			}
-		} else
-			next = null;
-
-	}
-
-	private void evalInit() throws ConfigFileErrorException {
-		String init = configAst.getInit();
-		if (!init.equals("")) {
-			if (definitions.containsKey(init)) {
-				this.initNode = definitions.get(init);
-			} else {
-				throw new ConfigFileErrorException(
-						"Invalid declaration of the initialisation predicate."
-								+ " Module does not contain the defintion '"
-								+ init + "'");
-			}
-		} else {
-			init = null;
-		}
-
-	}
-
-	private void evalSpec() throws ConfigFileErrorException {
-		String spec = configAst.getSpec();
-		if (!spec.equals("")) {
-			if (definitions.containsKey(spec)) {
-				this.specNode = definitions.get(spec);
-			} else {
-				throw new ConfigFileErrorException(
-						"Invalid declaration of the specification predicate."
-								+ "Module does not contain the defintion '"
-								+ spec + "'");
-			}
-		} else
-			spec = null;
-	}
-
-	private void evalInvariants() throws ConfigFileErrorException {
-
-		Vect v = configAst.getInvariants();
-		if (v.capacity() != 0) {
-			for (int i = 0; i < v.capacity(); i++) {
-				if (v.elementAt(i) != null) {
-					String inv = (String) v.elementAt(i);
-					if (!definitions.containsKey(inv)) {
-						throw new ConfigFileErrorException(
-								"Invalid invariant declaration. Module does not contain definition '"
-										+ inv + "'");
-					}
-					invariantNodeList.add(definitions.get(inv));
-				}
-			}
-		}
-
-	}
-
-	/**
-	 * Represents a override statement in the configuration file: k &lt;- def
-	 */
-	@SuppressWarnings("unchecked")
-	private void evalConstantOrDefOverrides() throws ConfigFileErrorException {
-		Iterator<Map.Entry<String, String>> it = configAst.getOverrides()
-				.entrySet().iterator();
-		while (it.hasNext()) {
-			Map.Entry<String, String> entry = it.next();
-			String left = entry.getKey();
-			String right = entry.getValue();
-
-			OpDefNode rightDefNode = definitions.get(right);
-			if (rightDefNode == null) {
-				throw new ConfigFileErrorException("Invalid substitution for "
-						+ left + ".\n Module does not contain definition "
-						+ right + ".");
-			}
-
-			if (constants.containsKey(left)) {
-				// a constant is overridden by an operator
-				OpDeclNode conNode = constants.get(left);
-				if (conNode.getArity() != rightDefNode.getArity()) {
-					throw new ConfigFileErrorException(
-							String.format(
-									"Invalid substitution for %s.%n Constant %s has %s arguments while %s has %s arguments.",
-									left, left, conNode.getArity(), right,
-									rightDefNode.getArity()));
-				}
-				if(conNode.getArity()>0){
-					bConstantList.remove(conNode);
-				}
-				constantOverrideTable.put(conNode, rightDefNode);
-			} else if (definitions.containsKey(left)) {
-				// an operator is overridden by another operator
-				OpDefNode defNode = definitions.get(left);
-				if (defNode.getArity() != rightDefNode.getArity()) {
-					throw new ConfigFileErrorException(
-							String.format(
-									"Invalid substitution for %s.%n Operator %s has %s arguments while %s has %s arguments.",
-									left, left, defNode.getArity(), right,
-									rightDefNode.getArity()));
-				}
-
-				operatorOverrideTable.put(defNode, rightDefNode);
-			} else {
-				// every constants in the configuration file must appear in the
-				// TLA+
-				// module
-				throw new ConfigFileErrorException(
-						"Module does not contain the symbol: " + left);
-			}
-		}
-	}
-
-	private void evalConstantOrOperatorAssignments()
-			throws ConfigFileErrorException {
-		Vect configCons = configAst.getConstants();
-		// iterate over all constant or operator assignments in the config file
-		// k = 1 or def = 1
-		for (int i = 0; i < configCons.size(); i++) {
-			Vect symbol = (Vect) configCons.elementAt(i);
-			String symbolName = symbol.elementAt(0).toString();
-			Value symbolValue = (Value) symbol.elementAt(symbol.size() - 1);
-			TLAType symbolType = conGetType(symbol.elementAt(symbol.size() - 1));
-			if (constants.containsKey(symbolName)) {
-				OpDeclNode c = constants.get(symbolName);
-
-				ValueObj valueObj = new ValueObj(symbolValue, symbolType);
-				constantAssignments.put(c, valueObj);
-				/**
-				 * if conValue is a model value and the name of the value is the
-				 * same as the name of constants, then the constant declaration
-				 * in the resulting B machine disappears
-				 **/
-				if (symbolType instanceof EnumType
-						&& symbolName.equals(symbolValue.toString())) {
-					bConstantList.remove(c);
-				}
-			} else if (definitions.containsKey(symbolName)) {
-				OpDefNode def = definitions.get(symbolName);
-				ValueObj valueObj = new ValueObj(symbolValue, symbolType);
-				operatorAssignments.put(def, valueObj);
-
-				if (symbolType instanceof SetType) {
-					if (((SetType) symbolType).getSubType() instanceof EnumType) {
-						operatorModelvalues.add(def);
-					}
-				} else if ((symbolType instanceof EnumType)) {
-					operatorModelvalues.add(def);
-				}
-
-			} else {
-				// every constants or operator in the configuration file must
-				// appear in the TLA+
-				// module
-				throw new ConfigFileErrorException(
-						"Module does not contain the symbol: " + symbolName);
-			}
-		}
-
-	}
-
-	private void evalModConOrDefAssignments() throws ConfigFileErrorException {
-		// val = [Counter] 7
-		@SuppressWarnings("unchecked")
-		Hashtable<String, Vect> configCons = configAst.getModConstants();
-		Enumeration<String> moduleNames = configCons.keys();
-		while (moduleNames.hasMoreElements()) {
-			String moduleName = (String) moduleNames.nextElement();
-			ModuleNode mNode = searchModule(moduleName);
-			Vect assignments = configCons.get(moduleName);
-			for (int i = 0; i < assignments.size(); i++) {
-				Vect assigment = (Vect) assignments.elementAt(i);
-				OpDefOrDeclNode opDefOrDeclNode = searchDefinitionOrConstant(
-						mNode, (String) assigment.elementAt(0));
-				String symbolName = opDefOrDeclNode.getName().toString();
-				Value symbolValue = (Value) assigment.elementAt(1);
-				TLAType symbolType = conGetType(assigment.elementAt(1));
-				// System.out.println(symbolName + " " + symbolValue+ " " +
-				// symbolType);
-				if (opDefOrDeclNode instanceof OpDeclNode) {
-					// TODO test whether c is a extended constant
-					// Instanced constants have to overridden in the instance
-					// statement
-					OpDeclNode c = (OpDeclNode) opDefOrDeclNode;
-					ValueObj valueObj = new ValueObj(symbolValue, symbolType);
-					constantAssignments.put(c, valueObj);
-					/**
-					 * if conValue is a model value and the name of value is the
-					 * same as the name of constants, then the constant
-					 * declaration in the resulting B machine disappears
-					 **/
-					if (symbolName.equals(symbolValue.toString())) {
-						bConstantList.remove(c);
-					}
-				} else {
-					OpDefNode def = (OpDefNode) opDefOrDeclNode;
-					ValueObj valueObj = new ValueObj(symbolValue, symbolType);
-					operatorAssignments.put(def, valueObj);
-
-					if (symbolType instanceof SetType) {
-						if (((SetType) symbolType).getSubType() instanceof EnumType) {
-							operatorModelvalues.add(def);
-						}
-					} else if ((symbolType instanceof EnumType)) {
-						operatorModelvalues.add(def);
-					}
-
-				}
-			}
-		}
-	}
-
-	private void evalModConOrDefOverrides() throws ConfigFileErrorException {
-		// foo <- [Counter] bar or k <- [Counter] bar
-		@SuppressWarnings("unchecked")
-		Hashtable<String, Hashtable<String, String>> configCons = configAst
-				.getModOverrides();
-		Enumeration<String> moduleNames = configCons.keys();
-		while (moduleNames.hasMoreElements()) {
-			String moduleName = moduleNames.nextElement();
-			ModuleNode mNode = searchModule(moduleName);
-			Hashtable<String, String> o = configCons.get(moduleName);
-
-			Iterator<Map.Entry<String, String>> it = o.entrySet().iterator();
-			while (it.hasNext()) {
-				Map.Entry<String, String> entry = it.next();
-				String left = entry.getKey();
-				String right = entry.getValue();
-
-				OpDefNode rightDefNode = definitions.get(right);
-				if (rightDefNode == null) {
-					throw new ConfigFileErrorException(
-							"Invalid substitution for " + left
-									+ ".\n Module does not contain definition "
-									+ right + ".");
-				}
-				OpDefOrDeclNode opDefOrDeclNode = searchDefinitionOrConstant(
-						mNode, left);
-
-				if (opDefOrDeclNode instanceof OpDefNode) {
-					// an operator is overridden by another operator
-					OpDefNode defNode = (OpDefNode) opDefOrDeclNode;
-					if (defNode.getArity() != rightDefNode.getArity()) {
-						throw new ConfigFileErrorException(
-								String.format(
-										"Invalid substitution for %s.%n Operator %s has %s arguments while %s has %s arguments.",
-										left, left, defNode.getArity(), right,
-										rightDefNode.getArity()));
-					}
-					operatorOverrideTable.put(defNode, rightDefNode);
-				}
-
-				else {
-					InstanceNode[] instanceNodes = moduleNode.getInstances();
-					for (int i = 0; i < instanceNodes.length; i++) {
-						// if (instanceNodes[i].getModule().getName().toString()
-						// .equals(moduleName)) {
-						// /*
-						// * A constant overridden in a instanced module make
-						// * no sence. Such a constant will be overridden by
-						// * the instance statement
-						// */
-						// throw new ConfigFileErrorException(
-						// String.format(
-						// "Invalid substitution for constant '%s' of module '%s'.%n A Constant of an instanced module can not be overriden.",
-						// left, mNode.getName().toString()));
-						// }
-					}
-					// a constant is overridden by an operator
-					OpDeclNode conNode = (OpDeclNode) opDefOrDeclNode;
-					if (conNode.getArity() != rightDefNode.getArity()) {
-						throw new ConfigFileErrorException(
-								String.format(
-										"Invalid substitution for %s.%n Constant %s has %s arguments while %s has %s arguments.",
-										left, left, conNode.getArity(), right,
-										rightDefNode.getArity()));
-					}
-					bConstantList.remove(conNode);
-					constantOverrideTable.put(conNode, rightDefNode);
-
-				}
-			}
-
-		}
-	}
-
-	public ModuleNode searchModule(String moduleName)
-			throws ConfigFileErrorException {
-		/*
-		 * Search module in extended modules
-		 */
-		@SuppressWarnings("unchecked")
-		HashSet<ModuleNode> extendedModules = moduleNode.getExtendedModuleSet();
-		for (Iterator<ModuleNode> iterator = extendedModules.iterator(); iterator
-				.hasNext();) {
-			ModuleNode m = (ModuleNode) iterator.next();
-			if (m.getName().toString().equals(moduleName)) {
-				return m;
-			}
-		}
-
-		/*
-		 * search module in instanced modules
-		 */
-
-		OpDefNode[] defs = moduleNode.getOpDefs();
-		for (int j = defs.length - 1; j > 0; j--) {
-			OpDefNode def = null;
-			OpDefNode source = defs[j];
-			while (def != source) {
-				def = source;
-				source = def.getSource();
-				ModuleNode m = def.getOriginallyDefinedInModuleNode();
-				if (m.getName().toString().equals(moduleName)) {
-					return m;
-				}
-			}
-		}
-		throw new ConfigFileErrorException(
-				String.format(
-						"Module '%s' is not included in the specification.",
-						moduleName));
-	}
-
-	public OpDefOrDeclNode searchDefinitionOrConstant(ModuleNode n,
-			String defOrConName) throws ConfigFileErrorException {
-		for (int i = 0; i < n.getOpDefs().length; i++) {
-			if (n.getOpDefs()[i].getName().toString().equals(defOrConName)) {
-				return n.getOpDefs()[i];
-			}
-		}
-		for (int i = 0; i < n.getConstantDecls().length; i++) {
-			if (n.getConstantDecls()[i].getName().toString()
-					.equals(defOrConName)) {
-				return n.getConstantDecls()[i];
-			}
-		}
-		throw new ConfigFileErrorException(
-				"Module does not contain the symbol: " + defOrConName);
-	}
-
-	private TLAType conGetType(Object o) throws ConfigFileErrorException {
-		if (o instanceof IntValue) {
-
-			// IntValue iv = (IntValue) o;
-			return IntType.getInstance();
-		} else if (o.getClass().getName().equals("tlc2.value.SetEnumValue")) {
-			SetEnumValue set = (SetEnumValue) o;
-			SetType t = new SetType(new UntypedType());
-			if (set.size() == 0) {
-				throw new ConfigFileErrorException(
-						"empty set is not permitted!");
-			}
-			TLAType elemType;
-
-			if (set.elems.elementAt(0).getClass().getName()
-					.equals("tlc2.value.ModelValue")) {
-				EnumType e = new EnumType(new ArrayList<String>());
-				for (int i = 0; i < set.size(); i++) {
-					if (set.elems.elementAt(i).getClass().getName()
-							.equals("tlc2.value.ModelValue")) {
-						String mv = ((ModelValue) set.elems.elementAt(i))
-								.toString();
-						if (!enumeratedSet.contains(mv)) {
-							enumeratedSet.add(mv);
-							e.modelvalues.add(mv);
-						} else {
-							e.modelvalues.add(mv);
-							EnumType e2 = enumeratedTypes.get(mv);
-							try {
-								e = e2.unify(e2);
-							} catch (UnificationException exception) {
-							}
-						}
-
-					} else {
-						throw new ConfigFileErrorException(
-								"Elements of the set must have the same type: "
-										+ o);
-					}
-				}
-				Iterator<String> it = e.modelvalues.iterator();
-				while (it.hasNext()) {
-					enumeratedTypes.put(it.next(), e);
-				}
-				elemType = e;
-			} else {
-				elemType = conGetType(set.elems.elementAt(0));
-				for (int i = 1; i < set.size(); i++) {
-					elemType = conGetType(set.elems.elementAt(i));
-					// all Elements have the same Type?
-					if (!t.getSubType().compare(elemType)) {
-						throw new ConfigFileErrorException(
-								"Elements of the set must have the same type: "
-										+ o);
-					}
-				}
-			}
-			t.setSubType(elemType);
-			return t;
-
-		} else if (o.getClass().getName().equals("tlc2.value.ModelValue")) {
-			ModelValue mv = (ModelValue) o;
-			if (!enumeratedSet.contains(mv.toString())) {
-				enumeratedSet.add(mv.toString());
-				ArrayList<String> temp = new ArrayList<String>();
-				temp.add(mv.toString());
-				EnumType e = new EnumType(temp);
-				enumeratedTypes.put(mv.toString(), e);
-				return e;
-			} else {
-				return enumeratedTypes.get(mv.toString());
-			}
-
-		} else if (o.getClass().getName().equals("tlc2.value.StringValue")) {
-			return StringType.getInstance();
-		} else if (o.getClass().getName().equals("tlc2.value.BoolValue")) {
-			return BoolType.getInstance();
-		} else {
-			throw new ConfigFileErrorException("Unkown ConstantType: " + o
-					+ " " + o.getClass());
-		}
-	}
-
-	public OpDefNode getSpecNode() {
-		return specNode;
-	}
-
-	public OpDefNode getNextNode() {
-		return nextNode;
-	}
-
-	public OpDefNode getInitNode() {
-		return initNode;
-	}
-
-	public Hashtable<OpDeclNode, OpDefNode> getConstantOverrideTable() {
-		return constantOverrideTable;
-	}
-
-	public ArrayList<OpDefNode> getInvariants() {
-		return this.invariantNodeList;
-	}
-
-	public Hashtable<OpDeclNode, ValueObj> getConstantAssignments() {
-		return this.constantAssignments;
-	}
-
-	public Hashtable<OpDefNode, ValueObj> getOperatorAssignments() {
-		return this.operatorAssignments;
-	}
-
-	public ArrayList<OpDeclNode> getbConstantList() {
-		return bConstantList;
-	}
-
-	public Hashtable<OpDefNode, OpDefNode> getOperatorOverrideTable() {
-		return operatorOverrideTable;
-	}
-
-	public ArrayList<String> getEnumerationSet() {
-		return this.enumeratedSet;
-	}
-
-	public ArrayList<OpDefNode> getOperatorModelvalues() {
-		return this.operatorModelvalues;
-	}
-}
+package de.tla2b.config;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import de.tla2b.exceptions.ConfigFileErrorException;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.types.BoolType;
+import de.tla2b.types.EnumType;
+import de.tla2b.types.IntType;
+import de.tla2b.types.SetType;
+import de.tla2b.types.StringType;
+import de.tla2b.types.TLAType;
+import de.tla2b.types.UntypedType;
+import tla2sany.semantic.InstanceNode;
+import tla2sany.semantic.ModuleNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+import tla2sany.semantic.OpDefOrDeclNode;
+import tlc2.tool.ModelConfig;
+import tlc2.util.Vect;
+import tlc2.value.IntValue;
+import tlc2.value.ModelValue;
+import tlc2.value.SetEnumValue;
+import tlc2.value.Value;
+
+/**
+ * This class evaluates the configfile and collects all necessary information of
+ * the configfile. All used identifier in the configfile are checked to be valid
+ * in the context of the module
+ */
+public class ConfigfileEvaluator {
+
+	private ModelConfig configAst;
+	private ModuleNode moduleNode;
+	private Hashtable<String, OpDefNode> definitions;
+	// Hashtable of all definitons in module
+	private Hashtable<String, OpDeclNode> constants;
+	// Hashtable of all constants in the module
+
+	private OpDefNode specNode; // SPECIFICATION node, may be null
+	private OpDefNode nextNode; // NEXT node, may be null
+	private OpDefNode initNode; // INIT node, may be null
+	private final ArrayList<OpDefNode> invariantNodeList = new ArrayList<OpDefNode>();
+	private ArrayList<String> enumeratedSet;
+	private LinkedHashMap<String, EnumType> enumeratedTypes;
+	public Hashtable<OpDeclNode, ValueObj> constantAssignments;
+	// k = 1, the ValueObj describes the right side of the assignment and
+	// contains it type
+	public Hashtable<OpDefNode, ValueObj> operatorAssignments;
+	// def = 1
+
+	private ArrayList<OpDefNode> operatorModelvalues;
+
+	private final ArrayList<OpDeclNode> bConstantList = new ArrayList<OpDeclNode>();
+	// List of constants in the resulting B machine. This list does not contain
+	// a TLA+ constant if the constant is substituted by a modelvalue with the
+	// same name (the constant name is moved to an enumerated set) or if the
+	// constants has arguments and is overriden by an operator
+	public Hashtable<OpDefNode, OpDefNode> operatorOverrideTable;
+	// This table contains mappings for operators which are overridden in the
+	// configuration file
+	public Hashtable<OpDeclNode, OpDefNode> constantOverrideTable;
+
+	// This table contains mappings for constants which are overridden in the
+	// configuration file. All constants with arguments have to be overridden in
+	// the configuration file.
+
+	public ConfigfileEvaluator(ModelConfig configAst, ModuleNode moduleNode) {
+		this.configAst = configAst;
+		this.moduleNode = moduleNode;
+
+		definitions = new Hashtable<String, OpDefNode>();
+		OpDefNode[] defs = moduleNode.getOpDefs();
+		for (int i = 0; i < defs.length; i++) {
+			definitions.put(defs[i].getName().toString(), defs[i]);
+		}
+
+		constants = new Hashtable<String, OpDeclNode>();
+		OpDeclNode[] cons = moduleNode.getConstantDecls();
+		for (int i = 0; i < cons.length; i++) {
+			constants.put(cons[i].getName().toString(), cons[i]);
+			bConstantList.add(cons[i]);
+		}
+
+		initialize();
+	}
+
+	public ConfigfileEvaluator() {
+		initialize();
+	}
+
+	private void initialize() {
+		this.constantOverrideTable = new Hashtable<OpDeclNode, OpDefNode>();
+		this.operatorOverrideTable = new Hashtable<OpDefNode, OpDefNode>();
+
+		this.constantAssignments = new Hashtable<OpDeclNode, ValueObj>();
+		this.operatorAssignments = new Hashtable<OpDefNode, ValueObj>();
+		this.operatorModelvalues = new ArrayList<OpDefNode>();
+
+		this.enumeratedSet = new ArrayList<String>();
+		this.enumeratedTypes = new LinkedHashMap<String, EnumType>();
+	}
+
+	public void start() throws ConfigFileErrorException {
+		evalNext(); // check if NEXT declaration is a valid definition
+		evalInit(); // check if INIT declaration is a valid definition
+		evalSpec(); // check if SPECIFICATION declaration is a valid definition
+
+		if (moduleNode.getVariableDecls().length > 0 && this.initNode == null
+				&& this.specNode == null) {
+			throw new ConfigFileErrorException(
+					"The module contains variables."
+							+ " Hence there must be either a SPECIFICATION or INIT declaration.");
+		}
+
+		evalInvariants();
+		// check if INVARIANT declarations are valid definitions
+
+		evalConstantOrDefOverrides();
+
+		evalConstantOrOperatorAssignments();
+
+		evalModConOrDefAssignments();
+
+		evalModConOrDefOverrides();
+
+	}
+
+
+	private void evalNext() throws ConfigFileErrorException {
+		String next = configAst.getNext();
+		if (!next.equals("")) {
+			if (definitions.containsKey(next)) {
+				this.nextNode = definitions.get(next);
+			} else {
+				throw new ConfigFileErrorException(
+						"Invalid declaration of the next state predicate."
+								+ " Module does not contain the defintion '"
+								+ next + "'");
+			}
+		} else
+			next = null;
+
+	}
+
+	private void evalInit() throws ConfigFileErrorException {
+		String init = configAst.getInit();
+		if (!init.equals("")) {
+			if (definitions.containsKey(init)) {
+				this.initNode = definitions.get(init);
+			} else {
+				throw new ConfigFileErrorException(
+						"Invalid declaration of the initialisation predicate."
+								+ " Module does not contain the defintion '"
+								+ init + "'");
+			}
+		} else {
+			init = null;
+		}
+
+	}
+
+	private void evalSpec() throws ConfigFileErrorException {
+		String spec = configAst.getSpec();
+		if (!spec.equals("")) {
+			if (definitions.containsKey(spec)) {
+				this.specNode = definitions.get(spec);
+			} else {
+				throw new ConfigFileErrorException(
+						"Invalid declaration of the specification predicate."
+								+ "Module does not contain the defintion '"
+								+ spec + "'");
+			}
+		} else
+			spec = null;
+	}
+
+	private void evalInvariants() throws ConfigFileErrorException {
+
+		Vect v = configAst.getInvariants();
+		if (v.capacity() != 0) {
+			for (int i = 0; i < v.capacity(); i++) {
+				if (v.elementAt(i) != null) {
+					String inv = (String) v.elementAt(i);
+					if (!definitions.containsKey(inv)) {
+						throw new ConfigFileErrorException(
+								"Invalid invariant declaration. Module does not contain definition '"
+										+ inv + "'");
+					}
+					invariantNodeList.add(definitions.get(inv));
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * Represents a override statement in the configuration file: k &lt;- def
+	 */
+	@SuppressWarnings("unchecked")
+	private void evalConstantOrDefOverrides() throws ConfigFileErrorException {
+		Iterator<Map.Entry<String, String>> it = configAst.getOverrides()
+				.entrySet().iterator();
+		while (it.hasNext()) {
+			Map.Entry<String, String> entry = it.next();
+			String left = entry.getKey();
+			String right = entry.getValue();
+
+			OpDefNode rightDefNode = definitions.get(right);
+			if (rightDefNode == null) {
+				throw new ConfigFileErrorException("Invalid substitution for "
+						+ left + ".\n Module does not contain definition "
+						+ right + ".");
+			}
+
+			if (constants.containsKey(left)) {
+				// a constant is overridden by an operator
+				OpDeclNode conNode = constants.get(left);
+				if (conNode.getArity() != rightDefNode.getArity()) {
+					throw new ConfigFileErrorException(
+							String.format(
+									"Invalid substitution for %s.%n Constant %s has %s arguments while %s has %s arguments.",
+									left, left, conNode.getArity(), right,
+									rightDefNode.getArity()));
+				}
+				if(conNode.getArity()>0){
+					bConstantList.remove(conNode);
+				}
+				constantOverrideTable.put(conNode, rightDefNode);
+			} else if (definitions.containsKey(left)) {
+				// an operator is overridden by another operator
+				OpDefNode defNode = definitions.get(left);
+				if (defNode.getArity() != rightDefNode.getArity()) {
+					throw new ConfigFileErrorException(
+							String.format(
+									"Invalid substitution for %s.%n Operator %s has %s arguments while %s has %s arguments.",
+									left, left, defNode.getArity(), right,
+									rightDefNode.getArity()));
+				}
+
+				operatorOverrideTable.put(defNode, rightDefNode);
+			} else {
+				// every constants in the configuration file must appear in the
+				// TLA+
+				// module
+				throw new ConfigFileErrorException(
+						"Module does not contain the symbol: " + left);
+			}
+		}
+	}
+
+	private void evalConstantOrOperatorAssignments()
+			throws ConfigFileErrorException {
+		Vect configCons = configAst.getConstants();
+		// iterate over all constant or operator assignments in the config file
+		// k = 1 or def = 1
+		for (int i = 0; i < configCons.size(); i++) {
+			Vect symbol = (Vect) configCons.elementAt(i);
+			String symbolName = symbol.elementAt(0).toString();
+			Value symbolValue = (Value) symbol.elementAt(symbol.size() - 1);
+			TLAType symbolType = conGetType(symbol.elementAt(symbol.size() - 1));
+			if (constants.containsKey(symbolName)) {
+				OpDeclNode c = constants.get(symbolName);
+
+				ValueObj valueObj = new ValueObj(symbolValue, symbolType);
+				constantAssignments.put(c, valueObj);
+				/**
+				 * if conValue is a model value and the name of the value is the
+				 * same as the name of constants, then the constant declaration
+				 * in the resulting B machine disappears
+				 **/
+				if (symbolType instanceof EnumType
+						&& symbolName.equals(symbolValue.toString())) {
+					bConstantList.remove(c);
+				}
+			} else if (definitions.containsKey(symbolName)) {
+				OpDefNode def = definitions.get(symbolName);
+				ValueObj valueObj = new ValueObj(symbolValue, symbolType);
+				operatorAssignments.put(def, valueObj);
+
+				if (symbolType instanceof SetType) {
+					if (((SetType) symbolType).getSubType() instanceof EnumType) {
+						operatorModelvalues.add(def);
+					}
+				} else if ((symbolType instanceof EnumType)) {
+					operatorModelvalues.add(def);
+				}
+
+			} else {
+				// every constants or operator in the configuration file must
+				// appear in the TLA+
+				// module
+				throw new ConfigFileErrorException(
+						"Module does not contain the symbol: " + symbolName);
+			}
+		}
+
+	}
+
+	private void evalModConOrDefAssignments() throws ConfigFileErrorException {
+		// val = [Counter] 7
+		@SuppressWarnings("unchecked")
+		Hashtable<String, Vect> configCons = configAst.getModConstants();
+		Enumeration<String> moduleNames = configCons.keys();
+		while (moduleNames.hasMoreElements()) {
+			String moduleName = (String) moduleNames.nextElement();
+			ModuleNode mNode = searchModule(moduleName);
+			Vect assignments = configCons.get(moduleName);
+			for (int i = 0; i < assignments.size(); i++) {
+				Vect assigment = (Vect) assignments.elementAt(i);
+				OpDefOrDeclNode opDefOrDeclNode = searchDefinitionOrConstant(
+						mNode, (String) assigment.elementAt(0));
+				String symbolName = opDefOrDeclNode.getName().toString();
+				Value symbolValue = (Value) assigment.elementAt(1);
+				TLAType symbolType = conGetType(assigment.elementAt(1));
+				// System.out.println(symbolName + " " + symbolValue+ " " +
+				// symbolType);
+				if (opDefOrDeclNode instanceof OpDeclNode) {
+					// TODO test whether c is a extended constant
+					// Instanced constants have to overridden in the instance
+					// statement
+					OpDeclNode c = (OpDeclNode) opDefOrDeclNode;
+					ValueObj valueObj = new ValueObj(symbolValue, symbolType);
+					constantAssignments.put(c, valueObj);
+					/**
+					 * if conValue is a model value and the name of value is the
+					 * same as the name of constants, then the constant
+					 * declaration in the resulting B machine disappears
+					 **/
+					if (symbolName.equals(symbolValue.toString())) {
+						bConstantList.remove(c);
+					}
+				} else {
+					OpDefNode def = (OpDefNode) opDefOrDeclNode;
+					ValueObj valueObj = new ValueObj(symbolValue, symbolType);
+					operatorAssignments.put(def, valueObj);
+
+					if (symbolType instanceof SetType) {
+						if (((SetType) symbolType).getSubType() instanceof EnumType) {
+							operatorModelvalues.add(def);
+						}
+					} else if ((symbolType instanceof EnumType)) {
+						operatorModelvalues.add(def);
+					}
+
+				}
+			}
+		}
+	}
+
+	private void evalModConOrDefOverrides() throws ConfigFileErrorException {
+		// foo <- [Counter] bar or k <- [Counter] bar
+		@SuppressWarnings("unchecked")
+		Hashtable<String, Hashtable<String, String>> configCons = configAst
+				.getModOverrides();
+		Enumeration<String> moduleNames = configCons.keys();
+		while (moduleNames.hasMoreElements()) {
+			String moduleName = moduleNames.nextElement();
+			ModuleNode mNode = searchModule(moduleName);
+			Hashtable<String, String> o = configCons.get(moduleName);
+
+			Iterator<Map.Entry<String, String>> it = o.entrySet().iterator();
+			while (it.hasNext()) {
+				Map.Entry<String, String> entry = it.next();
+				String left = entry.getKey();
+				String right = entry.getValue();
+
+				OpDefNode rightDefNode = definitions.get(right);
+				if (rightDefNode == null) {
+					throw new ConfigFileErrorException(
+							"Invalid substitution for " + left
+									+ ".\n Module does not contain definition "
+									+ right + ".");
+				}
+				OpDefOrDeclNode opDefOrDeclNode = searchDefinitionOrConstant(
+						mNode, left);
+
+				if (opDefOrDeclNode instanceof OpDefNode) {
+					// an operator is overridden by another operator
+					OpDefNode defNode = (OpDefNode) opDefOrDeclNode;
+					if (defNode.getArity() != rightDefNode.getArity()) {
+						throw new ConfigFileErrorException(
+								String.format(
+										"Invalid substitution for %s.%n Operator %s has %s arguments while %s has %s arguments.",
+										left, left, defNode.getArity(), right,
+										rightDefNode.getArity()));
+					}
+					operatorOverrideTable.put(defNode, rightDefNode);
+				}
+
+				else {
+					InstanceNode[] instanceNodes = moduleNode.getInstances();
+					for (int i = 0; i < instanceNodes.length; i++) {
+						// if (instanceNodes[i].getModule().getName().toString()
+						// .equals(moduleName)) {
+						// /*
+						// * A constant overridden in a instanced module make
+						// * no sence. Such a constant will be overridden by
+						// * the instance statement
+						// */
+						// throw new ConfigFileErrorException(
+						// String.format(
+						// "Invalid substitution for constant '%s' of module '%s'.%n A Constant of an instanced module can not be overriden.",
+						// left, mNode.getName().toString()));
+						// }
+					}
+					// a constant is overridden by an operator
+					OpDeclNode conNode = (OpDeclNode) opDefOrDeclNode;
+					if (conNode.getArity() != rightDefNode.getArity()) {
+						throw new ConfigFileErrorException(
+								String.format(
+										"Invalid substitution for %s.%n Constant %s has %s arguments while %s has %s arguments.",
+										left, left, conNode.getArity(), right,
+										rightDefNode.getArity()));
+					}
+					bConstantList.remove(conNode);
+					constantOverrideTable.put(conNode, rightDefNode);
+
+				}
+			}
+
+		}
+	}
+
+	public ModuleNode searchModule(String moduleName)
+			throws ConfigFileErrorException {
+		/*
+		 * Search module in extended modules
+		 */
+		@SuppressWarnings("unchecked")
+		HashSet<ModuleNode> extendedModules = moduleNode.getExtendedModuleSet();
+		for (Iterator<ModuleNode> iterator = extendedModules.iterator(); iterator
+				.hasNext();) {
+			ModuleNode m = (ModuleNode) iterator.next();
+			if (m.getName().toString().equals(moduleName)) {
+				return m;
+			}
+		}
+
+		/*
+		 * search module in instanced modules
+		 */
+
+		OpDefNode[] defs = moduleNode.getOpDefs();
+		for (int j = defs.length - 1; j > 0; j--) {
+			OpDefNode def = null;
+			OpDefNode source = defs[j];
+			while (def != source) {
+				def = source;
+				source = def.getSource();
+				ModuleNode m = def.getOriginallyDefinedInModuleNode();
+				if (m.getName().toString().equals(moduleName)) {
+					return m;
+				}
+			}
+		}
+		throw new ConfigFileErrorException(
+				String.format(
+						"Module '%s' is not included in the specification.",
+						moduleName));
+	}
+
+	public OpDefOrDeclNode searchDefinitionOrConstant(ModuleNode n,
+			String defOrConName) throws ConfigFileErrorException {
+		for (int i = 0; i < n.getOpDefs().length; i++) {
+			if (n.getOpDefs()[i].getName().toString().equals(defOrConName)) {
+				return n.getOpDefs()[i];
+			}
+		}
+		for (int i = 0; i < n.getConstantDecls().length; i++) {
+			if (n.getConstantDecls()[i].getName().toString()
+					.equals(defOrConName)) {
+				return n.getConstantDecls()[i];
+			}
+		}
+		throw new ConfigFileErrorException(
+				"Module does not contain the symbol: " + defOrConName);
+	}
+
+	private TLAType conGetType(Object o) throws ConfigFileErrorException {
+		if (o instanceof IntValue) {
+
+			// IntValue iv = (IntValue) o;
+			return IntType.getInstance();
+		} else if (o.getClass().getName().equals("tlc2.value.SetEnumValue")) {
+			SetEnumValue set = (SetEnumValue) o;
+			SetType t = new SetType(new UntypedType());
+			if (set.size() == 0) {
+				throw new ConfigFileErrorException(
+						"empty set is not permitted!");
+			}
+			TLAType elemType;
+
+			if (set.elems.elementAt(0).getClass().getName()
+					.equals("tlc2.value.ModelValue")) {
+				EnumType e = new EnumType(new ArrayList<String>());
+				for (int i = 0; i < set.size(); i++) {
+					if (set.elems.elementAt(i).getClass().getName()
+							.equals("tlc2.value.ModelValue")) {
+						String mv = ((ModelValue) set.elems.elementAt(i))
+								.toString();
+						if (!enumeratedSet.contains(mv)) {
+							enumeratedSet.add(mv);
+							e.modelvalues.add(mv);
+						} else {
+							e.modelvalues.add(mv);
+							EnumType e2 = enumeratedTypes.get(mv);
+							try {
+								e = e2.unify(e2);
+							} catch (UnificationException exception) {
+							}
+						}
+
+					} else {
+						throw new ConfigFileErrorException(
+								"Elements of the set must have the same type: "
+										+ o);
+					}
+				}
+				Iterator<String> it = e.modelvalues.iterator();
+				while (it.hasNext()) {
+					enumeratedTypes.put(it.next(), e);
+				}
+				elemType = e;
+			} else {
+				elemType = conGetType(set.elems.elementAt(0));
+				for (int i = 1; i < set.size(); i++) {
+					elemType = conGetType(set.elems.elementAt(i));
+					// all Elements have the same Type?
+					if (!t.getSubType().compare(elemType)) {
+						throw new ConfigFileErrorException(
+								"Elements of the set must have the same type: "
+										+ o);
+					}
+				}
+			}
+			t.setSubType(elemType);
+			return t;
+
+		} else if (o.getClass().getName().equals("tlc2.value.ModelValue")) {
+			ModelValue mv = (ModelValue) o;
+			if (!enumeratedSet.contains(mv.toString())) {
+				enumeratedSet.add(mv.toString());
+				ArrayList<String> temp = new ArrayList<String>();
+				temp.add(mv.toString());
+				EnumType e = new EnumType(temp);
+				enumeratedTypes.put(mv.toString(), e);
+				return e;
+			} else {
+				return enumeratedTypes.get(mv.toString());
+			}
+
+		} else if (o.getClass().getName().equals("tlc2.value.StringValue")) {
+			return StringType.getInstance();
+		} else if (o.getClass().getName().equals("tlc2.value.BoolValue")) {
+			return BoolType.getInstance();
+		} else {
+			throw new ConfigFileErrorException("Unkown ConstantType: " + o
+					+ " " + o.getClass());
+		}
+	}
+
+	public OpDefNode getSpecNode() {
+		return specNode;
+	}
+
+	public OpDefNode getNextNode() {
+		return nextNode;
+	}
+
+	public OpDefNode getInitNode() {
+		return initNode;
+	}
+
+	public Hashtable<OpDeclNode, OpDefNode> getConstantOverrideTable() {
+		return constantOverrideTable;
+	}
+
+	public ArrayList<OpDefNode> getInvariants() {
+		return this.invariantNodeList;
+	}
+
+	public Hashtable<OpDeclNode, ValueObj> getConstantAssignments() {
+		return this.constantAssignments;
+	}
+
+	public Hashtable<OpDefNode, ValueObj> getOperatorAssignments() {
+		return this.operatorAssignments;
+	}
+
+	public ArrayList<OpDeclNode> getbConstantList() {
+		return bConstantList;
+	}
+
+	public Hashtable<OpDefNode, OpDefNode> getOperatorOverrideTable() {
+		return operatorOverrideTable;
+	}
+
+	public ArrayList<String> getEnumerationSet() {
+		return this.enumeratedSet;
+	}
+
+	public ArrayList<OpDefNode> getOperatorModelvalues() {
+		return this.operatorModelvalues;
+	}
+}
diff --git a/src/main/java/de/tla2b/config/ModuleOverrider.java b/src/main/java/de/tla2b/config/ModuleOverrider.java
index 1b6108c29593ba802c2ce3fcf2b6be8d009ccb5c..198e7b735535ccf941869c24e72658eb886aac2d 100644
--- a/src/main/java/de/tla2b/config/ModuleOverrider.java
+++ b/src/main/java/de/tla2b/config/ModuleOverrider.java
@@ -1,226 +1,226 @@
-package de.tla2b.config;
-
-import java.util.Hashtable;
-
-import tla2sany.semantic.ASTConstants;
-import tla2sany.semantic.AbortException;
-import tla2sany.semantic.AssumeNode;
-import tla2sany.semantic.ExprNode;
-import tla2sany.semantic.ExprOrOpArgNode;
-import tla2sany.semantic.LetInNode;
-import tla2sany.semantic.ModuleNode;
-import tla2sany.semantic.OpApplNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-import tla2sany.semantic.SymbolNode;
-import tlc2.tool.BuiltInOPs;
-
-public class ModuleOverrider extends BuiltInOPs implements ASTConstants {
-
-	private ModuleNode moduleNode;
-	private Hashtable<OpDeclNode, OpDefNode> constantOverrideTable;
-	private Hashtable<OpDefNode, OpDefNode> operatorOverrideTable;
-	private Hashtable<OpDefNode, ValueObj> operatorAssignments;
-
-	public ModuleOverrider(ModuleNode moduleNode,
-			Hashtable<OpDeclNode, OpDefNode> constantOverrideTable,
-			Hashtable<OpDefNode, OpDefNode> operatorOverrideTable,
-			Hashtable<OpDefNode, ValueObj> operatorAssignments) {
-		this.moduleNode = moduleNode;
-		this.constantOverrideTable = constantOverrideTable;
-		this.operatorOverrideTable = operatorOverrideTable;
-		this.operatorAssignments = operatorAssignments;
-	}
-
-	public ModuleOverrider(ModuleNode moduleNode, ConfigfileEvaluator conEval) {
-		this.moduleNode = moduleNode;
-		this.constantOverrideTable = conEval.getConstantOverrideTable();
-		this.operatorOverrideTable = conEval.getOperatorOverrideTable();
-		this.operatorAssignments = conEval.getOperatorAssignments();
-
-	}
-
-	public void start() {
-		OpDefNode[] defs = moduleNode.getOpDefs();
-		for (int i = 0; i < defs.length; i++) {
-			OpDefNode def = defs[i];
-			if (operatorAssignments.containsKey(def)) {
-				ExprNode oldExpr = def.getBody();
-				TLCValueNode valueNode;
-				try {
-					valueNode = new TLCValueNode(operatorAssignments.get(def),
-							oldExpr.getTreeNode());
-				} catch (AbortException e) {
-					throw new RuntimeException();
-				}
-				def.setBody(valueNode);
-			} else if (operatorAssignments.containsKey(def.getSource())) {
-				ExprNode oldExpr = def.getBody();
-				TLCValueNode valueNode;
-				try {
-					valueNode = new TLCValueNode(operatorAssignments.get(def
-							.getSource()), oldExpr.getTreeNode());
-				} catch (AbortException e) {
-					throw new RuntimeException();
-				}
-				def.setBody(valueNode);
-			}
-
-		}
-
-		for (int i = 0; i < defs.length; i++) {
-			OpApplNode res = visitExprNode(defs[i].getBody());
-			if (res != null) {
-				defs[i].setBody(res);
-			}
-		}
-
-		AssumeNode[] assumes = moduleNode.getAssumptions();
-		for (int i = 0; i < assumes.length; i++) {
-			AssumeNode assume = assumes[i];
-			OpApplNode res = visitExprNode(assume.getAssume());
-			if (res != null) {
-
-				AssumeNode newAssume = new AssumeNode(assume.stn, res, null,
-						null);
-				assumes[i] = newAssume;
-			}
-		}
-	}
-
-	private OpApplNode visitExprOrOpArgNode(ExprOrOpArgNode n) {
-		if (n instanceof ExprNode) {
-
-			return visitExprNode((ExprNode) n);
-		} else {
-			throw new RuntimeException("OpArgNode not implemented jet");
-		}
-	}
-
-	private OpApplNode visitExprNode(ExprNode n) {
-
-		switch (n.getKind()) {
-		case OpApplKind:
-			return (OpApplNode) visitOpApplNode((OpApplNode) n);
-
-		case StringKind:
-		case AtNodeKind: // @
-		case NumeralKind: {
-			return null;
-		}
-
-		case LetInKind: {
-			LetInNode l = (LetInNode) n;
-			for (int i = 0; i < l.getLets().length; i++) {
-				visitExprNode(l.getLets()[i].getBody());
-			}
-
-			OpApplNode res = visitExprNode(l.getBody());
-			if (res != null) {
-				throw new RuntimeException();
-			}
-			return null;
-		}
-		}
-		return null;
-	}
-
-	private OpApplNode visitOpApplNode(OpApplNode n) {
-		SymbolNode s = n.getOperator();
-		switch (s.getKind()) {
-		case ConstantDeclKind: {
-			if (constantOverrideTable.containsKey(s) && s.getArity() > 0) {
-				SymbolNode newOperator = constantOverrideTable.get(s);
-				OpApplNode newNode = null;
-				try {
-					newNode = new OpApplNode(newOperator, n.getArgs(),
-							n.getTreeNode(), null);
-				} catch (AbortException e) {
-					throw new RuntimeException();
-				}
-				for (int i = 0; i < n.getArgs().length; i++) {
-					if (n.getArgs()[i] != null) {
-						OpApplNode res = visitExprOrOpArgNode(n.getArgs()[i]);
-						if (res != null) {
-							n.getArgs()[i] = res;
-						}
-					}
-				}
-				// n.setOperator(constantOverrideTable.get(s));
-				return newNode;
-			}
-			break;
-
-		}
-		case FormalParamKind: // Params are not global in the module
-		case VariableDeclKind: // TODO try to override variable
-			break;
-
-		case BuiltInKind:// Buildin operator can not be overridden by in the
-							// configuration file
-			ExprNode[] ins = n.getBdedQuantBounds();
-			if (ins != null) {
-				for (int i = 0; i < ins.length; i++) {
-
-					OpApplNode res = visitExprOrOpArgNode(ins[i]);
-					if (res != null) {
-						ins[i] = res;
-					}
-				}
-			}
-
-			break;
-
-		case UserDefinedOpKind: {
-			OpDefNode operator = (OpDefNode) n.getOperator();
-			if (!operatorOverrideTable.containsKey(operator.getSource())
-					&& !operatorOverrideTable.containsKey(operator))
-				break;
-
-			SymbolNode newOperator = null;
-			// IF there are two override statements in the configuration file
-			//(a: Add <- (Rule) Add2, b: R1!Add <- Add3)
-			// TLC uses variant a) overriding the source definition
-			if (operatorOverrideTable.containsKey(operator.getSource())) {
-				newOperator = operatorOverrideTable.get(operator.getSource());
-			} else {
-				newOperator = operatorOverrideTable.get(operator);
-			}
-			OpApplNode newNode = null;
-			OpDefNode def = (OpDefNode) n.getOperator();
-			try {
-				newNode = new OpApplNode(newOperator, n.getArgs(),
-						n.getTreeNode(), def.getOriginallyDefinedInModuleNode());
-			} catch (AbortException e) {
-				e.printStackTrace();
-			}
-			for (int i = 0; i < n.getArgs().length; i++) {
-				if (n.getArgs()[i] != null) {
-					OpApplNode res = visitExprOrOpArgNode(n.getArgs()[i]);
-					if (res != null) {
-						n.getArgs()[i] = res;
-					}
-				}
-
-			}
-			// n.setOperator(constantOverrideTable.get(s));
-			return newNode;
-		}
-		}
-
-		for (int i = 0; i < n.getArgs().length; i++) {
-			if (n.getArgs()[i] != null) {
-				ExprOrOpArgNode arg = n.getArgs()[i];
-				if (arg != null) {
-					OpApplNode res = visitExprOrOpArgNode(n.getArgs()[i]);
-					if (res != null) {
-						n.getArgs()[i] = res;
-					}
-				}
-			}
-
-		}
-		return null;
-	}
-
-}
+package de.tla2b.config;
+
+import java.util.Hashtable;
+
+import tla2sany.semantic.ASTConstants;
+import tla2sany.semantic.AbortException;
+import tla2sany.semantic.AssumeNode;
+import tla2sany.semantic.ExprNode;
+import tla2sany.semantic.ExprOrOpArgNode;
+import tla2sany.semantic.LetInNode;
+import tla2sany.semantic.ModuleNode;
+import tla2sany.semantic.OpApplNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+import tla2sany.semantic.SymbolNode;
+import tlc2.tool.BuiltInOPs;
+
+public class ModuleOverrider extends BuiltInOPs implements ASTConstants {
+
+	private ModuleNode moduleNode;
+	private Hashtable<OpDeclNode, OpDefNode> constantOverrideTable;
+	private Hashtable<OpDefNode, OpDefNode> operatorOverrideTable;
+	private Hashtable<OpDefNode, ValueObj> operatorAssignments;
+
+	public ModuleOverrider(ModuleNode moduleNode,
+			Hashtable<OpDeclNode, OpDefNode> constantOverrideTable,
+			Hashtable<OpDefNode, OpDefNode> operatorOverrideTable,
+			Hashtable<OpDefNode, ValueObj> operatorAssignments) {
+		this.moduleNode = moduleNode;
+		this.constantOverrideTable = constantOverrideTable;
+		this.operatorOverrideTable = operatorOverrideTable;
+		this.operatorAssignments = operatorAssignments;
+	}
+
+	public ModuleOverrider(ModuleNode moduleNode, ConfigfileEvaluator conEval) {
+		this.moduleNode = moduleNode;
+		this.constantOverrideTable = conEval.getConstantOverrideTable();
+		this.operatorOverrideTable = conEval.getOperatorOverrideTable();
+		this.operatorAssignments = conEval.getOperatorAssignments();
+
+	}
+
+	public void start() {
+		OpDefNode[] defs = moduleNode.getOpDefs();
+		for (int i = 0; i < defs.length; i++) {
+			OpDefNode def = defs[i];
+			if (operatorAssignments.containsKey(def)) {
+				ExprNode oldExpr = def.getBody();
+				TLCValueNode valueNode;
+				try {
+					valueNode = new TLCValueNode(operatorAssignments.get(def),
+							oldExpr.getTreeNode());
+				} catch (AbortException e) {
+					throw new RuntimeException();
+				}
+				def.setBody(valueNode);
+			} else if (operatorAssignments.containsKey(def.getSource())) {
+				ExprNode oldExpr = def.getBody();
+				TLCValueNode valueNode;
+				try {
+					valueNode = new TLCValueNode(operatorAssignments.get(def
+							.getSource()), oldExpr.getTreeNode());
+				} catch (AbortException e) {
+					throw new RuntimeException();
+				}
+				def.setBody(valueNode);
+			}
+
+		}
+
+		for (int i = 0; i < defs.length; i++) {
+			OpApplNode res = visitExprNode(defs[i].getBody());
+			if (res != null) {
+				defs[i].setBody(res);
+			}
+		}
+
+		AssumeNode[] assumes = moduleNode.getAssumptions();
+		for (int i = 0; i < assumes.length; i++) {
+			AssumeNode assume = assumes[i];
+			OpApplNode res = visitExprNode(assume.getAssume());
+			if (res != null) {
+
+				AssumeNode newAssume = new AssumeNode(assume.stn, res, null,
+						null);
+				assumes[i] = newAssume;
+			}
+		}
+	}
+
+	private OpApplNode visitExprOrOpArgNode(ExprOrOpArgNode n) {
+		if (n instanceof ExprNode) {
+
+			return visitExprNode((ExprNode) n);
+		} else {
+			throw new RuntimeException("OpArgNode not implemented jet");
+		}
+	}
+
+	private OpApplNode visitExprNode(ExprNode n) {
+
+		switch (n.getKind()) {
+		case OpApplKind:
+			return (OpApplNode) visitOpApplNode((OpApplNode) n);
+
+		case StringKind:
+		case AtNodeKind: // @
+		case NumeralKind: {
+			return null;
+		}
+
+		case LetInKind: {
+			LetInNode l = (LetInNode) n;
+			for (int i = 0; i < l.getLets().length; i++) {
+				visitExprNode(l.getLets()[i].getBody());
+			}
+
+			OpApplNode res = visitExprNode(l.getBody());
+			if (res != null) {
+				throw new RuntimeException();
+			}
+			return null;
+		}
+		}
+		return null;
+	}
+
+	private OpApplNode visitOpApplNode(OpApplNode n) {
+		SymbolNode s = n.getOperator();
+		switch (s.getKind()) {
+		case ConstantDeclKind: {
+			if (constantOverrideTable.containsKey(s) && s.getArity() > 0) {
+				SymbolNode newOperator = constantOverrideTable.get(s);
+				OpApplNode newNode = null;
+				try {
+					newNode = new OpApplNode(newOperator, n.getArgs(),
+							n.getTreeNode(), null);
+				} catch (AbortException e) {
+					throw new RuntimeException();
+				}
+				for (int i = 0; i < n.getArgs().length; i++) {
+					if (n.getArgs()[i] != null) {
+						OpApplNode res = visitExprOrOpArgNode(n.getArgs()[i]);
+						if (res != null) {
+							n.getArgs()[i] = res;
+						}
+					}
+				}
+				// n.setOperator(constantOverrideTable.get(s));
+				return newNode;
+			}
+			break;
+
+		}
+		case FormalParamKind: // Params are not global in the module
+		case VariableDeclKind: // TODO try to override variable
+			break;
+
+		case BuiltInKind:// Buildin operator can not be overridden by in the
+							// configuration file
+			ExprNode[] ins = n.getBdedQuantBounds();
+			if (ins != null) {
+				for (int i = 0; i < ins.length; i++) {
+
+					OpApplNode res = visitExprOrOpArgNode(ins[i]);
+					if (res != null) {
+						ins[i] = res;
+					}
+				}
+			}
+
+			break;
+
+		case UserDefinedOpKind: {
+			OpDefNode operator = (OpDefNode) n.getOperator();
+			if (!operatorOverrideTable.containsKey(operator.getSource())
+					&& !operatorOverrideTable.containsKey(operator))
+				break;
+
+			SymbolNode newOperator = null;
+			// IF there are two override statements in the configuration file
+			//(a: Add <- (Rule) Add2, b: R1!Add <- Add3)
+			// TLC uses variant a) overriding the source definition
+			if (operatorOverrideTable.containsKey(operator.getSource())) {
+				newOperator = operatorOverrideTable.get(operator.getSource());
+			} else {
+				newOperator = operatorOverrideTable.get(operator);
+			}
+			OpApplNode newNode = null;
+			OpDefNode def = (OpDefNode) n.getOperator();
+			try {
+				newNode = new OpApplNode(newOperator, n.getArgs(),
+						n.getTreeNode(), def.getOriginallyDefinedInModuleNode());
+			} catch (AbortException e) {
+				e.printStackTrace();
+			}
+			for (int i = 0; i < n.getArgs().length; i++) {
+				if (n.getArgs()[i] != null) {
+					OpApplNode res = visitExprOrOpArgNode(n.getArgs()[i]);
+					if (res != null) {
+						n.getArgs()[i] = res;
+					}
+				}
+
+			}
+			// n.setOperator(constantOverrideTable.get(s));
+			return newNode;
+		}
+		}
+
+		for (int i = 0; i < n.getArgs().length; i++) {
+			if (n.getArgs()[i] != null) {
+				ExprOrOpArgNode arg = n.getArgs()[i];
+				if (arg != null) {
+					OpApplNode res = visitExprOrOpArgNode(n.getArgs()[i]);
+					if (res != null) {
+						n.getArgs()[i] = res;
+					}
+				}
+			}
+
+		}
+		return null;
+	}
+
+}
diff --git a/src/main/java/de/tla2b/config/TLCValueNode.java b/src/main/java/de/tla2b/config/TLCValueNode.java
index 5878606e2ceb855749d9e9279934897c142394b9..41f08c3760624a5250f5b622a74f8e0ed28973af 100644
--- a/src/main/java/de/tla2b/config/TLCValueNode.java
+++ b/src/main/java/de/tla2b/config/TLCValueNode.java
@@ -1,34 +1,34 @@
-package de.tla2b.config;
-
-import de.tla2b.global.TranslationGlobals;
-import de.tla2b.types.TLAType;
-import tla2sany.semantic.AbortException;
-import tla2sany.semantic.NumeralNode;
-import tla2sany.st.TreeNode;
-import tlc2.value.Value;
-
-public class TLCValueNode extends NumeralNode implements TranslationGlobals {
-
-	private Value value;
-	private TLAType type;
-
-	public TLCValueNode(ValueObj valObj, TreeNode stn) throws AbortException {
-		super("1337", stn);
-		this.value = valObj.getValue();
-		this.type = valObj.getType();
-	}
-
-	public String toString2() {
-		return "\n*TLCValueNode: Value: '"
-				+ value.toString() + "'";
-				
-	}
-
-	public TLAType getType() {
-		return type;
-	}
-
-	public Value getValue() {
-		return value;
-	}
-}
+package de.tla2b.config;
+
+import de.tla2b.global.TranslationGlobals;
+import de.tla2b.types.TLAType;
+import tla2sany.semantic.AbortException;
+import tla2sany.semantic.NumeralNode;
+import tla2sany.st.TreeNode;
+import tlc2.value.Value;
+
+public class TLCValueNode extends NumeralNode implements TranslationGlobals {
+
+	private Value value;
+	private TLAType type;
+
+	public TLCValueNode(ValueObj valObj, TreeNode stn) throws AbortException {
+		super("1337", stn);
+		this.value = valObj.getValue();
+		this.type = valObj.getType();
+	}
+
+	public String toString2() {
+		return "\n*TLCValueNode: Value: '"
+				+ value.toString() + "'";
+				
+	}
+
+	public TLAType getType() {
+		return type;
+	}
+
+	public Value getValue() {
+		return value;
+	}
+}
diff --git a/src/main/java/de/tla2b/config/ValueObj.java b/src/main/java/de/tla2b/config/ValueObj.java
index 85b95f99dcb565ff3610d57e1f586fa0b45521a0..e239c56b09835c7adcd089fea7fcc824e14f03dd 100644
--- a/src/main/java/de/tla2b/config/ValueObj.java
+++ b/src/main/java/de/tla2b/config/ValueObj.java
@@ -1,31 +1,31 @@
-package de.tla2b.config;
-
-import de.tla2b.types.TLAType;
-import tlc2.value.Value;
-
-public class ValueObj {
-	private Value value;
-	private TLAType type;
-
-	public ValueObj(Value value, TLAType t) {
-		this.value = value;
-		this.type = t;
-	}
-
-	public Value getValue() {
-		return value;
-	}
-
-	public void setValue(Value value) {
-		this.value = value;
-	}
-
-	public void setType(TLAType type) {
-		this.type = type;
-	}
-	
-	public TLAType getType(){
-		return type;
-	}
-		
-}
+package de.tla2b.config;
+
+import de.tla2b.types.TLAType;
+import tlc2.value.Value;
+
+public class ValueObj {
+	private Value value;
+	private TLAType type;
+
+	public ValueObj(Value value, TLAType t) {
+		this.value = value;
+		this.type = t;
+	}
+
+	public Value getValue() {
+		return value;
+	}
+
+	public void setValue(Value value) {
+		this.value = value;
+	}
+
+	public void setType(TLAType type) {
+		this.type = type;
+	}
+	
+	public TLAType getType(){
+		return type;
+	}
+		
+}
diff --git a/src/main/java/de/tla2b/exceptions/ConfigFileErrorException.java b/src/main/java/de/tla2b/exceptions/ConfigFileErrorException.java
index e3f61bf965f63be772d2b10652b9644c24af90d8..bbe66b178a43b3473143a7c8532da0c99665ab6b 100644
--- a/src/main/java/de/tla2b/exceptions/ConfigFileErrorException.java
+++ b/src/main/java/de/tla2b/exceptions/ConfigFileErrorException.java
@@ -1,10 +1,10 @@
-package de.tla2b.exceptions;
-
-
-@SuppressWarnings("serial")
-public class ConfigFileErrorException extends TLA2BException{
-
-	public ConfigFileErrorException(String s) {
-		super(s);
-	}
-}
+package de.tla2b.exceptions;
+
+
+@SuppressWarnings("serial")
+public class ConfigFileErrorException extends TLA2BException{
+
+	public ConfigFileErrorException(String s) {
+		super(s);
+	}
+}
diff --git a/src/main/java/de/tla2b/exceptions/FrontEndException.java b/src/main/java/de/tla2b/exceptions/FrontEndException.java
index ffca417cadc710e48e22fe18c115a7c6db95ef04..9d6f9edc00cfd18f3ead5e2efa8ff8d178fb9843 100644
--- a/src/main/java/de/tla2b/exceptions/FrontEndException.java
+++ b/src/main/java/de/tla2b/exceptions/FrontEndException.java
@@ -1,17 +1,17 @@
-package de.tla2b.exceptions;
-
-import tla2sany.modanalyzer.SpecObj;
-
-@SuppressWarnings("serial")
-public class FrontEndException extends TLA2BException{
-
-	public SpecObj spec;
-	public FrontEndException(String e){
-		super(e);
-	}
-
-	public FrontEndException(String string, SpecObj spec) {
-		super(string);
-		this.spec = spec;
-	}
-}
+package de.tla2b.exceptions;
+
+import tla2sany.modanalyzer.SpecObj;
+
+@SuppressWarnings("serial")
+public class FrontEndException extends TLA2BException{
+
+	public SpecObj spec;
+	public FrontEndException(String e){
+		super(e);
+	}
+
+	public FrontEndException(String string, SpecObj spec) {
+		super(string);
+		this.spec = spec;
+	}
+}
diff --git a/src/main/java/de/tla2b/exceptions/ModuleErrorException.java b/src/main/java/de/tla2b/exceptions/ModuleErrorException.java
index ac91a246218bd77be479def32846c1479d292c67..07c8da5169dfce0e24fb363ede8d805e3b9995b9 100644
--- a/src/main/java/de/tla2b/exceptions/ModuleErrorException.java
+++ b/src/main/java/de/tla2b/exceptions/ModuleErrorException.java
@@ -1,10 +1,10 @@
-package de.tla2b.exceptions;
-
-
-@SuppressWarnings("serial")
-public class ModuleErrorException extends TLA2BException{
-	public ModuleErrorException(String e){
-		super(e);
-	}
-
-}
+package de.tla2b.exceptions;
+
+
+@SuppressWarnings("serial")
+public class ModuleErrorException extends TLA2BException{
+	public ModuleErrorException(String e){
+		super(e);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/exceptions/NotImplementedException.java b/src/main/java/de/tla2b/exceptions/NotImplementedException.java
index a9376b5d877a7a7537e41b13e3d914791c5c8197..7d1367c2a7787376fcbaca5ff1b3fe30252d8746 100644
--- a/src/main/java/de/tla2b/exceptions/NotImplementedException.java
+++ b/src/main/java/de/tla2b/exceptions/NotImplementedException.java
@@ -1,10 +1,10 @@
-package de.tla2b.exceptions;
-
-
-@SuppressWarnings("serial")
-public class NotImplementedException extends RuntimeException {
-	public NotImplementedException(String e){
-		super(e);
-	}
-
-}
+package de.tla2b.exceptions;
+
+
+@SuppressWarnings("serial")
+public class NotImplementedException extends RuntimeException {
+	public NotImplementedException(String e){
+		super(e);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/exceptions/SemanticErrorException.java b/src/main/java/de/tla2b/exceptions/SemanticErrorException.java
index 7708c8b8897ca27ab429cb3a8373e639b3d6a926..72c3f61a8d4224a2602244ea1b2ff488ad1dda15 100644
--- a/src/main/java/de/tla2b/exceptions/SemanticErrorException.java
+++ b/src/main/java/de/tla2b/exceptions/SemanticErrorException.java
@@ -1,10 +1,10 @@
-package de.tla2b.exceptions;
-
-@SuppressWarnings("serial")
-public class SemanticErrorException extends TLA2BException {
-	
-	public SemanticErrorException(String e){
-		super(e);
-	}
-
-}
+package de.tla2b.exceptions;
+
+@SuppressWarnings("serial")
+public class SemanticErrorException extends TLA2BException {
+	
+	public SemanticErrorException(String e){
+		super(e);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/exceptions/TLA2BException.java b/src/main/java/de/tla2b/exceptions/TLA2BException.java
index edb67f65d4bd0439e6334e19b0c0c04491777225..c86ebf7f628a749200f0eb6521b718c8f23d1f78 100644
--- a/src/main/java/de/tla2b/exceptions/TLA2BException.java
+++ b/src/main/java/de/tla2b/exceptions/TLA2BException.java
@@ -1,9 +1,9 @@
-package de.tla2b.exceptions;
-
-@SuppressWarnings("serial")
-public abstract class TLA2BException extends Exception{
-
-	public TLA2BException(String e){
-		super(e);
-	}
-}
+package de.tla2b.exceptions;
+
+@SuppressWarnings("serial")
+public abstract class TLA2BException extends Exception{
+
+	public TLA2BException(String e){
+		super(e);
+	}
+}
diff --git a/src/main/java/de/tla2b/exceptions/TLA2BIOException.java b/src/main/java/de/tla2b/exceptions/TLA2BIOException.java
index f8541148e9d3ca58c627d4e292dca11562ea5a7a..15595faeddb9046629cf84711f108948411bbb38 100644
--- a/src/main/java/de/tla2b/exceptions/TLA2BIOException.java
+++ b/src/main/java/de/tla2b/exceptions/TLA2BIOException.java
@@ -1,10 +1,10 @@
-package de.tla2b.exceptions;
-
-@SuppressWarnings("serial")
-public class TLA2BIOException extends TLA2BException {
-
-	
-	public TLA2BIOException(String e){
-		super(e);
-	}
-}
+package de.tla2b.exceptions;
+
+@SuppressWarnings("serial")
+public class TLA2BIOException extends TLA2BException {
+
+	
+	public TLA2BIOException(String e){
+		super(e);
+	}
+}
diff --git a/src/main/java/de/tla2b/exceptions/TypeErrorException.java b/src/main/java/de/tla2b/exceptions/TypeErrorException.java
index cea021a7de097285f2208fd5edbe1e1cccd56514..15f2116500a3a02a58da87c65d10bbb412d0afe1 100644
--- a/src/main/java/de/tla2b/exceptions/TypeErrorException.java
+++ b/src/main/java/de/tla2b/exceptions/TypeErrorException.java
@@ -1,11 +1,11 @@
-package de.tla2b.exceptions;
-
-
-@SuppressWarnings("serial")
-public class TypeErrorException extends TLA2BException {
-
-
-	public TypeErrorException(String s) {
-		super(s);
-	}
-}
+package de.tla2b.exceptions;
+
+
+@SuppressWarnings("serial")
+public class TypeErrorException extends TLA2BException {
+
+
+	public TypeErrorException(String s) {
+		super(s);
+	}
+}
diff --git a/src/main/java/de/tla2b/exceptions/UnificationException.java b/src/main/java/de/tla2b/exceptions/UnificationException.java
index 8ca36d7eb1669c4539af5b730e03be08a7540248..1bd35e7c36b60f6b0db06e22afed55c32e2d61e2 100644
--- a/src/main/java/de/tla2b/exceptions/UnificationException.java
+++ b/src/main/java/de/tla2b/exceptions/UnificationException.java
@@ -1,8 +1,8 @@
-package de.tla2b.exceptions;
-@SuppressWarnings("serial")
-public class UnificationException extends TLA2BException{
-
-	public UnificationException() {
-		super(null);
-	}
-}
+package de.tla2b.exceptions;
+@SuppressWarnings("serial")
+public class UnificationException extends TLA2BException{
+
+	public UnificationException() {
+		super(null);
+	}
+}
diff --git a/src/main/java/de/tla2b/global/BBuildIns.java b/src/main/java/de/tla2b/global/BBuildIns.java
index f30e02b0dde6ea54028f1734b877f63e7c66efcb..a77165cb44e5c3c2df0e9d507d20afe9e9ab5bf6 100644
--- a/src/main/java/de/tla2b/global/BBuildIns.java
+++ b/src/main/java/de/tla2b/global/BBuildIns.java
@@ -1,132 +1,132 @@
-package de.tla2b.global;
-
-import util.UniqueString;
-
-public interface BBuildIns {
-	public static final UniqueString OP_dotdot = UniqueString
-			.uniqueStringOf("..");
-	public static final UniqueString OP_plus = UniqueString.uniqueStringOf("+");
-	public static final UniqueString OP_minus = UniqueString
-			.uniqueStringOf("-");
-	public static final UniqueString OP_times = UniqueString
-			.uniqueStringOf("*");
-	public static final UniqueString OP_div = UniqueString
-			.uniqueStringOf("\\div");
-	public static final UniqueString OP_mod = UniqueString.uniqueStringOf("%");
-	public static final UniqueString OP_exp = UniqueString.uniqueStringOf("^");
-
-	public static final UniqueString OP_uminus = UniqueString
-			.uniqueStringOf("-.");
-
-	public static final UniqueString OP_lt = UniqueString.uniqueStringOf("<");
-	public static final UniqueString OP_leq = UniqueString
-			.uniqueStringOf("\\leq");
-	public static final UniqueString OP_gt = UniqueString.uniqueStringOf(">");
-	public static final UniqueString OP_geq = UniqueString
-			.uniqueStringOf("\\geq");
-
-	public static final UniqueString OP_nat = UniqueString
-			.uniqueStringOf("Nat");
-	public static final UniqueString OP_int = UniqueString
-			.uniqueStringOf("Int");
-	public static final UniqueString OP_bool = UniqueString
-			.uniqueStringOf("BOOLEAN");
-	public static final UniqueString OP_true = UniqueString
-			.uniqueStringOf("TRUE");
-	public static final UniqueString OP_false = UniqueString
-			.uniqueStringOf("FALSE");
-	public static final UniqueString OP_string = UniqueString
-			.uniqueStringOf("STRING");
-
-	// Sets
-	public static final UniqueString OP_card = UniqueString
-			.uniqueStringOf("Cardinality");
-	public static final UniqueString OP_finite = UniqueString
-			.uniqueStringOf("IsFiniteSet");
-
-	// Sequences
-	public static final UniqueString OP_len = UniqueString
-			.uniqueStringOf("Len");
-	public static final UniqueString OP_append = UniqueString
-			.uniqueStringOf("Append");
-	public static final UniqueString OP_seq = UniqueString
-			.uniqueStringOf("Seq");
-	public static final UniqueString OP_head = UniqueString
-			.uniqueStringOf("Head");
-	public static final UniqueString OP_tail = UniqueString
-			.uniqueStringOf("Tail");
-	public static final UniqueString OP_subseq = UniqueString
-			.uniqueStringOf("SubSeq");
-	public static final UniqueString OP_conc = UniqueString
-	.uniqueStringOf("\\o");
-	
-	//TLA2B
-	public static final UniqueString OP_min = UniqueString
-			.uniqueStringOf("MinOfSet");
-	public static final UniqueString OP_max = UniqueString
-			.uniqueStringOf("MaxOfSet");
-	public static final UniqueString OP_setprod = UniqueString
-			.uniqueStringOf("SetProduct");
-	public static final UniqueString OP_setsum = UniqueString
-			.uniqueStringOf("SetSummation");
-	public static final UniqueString OP_permseq = UniqueString
-			.uniqueStringOf("PermutedSequences");
-
-	//BBuildIns
-	public static final UniqueString OP_pow1 = UniqueString
-			.uniqueStringOf("POW1");
-	
-	
-	//Relations
-	public static final UniqueString OP_rel_inverse = UniqueString
-			.uniqueStringOf("rel_inverse");
-	
-	//TLC
-	public static final UniqueString OP_assert = UniqueString
-	.uniqueStringOf("Assert");
-	
-	public static final int B_OPCODE_dotdot = 1;
-	public static final int B_OPCODE_plus = 2;
-	public static final int B_OPCODE_minus = 3;
-	public static final int B_OPCODE_times = 4;
-	public static final int B_OPCODE_div = 5;
-	public static final int B_OPCODE_exp = 6;
-	public static final int B_OPCODE_uminus = 7;
-	public static final int B_OPCODE_mod = 8;
-
-	public static final int B_OPCODE_lt = B_OPCODE_mod + 1;
-	public static final int B_OPCODE_leq = B_OPCODE_mod + 2;
-	public static final int B_OPCODE_gt = B_OPCODE_mod + 3;
-	public static final int B_OPCODE_geq = B_OPCODE_mod + 4;
-
-	public static final int B_OPCODE_nat = B_OPCODE_geq + 1;
-	public static final int B_OPCODE_bool = B_OPCODE_geq + 2;
-	public static final int B_OPCODE_true = B_OPCODE_geq + 3;
-	public static final int B_OPCODE_false = B_OPCODE_geq + 4;
-	public static final int B_OPCODE_int = B_OPCODE_geq + 5;
-	public static final int B_OPCODE_string = B_OPCODE_geq + 6;
-
-	public static final int B_OPCODE_finite = B_OPCODE_string + 1;
-	public static final int B_OPCODE_card = B_OPCODE_string + 2;
-
-	public static final int B_OPCODE_len = B_OPCODE_card + 1;
-	public static final int B_OPCODE_append = B_OPCODE_card + 2;
-	public static final int B_OPCODE_seq = B_OPCODE_card + 3;
-	public static final int B_OPCODE_head = B_OPCODE_card + 4;
-	public static final int B_OPCODE_tail = B_OPCODE_card + 5;
-	public static final int B_OPCODE_subseq = B_OPCODE_card + 6;
-	public static final int B_OPCODE_conc = B_OPCODE_card + 7;
-
-	public static final int B_OPCODE_min = B_OPCODE_conc + 1;
-	public static final int B_OPCODE_max = B_OPCODE_conc + 2;
-	public static final int B_OPCODE_setprod = B_OPCODE_conc + 3;
-	public static final int B_OPCODE_setsum = B_OPCODE_conc + 4;
-	public static final int B_OPCODE_permseq = B_OPCODE_conc + 5;
-	
-	public static final int B_OPCODE_pow1 = B_OPCODE_permseq + 1;
-	
-	
-	public static final int B_OPCODE_rel_inverse = B_OPCODE_pow1 + 1;
-	
-	public static final int B_OPCODE_assert = B_OPCODE_rel_inverse + 1;
-}
+package de.tla2b.global;
+
+import util.UniqueString;
+
+public interface BBuildIns {
+	public static final UniqueString OP_dotdot = UniqueString
+			.uniqueStringOf("..");
+	public static final UniqueString OP_plus = UniqueString.uniqueStringOf("+");
+	public static final UniqueString OP_minus = UniqueString
+			.uniqueStringOf("-");
+	public static final UniqueString OP_times = UniqueString
+			.uniqueStringOf("*");
+	public static final UniqueString OP_div = UniqueString
+			.uniqueStringOf("\\div");
+	public static final UniqueString OP_mod = UniqueString.uniqueStringOf("%");
+	public static final UniqueString OP_exp = UniqueString.uniqueStringOf("^");
+
+	public static final UniqueString OP_uminus = UniqueString
+			.uniqueStringOf("-.");
+
+	public static final UniqueString OP_lt = UniqueString.uniqueStringOf("<");
+	public static final UniqueString OP_leq = UniqueString
+			.uniqueStringOf("\\leq");
+	public static final UniqueString OP_gt = UniqueString.uniqueStringOf(">");
+	public static final UniqueString OP_geq = UniqueString
+			.uniqueStringOf("\\geq");
+
+	public static final UniqueString OP_nat = UniqueString
+			.uniqueStringOf("Nat");
+	public static final UniqueString OP_int = UniqueString
+			.uniqueStringOf("Int");
+	public static final UniqueString OP_bool = UniqueString
+			.uniqueStringOf("BOOLEAN");
+	public static final UniqueString OP_true = UniqueString
+			.uniqueStringOf("TRUE");
+	public static final UniqueString OP_false = UniqueString
+			.uniqueStringOf("FALSE");
+	public static final UniqueString OP_string = UniqueString
+			.uniqueStringOf("STRING");
+
+	// Sets
+	public static final UniqueString OP_card = UniqueString
+			.uniqueStringOf("Cardinality");
+	public static final UniqueString OP_finite = UniqueString
+			.uniqueStringOf("IsFiniteSet");
+
+	// Sequences
+	public static final UniqueString OP_len = UniqueString
+			.uniqueStringOf("Len");
+	public static final UniqueString OP_append = UniqueString
+			.uniqueStringOf("Append");
+	public static final UniqueString OP_seq = UniqueString
+			.uniqueStringOf("Seq");
+	public static final UniqueString OP_head = UniqueString
+			.uniqueStringOf("Head");
+	public static final UniqueString OP_tail = UniqueString
+			.uniqueStringOf("Tail");
+	public static final UniqueString OP_subseq = UniqueString
+			.uniqueStringOf("SubSeq");
+	public static final UniqueString OP_conc = UniqueString
+	.uniqueStringOf("\\o");
+	
+	//TLA2B
+	public static final UniqueString OP_min = UniqueString
+			.uniqueStringOf("MinOfSet");
+	public static final UniqueString OP_max = UniqueString
+			.uniqueStringOf("MaxOfSet");
+	public static final UniqueString OP_setprod = UniqueString
+			.uniqueStringOf("SetProduct");
+	public static final UniqueString OP_setsum = UniqueString
+			.uniqueStringOf("SetSummation");
+	public static final UniqueString OP_permseq = UniqueString
+			.uniqueStringOf("PermutedSequences");
+
+	//BBuildIns
+	public static final UniqueString OP_pow1 = UniqueString
+			.uniqueStringOf("POW1");
+	
+	
+	//Relations
+	public static final UniqueString OP_rel_inverse = UniqueString
+			.uniqueStringOf("rel_inverse");
+	
+	//TLC
+	public static final UniqueString OP_assert = UniqueString
+	.uniqueStringOf("Assert");
+	
+	public static final int B_OPCODE_dotdot = 1;
+	public static final int B_OPCODE_plus = 2;
+	public static final int B_OPCODE_minus = 3;
+	public static final int B_OPCODE_times = 4;
+	public static final int B_OPCODE_div = 5;
+	public static final int B_OPCODE_exp = 6;
+	public static final int B_OPCODE_uminus = 7;
+	public static final int B_OPCODE_mod = 8;
+
+	public static final int B_OPCODE_lt = B_OPCODE_mod + 1;
+	public static final int B_OPCODE_leq = B_OPCODE_mod + 2;
+	public static final int B_OPCODE_gt = B_OPCODE_mod + 3;
+	public static final int B_OPCODE_geq = B_OPCODE_mod + 4;
+
+	public static final int B_OPCODE_nat = B_OPCODE_geq + 1;
+	public static final int B_OPCODE_bool = B_OPCODE_geq + 2;
+	public static final int B_OPCODE_true = B_OPCODE_geq + 3;
+	public static final int B_OPCODE_false = B_OPCODE_geq + 4;
+	public static final int B_OPCODE_int = B_OPCODE_geq + 5;
+	public static final int B_OPCODE_string = B_OPCODE_geq + 6;
+
+	public static final int B_OPCODE_finite = B_OPCODE_string + 1;
+	public static final int B_OPCODE_card = B_OPCODE_string + 2;
+
+	public static final int B_OPCODE_len = B_OPCODE_card + 1;
+	public static final int B_OPCODE_append = B_OPCODE_card + 2;
+	public static final int B_OPCODE_seq = B_OPCODE_card + 3;
+	public static final int B_OPCODE_head = B_OPCODE_card + 4;
+	public static final int B_OPCODE_tail = B_OPCODE_card + 5;
+	public static final int B_OPCODE_subseq = B_OPCODE_card + 6;
+	public static final int B_OPCODE_conc = B_OPCODE_card + 7;
+
+	public static final int B_OPCODE_min = B_OPCODE_conc + 1;
+	public static final int B_OPCODE_max = B_OPCODE_conc + 2;
+	public static final int B_OPCODE_setprod = B_OPCODE_conc + 3;
+	public static final int B_OPCODE_setsum = B_OPCODE_conc + 4;
+	public static final int B_OPCODE_permseq = B_OPCODE_conc + 5;
+	
+	public static final int B_OPCODE_pow1 = B_OPCODE_permseq + 1;
+	
+	
+	public static final int B_OPCODE_rel_inverse = B_OPCODE_pow1 + 1;
+	
+	public static final int B_OPCODE_assert = B_OPCODE_rel_inverse + 1;
+}
diff --git a/src/main/java/de/tla2b/global/BBuiltInOPs.java b/src/main/java/de/tla2b/global/BBuiltInOPs.java
index ad48af3bf8a401ec964e461adfd9251ef3a3bcd8..73a553381b845cb3e08555693437a2dde089d341 100644
--- a/src/main/java/de/tla2b/global/BBuiltInOPs.java
+++ b/src/main/java/de/tla2b/global/BBuiltInOPs.java
@@ -1,64 +1,64 @@
-package de.tla2b.global;
-
-
-import java.util.Hashtable;
-
-import util.UniqueString;
-
-public class BBuiltInOPs implements BBuildIns{
-	private static Hashtable<UniqueString, Integer> B_Opcode_Table;
-	static {
-		B_Opcode_Table = new Hashtable<UniqueString, Integer>();
-		B_Opcode_Table.put(OP_dotdot, B_OPCODE_dotdot);
-		B_Opcode_Table.put(OP_plus, B_OPCODE_plus);
-		B_Opcode_Table.put(OP_minus, B_OPCODE_minus);
-		B_Opcode_Table.put(OP_times, B_OPCODE_times);
-		B_Opcode_Table.put(OP_div, B_OPCODE_div);
-		B_Opcode_Table.put(OP_mod, B_OPCODE_mod);
-		B_Opcode_Table.put(OP_exp, B_OPCODE_exp);
-		B_Opcode_Table.put(OP_uminus, B_OPCODE_uminus);
-		
-		B_Opcode_Table.put(OP_lt, B_OPCODE_lt);
-		B_Opcode_Table.put(OP_leq, B_OPCODE_leq);
-		B_Opcode_Table.put(OP_gt, B_OPCODE_gt);
-		B_Opcode_Table.put(OP_geq, B_OPCODE_geq);
-		B_Opcode_Table.put(OP_bool, B_OPCODE_bool);
-		B_Opcode_Table.put(OP_true, B_OPCODE_true);
-		B_Opcode_Table.put(OP_false, B_OPCODE_false);
-		B_Opcode_Table.put(OP_nat, B_OPCODE_nat);
-		B_Opcode_Table.put(OP_int, B_OPCODE_int);
-		B_Opcode_Table.put(OP_string, B_OPCODE_string);
-		
-		B_Opcode_Table.put(OP_finite, B_OPCODE_finite);
-		B_Opcode_Table.put(OP_card, B_OPCODE_card);
-		
-		B_Opcode_Table.put(OP_len, B_OPCODE_len);
-		B_Opcode_Table.put(OP_append, B_OPCODE_append);
-		B_Opcode_Table.put(OP_seq, B_OPCODE_seq);
-		B_Opcode_Table.put(OP_head, B_OPCODE_head);
-		B_Opcode_Table.put(OP_tail, B_OPCODE_tail);
-		B_Opcode_Table.put(OP_subseq, B_OPCODE_subseq);
-		B_Opcode_Table.put(OP_conc, B_OPCODE_conc);
-		
-		B_Opcode_Table.put(OP_min, B_OPCODE_min);
-		B_Opcode_Table.put(OP_max, B_OPCODE_max);
-		B_Opcode_Table.put(OP_setprod, B_OPCODE_setprod);
-		B_Opcode_Table.put(OP_setsum, B_OPCODE_setsum);
-		B_Opcode_Table.put(OP_permseq, B_OPCODE_permseq);
-		
-		B_Opcode_Table.put(OP_pow1, B_OPCODE_pow1);
-		
-		//relations
-		B_Opcode_Table.put(OP_rel_inverse, B_OPCODE_rel_inverse);
-		
-		B_Opcode_Table.put(OP_assert, B_OPCODE_assert);
-	}
-	
-	public static boolean contains(UniqueString s){
-		return B_Opcode_Table.containsKey(s);
-	}
-	
-	public static int getOpcode(UniqueString s){
-		return B_Opcode_Table.get(s);
-	}
-}
+package de.tla2b.global;
+
+
+import java.util.Hashtable;
+
+import util.UniqueString;
+
+public class BBuiltInOPs implements BBuildIns{
+	private static Hashtable<UniqueString, Integer> B_Opcode_Table;
+	static {
+		B_Opcode_Table = new Hashtable<UniqueString, Integer>();
+		B_Opcode_Table.put(OP_dotdot, B_OPCODE_dotdot);
+		B_Opcode_Table.put(OP_plus, B_OPCODE_plus);
+		B_Opcode_Table.put(OP_minus, B_OPCODE_minus);
+		B_Opcode_Table.put(OP_times, B_OPCODE_times);
+		B_Opcode_Table.put(OP_div, B_OPCODE_div);
+		B_Opcode_Table.put(OP_mod, B_OPCODE_mod);
+		B_Opcode_Table.put(OP_exp, B_OPCODE_exp);
+		B_Opcode_Table.put(OP_uminus, B_OPCODE_uminus);
+		
+		B_Opcode_Table.put(OP_lt, B_OPCODE_lt);
+		B_Opcode_Table.put(OP_leq, B_OPCODE_leq);
+		B_Opcode_Table.put(OP_gt, B_OPCODE_gt);
+		B_Opcode_Table.put(OP_geq, B_OPCODE_geq);
+		B_Opcode_Table.put(OP_bool, B_OPCODE_bool);
+		B_Opcode_Table.put(OP_true, B_OPCODE_true);
+		B_Opcode_Table.put(OP_false, B_OPCODE_false);
+		B_Opcode_Table.put(OP_nat, B_OPCODE_nat);
+		B_Opcode_Table.put(OP_int, B_OPCODE_int);
+		B_Opcode_Table.put(OP_string, B_OPCODE_string);
+		
+		B_Opcode_Table.put(OP_finite, B_OPCODE_finite);
+		B_Opcode_Table.put(OP_card, B_OPCODE_card);
+		
+		B_Opcode_Table.put(OP_len, B_OPCODE_len);
+		B_Opcode_Table.put(OP_append, B_OPCODE_append);
+		B_Opcode_Table.put(OP_seq, B_OPCODE_seq);
+		B_Opcode_Table.put(OP_head, B_OPCODE_head);
+		B_Opcode_Table.put(OP_tail, B_OPCODE_tail);
+		B_Opcode_Table.put(OP_subseq, B_OPCODE_subseq);
+		B_Opcode_Table.put(OP_conc, B_OPCODE_conc);
+		
+		B_Opcode_Table.put(OP_min, B_OPCODE_min);
+		B_Opcode_Table.put(OP_max, B_OPCODE_max);
+		B_Opcode_Table.put(OP_setprod, B_OPCODE_setprod);
+		B_Opcode_Table.put(OP_setsum, B_OPCODE_setsum);
+		B_Opcode_Table.put(OP_permseq, B_OPCODE_permseq);
+		
+		B_Opcode_Table.put(OP_pow1, B_OPCODE_pow1);
+		
+		//relations
+		B_Opcode_Table.put(OP_rel_inverse, B_OPCODE_rel_inverse);
+		
+		B_Opcode_Table.put(OP_assert, B_OPCODE_assert);
+	}
+	
+	public static boolean contains(UniqueString s){
+		return B_Opcode_Table.containsKey(s);
+	}
+	
+	public static int getOpcode(UniqueString s){
+		return B_Opcode_Table.get(s);
+	}
+}
diff --git a/src/main/java/de/tla2b/global/Priorities.java b/src/main/java/de/tla2b/global/Priorities.java
index bf3f23168d0ff0c7f543aaf23c300dd7e2991be3..7d176b60cdb4d2ecebbb7c1db4009826f05218d2 100644
--- a/src/main/java/de/tla2b/global/Priorities.java
+++ b/src/main/java/de/tla2b/global/Priorities.java
@@ -1,76 +1,76 @@
-package de.tla2b.global;
-
-public interface Priorities {
-	public static final int P_max = 300;
-	
-	public static final int P_record_acc = 250;
-	public static final int P_uminus = 210;
-	public static final int P_exp = 200;
-	
-	public static final int P_times = 190;
-	public static final int P_div = 190;
-	public static final int P_mod = 190;
-	
-	
-	
-	public static final int P_plus = 180;
-	public static final int P_minus = 180;
-	public static final int P_setdiff = 180;
-	
-	public static final int P_dotdot = 170;
-	
-	public static final int P_maplet = 160;
-	
-	public static final int P_take_first = 160;
-	public static final int P_drop_last = 160;
-	public static final int P_conc = 160;
-	
-	public static final int P_intersect = 140;
-	public static final int P_union = 140;
-	
-	
-	public static final int P_append = 130;
-	
-	public static final int P_total_f = 125;
-	
-	public static final int P_comma = 115;
-	
-
-	
-	public static final int P_rel_overriding = 90;
-	
-	public static final int P_in = 60;
-	public static final int P_notin = 60;
-	public static final int P_subseteq = 60;
-	
-	public static final int P_equals = 50;
-	public static final int P_noteq = 50;
-	public static final int P_gt = 50;
-	public static final int P_lt = 50;
-	public static final int P_leq = 50;
-	public static final int P_geq = 50;
-	
-	public static final int P_equiv = 60;
-	
-	public static final int P_and = 40;
-	public static final int P_or = 40;
-	
-
-	public static final int P_implies = 30;
-	
-	public static final int P_min = 0;
-	
-	
-	
-	
-
-	
-
-	
-	
-	
-	
-	
-	
-	
-}
+package de.tla2b.global;
+
+public interface Priorities {
+	public static final int P_max = 300;
+	
+	public static final int P_record_acc = 250;
+	public static final int P_uminus = 210;
+	public static final int P_exp = 200;
+	
+	public static final int P_times = 190;
+	public static final int P_div = 190;
+	public static final int P_mod = 190;
+	
+	
+	
+	public static final int P_plus = 180;
+	public static final int P_minus = 180;
+	public static final int P_setdiff = 180;
+	
+	public static final int P_dotdot = 170;
+	
+	public static final int P_maplet = 160;
+	
+	public static final int P_take_first = 160;
+	public static final int P_drop_last = 160;
+	public static final int P_conc = 160;
+	
+	public static final int P_intersect = 140;
+	public static final int P_union = 140;
+	
+	
+	public static final int P_append = 130;
+	
+	public static final int P_total_f = 125;
+	
+	public static final int P_comma = 115;
+	
+
+	
+	public static final int P_rel_overriding = 90;
+	
+	public static final int P_in = 60;
+	public static final int P_notin = 60;
+	public static final int P_subseteq = 60;
+	
+	public static final int P_equals = 50;
+	public static final int P_noteq = 50;
+	public static final int P_gt = 50;
+	public static final int P_lt = 50;
+	public static final int P_leq = 50;
+	public static final int P_geq = 50;
+	
+	public static final int P_equiv = 60;
+	
+	public static final int P_and = 40;
+	public static final int P_or = 40;
+	
+
+	public static final int P_implies = 30;
+	
+	public static final int P_min = 0;
+	
+	
+	
+	
+
+	
+
+	
+	
+	
+	
+	
+	
+	
+}
diff --git a/src/main/java/de/tla2b/global/TranslationGlobals.java b/src/main/java/de/tla2b/global/TranslationGlobals.java
index cc159dfb118af2742823d822c3bcd5350e296ef9..031c25652f7e693639d1694ddfde602c76e65f77 100644
--- a/src/main/java/de/tla2b/global/TranslationGlobals.java
+++ b/src/main/java/de/tla2b/global/TranslationGlobals.java
@@ -1,32 +1,32 @@
-package de.tla2b.global;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import tla2sany.semantic.FrontEnd;
-
-public interface TranslationGlobals {
-	final String VERSION_NUMBER = "1.0.8";
-
-	final int TLCValueKind = 100;
-
-	final int USED = FrontEnd.getToolId();
-	final int OVERRIDE_SUBSTITUTION_ID = 17;
-	final int CONSTANT_OBJECT = 18;
-	final int DEF_OBJECT = 19;
-	final int PRINT_DEFINITION = 11;
-	final int TYPE_ID = 5;
-	final int EXCEPT_BASE = 6;
-	final int LET_PARAMS_ID = 13;
-	final int NEW_NAME = 20;
-	
-	final int SUBSTITUTE_PARAM = 29;
-	final int TUPLE = 30;
-
-	final String CHOOSE = " CHOOSE(X) == \"a member of X\"; EXTERNAL_FUNCTION_CHOOSE(T) == (POW(T)-->T)";
-	final String IF_THEN_ELSE = " IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE)";
-
-	final ArrayList<String> STANDARD_MODULES = new ArrayList<String>(
-			Arrays.asList(new String[] { "Naturals", "FiniteSets", "Integers",
-					"Sequences", "TLC", "Relations", "TLA2B", "BBuildIns" }));
-}
+package de.tla2b.global;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import tla2sany.semantic.FrontEnd;
+
+public interface TranslationGlobals {
+	final String VERSION_NUMBER = "1.0.8";
+
+	final int TLCValueKind = 100;
+
+	final int USED = FrontEnd.getToolId();
+	final int OVERRIDE_SUBSTITUTION_ID = 17;
+	final int CONSTANT_OBJECT = 18;
+	final int DEF_OBJECT = 19;
+	final int PRINT_DEFINITION = 11;
+	final int TYPE_ID = 5;
+	final int EXCEPT_BASE = 6;
+	final int LET_PARAMS_ID = 13;
+	final int NEW_NAME = 20;
+	
+	final int SUBSTITUTE_PARAM = 29;
+	final int TUPLE = 30;
+
+	final String CHOOSE = " CHOOSE(X) == \"a member of X\"; EXTERNAL_FUNCTION_CHOOSE(T) == (POW(T)-->T)";
+	final String IF_THEN_ELSE = " IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE)";
+
+	final ArrayList<String> STANDARD_MODULES = new ArrayList<String>(
+			Arrays.asList(new String[] { "Naturals", "FiniteSets", "Integers",
+					"Sequences", "TLC", "Relations", "TLA2B", "BBuildIns" }));
+}
diff --git a/src/main/java/de/tla2b/types/AbstractHasFollowers.java b/src/main/java/de/tla2b/types/AbstractHasFollowers.java
index 2666c759cdd3befacac737353daf9a6d67b98796..2d64796587d753656fb8daa56e6bb7706172d783 100644
--- a/src/main/java/de/tla2b/types/AbstractHasFollowers.java
+++ b/src/main/java/de/tla2b/types/AbstractHasFollowers.java
@@ -1,94 +1,94 @@
-package de.tla2b.types;
-
-import java.util.ArrayList;
-import tla2sany.semantic.SemanticNode;
-
-public abstract class AbstractHasFollowers extends TLAType {
-
-	public ArrayList<Object> followers;
-
-	public AbstractHasFollowers(int t) {
-		super(t);
-		followers = new ArrayList<Object>();
-	}
-
-	public ArrayList<Object> getFollowers() {
-		return followers;
-	}
-
-	public void addFollower(Object o) {
-		// only (partial) untyped types need follower
-		if (this.followers != null) {
-			for (int i = 0; i < followers.size(); i++) {
-				if (followers.get(i) == o)
-					return;
-			}
-			followers.add(o);
-		}
-
-	}
-
-	public void deleteFollower(Object o) {
-		followers.remove(o);
-	}
-
-	public void deleteFollowers() {
-		followers = null;
-	}
-
-	public void removeFollower(Object o) {
-		followers.remove(o);
-	}
-
-	public String followersToString() {
-		return followers.toString();
-	}
-
-	protected void setFollowersTo(TLAType newType) {
-		if (this.followers == null)
-			return;
-		for (int i = 0; i < this.followers.size(); i++) {
-
-			Object follower = this.followers.get(i);
-			if (follower instanceof SemanticNode) {
-				((SemanticNode) follower).setToolObject(5, newType);
-				if (newType instanceof AbstractHasFollowers) {
-					((AbstractHasFollowers) newType).addFollower(follower);
-				}
-			} else if (follower instanceof AbstractSymbol) {
-				((AbstractSymbol) follower).setType(newType);
-			} else if (follower instanceof SetType) {
-				((SetType) follower).setSubType(newType);
-			} else if (follower instanceof TupleType) {
-				((TupleType) follower).update(this, newType);
-			} else if (follower instanceof PairType) {
-				PairType pair = ((PairType) follower);
-				if (pair.getFirst() == this) {
-					pair.setFirst(newType);
-				}
-				if (pair.getSecond() == this) {
-					pair.setSecond(newType);
-				}
-
-			} else if (follower instanceof FunctionType) {
-				((FunctionType) follower).update(this, newType);
-			} else if (follower instanceof StructType) {
-				((StructType) follower).setNewType(this, newType);
-			} else if (follower instanceof StructOrFunctionType) {
-				((StructOrFunctionType) follower).setNewType(this, newType);
-			} else if (follower instanceof TupleOrFunction) {
-				((TupleOrFunction) follower).setNewType(this, newType);
-			} else {
-				throw new RuntimeException("Unknown follower type: "
-						+ follower.getClass());
-			}
-		}
-	}
-
-	public boolean hasFollower() {
-		if (followers.size() == 0) {
-			return false;
-		} else
-			return true;
-	}
-}
+package de.tla2b.types;
+
+import java.util.ArrayList;
+import tla2sany.semantic.SemanticNode;
+
+public abstract class AbstractHasFollowers extends TLAType {
+
+	public ArrayList<Object> followers;
+
+	public AbstractHasFollowers(int t) {
+		super(t);
+		followers = new ArrayList<Object>();
+	}
+
+	public ArrayList<Object> getFollowers() {
+		return followers;
+	}
+
+	public void addFollower(Object o) {
+		// only (partial) untyped types need follower
+		if (this.followers != null) {
+			for (int i = 0; i < followers.size(); i++) {
+				if (followers.get(i) == o)
+					return;
+			}
+			followers.add(o);
+		}
+
+	}
+
+	public void deleteFollower(Object o) {
+		followers.remove(o);
+	}
+
+	public void deleteFollowers() {
+		followers = null;
+	}
+
+	public void removeFollower(Object o) {
+		followers.remove(o);
+	}
+
+	public String followersToString() {
+		return followers.toString();
+	}
+
+	protected void setFollowersTo(TLAType newType) {
+		if (this.followers == null)
+			return;
+		for (int i = 0; i < this.followers.size(); i++) {
+
+			Object follower = this.followers.get(i);
+			if (follower instanceof SemanticNode) {
+				((SemanticNode) follower).setToolObject(5, newType);
+				if (newType instanceof AbstractHasFollowers) {
+					((AbstractHasFollowers) newType).addFollower(follower);
+				}
+			} else if (follower instanceof AbstractSymbol) {
+				((AbstractSymbol) follower).setType(newType);
+			} else if (follower instanceof SetType) {
+				((SetType) follower).setSubType(newType);
+			} else if (follower instanceof TupleType) {
+				((TupleType) follower).update(this, newType);
+			} else if (follower instanceof PairType) {
+				PairType pair = ((PairType) follower);
+				if (pair.getFirst() == this) {
+					pair.setFirst(newType);
+				}
+				if (pair.getSecond() == this) {
+					pair.setSecond(newType);
+				}
+
+			} else if (follower instanceof FunctionType) {
+				((FunctionType) follower).update(this, newType);
+			} else if (follower instanceof StructType) {
+				((StructType) follower).setNewType(this, newType);
+			} else if (follower instanceof StructOrFunctionType) {
+				((StructOrFunctionType) follower).setNewType(this, newType);
+			} else if (follower instanceof TupleOrFunction) {
+				((TupleOrFunction) follower).setNewType(this, newType);
+			} else {
+				throw new RuntimeException("Unknown follower type: "
+						+ follower.getClass());
+			}
+		}
+	}
+
+	public boolean hasFollower() {
+		if (followers.size() == 0) {
+			return false;
+		} else
+			return true;
+	}
+}
diff --git a/src/main/java/de/tla2b/types/AbstractSymbol.java b/src/main/java/de/tla2b/types/AbstractSymbol.java
index 498abc0e7570d9db4d3cf87f4de744ddcfd8c8c9..35da7fc6b0787b5551dab77e17b233e02fc8cb1f 100644
--- a/src/main/java/de/tla2b/types/AbstractSymbol.java
+++ b/src/main/java/de/tla2b/types/AbstractSymbol.java
@@ -1,23 +1,23 @@
-package de.tla2b.types;
-
-public abstract class AbstractSymbol {
-
-	private TLAType type;
-	
-	public AbstractSymbol(TLAType t){
-		setType(t);
-	}
-	
-	public TLAType getType() {
-		return type;
-	}
-
-
-	protected void setType(TLAType t) {
-		this.type = t;
-		if (type instanceof AbstractHasFollowers) {
-			AbstractHasFollowers p = (AbstractHasFollowers) t;
-			p.addFollower(this);
-		}
-	}
-}
+package de.tla2b.types;
+
+public abstract class AbstractSymbol {
+
+	private TLAType type;
+	
+	public AbstractSymbol(TLAType t){
+		setType(t);
+	}
+	
+	public TLAType getType() {
+		return type;
+	}
+
+
+	protected void setType(TLAType t) {
+		this.type = t;
+		if (type instanceof AbstractHasFollowers) {
+			AbstractHasFollowers p = (AbstractHasFollowers) t;
+			p.addFollower(this);
+		}
+	}
+}
diff --git a/src/main/java/de/tla2b/types/BoolType.java b/src/main/java/de/tla2b/types/BoolType.java
index 4daed9177db179c678c863a1022414108398260d..79636ee3f312a7d551cd83d0572d69c06f2d72a9 100644
--- a/src/main/java/de/tla2b/types/BoolType.java
+++ b/src/main/java/de/tla2b/types/BoolType.java
@@ -1,68 +1,68 @@
-package de.tla2b.types;
-
-import de.be4.classicalb.core.parser.node.ABoolSetExpression;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class BoolType extends TLAType {
-
-	private static BoolType instance = new BoolType();
-
-	private BoolType() {
-		super(BOOL);
-	}
-
-	public static BoolType getInstance() {
-		return instance;
-	}
-
-	@Override
-	public String toString() {
-		return "BOOL";
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return false;
-	}
-
-	@Override
-	public boolean compare(TLAType o) {
-		if (o.getKind() == UNTYPED || o.getKind() == BOOL)
-			return true;
-		else
-			return false;
-	}
-	
-	@Override
-	public BoolType unify(TLAType o) throws UnificationException {
-		if (o.getKind() == BOOL) {
-			return this;
-		} else if (o instanceof UntypedType) {
-			((UntypedType) o).setFollowersTo(this);
-			return this;
-		} else
-			throw new UnificationException();
-	}
-
-	@Override
-	public BoolType cloneTLAType() {
-		return this;
-	}
-	
-	@Override
-	public boolean contains(TLAType o) {
-		return false;
-	}
-
-	@Override
-	public PExpression getBNode() {
-		return new ABoolSetExpression();
-	}
-
-	public void apply(TypeVisitorInterface t) {
-		t.caseBoolType(this);
-	}
-
+package de.tla2b.types;
+
+import de.be4.classicalb.core.parser.node.ABoolSetExpression;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class BoolType extends TLAType {
+
+	private static BoolType instance = new BoolType();
+
+	private BoolType() {
+		super(BOOL);
+	}
+
+	public static BoolType getInstance() {
+		return instance;
+	}
+
+	@Override
+	public String toString() {
+		return "BOOL";
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return false;
+	}
+
+	@Override
+	public boolean compare(TLAType o) {
+		if (o.getKind() == UNTYPED || o.getKind() == BOOL)
+			return true;
+		else
+			return false;
+	}
+	
+	@Override
+	public BoolType unify(TLAType o) throws UnificationException {
+		if (o.getKind() == BOOL) {
+			return this;
+		} else if (o instanceof UntypedType) {
+			((UntypedType) o).setFollowersTo(this);
+			return this;
+		} else
+			throw new UnificationException();
+	}
+
+	@Override
+	public BoolType cloneTLAType() {
+		return this;
+	}
+	
+	@Override
+	public boolean contains(TLAType o) {
+		return false;
+	}
+
+	@Override
+	public PExpression getBNode() {
+		return new ABoolSetExpression();
+	}
+
+	public void apply(TypeVisitorInterface t) {
+		t.caseBoolType(this);
+	}
+
 }
\ No newline at end of file
diff --git a/src/main/java/de/tla2b/types/EnumType.java b/src/main/java/de/tla2b/types/EnumType.java
index a78c0fe3b49e8b7fb6a83d1e2517f36829103e3a..ba7496d97f386a4300afb215338ee09270930b01 100644
--- a/src/main/java/de/tla2b/types/EnumType.java
+++ b/src/main/java/de/tla2b/types/EnumType.java
@@ -1,87 +1,87 @@
-package de.tla2b.types;
-
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-import de.tla2bAst.BAstCreator;
-
-public class EnumType extends AbstractHasFollowers {
-	public LinkedHashSet<String> modelvalues;
-	public int id;
-	private boolean noVal = false;
-
-	public EnumType(ArrayList<String> enums) {
-		super(MODELVALUE);
-		modelvalues = new LinkedHashSet<String>(enums);
-	}
-
-	public void setNoVal() {
-		noVal = true;
-	}
-
-	public boolean hasNoVal() {
-		return noVal;
-	}
-
-	public LinkedHashSet<String> getValues() {
-		return modelvalues;
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return false;
-	}
-
-	@Override
-	public boolean compare(TLAType o) {
-		if (o.getKind() == UNTYPED || o.getKind() == MODELVALUE)
-			return true;
-		else
-			return false;
-	}
-
-	@Override
-	public EnumType unify(TLAType o) throws UnificationException {
-		if (o instanceof UntypedType) {
-			((UntypedType) o).setFollowersTo(this);
-			return this;
-		}
-		if (o instanceof EnumType) {
-			EnumType e = (EnumType) o;
-			e.setFollowersTo(this);
-			this.modelvalues.addAll(((EnumType) o).modelvalues);
-			return this;
-		}
-		throw new UnificationException();
-	}
-
-	@Override
-	public EnumType cloneTLAType() {
-		return this;
-	}
-	
-	@Override
-	public boolean contains(TLAType o) {
-		//TODO is this really false
-		return false;
-	}
-
-	@Override
-	public String toString() {
-		return "ENUM" + id;
-	}
-	
-	@Override
-	public PExpression getBNode() {
-		return BAstCreator.createIdentifierNode("ENUM" + id);
-	}
-
-	public void apply(TypeVisitorInterface t) {
-		t.caseEnumType(this);
-	}
-
-
-}
+package de.tla2b.types;
+
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+import de.tla2bAst.BAstCreator;
+
+public class EnumType extends AbstractHasFollowers {
+	public LinkedHashSet<String> modelvalues;
+	public int id;
+	private boolean noVal = false;
+
+	public EnumType(ArrayList<String> enums) {
+		super(MODELVALUE);
+		modelvalues = new LinkedHashSet<String>(enums);
+	}
+
+	public void setNoVal() {
+		noVal = true;
+	}
+
+	public boolean hasNoVal() {
+		return noVal;
+	}
+
+	public LinkedHashSet<String> getValues() {
+		return modelvalues;
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return false;
+	}
+
+	@Override
+	public boolean compare(TLAType o) {
+		if (o.getKind() == UNTYPED || o.getKind() == MODELVALUE)
+			return true;
+		else
+			return false;
+	}
+
+	@Override
+	public EnumType unify(TLAType o) throws UnificationException {
+		if (o instanceof UntypedType) {
+			((UntypedType) o).setFollowersTo(this);
+			return this;
+		}
+		if (o instanceof EnumType) {
+			EnumType e = (EnumType) o;
+			e.setFollowersTo(this);
+			this.modelvalues.addAll(((EnumType) o).modelvalues);
+			return this;
+		}
+		throw new UnificationException();
+	}
+
+	@Override
+	public EnumType cloneTLAType() {
+		return this;
+	}
+	
+	@Override
+	public boolean contains(TLAType o) {
+		//TODO is this really false
+		return false;
+	}
+
+	@Override
+	public String toString() {
+		return "ENUM" + id;
+	}
+	
+	@Override
+	public PExpression getBNode() {
+		return BAstCreator.createIdentifierNode("ENUM" + id);
+	}
+
+	public void apply(TypeVisitorInterface t) {
+		t.caseEnumType(this);
+	}
+
+
+}
diff --git a/src/main/java/de/tla2b/types/FunctionType.java b/src/main/java/de/tla2b/types/FunctionType.java
index e283d1f362284f61e3cb14c4190aa0a60dff4152..c25fd7fac0287076f4e580233abeaf52e5cb63e8 100644
--- a/src/main/java/de/tla2b/types/FunctionType.java
+++ b/src/main/java/de/tla2b/types/FunctionType.java
@@ -1,149 +1,149 @@
-package de.tla2b.types;
-
-import de.be4.classicalb.core.parser.node.APartialFunctionExpression;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class FunctionType extends AbstractHasFollowers {
-	private TLAType domain;
-	private TLAType range;
-
-	public FunctionType(TLAType domain, TLAType range) {
-		super(FUNCTION);
-		this.setDomain(domain);
-		this.setRange(range);
-	}
-
-	public FunctionType() {
-		super(FUNCTION);
-		this.setDomain(new UntypedType());
-		this.setRange(new UntypedType());
-	}
-
-	public FunctionType(int string) {
-		super(string);
-	}
-
-	public void update(TLAType oldType, TLAType newType) {
-		if (domain == oldType)
-			setDomain(newType);
-		if (range == oldType)
-			setRange(newType);
-	}
-
-	@Override
-	public boolean compare(TLAType other) {
-		if (this.contains(other))
-			return false;
-		if (other.getKind() == UNTYPED)
-			return true;
-		if (other instanceof StringType
-				&& domain.compare(IntType.getInstance())
-				&& range instanceof UntypedType) {
-			return true;
-		}
-		if (other instanceof FunctionType) {
-			FunctionType f = (FunctionType) other;
-			return domain.compare(f.domain) && range.compare(f.range);
-		}
-		if (other instanceof TupleType) {
-			return other.compare(this);
-		}
-		if (other instanceof TupleOrFunction) {
-			return other.compare(this);
-		}
-		return false;
-	}
-
-	@Override
-	public boolean contains(TLAType o) {
-		return domain.equals(o) || domain.contains(o) || range.equals(o)
-				|| range.contains(o);
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return domain.isUntyped() || range.isUntyped();
-	}
-
-	@Override
-	public TLAType cloneTLAType() {
-		return new FunctionType(domain.cloneTLAType(), range.cloneTLAType());
-	}
-
-	@Override
-	public TLAType unify(TLAType other) throws UnificationException {
-		if (other == null || !this.compare(other)) {
-			throw new UnificationException();
-		}
-
-		if (other instanceof StringType) {
-			this.setFollowersTo(other);
-			return StringType.getInstance();
-		}
-
-		if (other instanceof UntypedType) {
-			((UntypedType) other).setFollowersTo(this);
-			return this;
-		}
-		if (other instanceof FunctionType) {
-			domain = domain.unify(((FunctionType) other).domain);
-			range = range.unify(((FunctionType) other).range);
-			return this;
-		}
-		if (other instanceof TupleType) {
-			return (FunctionType) other.unify(this);
-		}
-		if (other instanceof TupleOrFunction) {
-			return (FunctionType) other.unify(this);
-		}
-
-		throw new RuntimeException();
-	}
-
-	public TLAType getDomain() {
-		return domain;
-	}
-
-	public TLAType getRange() {
-		return range;
-	}
-
-	public void setDomain(TLAType domain) {
-		this.domain = domain;
-		if (domain instanceof AbstractHasFollowers) {
-			((AbstractHasFollowers) domain).addFollower(this);
-		}
-	}
-
-	public void setRange(TLAType range) {
-		this.range = range;
-		if (range instanceof AbstractHasFollowers) {
-			((AbstractHasFollowers) range).addFollower(this);
-		}
-	}
-
-	@Override
-	public String toString() {
-		String res = "POW(" + domain + "*";
-		if (range instanceof TupleType) {
-			res += "(" + range + ")";
-		} else {
-			res += range;
-		}
-		res += ")";
-		return res;
-	}
-
-	@Override
-	public PExpression getBNode() {
-		return new APartialFunctionExpression(domain.getBNode(),
-				range.getBNode());
-	}
-
-	public void apply(TypeVisitorInterface vistor) {
-		vistor.caseFunctionType(this);
-	}
-
-}
+package de.tla2b.types;
+
+import de.be4.classicalb.core.parser.node.APartialFunctionExpression;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class FunctionType extends AbstractHasFollowers {
+	private TLAType domain;
+	private TLAType range;
+
+	public FunctionType(TLAType domain, TLAType range) {
+		super(FUNCTION);
+		this.setDomain(domain);
+		this.setRange(range);
+	}
+
+	public FunctionType() {
+		super(FUNCTION);
+		this.setDomain(new UntypedType());
+		this.setRange(new UntypedType());
+	}
+
+	public FunctionType(int string) {
+		super(string);
+	}
+
+	public void update(TLAType oldType, TLAType newType) {
+		if (domain == oldType)
+			setDomain(newType);
+		if (range == oldType)
+			setRange(newType);
+	}
+
+	@Override
+	public boolean compare(TLAType other) {
+		if (this.contains(other))
+			return false;
+		if (other.getKind() == UNTYPED)
+			return true;
+		if (other instanceof StringType
+				&& domain.compare(IntType.getInstance())
+				&& range instanceof UntypedType) {
+			return true;
+		}
+		if (other instanceof FunctionType) {
+			FunctionType f = (FunctionType) other;
+			return domain.compare(f.domain) && range.compare(f.range);
+		}
+		if (other instanceof TupleType) {
+			return other.compare(this);
+		}
+		if (other instanceof TupleOrFunction) {
+			return other.compare(this);
+		}
+		return false;
+	}
+
+	@Override
+	public boolean contains(TLAType o) {
+		return domain.equals(o) || domain.contains(o) || range.equals(o)
+				|| range.contains(o);
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return domain.isUntyped() || range.isUntyped();
+	}
+
+	@Override
+	public TLAType cloneTLAType() {
+		return new FunctionType(domain.cloneTLAType(), range.cloneTLAType());
+	}
+
+	@Override
+	public TLAType unify(TLAType other) throws UnificationException {
+		if (other == null || !this.compare(other)) {
+			throw new UnificationException();
+		}
+
+		if (other instanceof StringType) {
+			this.setFollowersTo(other);
+			return StringType.getInstance();
+		}
+
+		if (other instanceof UntypedType) {
+			((UntypedType) other).setFollowersTo(this);
+			return this;
+		}
+		if (other instanceof FunctionType) {
+			domain = domain.unify(((FunctionType) other).domain);
+			range = range.unify(((FunctionType) other).range);
+			return this;
+		}
+		if (other instanceof TupleType) {
+			return (FunctionType) other.unify(this);
+		}
+		if (other instanceof TupleOrFunction) {
+			return (FunctionType) other.unify(this);
+		}
+
+		throw new RuntimeException();
+	}
+
+	public TLAType getDomain() {
+		return domain;
+	}
+
+	public TLAType getRange() {
+		return range;
+	}
+
+	public void setDomain(TLAType domain) {
+		this.domain = domain;
+		if (domain instanceof AbstractHasFollowers) {
+			((AbstractHasFollowers) domain).addFollower(this);
+		}
+	}
+
+	public void setRange(TLAType range) {
+		this.range = range;
+		if (range instanceof AbstractHasFollowers) {
+			((AbstractHasFollowers) range).addFollower(this);
+		}
+	}
+
+	@Override
+	public String toString() {
+		String res = "POW(" + domain + "*";
+		if (range instanceof TupleType) {
+			res += "(" + range + ")";
+		} else {
+			res += range;
+		}
+		res += ")";
+		return res;
+	}
+
+	@Override
+	public PExpression getBNode() {
+		return new APartialFunctionExpression(domain.getBNode(),
+				range.getBNode());
+	}
+
+	public void apply(TypeVisitorInterface vistor) {
+		vistor.caseFunctionType(this);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/types/IType.java b/src/main/java/de/tla2b/types/IType.java
index b55529539748af08bba20a63032d1fcac75c8edb..fcb3bbd32f3d76b8a7756324dfb8b2fe89123cb7 100644
--- a/src/main/java/de/tla2b/types/IType.java
+++ b/src/main/java/de/tla2b/types/IType.java
@@ -1,21 +1,21 @@
-package de.tla2b.types;
-
-import de.tla2b.output.TypeVisitorInterface;
-
-public interface IType {
-	public final int UNTYPED = 0;
-	public final int INTEGER = 1;
-	public final int BOOL = 2;
-	public final int STRING = 3;
-	public final int MODELVALUE = 4;
-	public final int POW = 5;
-	public final int PAIR = 6;
-	public final int STRUCT = 7;
-	public final int TUPLEORSEQ  =8;
-	public final int STRUCT_OR_FUNCTION = 9;
-	public final int FUNCTION = 10;
-	public final int TUPLE = 11;
-	public final int TUPLE_OR_FUNCTION =12;
-	
-	void apply(TypeVisitorInterface visitor);
-}
+package de.tla2b.types;
+
+import de.tla2b.output.TypeVisitorInterface;
+
+public interface IType {
+	public final int UNTYPED = 0;
+	public final int INTEGER = 1;
+	public final int BOOL = 2;
+	public final int STRING = 3;
+	public final int MODELVALUE = 4;
+	public final int POW = 5;
+	public final int PAIR = 6;
+	public final int STRUCT = 7;
+	public final int TUPLEORSEQ  =8;
+	public final int STRUCT_OR_FUNCTION = 9;
+	public final int FUNCTION = 10;
+	public final int TUPLE = 11;
+	public final int TUPLE_OR_FUNCTION =12;
+	
+	void apply(TypeVisitorInterface visitor);
+}
diff --git a/src/main/java/de/tla2b/types/IntType.java b/src/main/java/de/tla2b/types/IntType.java
index 10bce86bc727ddf64f24d72f155c513691516bbc..f6f2d0619bf006c582276229c6b0239eb6af8835 100644
--- a/src/main/java/de/tla2b/types/IntType.java
+++ b/src/main/java/de/tla2b/types/IntType.java
@@ -1,68 +1,68 @@
-package de.tla2b.types;
-
-import de.be4.classicalb.core.parser.node.AIntegerSetExpression;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class IntType extends TLAType {
-
-	private static IntType instance = new IntType();
-
-	private IntType() {
-		super(INTEGER);
-	}
-
-	public static IntType getInstance() {
-		return instance;
-	}
-
-	@Override
-	public String toString() {
-		return "INTEGER";
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return false;
-	}
-
-	@Override
-	public boolean compare(TLAType o) {
-		if (o.getKind() == UNTYPED || o.getKind() == INTEGER)
-			return true;
-		else
-			return false;
-	}
-
-	@Override
-	public IntType unify(TLAType o) throws UnificationException {
-		if (o.getKind() == INTEGER) {
-			return this;
-		} else if (o instanceof UntypedType) {
-			((UntypedType) o).setFollowersTo(this);
-			return this;
-		} else
-			throw new UnificationException();
-	}
-
-	@Override
-	public IntType cloneTLAType() {
-		return this;
-	}
-
-	@Override
-	public boolean contains(TLAType o) {
-		return false;
-	}
-
-	@Override
-	public PExpression getBNode() {
-		return new AIntegerSetExpression();
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.caseIntegerType(this);
-	}
-
+package de.tla2b.types;
+
+import de.be4.classicalb.core.parser.node.AIntegerSetExpression;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class IntType extends TLAType {
+
+	private static IntType instance = new IntType();
+
+	private IntType() {
+		super(INTEGER);
+	}
+
+	public static IntType getInstance() {
+		return instance;
+	}
+
+	@Override
+	public String toString() {
+		return "INTEGER";
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return false;
+	}
+
+	@Override
+	public boolean compare(TLAType o) {
+		if (o.getKind() == UNTYPED || o.getKind() == INTEGER)
+			return true;
+		else
+			return false;
+	}
+
+	@Override
+	public IntType unify(TLAType o) throws UnificationException {
+		if (o.getKind() == INTEGER) {
+			return this;
+		} else if (o instanceof UntypedType) {
+			((UntypedType) o).setFollowersTo(this);
+			return this;
+		} else
+			throw new UnificationException();
+	}
+
+	@Override
+	public IntType cloneTLAType() {
+		return this;
+	}
+
+	@Override
+	public boolean contains(TLAType o) {
+		return false;
+	}
+
+	@Override
+	public PExpression getBNode() {
+		return new AIntegerSetExpression();
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.caseIntegerType(this);
+	}
+
 }
\ No newline at end of file
diff --git a/src/main/java/de/tla2b/types/ModelValueType.java b/src/main/java/de/tla2b/types/ModelValueType.java
index 86bed4b72d8e118c2b3fed28cecfa8683ee23218..b9c6697d9f9050dcc5ac81a9f44dc0fd2411fa87 100644
--- a/src/main/java/de/tla2b/types/ModelValueType.java
+++ b/src/main/java/de/tla2b/types/ModelValueType.java
@@ -1,68 +1,68 @@
-package de.tla2b.types;
-
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class ModelValueType extends TLAType {
-
-	private static ModelValueType instance = new ModelValueType();
-
-	private ModelValueType() {
-		super(MODELVALUE);
-	}
-
-	public static ModelValueType getInstance() {
-		return instance;
-	}
-
-
-	@Override
-	public String toString() {
-		return "ENUM";
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return false;
-	}
-	
-	@Override
-	public boolean compare(TLAType o) {
-		if (o.getKind() == UNTYPED || o.getKind() == MODELVALUE)
-			return true;
-		else
-			return false;
-	}
-	
-	@Override
-	public ModelValueType unify(TLAType o) throws UnificationException {
-		if (o.getKind() == MODELVALUE) {
-			return this;
-		} else if (o instanceof UntypedType) {
-			((UntypedType) o).setFollowersTo(this);
-			return this;
-		} else
-			throw new UnificationException();
-	}
-
-	@Override
-	public ModelValueType cloneTLAType() {
-		return this;
-	}
-	
-	@Override
-	public boolean contains(TLAType o) {
-		return false;
-	}
-
-	@Override
-	public PExpression getBNode() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.caseModelValueType(this);
-	}
+package de.tla2b.types;
+
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class ModelValueType extends TLAType {
+
+	private static ModelValueType instance = new ModelValueType();
+
+	private ModelValueType() {
+		super(MODELVALUE);
+	}
+
+	public static ModelValueType getInstance() {
+		return instance;
+	}
+
+
+	@Override
+	public String toString() {
+		return "ENUM";
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return false;
+	}
+	
+	@Override
+	public boolean compare(TLAType o) {
+		if (o.getKind() == UNTYPED || o.getKind() == MODELVALUE)
+			return true;
+		else
+			return false;
+	}
+	
+	@Override
+	public ModelValueType unify(TLAType o) throws UnificationException {
+		if (o.getKind() == MODELVALUE) {
+			return this;
+		} else if (o instanceof UntypedType) {
+			((UntypedType) o).setFollowersTo(this);
+			return this;
+		} else
+			throw new UnificationException();
+	}
+
+	@Override
+	public ModelValueType cloneTLAType() {
+		return this;
+	}
+	
+	@Override
+	public boolean contains(TLAType o) {
+		return false;
+	}
+
+	@Override
+	public PExpression getBNode() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.caseModelValueType(this);
+	}
 }
\ No newline at end of file
diff --git a/src/main/java/de/tla2b/types/PairType.java b/src/main/java/de/tla2b/types/PairType.java
index 2b3865a45f567dc83ce6f292d827978f5996e761..b98dfe45d0a1af196276ca8564cd5da199a53ba3 100644
--- a/src/main/java/de/tla2b/types/PairType.java
+++ b/src/main/java/de/tla2b/types/PairType.java
@@ -1,143 +1,143 @@
-package de.tla2b.types;
-
-
-import de.be4.classicalb.core.parser.node.AMultOrCartExpression;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class PairType extends AbstractHasFollowers {
-
-	private TLAType first;
-	private TLAType second;
-
-	public PairType() {
-		super(PAIR);
-		setFirst(new UntypedType());
-		setSecond(new UntypedType());
-	}
-
-	public PairType(TLAType f, TLAType s) {
-		super(PAIR);
-		this.first = f;
-		if (first instanceof AbstractHasFollowers) {
-			AbstractHasFollowers firstHasFollowers = (AbstractHasFollowers) first;
-			firstHasFollowers.addFollower(this);
-		}
-		this.second = s;
-		if (second instanceof AbstractHasFollowers) {
-			AbstractHasFollowers secondHasFollowers = (AbstractHasFollowers) second;
-			secondHasFollowers.addFollower(this);
-		}
-	}
-
-	public TLAType getFirst() {
-		return first;
-	}
-
-	public void setFirst(TLAType f) {
-		this.first = f;
-
-		if (first instanceof AbstractHasFollowers) {
-			AbstractHasFollowers firstHasFollowers = (AbstractHasFollowers) first;
-			firstHasFollowers.addFollower(this);
-		}
-
-		// setting first can leads to a completely typed type
-		if (!this.isUntyped()) {
-			// this type is completely typed
-			this.deleteFollowers();
-		}
-	}
-
-	public TLAType getSecond() {
-		return second;
-	}
-
-	public void setSecond(TLAType s) {
-		this.second = s;
-
-		if (second instanceof AbstractHasFollowers) {
-			AbstractHasFollowers secondHasFollowers = (AbstractHasFollowers) second;
-			secondHasFollowers.addFollower(this);
-		}
-
-		// setting second can leads to a completely typed type
-		if (!this.isUntyped()) {
-			// this type is completely typed
-			this.deleteFollowers();
-		}
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return first.isUntyped() || second.isUntyped();
-	}
-
-	@Override
-	public PairType unify(TLAType o) throws UnificationException {
-		if (!this.compare(o))
-			throw new UnificationException();
-		if (o instanceof AbstractHasFollowers)
-			((AbstractHasFollowers) o).setFollowersTo(this);
-
-		if (o instanceof PairType) {
-			PairType p = (PairType) o;
-			this.first = this.first.unify(p.first);
-			this.second = this.second.unify(p.second);
-			return this;
-		}
-		throw new RuntimeException();
-	}
-
-	@Override
-	public boolean compare(TLAType o) {
-		if (this.contains(o))
-			return false;
-		if (o.getKind() == UNTYPED)
-			return true;
-
-		if (o instanceof PairType) {
-			PairType p = (PairType) o;
-			// test first and second component compatibility
-			return this.first.compare(p.first) && this.second.compare(p.second);
-		} else
-			return false;
-	}
-
-	@Override
-	public PairType cloneTLAType() {
-		return new PairType(this.first.cloneTLAType(),
-				this.second.cloneTLAType());
-	}
-
-	@Override
-	public boolean contains(TLAType o) {
-		return first.equals(o) || first.contains(o) || second.equals(o)
-				|| second.contains(o);
-	}
-
-	@Override
-	public String toString() {
-		String res = first + "*";
-		if (second instanceof PairType) {
-			res += "(" + second + ")";
-		} else
-			res += second;
-		return res;
-
-	}
-
-	@Override
-	public PExpression getBNode() {
-		AMultOrCartExpression card = new AMultOrCartExpression();
-		card.setLeft(first.getBNode());
-		card.setRight(second.getBNode());
-		return card;
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.casePairType(this);
-	}
-
-}
+package de.tla2b.types;
+
+
+import de.be4.classicalb.core.parser.node.AMultOrCartExpression;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class PairType extends AbstractHasFollowers {
+
+	private TLAType first;
+	private TLAType second;
+
+	public PairType() {
+		super(PAIR);
+		setFirst(new UntypedType());
+		setSecond(new UntypedType());
+	}
+
+	public PairType(TLAType f, TLAType s) {
+		super(PAIR);
+		this.first = f;
+		if (first instanceof AbstractHasFollowers) {
+			AbstractHasFollowers firstHasFollowers = (AbstractHasFollowers) first;
+			firstHasFollowers.addFollower(this);
+		}
+		this.second = s;
+		if (second instanceof AbstractHasFollowers) {
+			AbstractHasFollowers secondHasFollowers = (AbstractHasFollowers) second;
+			secondHasFollowers.addFollower(this);
+		}
+	}
+
+	public TLAType getFirst() {
+		return first;
+	}
+
+	public void setFirst(TLAType f) {
+		this.first = f;
+
+		if (first instanceof AbstractHasFollowers) {
+			AbstractHasFollowers firstHasFollowers = (AbstractHasFollowers) first;
+			firstHasFollowers.addFollower(this);
+		}
+
+		// setting first can leads to a completely typed type
+		if (!this.isUntyped()) {
+			// this type is completely typed
+			this.deleteFollowers();
+		}
+	}
+
+	public TLAType getSecond() {
+		return second;
+	}
+
+	public void setSecond(TLAType s) {
+		this.second = s;
+
+		if (second instanceof AbstractHasFollowers) {
+			AbstractHasFollowers secondHasFollowers = (AbstractHasFollowers) second;
+			secondHasFollowers.addFollower(this);
+		}
+
+		// setting second can leads to a completely typed type
+		if (!this.isUntyped()) {
+			// this type is completely typed
+			this.deleteFollowers();
+		}
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return first.isUntyped() || second.isUntyped();
+	}
+
+	@Override
+	public PairType unify(TLAType o) throws UnificationException {
+		if (!this.compare(o))
+			throw new UnificationException();
+		if (o instanceof AbstractHasFollowers)
+			((AbstractHasFollowers) o).setFollowersTo(this);
+
+		if (o instanceof PairType) {
+			PairType p = (PairType) o;
+			this.first = this.first.unify(p.first);
+			this.second = this.second.unify(p.second);
+			return this;
+		}
+		throw new RuntimeException();
+	}
+
+	@Override
+	public boolean compare(TLAType o) {
+		if (this.contains(o))
+			return false;
+		if (o.getKind() == UNTYPED)
+			return true;
+
+		if (o instanceof PairType) {
+			PairType p = (PairType) o;
+			// test first and second component compatibility
+			return this.first.compare(p.first) && this.second.compare(p.second);
+		} else
+			return false;
+	}
+
+	@Override
+	public PairType cloneTLAType() {
+		return new PairType(this.first.cloneTLAType(),
+				this.second.cloneTLAType());
+	}
+
+	@Override
+	public boolean contains(TLAType o) {
+		return first.equals(o) || first.contains(o) || second.equals(o)
+				|| second.contains(o);
+	}
+
+	@Override
+	public String toString() {
+		String res = first + "*";
+		if (second instanceof PairType) {
+			res += "(" + second + ")";
+		} else
+			res += second;
+		return res;
+
+	}
+
+	@Override
+	public PExpression getBNode() {
+		AMultOrCartExpression card = new AMultOrCartExpression();
+		card.setLeft(first.getBNode());
+		card.setRight(second.getBNode());
+		return card;
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.casePairType(this);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/types/SetType.java b/src/main/java/de/tla2b/types/SetType.java
index 4179d0cce48a1b1c0d91aefe65ae99cf6d0d86a2..0460b96361bcd2d94a7771bede1596312b2b5832 100644
--- a/src/main/java/de/tla2b/types/SetType.java
+++ b/src/main/java/de/tla2b/types/SetType.java
@@ -1,110 +1,110 @@
-package de.tla2b.types;
-
-import de.be4.classicalb.core.parser.node.APowSubsetExpression;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class SetType extends AbstractHasFollowers {
-	private TLAType subType;
-
-	public SetType(TLAType t) {
-		super(POW);
-		setSubType(t);
-	}
-
-	public TLAType getSubType() {
-		return subType;
-	}
-
-	public void setSubType(TLAType t) {
-		// if (subType instanceof AbstractHasFollowers) {
-		// // delete old reference
-		// ((AbstractHasFollowers) subType).deleteFollower(this);
-		// }
-
-		if (t instanceof AbstractHasFollowers) {
-			// set new reference
-			((AbstractHasFollowers) t).addFollower(this);
-		}
-		this.subType = t;
-
-		// setting subType can lead to a completely typed type
-		if (!this.isUntyped()) {
-			// this type is completely typed
-			this.deleteFollowers();
-		}
-	}
-
-	public SetType unify(TLAType o) throws UnificationException {
-		if (!this.compare(o)|| this.contains(o)) {
-			throw new UnificationException();
-		}
-		// if o has followers than switch pointer to this
-		if (o instanceof AbstractHasFollowers) {
-			((AbstractHasFollowers) o).setFollowersTo(this);
-		}
-		
-		if (o instanceof StructOrFunctionType){
-			return (SetType)o.unify(this);
-		}
-		if (o instanceof SetType) {
-			SetType p = (SetType) o;
-			this.subType = this.subType.unify(p.subType);
-
-//			if (this.subType instanceof AbstractHasFollowers) {
-//				((AbstractHasFollowers) this.subType).removeFollower(p);
-//			}
-		}
-		return this;
-	}
-
-	@Override
-	public boolean compare(TLAType o) {
-		if(this.contains(o))
-			return false;
-		
-		if (o.getKind() == UNTYPED)
-			return true;
-		
-		if (o instanceof SetType) {
-			SetType p = (SetType) o;
-			// test sub types compatibility
-			return this.subType.compare(p.subType);
-		} else
-			return false;
-	}
-
-	@Override
-	public String toString() {
-		String res = "POW(" + this.getSubType() + ")";
-
-		return res;
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return subType.isUntyped();
-	}
-
-	@Override
-	public SetType cloneTLAType() {
-		return new SetType(this.subType.cloneTLAType());
-	}
-
-
-	@Override
-	public boolean contains(TLAType o) {
-		return this.getSubType().equals(o) || this.getSubType().contains(o);
-	}
-
-	@Override
-	public PExpression getBNode() {
-		return new APowSubsetExpression(this.getSubType().getBNode());
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.caseSetType(this);
-	}
-
-}
+package de.tla2b.types;
+
+import de.be4.classicalb.core.parser.node.APowSubsetExpression;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class SetType extends AbstractHasFollowers {
+	private TLAType subType;
+
+	public SetType(TLAType t) {
+		super(POW);
+		setSubType(t);
+	}
+
+	public TLAType getSubType() {
+		return subType;
+	}
+
+	public void setSubType(TLAType t) {
+		// if (subType instanceof AbstractHasFollowers) {
+		// // delete old reference
+		// ((AbstractHasFollowers) subType).deleteFollower(this);
+		// }
+
+		if (t instanceof AbstractHasFollowers) {
+			// set new reference
+			((AbstractHasFollowers) t).addFollower(this);
+		}
+		this.subType = t;
+
+		// setting subType can lead to a completely typed type
+		if (!this.isUntyped()) {
+			// this type is completely typed
+			this.deleteFollowers();
+		}
+	}
+
+	public SetType unify(TLAType o) throws UnificationException {
+		if (!this.compare(o)|| this.contains(o)) {
+			throw new UnificationException();
+		}
+		// if o has followers than switch pointer to this
+		if (o instanceof AbstractHasFollowers) {
+			((AbstractHasFollowers) o).setFollowersTo(this);
+		}
+		
+		if (o instanceof StructOrFunctionType){
+			return (SetType)o.unify(this);
+		}
+		if (o instanceof SetType) {
+			SetType p = (SetType) o;
+			this.subType = this.subType.unify(p.subType);
+
+//			if (this.subType instanceof AbstractHasFollowers) {
+//				((AbstractHasFollowers) this.subType).removeFollower(p);
+//			}
+		}
+		return this;
+	}
+
+	@Override
+	public boolean compare(TLAType o) {
+		if(this.contains(o))
+			return false;
+		
+		if (o.getKind() == UNTYPED)
+			return true;
+		
+		if (o instanceof SetType) {
+			SetType p = (SetType) o;
+			// test sub types compatibility
+			return this.subType.compare(p.subType);
+		} else
+			return false;
+	}
+
+	@Override
+	public String toString() {
+		String res = "POW(" + this.getSubType() + ")";
+
+		return res;
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return subType.isUntyped();
+	}
+
+	@Override
+	public SetType cloneTLAType() {
+		return new SetType(this.subType.cloneTLAType());
+	}
+
+
+	@Override
+	public boolean contains(TLAType o) {
+		return this.getSubType().equals(o) || this.getSubType().contains(o);
+	}
+
+	@Override
+	public PExpression getBNode() {
+		return new APowSubsetExpression(this.getSubType().getBNode());
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.caseSetType(this);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/types/StringType.java b/src/main/java/de/tla2b/types/StringType.java
index 8e507fd5c6bae0523259afbce656be49e836d69e..2450686343f7bcf9a5813a15fc77cac361076cf3 100644
--- a/src/main/java/de/tla2b/types/StringType.java
+++ b/src/main/java/de/tla2b/types/StringType.java
@@ -1,83 +1,83 @@
-package de.tla2b.types;
-
-import de.be4.classicalb.core.parser.node.AStringSetExpression;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class StringType extends TLAType {
-
-	public StringType() {
-		super(STRING);
-	}
-
-	private static StringType instance = new StringType();
-
-	public static StringType getInstance() {
-		return instance;
-	}
-
-	@Override
-	public boolean compare(TLAType o) {
-		if (o.getKind() == UNTYPED || o.getKind() == STRING)
-			return true;
-		else if (o instanceof FunctionType) {
-			return o.compare(this);
-		} else
-			return false;
-
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return false;
-	}
-
-	@Override
-	public StringType unify(TLAType o) throws UnificationException {
-		if (!this.compare(o)) {
-			throw new UnificationException();
-		}
-		if (o.getKind() == STRING) {
-			return this;
-		} else if (o instanceof UntypedType) {
-			((UntypedType) o).setFollowersTo(this);
-			((UntypedType) o).deleteFollowers();
-			return this;
-		} else if (o instanceof FunctionType) {
-			// function
-			if (o instanceof AbstractHasFollowers) {
-				((AbstractHasFollowers) o).setFollowersTo(this);
-				((AbstractHasFollowers) o).deleteFollowers();
-			}
-			return this;
-		} else {
-			throw new UnificationException();
-		}
-	}
-
-	@Override
-	public StringType cloneTLAType() {
-		return this;
-	}
-
-	@Override
-	public boolean contains(TLAType o) {
-		return false;
-	}
-
-	@Override
-	public PExpression getBNode() {
-		return new AStringSetExpression();
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.caseStringType(this);
-	}
-
-	@Override
-	public String toString() {
-		return "STRING";
-	}
-
-}
+package de.tla2b.types;
+
+import de.be4.classicalb.core.parser.node.AStringSetExpression;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class StringType extends TLAType {
+
+	public StringType() {
+		super(STRING);
+	}
+
+	private static StringType instance = new StringType();
+
+	public static StringType getInstance() {
+		return instance;
+	}
+
+	@Override
+	public boolean compare(TLAType o) {
+		if (o.getKind() == UNTYPED || o.getKind() == STRING)
+			return true;
+		else if (o instanceof FunctionType) {
+			return o.compare(this);
+		} else
+			return false;
+
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return false;
+	}
+
+	@Override
+	public StringType unify(TLAType o) throws UnificationException {
+		if (!this.compare(o)) {
+			throw new UnificationException();
+		}
+		if (o.getKind() == STRING) {
+			return this;
+		} else if (o instanceof UntypedType) {
+			((UntypedType) o).setFollowersTo(this);
+			((UntypedType) o).deleteFollowers();
+			return this;
+		} else if (o instanceof FunctionType) {
+			// function
+			if (o instanceof AbstractHasFollowers) {
+				((AbstractHasFollowers) o).setFollowersTo(this);
+				((AbstractHasFollowers) o).deleteFollowers();
+			}
+			return this;
+		} else {
+			throw new UnificationException();
+		}
+	}
+
+	@Override
+	public StringType cloneTLAType() {
+		return this;
+	}
+
+	@Override
+	public boolean contains(TLAType o) {
+		return false;
+	}
+
+	@Override
+	public PExpression getBNode() {
+		return new AStringSetExpression();
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.caseStringType(this);
+	}
+
+	@Override
+	public String toString() {
+		return "STRING";
+	}
+
+}
diff --git a/src/main/java/de/tla2b/types/StructOrFunctionType.java b/src/main/java/de/tla2b/types/StructOrFunctionType.java
index 0243e925e129b35975a4541e832db4142ab3e953..da143bc0687da4ee57536f18441291ace1f1fa07 100644
--- a/src/main/java/de/tla2b/types/StructOrFunctionType.java
+++ b/src/main/java/de/tla2b/types/StructOrFunctionType.java
@@ -1,205 +1,205 @@
-package de.tla2b.types;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class StructOrFunctionType extends AbstractHasFollowers {
-	private LinkedHashMap<String, TLAType> types;
-
-	public StructOrFunctionType(String name, TLAType type) {
-		super(STRUCT_OR_FUNCTION);
-		types = new LinkedHashMap<String, TLAType>();
-		types.put(name, type);
-	}
-
-	public StructOrFunctionType() {
-		super(STRUCT_OR_FUNCTION);
-		types = new LinkedHashMap<String, TLAType>();
-	}
-
-	public void setNewType(TLAType old, TLAType New) {
-		Set<Entry<String, TLAType>> set = types.entrySet();
-		Iterator<Entry<String, TLAType>> iterator = set.iterator();
-
-		while (iterator.hasNext()) {
-			Entry<String, TLAType> entry = iterator.next();
-			if (entry.getValue() == old) {
-				String key = entry.getKey();
-				if (New instanceof AbstractHasFollowers) {
-					// set new reference
-					((AbstractHasFollowers) New).addFollower(this);
-				}
-				types.put(key, New);
-			}
-		}
-		testRecord();
-	}
-
-	@Override
-	public String toString() {
-		StringBuilder sb = new StringBuilder();
-		sb.append("StructOrFunction(");
-		for (Iterator<String> keys = types.keySet().iterator(); keys.hasNext();) {
-			String key = keys.next();
-			sb.append("\"").append(key).append("\"");
-			sb.append(" : ").append(types.get(key));
-			if (keys.hasNext())
-				sb.append(", ");
-		}
-		sb.append(")");
-		return sb.toString();
-	}
-
-	@Override
-	public boolean compare(TLAType o) {
-		if (this.contains(o) || o.contains(this))
-			return false;
-		if (o.getKind() == UNTYPED)
-			return true;
-		if (o instanceof StructType) {
-			StructType s = (StructType) o;
-			Iterator<String> thisKeys = types.keySet().iterator();
-			while (thisKeys.hasNext()) {
-				String fieldName = (String) thisKeys.next();
-				if (s.getFields().contains(fieldName)) {
-					if (!this.types.get(fieldName)
-							.compare(s.getType(fieldName))) {
-						return false;
-					}
-				}
-			}
-			return true;
-		}
-
-		if (o instanceof StructOrFunctionType) {
-			StructOrFunctionType s = (StructOrFunctionType) o;
-
-			Iterator<String> thisKeys = types.keySet().iterator();
-			while (thisKeys.hasNext()) {
-				String fieldName = (String) thisKeys.next();
-				if (s.types.containsKey(fieldName)) {
-					if (!this.types.get(fieldName).compare(
-							s.types.get(fieldName))) {
-						return false;
-					}
-				}
-			}
-			return true;
-		}
-		return false;
-	}
-
-	@Override
-	public boolean contains(TLAType o) {
-		Iterator<String> thisKeys = types.keySet().iterator();
-		while (thisKeys.hasNext()) {
-			String fieldName = (String) thisKeys.next();
-			TLAType type = this.types.get(fieldName);
-			if (type.equals(o) || type.contains(o))
-				return true;
-		}
-		return false;
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return true;
-	}
-
-	@Override
-	public TLAType cloneTLAType() {
-		StructOrFunctionType res = new StructOrFunctionType();
-		for (String field : types.keySet()) {
-			res.types.put(field, this.types.get(field));
-		}
-		return res;
-	}
-
-	@Override
-	public TLAType unify(TLAType o) throws UnificationException {
-		if (!this.compare(o))
-			throw new UnificationException();
-
-		if (o instanceof UntypedType) {
-			((UntypedType) o).setFollowersTo(this);
-			return this;
-		}
-
-		if (o instanceof SetType) {
-			Iterator<TLAType> itr = types.values().iterator();
-			TLAType temp = itr.next();
-			while (itr.hasNext()) {
-				temp = temp.unify(itr.next());
-			}
-			SetType found = new SetType(new PairType(StringType.getInstance(),
-					temp));
-			return found.unify(o);
-		}
-		if (o instanceof StructType) {
-			StructType res = StructType.getIncompleteStruct();
-
-			for (String field : types.keySet()) {
-				res.add(field, this.types.get(field));
-			}
-			return o.unify(res);
-		}
-		if (o instanceof StructOrFunctionType) {
-			StructOrFunctionType other = (StructOrFunctionType) o;
-			for (String field : other.types.keySet()) {
-				TLAType type = other.types.get(field);
-				if (this.types.containsKey(field)) {
-					TLAType res = this.types.get(field).unify(type);
-					this.types.put(field, res);
-				} else {
-					if (type instanceof AbstractHasFollowers) {
-						((AbstractHasFollowers) type).addFollower(this);
-					}
-					this.types.put(field, type);
-				}
-			}
-			TLAType res = testRecord();
-			return res;
-		}
-		return this;
-	}
-
-	private TLAType testRecord() {
-		Iterator<TLAType> itr = types.values().iterator();
-		TLAType temp = itr.next().cloneTLAType();
-		while (itr.hasNext()) {
-			TLAType next = itr.next().cloneTLAType();
-			try {
-				temp.unify(next);
-			} catch (UnificationException e) {
-				StructType res = new StructType();
-				for (String field : this.types.keySet()) {
-					res.add(field, this.types.get(field));
-				}
-				this.setFollowersTo(res);
-				return res;
-			}
-		}
-		return this;
-	}
-
-	public SetType getFunction() {
-		Iterator<TLAType> itr = types.values().iterator();
-		return new SetType(new PairType(StringType.getInstance(), itr.next()));
-	}
-
-	@Override
-	public PExpression getBNode() {
-		return null;
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.caseStructOrFunction(this);
-	}
-
-}
+package de.tla2b.types;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class StructOrFunctionType extends AbstractHasFollowers {
+	private LinkedHashMap<String, TLAType> types;
+
+	public StructOrFunctionType(String name, TLAType type) {
+		super(STRUCT_OR_FUNCTION);
+		types = new LinkedHashMap<String, TLAType>();
+		types.put(name, type);
+	}
+
+	public StructOrFunctionType() {
+		super(STRUCT_OR_FUNCTION);
+		types = new LinkedHashMap<String, TLAType>();
+	}
+
+	public void setNewType(TLAType old, TLAType New) {
+		Set<Entry<String, TLAType>> set = types.entrySet();
+		Iterator<Entry<String, TLAType>> iterator = set.iterator();
+
+		while (iterator.hasNext()) {
+			Entry<String, TLAType> entry = iterator.next();
+			if (entry.getValue() == old) {
+				String key = entry.getKey();
+				if (New instanceof AbstractHasFollowers) {
+					// set new reference
+					((AbstractHasFollowers) New).addFollower(this);
+				}
+				types.put(key, New);
+			}
+		}
+		testRecord();
+	}
+
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append("StructOrFunction(");
+		for (Iterator<String> keys = types.keySet().iterator(); keys.hasNext();) {
+			String key = keys.next();
+			sb.append("\"").append(key).append("\"");
+			sb.append(" : ").append(types.get(key));
+			if (keys.hasNext())
+				sb.append(", ");
+		}
+		sb.append(")");
+		return sb.toString();
+	}
+
+	@Override
+	public boolean compare(TLAType o) {
+		if (this.contains(o) || o.contains(this))
+			return false;
+		if (o.getKind() == UNTYPED)
+			return true;
+		if (o instanceof StructType) {
+			StructType s = (StructType) o;
+			Iterator<String> thisKeys = types.keySet().iterator();
+			while (thisKeys.hasNext()) {
+				String fieldName = (String) thisKeys.next();
+				if (s.getFields().contains(fieldName)) {
+					if (!this.types.get(fieldName)
+							.compare(s.getType(fieldName))) {
+						return false;
+					}
+				}
+			}
+			return true;
+		}
+
+		if (o instanceof StructOrFunctionType) {
+			StructOrFunctionType s = (StructOrFunctionType) o;
+
+			Iterator<String> thisKeys = types.keySet().iterator();
+			while (thisKeys.hasNext()) {
+				String fieldName = (String) thisKeys.next();
+				if (s.types.containsKey(fieldName)) {
+					if (!this.types.get(fieldName).compare(
+							s.types.get(fieldName))) {
+						return false;
+					}
+				}
+			}
+			return true;
+		}
+		return false;
+	}
+
+	@Override
+	public boolean contains(TLAType o) {
+		Iterator<String> thisKeys = types.keySet().iterator();
+		while (thisKeys.hasNext()) {
+			String fieldName = (String) thisKeys.next();
+			TLAType type = this.types.get(fieldName);
+			if (type.equals(o) || type.contains(o))
+				return true;
+		}
+		return false;
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return true;
+	}
+
+	@Override
+	public TLAType cloneTLAType() {
+		StructOrFunctionType res = new StructOrFunctionType();
+		for (String field : types.keySet()) {
+			res.types.put(field, this.types.get(field));
+		}
+		return res;
+	}
+
+	@Override
+	public TLAType unify(TLAType o) throws UnificationException {
+		if (!this.compare(o))
+			throw new UnificationException();
+
+		if (o instanceof UntypedType) {
+			((UntypedType) o).setFollowersTo(this);
+			return this;
+		}
+
+		if (o instanceof SetType) {
+			Iterator<TLAType> itr = types.values().iterator();
+			TLAType temp = itr.next();
+			while (itr.hasNext()) {
+				temp = temp.unify(itr.next());
+			}
+			SetType found = new SetType(new PairType(StringType.getInstance(),
+					temp));
+			return found.unify(o);
+		}
+		if (o instanceof StructType) {
+			StructType res = StructType.getIncompleteStruct();
+
+			for (String field : types.keySet()) {
+				res.add(field, this.types.get(field));
+			}
+			return o.unify(res);
+		}
+		if (o instanceof StructOrFunctionType) {
+			StructOrFunctionType other = (StructOrFunctionType) o;
+			for (String field : other.types.keySet()) {
+				TLAType type = other.types.get(field);
+				if (this.types.containsKey(field)) {
+					TLAType res = this.types.get(field).unify(type);
+					this.types.put(field, res);
+				} else {
+					if (type instanceof AbstractHasFollowers) {
+						((AbstractHasFollowers) type).addFollower(this);
+					}
+					this.types.put(field, type);
+				}
+			}
+			TLAType res = testRecord();
+			return res;
+		}
+		return this;
+	}
+
+	private TLAType testRecord() {
+		Iterator<TLAType> itr = types.values().iterator();
+		TLAType temp = itr.next().cloneTLAType();
+		while (itr.hasNext()) {
+			TLAType next = itr.next().cloneTLAType();
+			try {
+				temp.unify(next);
+			} catch (UnificationException e) {
+				StructType res = new StructType();
+				for (String field : this.types.keySet()) {
+					res.add(field, this.types.get(field));
+				}
+				this.setFollowersTo(res);
+				return res;
+			}
+		}
+		return this;
+	}
+
+	public SetType getFunction() {
+		Iterator<TLAType> itr = types.values().iterator();
+		return new SetType(new PairType(StringType.getInstance(), itr.next()));
+	}
+
+	@Override
+	public PExpression getBNode() {
+		return null;
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.caseStructOrFunction(this);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/types/StructType.java b/src/main/java/de/tla2b/types/StructType.java
index 50fca87cfc00fade1b42da58486fc7a096e58769..7584c03df48ab8ae0657299186f81b0917444d60 100644
--- a/src/main/java/de/tla2b/types/StructType.java
+++ b/src/main/java/de/tla2b/types/StructType.java
@@ -1,251 +1,251 @@
-package de.tla2b.types;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import de.be4.classicalb.core.parser.node.ABoolSetExpression;
-import de.be4.classicalb.core.parser.node.AMultOrCartExpression;
-import de.be4.classicalb.core.parser.node.APowSubsetExpression;
-import de.be4.classicalb.core.parser.node.ARecEntry;
-import de.be4.classicalb.core.parser.node.AStructExpression;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.be4.classicalb.core.parser.node.PRecEntry;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-import de.tla2bAst.BAstCreator;
-
-public class StructType extends AbstractHasFollowers {
-	private LinkedHashMap<String, TLAType> types;
-	private boolean extensible;
-	private boolean incompleteStruct;
-
-	public StructType() {
-		super(STRUCT);
-		types = new LinkedHashMap<String, TLAType>();
-		extensible = false;
-		incompleteStruct = false;
-	}
-
-	public static StructType getIncompleteStruct() {
-		StructType s = new StructType();
-		s.incompleteStruct = true;
-		return s;
-	}
-
-	public boolean isExtensible() {
-		return extensible;
-	}
-
-	public TLAType getType(String fieldName) {
-		return types.get(fieldName);
-	}
-
-	public void add(String name, TLAType type) {
-		if (type instanceof AbstractHasFollowers) {
-			// set new reference
-			((AbstractHasFollowers) type).addFollower(this);
-		}
-		types.put(name, type);
-	}
-
-	public void setNewType(TLAType old, TLAType New) {
-		Set<Entry<String, TLAType>> set = types.entrySet();
-		Iterator<Entry<String, TLAType>> iterator = set.iterator();
-
-		while (iterator.hasNext()) {
-			Entry<String, TLAType> entry = iterator.next();
-			if (entry.getValue() == old) {
-				String key = entry.getKey();
-				if (New instanceof AbstractHasFollowers) {
-					// set new reference
-					((AbstractHasFollowers) New).addFollower(this);
-				}
-				types.put(key, New);
-			}
-		}
-	}
-
-	@Override
-	public boolean isUntyped() {
-		Iterator<TLAType> ts = types.values().iterator();
-		while (ts.hasNext()) {
-			TLAType bType = (TLAType) ts.next();
-			if (bType.isUntyped())
-				return true;
-		}
-		return false;
-	}
-
-	public boolean compare(TLAType o) {
-		if (this.contains(o) || o.contains(this)) {
-			return false;
-		}
-		if (o.getKind() == UNTYPED)
-			return true;
-
-		if (o instanceof StructOrFunctionType) {
-			return o.compare(this);
-		}
-		if (o instanceof StructType) {
-			StructType s = (StructType) o;
-
-			Iterator<String> thisKeys = types.keySet().iterator();
-			while (thisKeys.hasNext()) {
-				String fieldName = (String) thisKeys.next();
-				if (s.types.containsKey(fieldName)) {
-					if (!this.types.get(fieldName).compare(
-							s.types.get(fieldName))) {
-						return false;
-					}
-				}
-			}
-			return true;
-		}
-		return false;
-	}
-
-	public StructType unify(TLAType o) throws UnificationException {
-		if (!this.compare(o)) {
-			throw new UnificationException();
-		}
-		if (o instanceof AbstractHasFollowers)
-			((AbstractHasFollowers) o).setFollowersTo(this);
-
-		if (o instanceof StructOrFunctionType) {
-			return (StructType) o.unify(this);
-		}
-
-		if (o instanceof StructType) {
-			StructType otherStruct = (StructType) o;
-			boolean extendStruct = false;
-
-			if (this.incompleteStruct && otherStruct.incompleteStruct) {
-				extendStruct = false;
-			} else if (this.incompleteStruct) {
-				if (otherStruct.types.keySet().containsAll(this.types.keySet())) {
-					extendStruct = false;
-				} else {
-					extendStruct = true;
-				}
-			} else if (otherStruct.incompleteStruct) {
-				if (this.types.keySet().containsAll(otherStruct.types.keySet())) {
-					extendStruct = false;
-				} else {
-					extendStruct = true;
-				}
-			} else {
-				extendStruct = !otherStruct.types.keySet().equals(this.types.keySet());
-			}
-			this.extensible = this.extensible || otherStruct.extensible || extendStruct;
-
-			Iterator<String> keys = otherStruct.types.keySet().iterator();
-			while (keys.hasNext()) {
-				String fieldName = (String) keys.next();
-				TLAType sType = otherStruct.types.get(fieldName);
-				if (this.types.containsKey(fieldName)) {
-					TLAType res = this.types.get(fieldName).unify(sType);
-					this.types.put(fieldName, res);
-				} else {
-					if (sType instanceof AbstractHasFollowers) {
-						// set new reference
-						((AbstractHasFollowers) sType).addFollower(this);
-					}
-					this.types.put(fieldName, sType);
-				}
-				this.incompleteStruct = false;
-			}
-			return this;
-		}
-		return this;
-	}
-
-	@Override
-	public StructType cloneTLAType() {
-		StructType clone = new StructType();
-
-		Set<Entry<String, TLAType>> set = this.types.entrySet();
-		Iterator<Entry<String, TLAType>> iterator = set.iterator();
-
-		while (iterator.hasNext()) {
-			Entry<String, TLAType> entry = iterator.next();
-			String field = entry.getKey();
-			TLAType type = entry.getValue().cloneTLAType();
-			clone.add(field, type);
-		}
-
-		return clone;
-	}
-
-	public ArrayList<String> getFields() {
-		ArrayList<String> fields = new ArrayList<String>();
-		Iterator<String> keys = this.types.keySet().iterator();
-		while (keys.hasNext()) {
-			String fieldName = (String) keys.next();
-			fields.add(fieldName);
-		}
-		return fields;
-	}
-
-	@Override
-	public boolean contains(TLAType o) {
-		Iterator<TLAType> ts = types.values().iterator();
-		while (ts.hasNext()) {
-			TLAType bType = (TLAType) ts.next();
-			if (bType.equals(o) || bType.contains(o))
-				return true;
-		}
-		return false;
-	}
-
-	@Override
-	public String toString() {
-		StringBuilder sb = new StringBuilder();
-		sb.append("struct(");
-		Iterator<String> keys = types.keySet().iterator();
-		if (!keys.hasNext()) {
-			sb.append("...");
-		}
-		while (keys.hasNext()) {
-			String fieldName = (String) keys.next();
-			sb.append(fieldName).append(":").append(types.get(fieldName));
-			if (keys.hasNext())
-				sb.append(",");
-		}
-		sb.append(")");
-		return sb.toString();
-	}
-
-	@Override
-	public PExpression getBNode() {
-		List<PRecEntry> recList = new ArrayList<PRecEntry>();
-		for (Entry<String, TLAType> entry : types.entrySet()) {
-			ARecEntry rec = new ARecEntry();
-			rec.setIdentifier(BAstCreator.createIdentifierNode(entry.getKey()));
-			if (extensible) {
-
-				AMultOrCartExpression cart = new AMultOrCartExpression();
-				cart.setLeft(new ABoolSetExpression());
-				cart.setRight(entry.getValue().getBNode());
-				APowSubsetExpression pow = new APowSubsetExpression(cart);
-				rec.setValue(pow);
-			} else {
-				rec.setValue(entry.getValue().getBNode());
-			}
-			recList.add(rec);
-		}
-		return new AStructExpression(recList);
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.caseStructType(this);
-	}
-
-	public LinkedHashMap<String, TLAType> getTypeTable() {
-		return this.types;
-	}
-
-}
+package de.tla2b.types;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import de.be4.classicalb.core.parser.node.ABoolSetExpression;
+import de.be4.classicalb.core.parser.node.AMultOrCartExpression;
+import de.be4.classicalb.core.parser.node.APowSubsetExpression;
+import de.be4.classicalb.core.parser.node.ARecEntry;
+import de.be4.classicalb.core.parser.node.AStructExpression;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.be4.classicalb.core.parser.node.PRecEntry;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+import de.tla2bAst.BAstCreator;
+
+public class StructType extends AbstractHasFollowers {
+	private LinkedHashMap<String, TLAType> types;
+	private boolean extensible;
+	private boolean incompleteStruct;
+
+	public StructType() {
+		super(STRUCT);
+		types = new LinkedHashMap<String, TLAType>();
+		extensible = false;
+		incompleteStruct = false;
+	}
+
+	public static StructType getIncompleteStruct() {
+		StructType s = new StructType();
+		s.incompleteStruct = true;
+		return s;
+	}
+
+	public boolean isExtensible() {
+		return extensible;
+	}
+
+	public TLAType getType(String fieldName) {
+		return types.get(fieldName);
+	}
+
+	public void add(String name, TLAType type) {
+		if (type instanceof AbstractHasFollowers) {
+			// set new reference
+			((AbstractHasFollowers) type).addFollower(this);
+		}
+		types.put(name, type);
+	}
+
+	public void setNewType(TLAType old, TLAType New) {
+		Set<Entry<String, TLAType>> set = types.entrySet();
+		Iterator<Entry<String, TLAType>> iterator = set.iterator();
+
+		while (iterator.hasNext()) {
+			Entry<String, TLAType> entry = iterator.next();
+			if (entry.getValue() == old) {
+				String key = entry.getKey();
+				if (New instanceof AbstractHasFollowers) {
+					// set new reference
+					((AbstractHasFollowers) New).addFollower(this);
+				}
+				types.put(key, New);
+			}
+		}
+	}
+
+	@Override
+	public boolean isUntyped() {
+		Iterator<TLAType> ts = types.values().iterator();
+		while (ts.hasNext()) {
+			TLAType bType = (TLAType) ts.next();
+			if (bType.isUntyped())
+				return true;
+		}
+		return false;
+	}
+
+	public boolean compare(TLAType o) {
+		if (this.contains(o) || o.contains(this)) {
+			return false;
+		}
+		if (o.getKind() == UNTYPED)
+			return true;
+
+		if (o instanceof StructOrFunctionType) {
+			return o.compare(this);
+		}
+		if (o instanceof StructType) {
+			StructType s = (StructType) o;
+
+			Iterator<String> thisKeys = types.keySet().iterator();
+			while (thisKeys.hasNext()) {
+				String fieldName = (String) thisKeys.next();
+				if (s.types.containsKey(fieldName)) {
+					if (!this.types.get(fieldName).compare(
+							s.types.get(fieldName))) {
+						return false;
+					}
+				}
+			}
+			return true;
+		}
+		return false;
+	}
+
+	public StructType unify(TLAType o) throws UnificationException {
+		if (!this.compare(o)) {
+			throw new UnificationException();
+		}
+		if (o instanceof AbstractHasFollowers)
+			((AbstractHasFollowers) o).setFollowersTo(this);
+
+		if (o instanceof StructOrFunctionType) {
+			return (StructType) o.unify(this);
+		}
+
+		if (o instanceof StructType) {
+			StructType otherStruct = (StructType) o;
+			boolean extendStruct = false;
+
+			if (this.incompleteStruct && otherStruct.incompleteStruct) {
+				extendStruct = false;
+			} else if (this.incompleteStruct) {
+				if (otherStruct.types.keySet().containsAll(this.types.keySet())) {
+					extendStruct = false;
+				} else {
+					extendStruct = true;
+				}
+			} else if (otherStruct.incompleteStruct) {
+				if (this.types.keySet().containsAll(otherStruct.types.keySet())) {
+					extendStruct = false;
+				} else {
+					extendStruct = true;
+				}
+			} else {
+				extendStruct = !otherStruct.types.keySet().equals(this.types.keySet());
+			}
+			this.extensible = this.extensible || otherStruct.extensible || extendStruct;
+
+			Iterator<String> keys = otherStruct.types.keySet().iterator();
+			while (keys.hasNext()) {
+				String fieldName = (String) keys.next();
+				TLAType sType = otherStruct.types.get(fieldName);
+				if (this.types.containsKey(fieldName)) {
+					TLAType res = this.types.get(fieldName).unify(sType);
+					this.types.put(fieldName, res);
+				} else {
+					if (sType instanceof AbstractHasFollowers) {
+						// set new reference
+						((AbstractHasFollowers) sType).addFollower(this);
+					}
+					this.types.put(fieldName, sType);
+				}
+				this.incompleteStruct = false;
+			}
+			return this;
+		}
+		return this;
+	}
+
+	@Override
+	public StructType cloneTLAType() {
+		StructType clone = new StructType();
+
+		Set<Entry<String, TLAType>> set = this.types.entrySet();
+		Iterator<Entry<String, TLAType>> iterator = set.iterator();
+
+		while (iterator.hasNext()) {
+			Entry<String, TLAType> entry = iterator.next();
+			String field = entry.getKey();
+			TLAType type = entry.getValue().cloneTLAType();
+			clone.add(field, type);
+		}
+
+		return clone;
+	}
+
+	public ArrayList<String> getFields() {
+		ArrayList<String> fields = new ArrayList<String>();
+		Iterator<String> keys = this.types.keySet().iterator();
+		while (keys.hasNext()) {
+			String fieldName = (String) keys.next();
+			fields.add(fieldName);
+		}
+		return fields;
+	}
+
+	@Override
+	public boolean contains(TLAType o) {
+		Iterator<TLAType> ts = types.values().iterator();
+		while (ts.hasNext()) {
+			TLAType bType = (TLAType) ts.next();
+			if (bType.equals(o) || bType.contains(o))
+				return true;
+		}
+		return false;
+	}
+
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append("struct(");
+		Iterator<String> keys = types.keySet().iterator();
+		if (!keys.hasNext()) {
+			sb.append("...");
+		}
+		while (keys.hasNext()) {
+			String fieldName = (String) keys.next();
+			sb.append(fieldName).append(":").append(types.get(fieldName));
+			if (keys.hasNext())
+				sb.append(",");
+		}
+		sb.append(")");
+		return sb.toString();
+	}
+
+	@Override
+	public PExpression getBNode() {
+		List<PRecEntry> recList = new ArrayList<PRecEntry>();
+		for (Entry<String, TLAType> entry : types.entrySet()) {
+			ARecEntry rec = new ARecEntry();
+			rec.setIdentifier(BAstCreator.createIdentifierNode(entry.getKey()));
+			if (extensible) {
+
+				AMultOrCartExpression cart = new AMultOrCartExpression();
+				cart.setLeft(new ABoolSetExpression());
+				cart.setRight(entry.getValue().getBNode());
+				APowSubsetExpression pow = new APowSubsetExpression(cart);
+				rec.setValue(pow);
+			} else {
+				rec.setValue(entry.getValue().getBNode());
+			}
+			recList.add(rec);
+		}
+		return new AStructExpression(recList);
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.caseStructType(this);
+	}
+
+	public LinkedHashMap<String, TLAType> getTypeTable() {
+		return this.types;
+	}
+
+}
diff --git a/src/main/java/de/tla2b/types/TLAType.java b/src/main/java/de/tla2b/types/TLAType.java
index e403352e91ca069ffa70bdbdb98694288d77ec57..790c2b1b3ab6922badde0f037e286496efc45917 100644
--- a/src/main/java/de/tla2b/types/TLAType.java
+++ b/src/main/java/de/tla2b/types/TLAType.java
@@ -1,42 +1,42 @@
-package de.tla2b.types;
-
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-
-public abstract class TLAType implements IType {
-	private int kind;
-
-	public TLAType(int t) {
-		this.kind = t;
-	}
-
-	public final int getKind() {
-		return kind;
-	}
-
-	public abstract String toString();
-	
-	public abstract PExpression getBNode();
-
-	public abstract boolean compare(TLAType o);
-	
-	public abstract boolean contains(TLAType o);
-	
-	public abstract boolean isUntyped();
-	
-	public abstract TLAType cloneTLAType();
-
-	public abstract TLAType unify(TLAType o) throws UnificationException;
-	
-	public TLAType unityAll(TLAType[] types) throws UnificationException{
-		TLAType current = this;
-		for (int i = 0; i < types.length; i++) {
-			current = current.unify(types[i]);
-		}
-		return current;
-	}
-
-	public final String printObjectToString() {
-		return super.toString();
-	}
-}
+package de.tla2b.types;
+
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+
+public abstract class TLAType implements IType {
+	private int kind;
+
+	public TLAType(int t) {
+		this.kind = t;
+	}
+
+	public final int getKind() {
+		return kind;
+	}
+
+	public abstract String toString();
+	
+	public abstract PExpression getBNode();
+
+	public abstract boolean compare(TLAType o);
+	
+	public abstract boolean contains(TLAType o);
+	
+	public abstract boolean isUntyped();
+	
+	public abstract TLAType cloneTLAType();
+
+	public abstract TLAType unify(TLAType o) throws UnificationException;
+	
+	public TLAType unityAll(TLAType[] types) throws UnificationException{
+		TLAType current = this;
+		for (int i = 0; i < types.length; i++) {
+			current = current.unify(types[i]);
+		}
+		return current;
+	}
+
+	public final String printObjectToString() {
+		return super.toString();
+	}
+}
diff --git a/src/main/java/de/tla2b/types/TupleType.java b/src/main/java/de/tla2b/types/TupleType.java
index 3fb67ed4ea7d891cfa52118ef67dc3e33cad2525..b53f6464757d64d175ac5ec391a201975c4c74f0 100644
--- a/src/main/java/de/tla2b/types/TupleType.java
+++ b/src/main/java/de/tla2b/types/TupleType.java
@@ -1,173 +1,173 @@
-package de.tla2b.types;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import de.be4.classicalb.core.parser.node.AMultOrCartExpression;
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class TupleType extends AbstractHasFollowers {
-	private List<TLAType> types;
-
-	public TupleType(List<TLAType> typeList) {
-		super(TUPLE);
-		setTypes(typeList);
-	}
-
-	public TupleType(int size) {
-		super(TUPLE);
-		ArrayList<TLAType> list = new ArrayList<TLAType>();
-		for (int i = 0; i < size; i++) {
-			list.add(new UntypedType());
-		}
-		setTypes(list);
-	}
-
-	public ArrayList<TLAType> getTypes() {
-		return new ArrayList<TLAType>(types);
-	}
-
-	public void setTypes(List<TLAType> types) {
-		this.types = types;
-		types = new ArrayList<TLAType>(types);
-		for (TLAType tlaType : types) {
-			if (tlaType instanceof AbstractHasFollowers) {
-				((AbstractHasFollowers) tlaType).addFollower(this);
-			}
-		}
-	}
-
-	public void update(TLAType oldType, TLAType newType) {
-		for (int i = 0; i < types.size(); i++) {
-			TLAType t = types.get(i);
-			if (oldType == t) {
-				types.set(i, newType);
-			}
-		}
-		if (oldType instanceof AbstractHasFollowers)
-			((AbstractHasFollowers) oldType).addFollower(this);
-	}
-
-	@Override
-	public boolean compare(TLAType o) {
-		if (this.contains(o))
-			return false;
-		if (o.getKind() == UNTYPED)
-			return true;
-		if (o instanceof TupleType) {
-			TupleType t = (TupleType) o;
-			if (this.types.size() != t.types.size()) {
-				return false;
-			}
-			for (int i = 0; i < types.size(); i++) {
-				if (!types.get(i).compare(t.types.get(i)))
-					return false;
-			}
-			return true;
-		}
-
-		if (o instanceof TupleOrFunction) {
-			return o.compare(this);
-		}
-
-		return false;
-	}
-
-	@Override
-	public boolean contains(TLAType o) {
-		for (TLAType tlaType : types) {
-			if (tlaType.equals(o) || tlaType.contains(o))
-				return true;
-		}
-		return false;
-	}
-
-	@Override
-	public boolean isUntyped() {
-		for (TLAType tlaType : types) {
-			if (tlaType.isUntyped())
-				return true;
-		}
-		return false;
-	}
-
-	@Override
-	public TLAType cloneTLAType() {
-		ArrayList<TLAType> list = new ArrayList<TLAType>();
-		for (TLAType tlaType : types) {
-			list.add(tlaType.cloneTLAType());
-		}
-		return new TupleType(list);
-	}
-
-	@Override
-	public TLAType unify(TLAType o) throws UnificationException {
-		if (!this.compare(o)) {
-			throw new UnificationException();
-		}
-		if (o instanceof UntypedType) {
-			((UntypedType) o).setFollowersTo(this);
-			return this;
-		}
-		if (o instanceof TupleType) {
-			TupleType tuple = (TupleType) o;
-
-			for (int i = 0; i < types.size(); i++) {
-				TLAType res = types.get(i).unify(tuple.types.get(i));
-				types.set(i, res);
-				if (res instanceof AbstractHasFollowers)
-					((AbstractHasFollowers) res).addFollower(this);
-			}
-			return this;
-		}
-
-		if (o instanceof TupleOrFunction) {
-			return o.unify(this);
-		}
-		throw new RuntimeException();
-	}
-
-	@Override
-	public String toString() {
-		StringBuilder sb = new StringBuilder();
-		for (int i = 0; i < types.size(); i++) {
-			if (types.get(i) instanceof TupleType && i != 0) {
-				sb.append("(").append(types.get(i)).append(")");
-			} else
-				sb.append(types.get(i));
-			if (i < types.size() - 1) {
-				sb.append("*");
-			}
-		}
-		return sb.toString();
-	}
-
-	@Override
-	public PExpression getBNode() {
-		List<PExpression> list = new ArrayList<PExpression>();
-		for (TLAType t : types) {
-			list.add(t.getBNode());
-		}
-		AMultOrCartExpression card = new AMultOrCartExpression();
-		card.setLeft(list.get(0));
-		for (int i = 1; i < list.size(); i++) {
-			if (i < list.size() - 1) {
-				AMultOrCartExpression old = card;
-				old.setRight(list.get(i));
-				card = new AMultOrCartExpression();
-				card.setLeft(old);
-			} else {
-				card.setRight(list.get(i));
-			}
-
-		}
-		return card;
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.caseTupleType(this);
-	}
-
-}
+package de.tla2b.types;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.be4.classicalb.core.parser.node.AMultOrCartExpression;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class TupleType extends AbstractHasFollowers {
+	private List<TLAType> types;
+
+	public TupleType(List<TLAType> typeList) {
+		super(TUPLE);
+		setTypes(typeList);
+	}
+
+	public TupleType(int size) {
+		super(TUPLE);
+		ArrayList<TLAType> list = new ArrayList<TLAType>();
+		for (int i = 0; i < size; i++) {
+			list.add(new UntypedType());
+		}
+		setTypes(list);
+	}
+
+	public ArrayList<TLAType> getTypes() {
+		return new ArrayList<TLAType>(types);
+	}
+
+	public void setTypes(List<TLAType> types) {
+		this.types = types;
+		types = new ArrayList<TLAType>(types);
+		for (TLAType tlaType : types) {
+			if (tlaType instanceof AbstractHasFollowers) {
+				((AbstractHasFollowers) tlaType).addFollower(this);
+			}
+		}
+	}
+
+	public void update(TLAType oldType, TLAType newType) {
+		for (int i = 0; i < types.size(); i++) {
+			TLAType t = types.get(i);
+			if (oldType == t) {
+				types.set(i, newType);
+			}
+		}
+		if (oldType instanceof AbstractHasFollowers)
+			((AbstractHasFollowers) oldType).addFollower(this);
+	}
+
+	@Override
+	public boolean compare(TLAType o) {
+		if (this.contains(o))
+			return false;
+		if (o.getKind() == UNTYPED)
+			return true;
+		if (o instanceof TupleType) {
+			TupleType t = (TupleType) o;
+			if (this.types.size() != t.types.size()) {
+				return false;
+			}
+			for (int i = 0; i < types.size(); i++) {
+				if (!types.get(i).compare(t.types.get(i)))
+					return false;
+			}
+			return true;
+		}
+
+		if (o instanceof TupleOrFunction) {
+			return o.compare(this);
+		}
+
+		return false;
+	}
+
+	@Override
+	public boolean contains(TLAType o) {
+		for (TLAType tlaType : types) {
+			if (tlaType.equals(o) || tlaType.contains(o))
+				return true;
+		}
+		return false;
+	}
+
+	@Override
+	public boolean isUntyped() {
+		for (TLAType tlaType : types) {
+			if (tlaType.isUntyped())
+				return true;
+		}
+		return false;
+	}
+
+	@Override
+	public TLAType cloneTLAType() {
+		ArrayList<TLAType> list = new ArrayList<TLAType>();
+		for (TLAType tlaType : types) {
+			list.add(tlaType.cloneTLAType());
+		}
+		return new TupleType(list);
+	}
+
+	@Override
+	public TLAType unify(TLAType o) throws UnificationException {
+		if (!this.compare(o)) {
+			throw new UnificationException();
+		}
+		if (o instanceof UntypedType) {
+			((UntypedType) o).setFollowersTo(this);
+			return this;
+		}
+		if (o instanceof TupleType) {
+			TupleType tuple = (TupleType) o;
+
+			for (int i = 0; i < types.size(); i++) {
+				TLAType res = types.get(i).unify(tuple.types.get(i));
+				types.set(i, res);
+				if (res instanceof AbstractHasFollowers)
+					((AbstractHasFollowers) res).addFollower(this);
+			}
+			return this;
+		}
+
+		if (o instanceof TupleOrFunction) {
+			return o.unify(this);
+		}
+		throw new RuntimeException();
+	}
+
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		for (int i = 0; i < types.size(); i++) {
+			if (types.get(i) instanceof TupleType && i != 0) {
+				sb.append("(").append(types.get(i)).append(")");
+			} else
+				sb.append(types.get(i));
+			if (i < types.size() - 1) {
+				sb.append("*");
+			}
+		}
+		return sb.toString();
+	}
+
+	@Override
+	public PExpression getBNode() {
+		List<PExpression> list = new ArrayList<PExpression>();
+		for (TLAType t : types) {
+			list.add(t.getBNode());
+		}
+		AMultOrCartExpression card = new AMultOrCartExpression();
+		card.setLeft(list.get(0));
+		for (int i = 1; i < list.size(); i++) {
+			if (i < list.size() - 1) {
+				AMultOrCartExpression old = card;
+				old.setRight(list.get(i));
+				card = new AMultOrCartExpression();
+				card.setLeft(old);
+			} else {
+				card.setRight(list.get(i));
+			}
+
+		}
+		return card;
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.caseTupleType(this);
+	}
+
+}
diff --git a/src/main/java/de/tla2b/types/UntypedType.java b/src/main/java/de/tla2b/types/UntypedType.java
index 5f4d74b42a7cd9c2e0a541d2cb2b0d29ca252ff1..fc746ed1e1890e36763d6c182dea46527850b4f8 100644
--- a/src/main/java/de/tla2b/types/UntypedType.java
+++ b/src/main/java/de/tla2b/types/UntypedType.java
@@ -1,59 +1,59 @@
-package de.tla2b.types;
-
-import de.be4.classicalb.core.parser.node.PExpression;
-import de.tla2b.exceptions.UnificationException;
-import de.tla2b.output.TypeVisitorInterface;
-
-public class UntypedType extends AbstractHasFollowers {
-
-	public UntypedType() {
-		super(UNTYPED);
-	}
-
-	public TLAType unify(TLAType o) throws UnificationException {
-		if (!this.compare(o)) {
-			throw new UnificationException();
-		}
-		// u2 contains more or equal type information than untyped (this)
-		this.setFollowersTo(o);
-		//this.deleteFollowers();
-		return o;
-	}
-	
-	@Override
-	public boolean compare(TLAType o){
-		if(o.contains(this)){
-			return false;
-		}
-		return true;
-	}
-	
-	@Override
-	public boolean contains(TLAType o){
-		return false;
-	}
-
-	@Override
-	public String toString() {
-		return "UNTYPED_"+hashCode();
-	}
-
-	@Override
-	public boolean isUntyped() {
-		return true;
-	}
-
-	@Override
-	public UntypedType cloneTLAType() {
-		return new UntypedType();
-	}
-
-	@Override
-	public PExpression getBNode() {
-		return null;
-	}
-
-	public void apply(TypeVisitorInterface visitor) {
-		visitor.caseUntyped(this);
-	}
-}
+package de.tla2b.types;
+
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.tla2b.exceptions.UnificationException;
+import de.tla2b.output.TypeVisitorInterface;
+
+public class UntypedType extends AbstractHasFollowers {
+
+	public UntypedType() {
+		super(UNTYPED);
+	}
+
+	public TLAType unify(TLAType o) throws UnificationException {
+		if (!this.compare(o)) {
+			throw new UnificationException();
+		}
+		// u2 contains more or equal type information than untyped (this)
+		this.setFollowersTo(o);
+		//this.deleteFollowers();
+		return o;
+	}
+	
+	@Override
+	public boolean compare(TLAType o){
+		if(o.contains(this)){
+			return false;
+		}
+		return true;
+	}
+	
+	@Override
+	public boolean contains(TLAType o){
+		return false;
+	}
+
+	@Override
+	public String toString() {
+		return "UNTYPED_"+hashCode();
+	}
+
+	@Override
+	public boolean isUntyped() {
+		return true;
+	}
+
+	@Override
+	public UntypedType cloneTLAType() {
+		return new UntypedType();
+	}
+
+	@Override
+	public PExpression getBNode() {
+		return null;
+	}
+
+	public void apply(TypeVisitorInterface visitor) {
+		visitor.caseUntyped(this);
+	}
+}
diff --git a/src/test/java/de/tla2b/expression/ComplexExpressionTest.java b/src/test/java/de/tla2b/expression/ComplexExpressionTest.java
index 69bfaa6282803984c8e4cb56f2f0a48d02001ca6..37d5b33511889d708a2e17a9faff0d3229c8418b 100644
--- a/src/test/java/de/tla2b/expression/ComplexExpressionTest.java
+++ b/src/test/java/de/tla2b/expression/ComplexExpressionTest.java
@@ -1,78 +1,78 @@
-package de.tla2b.expression;
-
-import org.junit.Test;
-
-import static de.tla2b.util.TestUtil.compareExpr;
-
-public class ComplexExpressionTest {
-
-	@Test
-	public void testExcept() throws Exception {
-		compareExpr("a = %u.(u : {3, 4, 5}| u + 1) & x = a <+ {3 |-> 1}",
-				"a = [u \\in {3,4,5}|-> u + 1] /\\ x = [a EXCEPT ![3] = 1]");
-	}
-
-	@Test
-	public void testLetIn() throws Exception {
-		compareExpr("1 + 1", "LET foo == 1 IN foo + foo");
-	}
-	
-	@Test
-	public void testLetPredicate() throws Exception {
-		compareExpr("1=1 & 1 = 1", "LET foo == 1 = 1 IN foo /\\ foo");
-	}
-	
-	@Test
-	public void testLetParameterPredicate() throws Exception {
-		compareExpr("1=1 & 1 = 2", "LET foo(a,b) == a = b IN foo(1,1) /\\ foo(1,2)");
-	}
-	
-
-	@Test
-	public void testLetDefWithArgs() throws Exception {
-		compareExpr("2 * 4", "LET foo(x,y) == x * y IN foo(2,4) ");
-	}
-
-	@Test
-	public void testLetTwoDefs() throws Exception {
-		compareExpr("1 + 2", "LET foo == 1 bar == 2 IN foo + bar ");
-	}
-
-	@Test
-	public void testPrime() throws Exception {
-		compareExpr("x_n = 1", "x' = 1");
-	}
-
-	@Test
-	public void testFunction() throws Exception {
-		compareExpr("%n.(n : {1}| 1)(1)", "LET f[n \\in {1}] == 1 IN f[1]");
-	}
-
-	@Test
-	public void testQuantifier() throws Exception {
-		compareExpr(
-				"#x,z,y.(x : NATURAL & z : NATURAL & y : NATURAL & x = y)",
-				"\\E x,z \\in Nat, y \\in Nat: x = y");
-	}
-
-	@Test
-	public void testFunctions() throws Exception {
-		compareExpr("(%x.(x : 1 .. 10| x * x) <+ {3 |-> 6})(3)", "LET"
-				+ " f[x \\in 1..10] == x*x\n" + " h == [f EXCEPT ![3] = 6]\n"
-				+ "IN h[3]");
-	}
-
-	@Test
-	public void testRecord() throws Exception {
-		compareExpr("rec(a:rec(a:1, b:TRUE)'a + rec(a:1, b:TRUE)'a, b:rec(a:1, b:TRUE)'b)",
-				"[[a|->1, b |->TRUE] EXCEPT !.a= @+@]");
-	}
-
-	@Test
-	public void testRecord2() throws Exception {
-		compareExpr("r = rec(a:rec(x:1, y:TRUE), b:1) & r2 = rec(a:rec(x:2, y:(r'a)'y), b:r'b)",
-				"r = [a |-> [x|->1,y|->TRUE], b |-> 1] "
-						+ "/\\ r2 = [r EXCEPT !.a.x = 2]");
-	}
-
-}
+package de.tla2b.expression;
+
+import org.junit.Test;
+
+import static de.tla2b.util.TestUtil.compareExpr;
+
+public class ComplexExpressionTest {
+
+	@Test
+	public void testExcept() throws Exception {
+		compareExpr("a = %u.(u : {3, 4, 5}| u + 1) & x = a <+ {3 |-> 1}",
+				"a = [u \\in {3,4,5}|-> u + 1] /\\ x = [a EXCEPT ![3] = 1]");
+	}
+
+	@Test
+	public void testLetIn() throws Exception {
+		compareExpr("1 + 1", "LET foo == 1 IN foo + foo");
+	}
+	
+	@Test
+	public void testLetPredicate() throws Exception {
+		compareExpr("1=1 & 1 = 1", "LET foo == 1 = 1 IN foo /\\ foo");
+	}
+	
+	@Test
+	public void testLetParameterPredicate() throws Exception {
+		compareExpr("1=1 & 1 = 2", "LET foo(a,b) == a = b IN foo(1,1) /\\ foo(1,2)");
+	}
+	
+
+	@Test
+	public void testLetDefWithArgs() throws Exception {
+		compareExpr("2 * 4", "LET foo(x,y) == x * y IN foo(2,4) ");
+	}
+
+	@Test
+	public void testLetTwoDefs() throws Exception {
+		compareExpr("1 + 2", "LET foo == 1 bar == 2 IN foo + bar ");
+	}
+
+	@Test
+	public void testPrime() throws Exception {
+		compareExpr("x_n = 1", "x' = 1");
+	}
+
+	@Test
+	public void testFunction() throws Exception {
+		compareExpr("%n.(n : {1}| 1)(1)", "LET f[n \\in {1}] == 1 IN f[1]");
+	}
+
+	@Test
+	public void testQuantifier() throws Exception {
+		compareExpr(
+				"#x,z,y.(x : NATURAL & z : NATURAL & y : NATURAL & x = y)",
+				"\\E x,z \\in Nat, y \\in Nat: x = y");
+	}
+
+	@Test
+	public void testFunctions() throws Exception {
+		compareExpr("(%x.(x : 1 .. 10| x * x) <+ {3 |-> 6})(3)", "LET"
+				+ " f[x \\in 1..10] == x*x\n" + " h == [f EXCEPT ![3] = 6]\n"
+				+ "IN h[3]");
+	}
+
+	@Test
+	public void testRecord() throws Exception {
+		compareExpr("rec(a:rec(a:1, b:TRUE)'a + rec(a:1, b:TRUE)'a, b:rec(a:1, b:TRUE)'b)",
+				"[[a|->1, b |->TRUE] EXCEPT !.a= @+@]");
+	}
+
+	@Test
+	public void testRecord2() throws Exception {
+		compareExpr("r = rec(a:rec(x:1, y:TRUE), b:1) & r2 = rec(a:rec(x:2, y:(r'a)'y), b:r'b)",
+				"r = [a |-> [x|->1,y|->TRUE], b |-> 1] "
+						+ "/\\ r2 = [r EXCEPT !.a.x = 2]");
+	}
+
+}
diff --git a/src/test/java/de/tla2b/expression/SimpleExpressionTest.java b/src/test/java/de/tla2b/expression/SimpleExpressionTest.java
index 01f1577c56a05f7398bc67b15ce3b741fcd97f60..a914b2bde4bc72a80324f7938f332794cf85c11d 100644
--- a/src/test/java/de/tla2b/expression/SimpleExpressionTest.java
+++ b/src/test/java/de/tla2b/expression/SimpleExpressionTest.java
@@ -1,45 +1,45 @@
-package de.tla2b.expression;
-
-import org.junit.Test;
-
-import static de.tla2b.util.TestUtil.compareExpr;
-
-public class SimpleExpressionTest {
-
-	@Test
-	public void testSimpleExpression() throws Exception {
-		compareExpr("1 + 2", "1 + 2");
-	}
-
-	@Test
-	public void testSimplePredicate() throws Exception {
-		compareExpr("1 = 1", "1 = 1");
-	}
-
-	@Test
-	public void testSimplePredicate2() throws Exception {
-		compareExpr("1 < 1", "1 < 1");
-	}
-
-	@Test
-	public void testModulIntegers() throws Exception {
-		compareExpr("-1 : INTEGER", "-1 \\in Int");
-	}
-
-	@Test
-	public void testExist() throws Exception {
-		compareExpr("#a.(a : {1} & 2 > 1)", "\\E a \\in {1}: 2 > 1");
-	}
-
-	@Test
-	public void testIfThenElse() throws Exception {
-		compareExpr(
-				"(%t_.( t_ = 0 & 1 = 1 | 1 )\\/%t_.( t_ = 0 & not(1 = 1) | 2 ))(0)",
-				"IF 1 = 1 THEN 1 ELSE 2");
-	}
-
-	@Test
-	public void testTRUE() throws Exception {
-		compareExpr("TRUE", "TRUE");
-	}
-}
+package de.tla2b.expression;
+
+import org.junit.Test;
+
+import static de.tla2b.util.TestUtil.compareExpr;
+
+public class SimpleExpressionTest {
+
+	@Test
+	public void testSimpleExpression() throws Exception {
+		compareExpr("1 + 2", "1 + 2");
+	}
+
+	@Test
+	public void testSimplePredicate() throws Exception {
+		compareExpr("1 = 1", "1 = 1");
+	}
+
+	@Test
+	public void testSimplePredicate2() throws Exception {
+		compareExpr("1 < 1", "1 < 1");
+	}
+
+	@Test
+	public void testModulIntegers() throws Exception {
+		compareExpr("-1 : INTEGER", "-1 \\in Int");
+	}
+
+	@Test
+	public void testExist() throws Exception {
+		compareExpr("#a.(a : {1} & 2 > 1)", "\\E a \\in {1}: 2 > 1");
+	}
+
+	@Test
+	public void testIfThenElse() throws Exception {
+		compareExpr(
+				"(%t_.( t_ = 0 & 1 = 1 | 1 )\\/%t_.( t_ = 0 & not(1 = 1) | 2 ))(0)",
+				"IF 1 = 1 THEN 1 ELSE 2");
+	}
+
+	@Test
+	public void testTRUE() throws Exception {
+		compareExpr("TRUE", "TRUE");
+	}
+}
diff --git a/src/test/java/de/tla2b/expression/TestError.java b/src/test/java/de/tla2b/expression/TestError.java
index 63f113bce03dfc290d7a9549f9bea95e46839801..912940db7e6e546e7b06dec138cdd4ac422c66bb 100644
--- a/src/test/java/de/tla2b/expression/TestError.java
+++ b/src/test/java/de/tla2b/expression/TestError.java
@@ -1,25 +1,25 @@
-package de.tla2b.expression;
-
-import static de.tla2b.util.TestUtil.compareExpr;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.ExpressionTranslationException;
-
-public class TestError {
-
-	@Test(expected = ExpressionTranslationException.class)
-	public void testParseError() throws Exception {
-		compareExpr(null, "a =");
-	}
-
-	@Test(expected = ExpressionTranslationException.class)
-	public void testSemanticError() throws Exception {
-		compareExpr(null, "a(1)");
-	}
-
-	@Test(expected = ExpressionTranslationException.class)
-	public void testTypeError() throws Exception {
-		compareExpr(null, "1 = TRUE");
-	}
-}
+package de.tla2b.expression;
+
+import static de.tla2b.util.TestUtil.compareExpr;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.ExpressionTranslationException;
+
+public class TestError {
+
+	@Test(expected = ExpressionTranslationException.class)
+	public void testParseError() throws Exception {
+		compareExpr(null, "a =");
+	}
+
+	@Test(expected = ExpressionTranslationException.class)
+	public void testSemanticError() throws Exception {
+		compareExpr(null, "a(1)");
+	}
+
+	@Test(expected = ExpressionTranslationException.class)
+	public void testTypeError() throws Exception {
+		compareExpr(null, "1 = TRUE");
+	}
+}
diff --git a/src/test/java/de/tla2b/expression/TestKeywords.java b/src/test/java/de/tla2b/expression/TestKeywords.java
index 7516daeb1c26d4265479417b9ed4d367dde6749f..0f38543d041f25d136987d85bafc163c369bd31b 100644
--- a/src/test/java/de/tla2b/expression/TestKeywords.java
+++ b/src/test/java/de/tla2b/expression/TestKeywords.java
@@ -1,33 +1,33 @@
-package de.tla2b.expression;
-
-import org.junit.Test;
-
-import static de.tla2b.util.TestUtil.compareExpr;
-
-public class TestKeywords {
-
-	@Test
-	public void testTRUE() throws Exception {
-		compareExpr("TRUE", "TRUE");
-	}
-
-	@Test
-	public void testNat() throws Exception {
-		compareExpr("NATURAL", "Nat");
-	}
-
-	@Test
-	public void testExcept() throws Exception {
-		compareExpr("x = a <+ {1 |-> 1}", "x = [a EXCEPT ![1] = 1]");
-	}
-
-	@Test
-	public void testCardinality() throws Exception {
-		compareExpr("card({1, 2, 3})", "Cardinality({1,2,3})");
-	}
-
-	@Test
-	public void testDom() throws Exception {
-		compareExpr("dom_1 = 1", "dom = 1");
-	}
-}
+package de.tla2b.expression;
+
+import org.junit.Test;
+
+import static de.tla2b.util.TestUtil.compareExpr;
+
+public class TestKeywords {
+
+	@Test
+	public void testTRUE() throws Exception {
+		compareExpr("TRUE", "TRUE");
+	}
+
+	@Test
+	public void testNat() throws Exception {
+		compareExpr("NATURAL", "Nat");
+	}
+
+	@Test
+	public void testExcept() throws Exception {
+		compareExpr("x = a <+ {1 |-> 1}", "x = [a EXCEPT ![1] = 1]");
+	}
+
+	@Test
+	public void testCardinality() throws Exception {
+		compareExpr("card({1, 2, 3})", "Cardinality({1,2,3})");
+	}
+
+	@Test
+	public void testDom() throws Exception {
+		compareExpr("dom_1 = 1", "dom = 1");
+	}
+}
diff --git a/src/test/java/de/tla2b/expression/TestSequences.java b/src/test/java/de/tla2b/expression/TestSequences.java
index 123e10a74d22cb675db7c0c0fb25131776e2ce57..8f79b19282eba280b79c2d2e6f7ad5623626d92d 100644
--- a/src/test/java/de/tla2b/expression/TestSequences.java
+++ b/src/test/java/de/tla2b/expression/TestSequences.java
@@ -1,24 +1,24 @@
-package de.tla2b.expression;
-
-import static de.tla2b.util.TestUtil.compareExpr;
-
-import org.junit.Test;
-
-public class TestSequences {
-
-	@Test
-	public void testAppend() throws Exception {
-		compareExpr("[1] <- 2", "Append(<<1>>, 2)");
-	}
-
-	@Test
-	public void testHead() throws Exception {
-		compareExpr("first([1, 2, 3])", "Head(<<1,2,3>>)");
-	}
-
-	@Test
-	public void testTail() throws Exception {
-		compareExpr("tail([1, 2, 3])", "Tail(<<1,2,3>>)");
-	}
-
-}
+package de.tla2b.expression;
+
+import static de.tla2b.util.TestUtil.compareExpr;
+
+import org.junit.Test;
+
+public class TestSequences {
+
+	@Test
+	public void testAppend() throws Exception {
+		compareExpr("[1] <- 2", "Append(<<1>>, 2)");
+	}
+
+	@Test
+	public void testHead() throws Exception {
+		compareExpr("first([1, 2, 3])", "Head(<<1,2,3>>)");
+	}
+
+	@Test
+	public void testTail() throws Exception {
+		compareExpr("tail([1, 2, 3])", "Tail(<<1,2,3>>)");
+	}
+
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/BBuiltInsTest.java b/src/test/java/de/tla2b/prettyprintb/BBuiltInsTest.java
index 98b5c659f8ad96e5bc303df75617193f0a8369fc..f3637767badf1beea57584a760ea80f2c603b55c 100644
--- a/src/test/java/de/tla2b/prettyprintb/BBuiltInsTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/BBuiltInsTest.java
@@ -1,65 +1,65 @@
-package de.tla2b.prettyprintb;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class BBuiltInsTest {
-
-	@Test
-	public void testBoolean() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE \\in BOOLEAN\n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE : BOOL \n" + "END";
-		compare(expected, module);
-	}
-	
-	@Ignore
-	@Test
-	public void testSetSummation() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS TLA2B\n" 
-				+ "ASSUME SetSummation({1,2}) = 3\n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES SIGMA(t_).(t_ : {1,2}|t_) = 3 \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testString() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME \"abc\" \\in STRING\n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES \"abc\" : STRING \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testBoolValue() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE \n" + "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE = TRUE \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testBoolValue2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE = FALSE \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE = FALSE \n" + "END";
-		compare(expected, module);
-	}
-}
+package de.tla2b.prettyprintb;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class BBuiltInsTest {
+
+	@Test
+	public void testBoolean() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE \\in BOOLEAN\n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE : BOOL \n" + "END";
+		compare(expected, module);
+	}
+	
+	@Ignore
+	@Test
+	public void testSetSummation() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS TLA2B\n" 
+				+ "ASSUME SetSummation({1,2}) = 3\n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES SIGMA(t_).(t_ : {1,2}|t_) = 3 \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testString() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME \"abc\" \\in STRING\n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES \"abc\" : STRING \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testBoolValue() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE \n" + "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE = TRUE \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testBoolValue2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE = FALSE \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE = FALSE \n" + "END";
+		compare(expected, module);
+	}
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/FunctionTest.java b/src/test/java/de/tla2b/prettyprintb/FunctionTest.java
index 351f4f1d03a1e8f01cf403ad922280b6a2e9203a..0a24a545881b5814218ab442eb807a7fdb33be56 100644
--- a/src/test/java/de/tla2b/prettyprintb/FunctionTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/FunctionTest.java
@@ -1,173 +1,173 @@
-package de.tla2b.prettyprintb;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class FunctionTest {
-
-	@Test
-	public void testFunctionConstructor() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = [x \\in {1} |-> TRUE = TRUE] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k :  INTEGER +-> BOOL & k = %x.(x : {1}| bool(TRUE = TRUE)) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testFunctionConstructor2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = [x,y \\in {1,2} |-> 1] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : INTEGER * INTEGER +-> INTEGER & k = %x,y.(x : {1,2} & y : {1,2}| 1) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testFunctionConstructor3() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> 1] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : INTEGER * BOOL +-> INTEGER & k = %x,y.(x : {1} & y : BOOL| 1) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testFunctionConstructor4() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = [<<x,y>> \\in {1} \\X {2} |-> x + y] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : INTEGER * INTEGER +-> INTEGER & k = %(x, y).((x,y) : {1} * {2} | x + y) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testFunctionConstructorTuple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = [a \\in {1}, <<b,c>> \\in {2} \\X {3} |-> a + b + c] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : INTEGER * (INTEGER * INTEGER) +-> INTEGER  & k = %(a, bc).(a : {1} & bc : {2} * {3} | (a + prj1(INTEGER, INTEGER)(bc)) + prj2(INTEGER, INTEGER)(bc)) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testFunctionConstructorSequence() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = [<<a>> \\in {<<1>>}, <<b,c>> \\in {2} \\X {3} |-> a + b + c] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : (INTEGER +-> INTEGER) * (INTEGER * INTEGER) +-> INTEGER  & k = %(a, bc).(a : {[1]} & bc : {2} * {3} | (a(1) + prj1(INTEGER, INTEGER)(bc)) + prj2(INTEGER, INTEGER)(bc)) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * recursive Function
-	 */
-
-	@Ignore
-	@Test
-	public void testRecursiveFunction() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "fact[n \\in {1,2}] == IF n = 0 THEN 1 ELSE n+ fact[n-1] \n"
-				+ "ASSUME k = fact /\\ fact[k2] = k3 \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k,k2,k3\n"
-				+ "PROPERTIES k : POW(INTEGER*INTEGER) & k2 : INTEGER & k3 : INTEGER \n"
-				+ " & k = fact & fact(k2) = k3 \n"
-				+ "DEFINITIONS IF_THEN_ELSE(P, a, b) == (%t_.(t_=TRUE & P = TRUE | a )\\/%t_.(t_=TRUE & not(P= TRUE) | b ))(TRUE); \n"
-				+ "fact == %n.(n : {1, 2}| IF_THEN_ELSE(bool(n = 0), 1, n + fact(n - 1))) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Function call
-	 */
-	@Test
-	public void testFunctionCall() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME [x,y \\in {1,2} |-> x+y] [1,2] = 3 \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES %x,y.(x : {1,2} & y : {1,2}| x + y) (1, 2) = 3 \n" 
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testFunctionCall2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME[x \\in {1} |-> TRUE][1] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES %x.(x : {1}| TRUE)(1) = TRUE\n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testDomain() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME DOMAIN[x \\in {1} |-> x] = {1} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES dom(%x.(x : {1}| x)) = {1}" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testSetOfFunction() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [BOOLEAN -> {1}] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
-				+ "PROPERTIES k : POW(BOOL +-> INTEGER) &  k = BOOL --> {1}" 
-				+ "END";
-		compare(expected, module);
-	}
-
-
-}
+package de.tla2b.prettyprintb;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class FunctionTest {
+
+	@Test
+	public void testFunctionConstructor() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = [x \\in {1} |-> TRUE = TRUE] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k :  INTEGER +-> BOOL & k = %x.(x : {1}| bool(TRUE = TRUE)) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testFunctionConstructor2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = [x,y \\in {1,2} |-> 1] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : INTEGER * INTEGER +-> INTEGER & k = %x,y.(x : {1,2} & y : {1,2}| 1) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testFunctionConstructor3() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> 1] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : INTEGER * BOOL +-> INTEGER & k = %x,y.(x : {1} & y : BOOL| 1) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testFunctionConstructor4() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = [<<x,y>> \\in {1} \\X {2} |-> x + y] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : INTEGER * INTEGER +-> INTEGER & k = %(x, y).((x,y) : {1} * {2} | x + y) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testFunctionConstructorTuple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = [a \\in {1}, <<b,c>> \\in {2} \\X {3} |-> a + b + c] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : INTEGER * (INTEGER * INTEGER) +-> INTEGER  & k = %(a, bc).(a : {1} & bc : {2} * {3} | (a + prj1(INTEGER, INTEGER)(bc)) + prj2(INTEGER, INTEGER)(bc)) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testFunctionConstructorSequence() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = [<<a>> \\in {<<1>>}, <<b,c>> \\in {2} \\X {3} |-> a + b + c] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : (INTEGER +-> INTEGER) * (INTEGER * INTEGER) +-> INTEGER  & k = %(a, bc).(a : {[1]} & bc : {2} * {3} | (a(1) + prj1(INTEGER, INTEGER)(bc)) + prj2(INTEGER, INTEGER)(bc)) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * recursive Function
+	 */
+
+	@Ignore
+	@Test
+	public void testRecursiveFunction() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "fact[n \\in {1,2}] == IF n = 0 THEN 1 ELSE n+ fact[n-1] \n"
+				+ "ASSUME k = fact /\\ fact[k2] = k3 \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k,k2,k3\n"
+				+ "PROPERTIES k : POW(INTEGER*INTEGER) & k2 : INTEGER & k3 : INTEGER \n"
+				+ " & k = fact & fact(k2) = k3 \n"
+				+ "DEFINITIONS IF_THEN_ELSE(P, a, b) == (%t_.(t_=TRUE & P = TRUE | a )\\/%t_.(t_=TRUE & not(P= TRUE) | b ))(TRUE); \n"
+				+ "fact == %n.(n : {1, 2}| IF_THEN_ELSE(bool(n = 0), 1, n + fact(n - 1))) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Function call
+	 */
+	@Test
+	public void testFunctionCall() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME [x,y \\in {1,2} |-> x+y] [1,2] = 3 \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES %x,y.(x : {1,2} & y : {1,2}| x + y) (1, 2) = 3 \n" 
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testFunctionCall2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME[x \\in {1} |-> TRUE][1] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES %x.(x : {1}| TRUE)(1) = TRUE\n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testDomain() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME DOMAIN[x \\in {1} |-> x] = {1} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES dom(%x.(x : {1}| x)) = {1}" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testSetOfFunction() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [BOOLEAN -> {1}] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
+				+ "PROPERTIES k : POW(BOOL +-> INTEGER) &  k = BOOL --> {1}" 
+				+ "END";
+		compare(expected, module);
+	}
+
+
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/LogicOperatorsTest.java b/src/test/java/de/tla2b/prettyprintb/LogicOperatorsTest.java
index 6cf231b2857f751ae0a2833146254af2f5a79ba1..cc0696be07952fad3c4dbd20ee0f610a2d8706d1 100644
--- a/src/test/java/de/tla2b/prettyprintb/LogicOperatorsTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/LogicOperatorsTest.java
@@ -1,184 +1,184 @@
-package de.tla2b.prettyprintb;
-
-import org.junit.Test;
-
-import static de.tla2b.util.TestUtil.compare;
-
-public class LogicOperatorsTest {
-
-	@Test
-	public void testEquality() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = (2 # 1)\n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
-				+ "PROPERTIES k : BOOL & k = bool(2 /= 1)\n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testEquality2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = TRUE\n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
-				+ "PROPERTIES k : BOOL & k = TRUE \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testEquality3() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE\n" + "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE = TRUE \n" + "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Logic Operators: \neg, \lnot, \land, \cl, \lor, \dl, \equiv, =&gt;
-	 */
-	@Test
-	public void testAnd() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = (FALSE \\land TRUE) \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : BOOL & k = bool(FALSE = TRUE & TRUE = TRUE) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testAnd2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE /\\ (TRUE \\/ FALSE) \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE = TRUE & (TRUE = TRUE or FALSE = TRUE) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Negation: ~, \neg, \lnot
-	 */
-	@Test
-	public void testNegation() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME \\lnot TRUE \n" + "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES not(TRUE = TRUE) \n" + "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Implication and Equivalence: =>, \equiv
-	 */
-
-	@Test
-	public void testImplication() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE /\\ (TRUE => FALSE) \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE = TRUE & (TRUE = TRUE => FALSE = TRUE) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testEquivalence() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE /\\ (TRUE <=> FALSE) \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE = TRUE & (TRUE = TRUE <=> FALSE = TRUE) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Quantification: \A x \in S : P or \E x \in S : P
-	 */
-	@Test
-	public void testUniversalQuantifier() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME \\A x,y \\in {1,2} : x = 0 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES !x,y.(x : {1, 2} & y : {1, 2} => x = 0) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testExistentialQuantifier() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME \\E x,y \\in {1,2} : x = 0 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES #x,y.(x : {1, 2} & y : {1, 2} & x = 0) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testExistentialQuantifierSequence() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME \\E <<x>> \\in {<<1>>} : x = 1 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES #x.([x] : {[1]} & x = 1) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testExistentialQuantifierTuple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME \\E <<a,b>> \\in {<<1,TRUE>>} : a = 1 /\\ b = TRUE  \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES #(a,b).((a,b) : {(1,TRUE)} & (a = 1 & b = TRUE)) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testExistentialQuantifierAll() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME \\E <<a,b>> \\in {<<1,TRUE>>}, <<c>> \\in {<<3>>}, d,e \\in {TRUE}:  a= 1 /\\ b = TRUE /\\ c = 3 /\\ d = TRUE /\\ e  \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES #(a,b,c,d,e).(((((a,b) : {(1,TRUE)} & [c] : {[3]}) & d : {TRUE}) & e : {TRUE}) & ((((a = 1 & b = TRUE) & c = 3) & d = TRUE) & e = TRUE)) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testQuantifier() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals, Sequences \n"
-				+ "CONSTANTS S \n"
-				+ "ASSUME S = {1,2,3} /\\  \\E u \\in Seq(S) : \\A s \\in S : \\E n \\in 1..Len(u) : u[n] = s \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS S\n"
-				+ "PROPERTIES S : POW(INTEGER) & (S = {1, 2, 3} & #u.(u : seq(S) & !s.(s : S => #n.(n : 1 .. size(u) & u(n) = s)))) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-}
+package de.tla2b.prettyprintb;
+
+import org.junit.Test;
+
+import static de.tla2b.util.TestUtil.compare;
+
+public class LogicOperatorsTest {
+
+	@Test
+	public void testEquality() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = (2 # 1)\n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
+				+ "PROPERTIES k : BOOL & k = bool(2 /= 1)\n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testEquality2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = TRUE\n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
+				+ "PROPERTIES k : BOOL & k = TRUE \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testEquality3() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE\n" + "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE = TRUE \n" + "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Logic Operators: \neg, \lnot, \land, \cl, \lor, \dl, \equiv, =&gt;
+	 */
+	@Test
+	public void testAnd() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = (FALSE \\land TRUE) \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : BOOL & k = bool(FALSE = TRUE & TRUE = TRUE) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testAnd2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE /\\ (TRUE \\/ FALSE) \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE = TRUE & (TRUE = TRUE or FALSE = TRUE) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Negation: ~, \neg, \lnot
+	 */
+	@Test
+	public void testNegation() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME \\lnot TRUE \n" + "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES not(TRUE = TRUE) \n" + "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Implication and Equivalence: =>, \equiv
+	 */
+
+	@Test
+	public void testImplication() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE /\\ (TRUE => FALSE) \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE = TRUE & (TRUE = TRUE => FALSE = TRUE) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testEquivalence() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE /\\ (TRUE <=> FALSE) \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE = TRUE & (TRUE = TRUE <=> FALSE = TRUE) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Quantification: \A x \in S : P or \E x \in S : P
+	 */
+	@Test
+	public void testUniversalQuantifier() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME \\A x,y \\in {1,2} : x = 0 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES !x,y.(x : {1, 2} & y : {1, 2} => x = 0) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testExistentialQuantifier() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME \\E x,y \\in {1,2} : x = 0 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES #x,y.(x : {1, 2} & y : {1, 2} & x = 0) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testExistentialQuantifierSequence() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME \\E <<x>> \\in {<<1>>} : x = 1 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES #x.([x] : {[1]} & x = 1) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testExistentialQuantifierTuple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME \\E <<a,b>> \\in {<<1,TRUE>>} : a = 1 /\\ b = TRUE  \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES #(a,b).((a,b) : {(1,TRUE)} & (a = 1 & b = TRUE)) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testExistentialQuantifierAll() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME \\E <<a,b>> \\in {<<1,TRUE>>}, <<c>> \\in {<<3>>}, d,e \\in {TRUE}:  a= 1 /\\ b = TRUE /\\ c = 3 /\\ d = TRUE /\\ e  \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES #(a,b,c,d,e).(((((a,b) : {(1,TRUE)} & [c] : {[3]}) & d : {TRUE}) & e : {TRUE}) & ((((a = 1 & b = TRUE) & c = 3) & d = TRUE) & e = TRUE)) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testQuantifier() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals, Sequences \n"
+				+ "CONSTANTS S \n"
+				+ "ASSUME S = {1,2,3} /\\  \\E u \\in Seq(S) : \\A s \\in S : \\E n \\in 1..Len(u) : u[n] = s \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS S\n"
+				+ "PROPERTIES S : POW(INTEGER) & (S = {1, 2, 3} & #u.(u : seq(S) & !s.(s : S => #n.(n : 1 .. size(u) & u(n) = s)))) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/PrecedenceTest.java b/src/test/java/de/tla2b/prettyprintb/PrecedenceTest.java
index bb851df8b3e810640ba686c85d8113c49b7c53e3..2d087c5625cb78c837a6c81f24478f45465605aa 100644
--- a/src/test/java/de/tla2b/prettyprintb/PrecedenceTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/PrecedenceTest.java
@@ -1,55 +1,55 @@
-package de.tla2b.prettyprintb;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Test;
-
-public class PrecedenceTest {
-
-	@Test
-	public void testPrecedence() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME 1 + (2 * 3) = 7 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 + 2 * 3 = 7 \n" + "END";
-		compare(expected, module);
-	}
-
-	
-	@Test
-	public void testPrecedence2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME (1 + 2) * 3 = 9 \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES (1 + 2) * 3 = 9 \n" + "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testPrecedence3() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME (1 + 2) + 3 = 6 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 + 2 + 3 = 6 \n" + "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testPrecedence4() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME 1 + (2 + 3) = 6 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 + (2 + 3) = 6 \n" + "END";
-		compare(expected, module);
-	}
-
-}
+package de.tla2b.prettyprintb;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Test;
+
+public class PrecedenceTest {
+
+	@Test
+	public void testPrecedence() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME 1 + (2 * 3) = 7 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 + 2 * 3 = 7 \n" + "END";
+		compare(expected, module);
+	}
+
+	
+	@Test
+	public void testPrecedence2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME (1 + 2) * 3 = 9 \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES (1 + 2) * 3 = 9 \n" + "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testPrecedence3() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME (1 + 2) + 3 = 6 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 + 2 + 3 = 6 \n" + "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testPrecedence4() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME 1 + (2 + 3) = 6 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 + (2 + 3) = 6 \n" + "END";
+		compare(expected, module);
+	}
+
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/RecordTest.java b/src/test/java/de/tla2b/prettyprintb/RecordTest.java
index c837c85133974086ba250dd490aaf7c336c41b33..acb40b2ac1acf0fe4643569629ac88a5c2250160 100644
--- a/src/test/java/de/tla2b/prettyprintb/RecordTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/RecordTest.java
@@ -1,127 +1,127 @@
-package de.tla2b.prettyprintb;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import util.ToolIO;
-
-public class RecordTest {
-	static {
-		ToolIO.setMode(ToolIO.TOOL);
-	}
-
-	/*
-	 * Set of Records: [L1 : e1, L2 : e2]
-	 */
-	@Test
-	public void testStruct() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [a : {1}, b : BOOLEAN] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : POW(struct(a:INTEGER, b:BOOL)) & k = struct(a : {1}, b : BOOL) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-
-	/*
-	 * Record: [L1 |-> e1, L2 |-> e2]
-	 */
-	@Test
-	public void testRecord() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [a |-> 1, b |-> TRUE] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : struct(a:INTEGER, b:BOOL) & k = rec(a : 1, b : TRUE) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	
-	@Ignore
-	@Test
-	public void testRecordExpansion() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME [a|-> 2] = [a |-> 1, b |-> \"abc\"] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES rec(a : 2,b : \"\") = rec(a : 1,b : \"abc\") \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Record Select: r.c
-	 */
-	@Test
-	public void testRecordSelect() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME [a |-> 1, b |-> TRUE].a = 1 \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES rec(a : 1, b : TRUE)'a = 1\n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testRecordSelect2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [a |-> 1, b |-> TRUE] /\\ k.b \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : struct(a:INTEGER, b:BOOL) & (k = rec(a : 1, b : TRUE) & k'b = TRUE) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Record Except
-	 */
-	@Test
-	public void testRecordExcept() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [a |-> 1, b |-> TRUE] /\\ k2 = [k EXCEPT !.a = 2] \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k, k2\n"
-				+ "PROPERTIES k : struct(a:INTEGER, b:BOOL) & k2 : struct(a:INTEGER, b:BOOL) & (k = rec(a : 1, b : TRUE) & k2 = rec(a : 2, b : k'b)) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Record Except @
-	 */
-	@Test
-	public void testRecordExceptAt() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [a |-> 1, b |-> TRUE] /\\ k2 = [k EXCEPT !.a = @ + 1] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k, k2\n"
-				+ "PROPERTIES k : struct(a:INTEGER, b:BOOL) & k2 : struct(a:INTEGER, b:BOOL) & (k = rec(a : 1, b : TRUE) & k2 = rec(a : k'a + 1, b : k'b)) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-}
+package de.tla2b.prettyprintb;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import util.ToolIO;
+
+public class RecordTest {
+	static {
+		ToolIO.setMode(ToolIO.TOOL);
+	}
+
+	/*
+	 * Set of Records: [L1 : e1, L2 : e2]
+	 */
+	@Test
+	public void testStruct() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [a : {1}, b : BOOLEAN] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : POW(struct(a:INTEGER, b:BOOL)) & k = struct(a : {1}, b : BOOL) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+
+	/*
+	 * Record: [L1 |-> e1, L2 |-> e2]
+	 */
+	@Test
+	public void testRecord() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [a |-> 1, b |-> TRUE] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : struct(a:INTEGER, b:BOOL) & k = rec(a : 1, b : TRUE) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	
+	@Ignore
+	@Test
+	public void testRecordExpansion() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME [a|-> 2] = [a |-> 1, b |-> \"abc\"] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES rec(a : 2,b : \"\") = rec(a : 1,b : \"abc\") \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Record Select: r.c
+	 */
+	@Test
+	public void testRecordSelect() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME [a |-> 1, b |-> TRUE].a = 1 \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES rec(a : 1, b : TRUE)'a = 1\n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testRecordSelect2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [a |-> 1, b |-> TRUE] /\\ k.b \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : struct(a:INTEGER, b:BOOL) & (k = rec(a : 1, b : TRUE) & k'b = TRUE) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Record Except
+	 */
+	@Test
+	public void testRecordExcept() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [a |-> 1, b |-> TRUE] /\\ k2 = [k EXCEPT !.a = 2] \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k, k2\n"
+				+ "PROPERTIES k : struct(a:INTEGER, b:BOOL) & k2 : struct(a:INTEGER, b:BOOL) & (k = rec(a : 1, b : TRUE) & k2 = rec(a : 2, b : k'b)) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Record Except @
+	 */
+	@Test
+	public void testRecordExceptAt() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [a |-> 1, b |-> TRUE] /\\ k2 = [k EXCEPT !.a = @ + 1] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k, k2\n"
+				+ "PROPERTIES k : struct(a:INTEGER, b:BOOL) & k2 : struct(a:INTEGER, b:BOOL) & (k = rec(a : 1, b : TRUE) & k2 = rec(a : k'a + 1, b : k'b)) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/SetsTest.java b/src/test/java/de/tla2b/prettyprintb/SetsTest.java
index cbc5b000b837284dcd905066a64484510b9305ad..f01df8b44a02c19425dde7231fee76caa020d9ea 100644
--- a/src/test/java/de/tla2b/prettyprintb/SetsTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/SetsTest.java
@@ -1,217 +1,217 @@
-package de.tla2b.prettyprintb;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Test;
-
-public class SetsTest {
-
-	@Test
-	public void testSetEnumeration() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = {1,2,3}\n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
-				+ "PROPERTIES k : POW(INTEGER) & k = {1,2,3} \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testSetEnumeration2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = {TRUE, 1 = 1}\n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
-				+ "PROPERTIES k : POW(BOOL) & k = {TRUE, bool(1=1)} \n" + "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Element of: \in, \notin
-	 */
-	@Test
-	public void testMemberOf() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE \\in BOOLEAN \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE : BOOL \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testMemberOf2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 \\in {1,2,3} \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 : {1,2,3} \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testNotMemberOf() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 \\notin {} \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n" + "PROPERTIES 1 /: {} \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * set operators like difference, union, intersection: \setdiff, \cup, \cap
-	 */
-	@Test
-	public void testSetDifference() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {1} = {1,2} \\ {1} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {1} = {1,2} - {1} \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testCup() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {1,2} = {1} \\cup {2} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {1,2} = {1} \\/ {2} \n" + "END";
-		compare(expected, module);
-		}
-
-	@Test
-	public void testCap() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {1} = {1,2} \\cap {2} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {1} = {1,2} /\\ {2} \n" + "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Subseteq: subset or equal
-	 */
-	@Test
-	public void testSubsteq() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE = ({1} \\subseteq {1,2}) \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE = bool({1} <: {1,2}) \n" + "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * SUBSET: conforms POW in B
-	 */
-	@Test
-	public void testSubset() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {{},{1}} = SUBSET {1,2} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {{},{1}} = POW({1,2}) \n" + "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * UNION
-	 */
-	@Test
-	public void testUnion() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME UNION {{1},{2}} = {1,2} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES union({{1},{2}}) = {1,2} \n" + "END";
-		compare(expected, module);
-	}
-	 
-	/*
-	* Set Constructor
-	 */
-	@Test
-	public void testConstructor1() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {x \\in {1,2} : x = 1} = {1} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {x | x : {1,2} & x = 1} = {1} \n" + "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testConstructor1Tuple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {<<a,b>> \\in {<<1,2>>} : a = 1 /\\ b = 2} = {<<1,2>>} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {a,b | (a,b) : {(1,2)} & (a = 1 & b = 2)} = {(1,2)} \n" + "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testConstructor1Tuple3Elements() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {<<a,b,c>> \\in {<<1,2,3>>} : a = 1 /\\ b = 2} = {<<1,2,3>>} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {a,b,c | (a,b,c) : {(1,2,3)} & (a = 1 & b = 2)} = {(1,2,3)} \n" + "END";
-		compare(expected, module);
-	}
-
-
-	@Test
-	public void testConstructor2Simple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME  {x + x :  x \\in {1}} = {2} \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES UNION(x).(x : {1}| {x + x}) = {2} \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testConstructor2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME  {x + y:  x \\in {1}, y \\in {2} } = {3} \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES UNION(x,y).(x : {1} & y : {2} | {x+y}) = {3} \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testConstructor2Tuple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME  {x + y:  <<x,y>> \\in {<<1,2>>}} = {3} \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES UNION(x,y).((x|->y) : {(1|->2)} | {x + y}) = {3} \n"
-				+ "END";
-		compare(expected, module);
-	}
-}
+package de.tla2b.prettyprintb;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Test;
+
+public class SetsTest {
+
+	@Test
+	public void testSetEnumeration() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = {1,2,3}\n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
+				+ "PROPERTIES k : POW(INTEGER) & k = {1,2,3} \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testSetEnumeration2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = {TRUE, 1 = 1}\n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n" + "CONSTANTS k\n"
+				+ "PROPERTIES k : POW(BOOL) & k = {TRUE, bool(1=1)} \n" + "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Element of: \in, \notin
+	 */
+	@Test
+	public void testMemberOf() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE \\in BOOLEAN \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE : BOOL \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testMemberOf2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 \\in {1,2,3} \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 : {1,2,3} \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testNotMemberOf() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 \\notin {} \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n" + "PROPERTIES 1 /: {} \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * set operators like difference, union, intersection: \setdiff, \cup, \cap
+	 */
+	@Test
+	public void testSetDifference() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {1} = {1,2} \\ {1} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {1} = {1,2} - {1} \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testCup() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {1,2} = {1} \\cup {2} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {1,2} = {1} \\/ {2} \n" + "END";
+		compare(expected, module);
+		}
+
+	@Test
+	public void testCap() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {1} = {1,2} \\cap {2} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {1} = {1,2} /\\ {2} \n" + "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Subseteq: subset or equal
+	 */
+	@Test
+	public void testSubsteq() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE = ({1} \\subseteq {1,2}) \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE = bool({1} <: {1,2}) \n" + "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * SUBSET: conforms POW in B
+	 */
+	@Test
+	public void testSubset() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {{},{1}} = SUBSET {1,2} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {{},{1}} = POW({1,2}) \n" + "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * UNION
+	 */
+	@Test
+	public void testUnion() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME UNION {{1},{2}} = {1,2} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES union({{1},{2}}) = {1,2} \n" + "END";
+		compare(expected, module);
+	}
+	 
+	/*
+	* Set Constructor
+	 */
+	@Test
+	public void testConstructor1() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {x \\in {1,2} : x = 1} = {1} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {x | x : {1,2} & x = 1} = {1} \n" + "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testConstructor1Tuple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {<<a,b>> \\in {<<1,2>>} : a = 1 /\\ b = 2} = {<<1,2>>} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {a,b | (a,b) : {(1,2)} & (a = 1 & b = 2)} = {(1,2)} \n" + "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testConstructor1Tuple3Elements() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {<<a,b,c>> \\in {<<1,2,3>>} : a = 1 /\\ b = 2} = {<<1,2,3>>} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {a,b,c | (a,b,c) : {(1,2,3)} & (a = 1 & b = 2)} = {(1,2,3)} \n" + "END";
+		compare(expected, module);
+	}
+
+
+	@Test
+	public void testConstructor2Simple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME  {x + x :  x \\in {1}} = {2} \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES UNION(x).(x : {1}| {x + x}) = {2} \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testConstructor2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME  {x + y:  x \\in {1}, y \\in {2} } = {3} \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES UNION(x,y).(x : {1} & y : {2} | {x+y}) = {3} \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testConstructor2Tuple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME  {x + y:  <<x,y>> \\in {<<1,2>>}} = {3} \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES UNION(x,y).((x|->y) : {(1|->2)} | {x + y}) = {3} \n"
+				+ "END";
+		compare(expected, module);
+	}
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/TupleTest.java b/src/test/java/de/tla2b/prettyprintb/TupleTest.java
index 8528ef4f0ecd7460c330f35f825fbf1f76fa63b7..c516bf98f3cc0a313c6b8e8327033e8d74952e69 100644
--- a/src/test/java/de/tla2b/prettyprintb/TupleTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/TupleTest.java
@@ -1,159 +1,159 @@
-package de.tla2b.prettyprintb;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class TupleTest {
-	
-	@Test
-	public void testTuple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME <<TRUE,1,TRUE>> /= <<TRUE,1,TRUE>>\n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES (TRUE,1,TRUE) /= (TRUE,1,TRUE) \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testCartesianProduct() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME <<TRUE,1>> \\in BOOLEAN \\X {1} \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES (TRUE,1) : BOOL*{1} \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testCartesianProduct2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = BOOLEAN \\X ({1} \\X BOOLEAN) \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k\n"
-				+ "PROPERTIES k : POW(BOOL * (INTEGER * BOOL)) & k = BOOL*({1}*BOOL) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testTupleFunctionCall() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = <<1,TRUE>>[1] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 = prj1(INTEGER, BOOL)((1,TRUE)) \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testTupleFunctionCall2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME TRUE = <<1,TRUE>>[2] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES TRUE = prj2(INTEGER, BOOL)((1,TRUE)) \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testTupleFunctionCall3() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = <<1,TRUE,1>>[3] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 = prj2(INTEGER * BOOL, INTEGER)((1,TRUE,1)) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testTupleFunctionCall4() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = <<1,TRUE,1>>[1] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 = prj1(INTEGER, BOOL)((prj1(INTEGER * BOOL, INTEGER)((1,TRUE,1)))) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testTupleFunctionCall5() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = <<1,TRUE,2>>[1] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 = prj1(INTEGER, BOOL)((prj1(INTEGER * BOOL, INTEGER)((1,TRUE,2)))) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testTupleFunctionCall6() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = <<1,TRUE,2,FALSE>>[1] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 = prj1(INTEGER, BOOL)((prj1(INTEGER * BOOL, INTEGER)((prj1((INTEGER * BOOL) * INTEGER, BOOL)((1,TRUE,2,FALSE)))))) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testDomainOfTuple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {1,2,3} = DOMAIN <<\"a\", \"b\", \"c\">> \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {1, 2, 3} = dom([\"a\", \"b\", \"c\"]) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testTupleCartesianProduct() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME {<<1, 4>>, <<2,3>>} \\notin SUBSET ({1,2} \\X {3,4}) \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {(1,4), (2,3)} /: POW({1, 2} * {3, 4}) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Ignore
-	@Test
-	public void testAtTuple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k =[i \\in Nat |-> <<1, \"s\">>] /\\ k2 = [ k EXCEPT ![22] = <<@[1],\"d\">>] \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "PROPERTIES \n"
-				+ "(k : INTEGER +-> INTEGER * STRING & k2 : INTEGER +-> INTEGER * STRING)"
-				+ " & (k = %(i).(i : NATURAL | (1,\"s\")) & k2 = k <+ {(22,( prj1(INTEGER,STRING)(k(22)),\"d\") )}) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	
-}
+package de.tla2b.prettyprintb;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class TupleTest {
+	
+	@Test
+	public void testTuple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME <<TRUE,1,TRUE>> /= <<TRUE,1,TRUE>>\n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES (TRUE,1,TRUE) /= (TRUE,1,TRUE) \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testCartesianProduct() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME <<TRUE,1>> \\in BOOLEAN \\X {1} \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES (TRUE,1) : BOOL*{1} \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testCartesianProduct2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = BOOLEAN \\X ({1} \\X BOOLEAN) \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k\n"
+				+ "PROPERTIES k : POW(BOOL * (INTEGER * BOOL)) & k = BOOL*({1}*BOOL) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testTupleFunctionCall() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = <<1,TRUE>>[1] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 = prj1(INTEGER, BOOL)((1,TRUE)) \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testTupleFunctionCall2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME TRUE = <<1,TRUE>>[2] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES TRUE = prj2(INTEGER, BOOL)((1,TRUE)) \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testTupleFunctionCall3() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = <<1,TRUE,1>>[3] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 = prj2(INTEGER * BOOL, INTEGER)((1,TRUE,1)) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testTupleFunctionCall4() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = <<1,TRUE,1>>[1] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 = prj1(INTEGER, BOOL)((prj1(INTEGER * BOOL, INTEGER)((1,TRUE,1)))) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testTupleFunctionCall5() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = <<1,TRUE,2>>[1] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 = prj1(INTEGER, BOOL)((prj1(INTEGER * BOOL, INTEGER)((1,TRUE,2)))) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testTupleFunctionCall6() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = <<1,TRUE,2,FALSE>>[1] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 = prj1(INTEGER, BOOL)((prj1(INTEGER * BOOL, INTEGER)((prj1((INTEGER * BOOL) * INTEGER, BOOL)((1,TRUE,2,FALSE)))))) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testDomainOfTuple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {1,2,3} = DOMAIN <<\"a\", \"b\", \"c\">> \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {1, 2, 3} = dom([\"a\", \"b\", \"c\"]) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testTupleCartesianProduct() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME {<<1, 4>>, <<2,3>>} \\notin SUBSET ({1,2} \\X {3,4}) \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {(1,4), (2,3)} /: POW({1, 2} * {3, 4}) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Ignore
+	@Test
+	public void testAtTuple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k =[i \\in Nat |-> <<1, \"s\">>] /\\ k2 = [ k EXCEPT ![22] = <<@[1],\"d\">>] \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "PROPERTIES \n"
+				+ "(k : INTEGER +-> INTEGER * STRING & k2 : INTEGER +-> INTEGER * STRING)"
+				+ " & (k = %(i).(i : NATURAL | (1,\"s\")) & k2 = k <+ {(22,( prj1(INTEGER,STRING)(k(22)),\"d\") )}) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/VariablesTest.java b/src/test/java/de/tla2b/prettyprintb/VariablesTest.java
index 1188100abd2d06c0b1c6f96b01e58236c8521551..6f874eadb3663519e560807aae510209aa26502e 100644
--- a/src/test/java/de/tla2b/prettyprintb/VariablesTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/VariablesTest.java
@@ -1,25 +1,25 @@
-package de.tla2b.prettyprintb;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Test;
-
-public class VariablesTest {
-
-	@Test
-	public void testVariables() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "VARIABLES x, y \n"
-				+ "Init == x = 1 /\\ y = 1 \n"
-				+ "=================================";
-		
-		final String expected = "MACHINE Testing\n"
-				+ "VARIABLES x, y\n"
-				+ "INVARIANT x : INTEGER & y : INTEGER \n"
-				+ "INITIALISATION  x, y:(x = 1 & y = 1) \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-}
+package de.tla2b.prettyprintb;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Test;
+
+public class VariablesTest {
+
+	@Test
+	public void testVariables() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "VARIABLES x, y \n"
+				+ "Init == x = 1 /\\ y = 1 \n"
+				+ "=================================";
+		
+		final String expected = "MACHINE Testing\n"
+				+ "VARIABLES x, y\n"
+				+ "INVARIANT x : INTEGER & y : INTEGER \n"
+				+ "INITIALISATION  x, y:(x = 1 & y = 1) \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/standardmodules/ModuleFiniteSetsTest.java b/src/test/java/de/tla2b/prettyprintb/standardmodules/ModuleFiniteSetsTest.java
index 8c64d97626eb5ea3af1c88bed35d16db6ef50721..22453579c52df6308a52f0e2dc1791272c9da51e 100644
--- a/src/test/java/de/tla2b/prettyprintb/standardmodules/ModuleFiniteSetsTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/standardmodules/ModuleFiniteSetsTest.java
@@ -1,44 +1,44 @@
-package de.tla2b.prettyprintb.standardmodules;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Test;
-
-
-
-public class ModuleFiniteSetsTest {
-
-	@Test
-	public void testIsFiniteSet() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "ASSUME IsFiniteSet({1,2,3}) \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES {1,2,3} : FIN({1,2,3}) \n" + "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testIsFiniteSet2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets, Naturals \n"
-				+ "ASSUME IsFiniteSet(Nat) \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES NATURAL : FIN(NATURAL) \n" + "END";
-		compare(expected, module);
-	}
-	
-	@Test
-	public void testCardinality() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets, Naturals \n"
-				+ "ASSUME Cardinality({1,2,3}) = 3 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES card({1,2,3}) = 3 \n" + "END";
-		compare(expected, module);
-	}
-	
-}
+package de.tla2b.prettyprintb.standardmodules;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Test;
+
+
+
+public class ModuleFiniteSetsTest {
+
+	@Test
+	public void testIsFiniteSet() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "ASSUME IsFiniteSet({1,2,3}) \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES {1,2,3} : FIN({1,2,3}) \n" + "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testIsFiniteSet2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets, Naturals \n"
+				+ "ASSUME IsFiniteSet(Nat) \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES NATURAL : FIN(NATURAL) \n" + "END";
+		compare(expected, module);
+	}
+	
+	@Test
+	public void testCardinality() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets, Naturals \n"
+				+ "ASSUME Cardinality({1,2,3}) = 3 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES card({1,2,3}) = 3 \n" + "END";
+		compare(expected, module);
+	}
+	
+}
diff --git a/src/test/java/de/tla2b/prettyprintb/standardmodules/ModuleNaturalsTest.java b/src/test/java/de/tla2b/prettyprintb/standardmodules/ModuleNaturalsTest.java
index 58cc1c4ad7d97def206990c1dfe90bc416a64a72..8503b2e77c58a35514e05d71ba36796fdf40d13a 100644
--- a/src/test/java/de/tla2b/prettyprintb/standardmodules/ModuleNaturalsTest.java
+++ b/src/test/java/de/tla2b/prettyprintb/standardmodules/ModuleNaturalsTest.java
@@ -1,95 +1,95 @@
-package de.tla2b.prettyprintb.standardmodules;
-
-import static de.tla2b.util.TestUtil.compare;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-
-
-public class ModuleNaturalsTest {
-
-	/*
-	 *  >, <, <=, >=
-	 */
-	
-	@Test
-	public void testCompareOperators() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME 1 < 2 /\\ 2 > 1 /\\ 1 <= 1 /\\ 1 >= 1 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 < 2 & 2 > 1 & 1 <= 1 & 1 >= 1 \n" + "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testCompareOperators2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME (1 < 2) = (2 > 1) /\\ (1 <= 1) = (1 >= 1) \n"
-				+ "=================================";
-
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES bool(1 < 2) = bool(2 > 1) & bool(1 <= 1) = bool(1 >= 1) \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Arithmetic operator: +, -, *, %, ^ (\div operator is not tested)
-	 */
-	@Test
-	public void testArithmeticOperators() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME 1 + 2 = 4-1 /\\ 1 * 2 = 2 /\\  1 ^ 1 = 1 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 + 2 = 4 - 1 & 1 * 2 = 2 & 1 ** 1 = 1 \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	/*
-	 * Interval operator: x .. y 
-	 */
-	@Test
-	public void testDotDot() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME 1 \\in 1 .. 2 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 : 1..2 \n"
-				+ "END";
-		compare(expected, module);
-	}
-
-	@Test
-	public void testNat() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME 1 \\in Nat \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES 1 : NATURAL \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-	@Ignore
-	@Test
-	public void testMod() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals, Integers \n"
-				+ "ASSUME (-3) % 2 = 1 \n"
-				+ "=================================";
-		final String expected = "MACHINE Testing\n"
-				+ "PROPERTIES -3 - 2 * (-3 \\div 2) = 1 \n"
-				+ "END";
-		compare(expected, module);
-	}
-	
-}
+package de.tla2b.prettyprintb.standardmodules;
+
+import static de.tla2b.util.TestUtil.compare;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+
+public class ModuleNaturalsTest {
+
+	/*
+	 *  >, <, <=, >=
+	 */
+	
+	@Test
+	public void testCompareOperators() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME 1 < 2 /\\ 2 > 1 /\\ 1 <= 1 /\\ 1 >= 1 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 < 2 & 2 > 1 & 1 <= 1 & 1 >= 1 \n" + "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testCompareOperators2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME (1 < 2) = (2 > 1) /\\ (1 <= 1) = (1 >= 1) \n"
+				+ "=================================";
+
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES bool(1 < 2) = bool(2 > 1) & bool(1 <= 1) = bool(1 >= 1) \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Arithmetic operator: +, -, *, %, ^ (\div operator is not tested)
+	 */
+	@Test
+	public void testArithmeticOperators() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME 1 + 2 = 4-1 /\\ 1 * 2 = 2 /\\  1 ^ 1 = 1 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 + 2 = 4 - 1 & 1 * 2 = 2 & 1 ** 1 = 1 \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	/*
+	 * Interval operator: x .. y 
+	 */
+	@Test
+	public void testDotDot() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME 1 \\in 1 .. 2 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 : 1..2 \n"
+				+ "END";
+		compare(expected, module);
+	}
+
+	@Test
+	public void testNat() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME 1 \\in Nat \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES 1 : NATURAL \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+	@Ignore
+	@Test
+	public void testMod() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals, Integers \n"
+				+ "ASSUME (-3) % 2 = 1 \n"
+				+ "=================================";
+		final String expected = "MACHINE Testing\n"
+				+ "PROPERTIES -3 - 2 * (-3 \\div 2) = 1 \n"
+				+ "END";
+		compare(expected, module);
+	}
+	
+}
diff --git a/src/test/java/de/tla2b/typechecking/BBuiltInsTest.java b/src/test/java/de/tla2b/typechecking/BBuiltInsTest.java
index 5a9954b5b3e7ac06d56e250f8f94fbfb270c6420..1268d5f5b32d94bb4f94ede9217c85b2f538d1ce 100644
--- a/src/test/java/de/tla2b/typechecking/BBuiltInsTest.java
+++ b/src/test/java/de/tla2b/typechecking/BBuiltInsTest.java
@@ -1,86 +1,86 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class BBuiltInsTest {
-
-
-	/*
-	 * BOOLEAN
-	 */
-	@Test  
-	public void testBoolean() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = BOOLEAN \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k"));
-	}
-	
-	@Test (expected = TypeErrorException.class)  
-	public void testBooleanException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME 1 \\in BOOLEAN \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k"));
-	}
-	
-
-	/*
-	 * String
-	 */
-	@Test  
-	public void testString() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = STRING \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(STRING)", t.getConstantType("k"));
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testUnifyErrorString() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME 1 = STRING \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	/*
-	 * Bool value: TRUE, FALSE
-	 */
-	@Test  
-	public void testBoolValue() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = TRUE \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k"));
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testUnifyErrorBoolValue() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = TRUE \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	
-	
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class BBuiltInsTest {
+
+
+	/*
+	 * BOOLEAN
+	 */
+	@Test  
+	public void testBoolean() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = BOOLEAN \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k"));
+	}
+	
+	@Test (expected = TypeErrorException.class)  
+	public void testBooleanException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME 1 \\in BOOLEAN \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k"));
+	}
+	
+
+	/*
+	 * String
+	 */
+	@Test  
+	public void testString() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = STRING \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(STRING)", t.getConstantType("k"));
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testUnifyErrorString() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME 1 = STRING \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	/*
+	 * Bool value: TRUE, FALSE
+	 */
+	@Test  
+	public void testBoolValue() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = TRUE \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k"));
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testUnifyErrorBoolValue() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = TRUE \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	
+	
+}
diff --git a/src/test/java/de/tla2b/typechecking/ConfigTest.java b/src/test/java/de/tla2b/typechecking/ConfigTest.java
index 2968bcef481f2ce892155b671794e09c86fe807e..8729051e5ca00dccb747c3441df2736ec0cda80e 100644
--- a/src/test/java/de/tla2b/typechecking/ConfigTest.java
+++ b/src/test/java/de/tla2b/typechecking/ConfigTest.java
@@ -1,38 +1,38 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class ConfigTest {
-
-	@Test
-	public void TestConAssignment() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n" + "=================================";
-		final String config = "CONSTANTS k = 1";
-		TestTypeChecker t = TestUtil.typeCheckString(module, config);
-		assertEquals("INTEGER", t.getConstantType("k").toString());
-	}
-
-	@Test
-	public void TestConOverride() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "foo == 1\n"
-				+ "ASSUME k2 = k\n"
-				+ "=================================";
-		final String config = "CONSTANTS k <- foo";
-		TestTypeChecker t = TestUtil.typeCheckString(module, config);
-		assertEquals("INTEGER", t.getConstantType("k2").toString());
-	}
-
-	// TODO DefOverriding
-
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class ConfigTest {
+
+	@Test
+	public void TestConAssignment() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n" + "=================================";
+		final String config = "CONSTANTS k = 1";
+		TestTypeChecker t = TestUtil.typeCheckString(module, config);
+		assertEquals("INTEGER", t.getConstantType("k").toString());
+	}
+
+	@Test
+	public void TestConOverride() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "foo == 1\n"
+				+ "ASSUME k2 = k\n"
+				+ "=================================";
+		final String config = "CONSTANTS k <- foo";
+		TestTypeChecker t = TestUtil.typeCheckString(module, config);
+		assertEquals("INTEGER", t.getConstantType("k2").toString());
+	}
+
+	// TODO DefOverriding
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/ConstantTypesTest.java b/src/test/java/de/tla2b/typechecking/ConstantTypesTest.java
index 998607a9fda4254c8d92ae4abb29bbe423bb643a..26544543bfad5b9905baa4b1a1955248b37d6968 100644
--- a/src/test/java/de/tla2b/typechecking/ConstantTypesTest.java
+++ b/src/test/java/de/tla2b/typechecking/ConstantTypesTest.java
@@ -1,103 +1,103 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class ConstantTypesTest {
-
-	@Test
-	public void test1() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = 1 /\\ k2 = k\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void test2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = k2 /\\ k = 1\n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void test3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = k2 /\\ k = k3 /\\ k3 = 1\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k3"));
-	}
-
-	@Test
-	public void worstCaseUnification() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS a, b, c, d, e, f, g, h \n"
-				+ "ASSUME a = b \n"
-				+ "ASSUME c = d \n"
-				+ "ASSUME a = c \n"
-				+ "ASSUME e = f \n"
-				+ "ASSUME g = h \n"
-				+ "ASSUME e = g \n"
-				+ "ASSUME a = e \n"
-				+ "ASSUME h = 1 \n" 
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("a"));
-		assertEquals("INTEGER", t.getConstantType("b"));
-		assertEquals("INTEGER", t.getConstantType("c"));
-		assertEquals("INTEGER", t.getConstantType("d"));
-		assertEquals("INTEGER", t.getConstantType("e"));
-		assertEquals("INTEGER", t.getConstantType("f"));
-		assertEquals("INTEGER", t.getConstantType("g"));
-		assertEquals("INTEGER", t.getConstantType("h"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void prime() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "Next ==  1' = 1 \n" + "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void prime2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "foo ==  k' = 1 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test
-	public void ifThenElse() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k = IF 1 = 1 THEN k2 ELSE 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class ConstantTypesTest {
+
+	@Test
+	public void test1() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = 1 /\\ k2 = k\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void test2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = k2 /\\ k = 1\n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void test3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = k2 /\\ k = k3 /\\ k3 = 1\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k3"));
+	}
+
+	@Test
+	public void worstCaseUnification() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS a, b, c, d, e, f, g, h \n"
+				+ "ASSUME a = b \n"
+				+ "ASSUME c = d \n"
+				+ "ASSUME a = c \n"
+				+ "ASSUME e = f \n"
+				+ "ASSUME g = h \n"
+				+ "ASSUME e = g \n"
+				+ "ASSUME a = e \n"
+				+ "ASSUME h = 1 \n" 
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("a"));
+		assertEquals("INTEGER", t.getConstantType("b"));
+		assertEquals("INTEGER", t.getConstantType("c"));
+		assertEquals("INTEGER", t.getConstantType("d"));
+		assertEquals("INTEGER", t.getConstantType("e"));
+		assertEquals("INTEGER", t.getConstantType("f"));
+		assertEquals("INTEGER", t.getConstantType("g"));
+		assertEquals("INTEGER", t.getConstantType("h"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void prime() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "Next ==  1' = 1 \n" + "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void prime2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "foo ==  k' = 1 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test
+	public void ifThenElse() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k = IF 1 = 1 THEN k2 ELSE 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/DefinitionsTest.java b/src/test/java/de/tla2b/typechecking/DefinitionsTest.java
index e1a65ae29e3ab0f3cec2a7e5e3eacff8c0ec399f..336fe4fce12414cbadc6588eb5848d5c388c98bb 100644
--- a/src/test/java/de/tla2b/typechecking/DefinitionsTest.java
+++ b/src/test/java/de/tla2b/typechecking/DefinitionsTest.java
@@ -1,227 +1,227 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class DefinitionsTest {
-
-	/*
-	 * Definition: foo(a,b) == e
-	 */
-	@Test
-	public void testDefinition() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "foo(a,b) ==  a = 1 /\\ b = TRUE \n"
-				+ "Next ==  foo(1,TRUE)  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertEquals("INTEGER", t.getDefinitionParamType("foo", "a"));
-		assertEquals("BOOL", t.getDefinitionParamType("foo", "b"));
-	}
-
-	@Test
-	public void testDefinition2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "foo(a,b) ==  a = k /\\ b = k2 \n"
-				+ "bar == k = 1 /\\ k2 = TRUE \n"
-				+ "ASSUME foo(1,FALSE) /\\ bar \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertEquals("INTEGER", t.getDefinitionParamType("foo", "a"));
-		assertEquals("BOOL", t.getDefinitionParamType("foo", "b"));
-		assertEquals("BOOL", t.getDefinitionType("bar"));
-
-	}
-
-	@Test
-	public void testDefinition3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "foo ==  k \n"
-				+ "bar == foo = 1 \n"
-				+ "ASSUME bar \n" + "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getDefinitionType("foo"));
-		assertEquals("BOOL", t.getDefinitionType("bar"));
-	}
-
-	@Test
-	public void testDefinition4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "foo(var, value) ==  var = value \n"
-				+ "ASSUME foo(k,1) /\\ foo(k2,TRUE)  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("BOOL", t.getConstantType("k2"));
-	}
-
-	/*
-	 * Definition Call
-	 */
-
-	@Test
-	public void testDefinitionCall() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "foo(a) ==  TRUE \n"
-				+ "bar == foo(1) \n"
-				+ "ASSUME bar \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertEquals("BOOL", t.getDefinitionType("bar"));
-	}
-
-	@Test
-	public void testDefinitionCall2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "foo(a) ==  a \n"
-				+ "bar == foo(1) \n"
-				+ "baz == foo(TRUE) \n"
-				+ "ASSUME baz /\\ bar = bar"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertTrue(t.getDefinitionType("foo").startsWith("UNTYPED"));
-		assertEquals("INTEGER", t.getDefinitionType("bar"));
-		assertEquals("BOOL", t.getDefinitionType("baz"));
-	}
-
-	@Test
-	public void testDefinitionCall3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "foo(a) ==  a \n"
-				+ "bar == foo(1) \n"
-				+ "baz == k = foo(k2) /\\ k2 = bar  \n"
-				+ "ASSUME baz \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertTrue(t.getDefinitionType("foo").startsWith("UNTYPED"));
-		assertEquals("INTEGER", t.getDefinitionType("bar"));
-		assertEquals("BOOL", t.getDefinitionType("baz"));
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testDefinitionCall4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "foo(a,b) ==  a \\cup b \n"
-				+ "bar == foo({1}, k) \n"
-				+ "baz == foo({TRUE}, k2)\n"
-				+ "ASSUME baz = baz /\\ bar = bar"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertTrue(t.getDefinitionType("foo").startsWith("POW(UNTYPED"));
-		assertEquals("POW(INTEGER)", t.getDefinitionType("bar"));
-		assertEquals("POW(BOOL)", t.getDefinitionType("baz"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(BOOL)", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testDefinitionCall5() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "foo(a,b) ==  a = b \n"
-				+ "bar == foo(1,k) \n"
-				+ "ASSUME bar \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertEquals("INTEGER", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testDefinitionCall6() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "foo(a,b) ==  a = b \n"
-				+ "bar == foo(k, k2) /\\ k2 = 1 \n"
-				+ "ASSUME bar \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertTrue(t.getDefinitionParamType("foo", "a").startsWith("UNTYPED"));
-		assertTrue(t.getDefinitionParamType("foo", "b").startsWith("UNTYPED"));
-		assertEquals("BOOL", t.getDefinitionType("bar"));
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testDefinitionCall7() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "foo(a,b) ==  a \\cup b \n"
-				+ "bar(x,y) == x = foo(y, k) /\\ y ={1} \n"
-				+ "ASSUME bar(k2,k3) \n" + "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertTrue(t.getDefinitionType("foo").startsWith("POW(UNTYPED"));
-		assertTrue(t.getDefinitionParamType("foo", "a").startsWith(
-				"POW(UNTYPED"));
-		assertTrue(t.getDefinitionParamType("foo", "b").startsWith(
-				"POW(UNTYPED"));
-		assertEquals("BOOL", t.getDefinitionType("bar"));
-		assertEquals("POW(INTEGER)", t.getDefinitionParamType("bar", "x"));
-		assertEquals("POW(INTEGER)", t.getDefinitionParamType("bar", "y"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testDefinitionCall8() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "foo(a) ==  k = a \n"
-				+ "bar == foo(k2)\n"
-				+ "baz == k2 = 1 \n"
-				+ "ASSUME bar /\\ baz \n" + "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertEquals("BOOL", t.getDefinitionType("bar"));
-		assertEquals("BOOL", t.getDefinitionType("baz"));
-		assertEquals("INTEGER", t.getDefinitionParamType("foo", "a"));
-	}
-
-	@Test
-	public void testDefinitionCall9() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "foo(a,b) ==  a = b \n"
-				+ "ASSUME foo(k, 1) /\\ foo(k2, TRUE) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("BOOL", t.getConstantType("k2"));
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertTrue(t.getDefinitionParamType("foo", "a").startsWith("UNTYPED"));
-		assertTrue(t.getDefinitionParamType("foo", "b").startsWith("UNTYPED"));
-	}
-
-	@Test
-	public void testDefinitionCall10() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "foo(a,b) ==  a= 1 /\\ b = TRUE \n"
-				+ "ASSUME foo(1, TRUE) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getDefinitionType("foo"));
-		assertEquals("INTEGER", t.getDefinitionParamType("foo", "a"));
-		assertEquals("BOOL", t.getDefinitionParamType("foo", "b"));
-	}
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class DefinitionsTest {
+
+	/*
+	 * Definition: foo(a,b) == e
+	 */
+	@Test
+	public void testDefinition() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "foo(a,b) ==  a = 1 /\\ b = TRUE \n"
+				+ "Next ==  foo(1,TRUE)  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertEquals("INTEGER", t.getDefinitionParamType("foo", "a"));
+		assertEquals("BOOL", t.getDefinitionParamType("foo", "b"));
+	}
+
+	@Test
+	public void testDefinition2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "foo(a,b) ==  a = k /\\ b = k2 \n"
+				+ "bar == k = 1 /\\ k2 = TRUE \n"
+				+ "ASSUME foo(1,FALSE) /\\ bar \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertEquals("INTEGER", t.getDefinitionParamType("foo", "a"));
+		assertEquals("BOOL", t.getDefinitionParamType("foo", "b"));
+		assertEquals("BOOL", t.getDefinitionType("bar"));
+
+	}
+
+	@Test
+	public void testDefinition3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "foo ==  k \n"
+				+ "bar == foo = 1 \n"
+				+ "ASSUME bar \n" + "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getDefinitionType("foo"));
+		assertEquals("BOOL", t.getDefinitionType("bar"));
+	}
+
+	@Test
+	public void testDefinition4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "foo(var, value) ==  var = value \n"
+				+ "ASSUME foo(k,1) /\\ foo(k2,TRUE)  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("BOOL", t.getConstantType("k2"));
+	}
+
+	/*
+	 * Definition Call
+	 */
+
+	@Test
+	public void testDefinitionCall() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "foo(a) ==  TRUE \n"
+				+ "bar == foo(1) \n"
+				+ "ASSUME bar \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertEquals("BOOL", t.getDefinitionType("bar"));
+	}
+
+	@Test
+	public void testDefinitionCall2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "foo(a) ==  a \n"
+				+ "bar == foo(1) \n"
+				+ "baz == foo(TRUE) \n"
+				+ "ASSUME baz /\\ bar = bar"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertTrue(t.getDefinitionType("foo").startsWith("UNTYPED"));
+		assertEquals("INTEGER", t.getDefinitionType("bar"));
+		assertEquals("BOOL", t.getDefinitionType("baz"));
+	}
+
+	@Test
+	public void testDefinitionCall3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "foo(a) ==  a \n"
+				+ "bar == foo(1) \n"
+				+ "baz == k = foo(k2) /\\ k2 = bar  \n"
+				+ "ASSUME baz \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertTrue(t.getDefinitionType("foo").startsWith("UNTYPED"));
+		assertEquals("INTEGER", t.getDefinitionType("bar"));
+		assertEquals("BOOL", t.getDefinitionType("baz"));
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testDefinitionCall4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "foo(a,b) ==  a \\cup b \n"
+				+ "bar == foo({1}, k) \n"
+				+ "baz == foo({TRUE}, k2)\n"
+				+ "ASSUME baz = baz /\\ bar = bar"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertTrue(t.getDefinitionType("foo").startsWith("POW(UNTYPED"));
+		assertEquals("POW(INTEGER)", t.getDefinitionType("bar"));
+		assertEquals("POW(BOOL)", t.getDefinitionType("baz"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(BOOL)", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testDefinitionCall5() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "foo(a,b) ==  a = b \n"
+				+ "bar == foo(1,k) \n"
+				+ "ASSUME bar \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertEquals("INTEGER", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testDefinitionCall6() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "foo(a,b) ==  a = b \n"
+				+ "bar == foo(k, k2) /\\ k2 = 1 \n"
+				+ "ASSUME bar \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertTrue(t.getDefinitionParamType("foo", "a").startsWith("UNTYPED"));
+		assertTrue(t.getDefinitionParamType("foo", "b").startsWith("UNTYPED"));
+		assertEquals("BOOL", t.getDefinitionType("bar"));
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testDefinitionCall7() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "foo(a,b) ==  a \\cup b \n"
+				+ "bar(x,y) == x = foo(y, k) /\\ y ={1} \n"
+				+ "ASSUME bar(k2,k3) \n" + "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertTrue(t.getDefinitionType("foo").startsWith("POW(UNTYPED"));
+		assertTrue(t.getDefinitionParamType("foo", "a").startsWith(
+				"POW(UNTYPED"));
+		assertTrue(t.getDefinitionParamType("foo", "b").startsWith(
+				"POW(UNTYPED"));
+		assertEquals("BOOL", t.getDefinitionType("bar"));
+		assertEquals("POW(INTEGER)", t.getDefinitionParamType("bar", "x"));
+		assertEquals("POW(INTEGER)", t.getDefinitionParamType("bar", "y"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testDefinitionCall8() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "foo(a) ==  k = a \n"
+				+ "bar == foo(k2)\n"
+				+ "baz == k2 = 1 \n"
+				+ "ASSUME bar /\\ baz \n" + "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertEquals("BOOL", t.getDefinitionType("bar"));
+		assertEquals("BOOL", t.getDefinitionType("baz"));
+		assertEquals("INTEGER", t.getDefinitionParamType("foo", "a"));
+	}
+
+	@Test
+	public void testDefinitionCall9() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "foo(a,b) ==  a = b \n"
+				+ "ASSUME foo(k, 1) /\\ foo(k2, TRUE) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("BOOL", t.getConstantType("k2"));
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertTrue(t.getDefinitionParamType("foo", "a").startsWith("UNTYPED"));
+		assertTrue(t.getDefinitionParamType("foo", "b").startsWith("UNTYPED"));
+	}
+
+	@Test
+	public void testDefinitionCall10() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "foo(a,b) ==  a= 1 /\\ b = TRUE \n"
+				+ "ASSUME foo(1, TRUE) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getDefinitionType("foo"));
+		assertEquals("INTEGER", t.getDefinitionParamType("foo", "a"));
+		assertEquals("BOOL", t.getDefinitionParamType("foo", "b"));
+	}
+}
diff --git a/src/test/java/de/tla2b/typechecking/ExceptTest.java b/src/test/java/de/tla2b/typechecking/ExceptTest.java
index 5531720aa94eb350870325da0578e67f82104335..ea2965af27279deb98ae04bf96c8be0284978e64 100644
--- a/src/test/java/de/tla2b/typechecking/ExceptTest.java
+++ b/src/test/java/de/tla2b/typechecking/ExceptTest.java
@@ -1,146 +1,146 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class ExceptTest {
-
-	@Test
-	public void testFunction() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [k2 EXCEPT ![TRUE] = 0]  \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testFunctionRecord() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [k EXCEPT ![1] = [a|-> 1, b |-> TRUE], ![1].b = k2 ] "
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*struct(a:INTEGER,b:BOOL))",
-				t.getConstantType("k"));
-		assertEquals("BOOL", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testFunctionRecord2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [k EXCEPT ![1].a = 2, ![1].b = k2 ] /\\ k2 = TRUE \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*struct(a:INTEGER,b:BOOL))",
-				t.getConstantType("k"));
-	}
-
-	@Test
-	public void testRecord() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [k EXCEPT !.a = 2, !.b = TRUE] \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k")
-				.toString());
-	}
-
-	@Test (expected = TypeErrorException.class)
-	public void testRecordOrFunction() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS a, b \n"
-				+ "ASSUME a = [a EXCEPT !.a = 1, !.b = 1] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testRecordAtTypeError() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS r, r2\n"
-				+ "ASSUME  r = [a |-> TRUE] \n"
-				+ "/\\ r2 = [r EXCEPT !.a = 1 = @] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testRecordAtTypeError2() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS r, r2\n"
-				+ "ASSUME  r = [x \\in {1,2}|->TRUE] \n"
-				+ "/\\ r2 = [r EXCEPT ![1] = 1 = @] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testRecordAtTypeError3() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS r, r2\n"
-				+ "ASSUME  r = [x \\in {1,2}|->TRUE] \n"
-				+ "/\\ r2 = [r EXCEPT ![1] = @ + 1] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test
-	public void testRecordAt() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = [k EXCEPT ![1] = @ = @] \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-	}
-	
-	@Test
-	public void testRecordExcept() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = [ [a |-> [i \\in 1..1 |-> i], b |-> [i \\in 1..1 |-> 2]] EXCEPT !.a[1] = 1].a[1] \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-	}
-	
-	@Test
-	public void testAtTuple() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k  = [i \\in Nat |-> <<1, \"s\">>] /\\ k2 = [ k EXCEPT ![22] = <<@[1],\"d\">>] \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*(INTEGER*STRING))", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*(INTEGER*STRING))", t.getConstantType("k2"));
-	}
-	
-
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class ExceptTest {
+
+	@Test
+	public void testFunction() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [k2 EXCEPT ![TRUE] = 0]  \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testFunctionRecord() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [k EXCEPT ![1] = [a|-> 1, b |-> TRUE], ![1].b = k2 ] "
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*struct(a:INTEGER,b:BOOL))",
+				t.getConstantType("k"));
+		assertEquals("BOOL", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testFunctionRecord2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [k EXCEPT ![1].a = 2, ![1].b = k2 ] /\\ k2 = TRUE \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*struct(a:INTEGER,b:BOOL))",
+				t.getConstantType("k"));
+	}
+
+	@Test
+	public void testRecord() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [k EXCEPT !.a = 2, !.b = TRUE] \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k")
+				.toString());
+	}
+
+	@Test (expected = TypeErrorException.class)
+	public void testRecordOrFunction() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS a, b \n"
+				+ "ASSUME a = [a EXCEPT !.a = 1, !.b = 1] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testRecordAtTypeError() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS r, r2\n"
+				+ "ASSUME  r = [a |-> TRUE] \n"
+				+ "/\\ r2 = [r EXCEPT !.a = 1 = @] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testRecordAtTypeError2() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS r, r2\n"
+				+ "ASSUME  r = [x \\in {1,2}|->TRUE] \n"
+				+ "/\\ r2 = [r EXCEPT ![1] = 1 = @] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testRecordAtTypeError3() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS r, r2\n"
+				+ "ASSUME  r = [x \\in {1,2}|->TRUE] \n"
+				+ "/\\ r2 = [r EXCEPT ![1] = @ + 1] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test
+	public void testRecordAt() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = [k EXCEPT ![1] = @ = @] \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+	}
+	
+	@Test
+	public void testRecordExcept() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = [ [a |-> [i \\in 1..1 |-> i], b |-> [i \\in 1..1 |-> 2]] EXCEPT !.a[1] = 1].a[1] \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+	}
+	
+	@Test
+	public void testAtTuple() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k  = [i \\in Nat |-> <<1, \"s\">>] /\\ k2 = [ k EXCEPT ![22] = <<@[1],\"d\">>] \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*(INTEGER*STRING))", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*(INTEGER*STRING))", t.getConstantType("k2"));
+	}
+	
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/ExtendsTest.java b/src/test/java/de/tla2b/typechecking/ExtendsTest.java
index a62dca20ca6e5c81155d00460ce01ffec11a0ffe..05e397e455024fad57ee94c7ba4317bd3f9fe44c 100644
--- a/src/test/java/de/tla2b/typechecking/ExtendsTest.java
+++ b/src/test/java/de/tla2b/typechecking/ExtendsTest.java
@@ -1,20 +1,20 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class ExtendsTest {
-
-	@Test
-	public void TestExtendsCounter() throws Exception {
-		String path = "src/test/resources/typechecking/modules/";
-		TestTypeChecker t = TestUtil.typeCheck(path + "ExtendsCounter.tla");
-		assertEquals("INTEGER", t.getVariableType("x"));
-		assertEquals("INTEGER", t.getConstantType("start"));
-	}
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class ExtendsTest {
+
+	@Test
+	public void TestExtendsCounter() throws Exception {
+		String path = "src/test/resources/typechecking/modules/";
+		TestTypeChecker t = TestUtil.typeCheck(path + "ExtendsCounter.tla");
+		assertEquals("INTEGER", t.getVariableType("x"));
+		assertEquals("INTEGER", t.getConstantType("start"));
+	}
+}
diff --git a/src/test/java/de/tla2b/typechecking/FunctionTest.java b/src/test/java/de/tla2b/typechecking/FunctionTest.java
index e12fda6a5e5b71dbc1f18e8d63a4502e0526fe0d..4bba2f6ddda5d13dce25054fdb8702a3bcb5b59d 100644
--- a/src/test/java/de/tla2b/typechecking/FunctionTest.java
+++ b/src/test/java/de/tla2b/typechecking/FunctionTest.java
@@ -1,435 +1,435 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class FunctionTest {
-
-	/*
-	 * Function constructor
-	 */
-
-	@Test
-	public void testSimpleFunctionConstructor() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [x \\in {1} |-> 1] \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testFunctionConstructor() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, S \n"
-				+ "ASSUME k = [x \\in S |-> x = k2] /\\ k2 = 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S"));
-	}
-
-	@Test
-	public void testFunctionConstructorTwoVariables() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [x,y \\in {1} |-> TRUE]  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*INTEGER*BOOL)", t.getConstantType("k")
-				.toString());
-	}
-
-	@Test
-	public void testFunctionConstructor2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [<<x,y>> \\in {<<1,TRUE>>} |-> TRUE]  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL*BOOL)", t.getConstantType("k")
-				.toString());
-	}
-
-	@Test
-	public void testFunctionConstructor6() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [x \\in {1}, <<y,z>> \\in {<<1,TRUE>>} |-> TRUE]  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		//System.out.println(t.getConstantType("k").toString());
-		assertEquals("POW(INTEGER*(INTEGER*BOOL)*BOOL)", t.getConstantType("k")
-				.toString());
-	}
-
-	@Test
-	public void testFunctionConstructorTwoVariables2()
-			throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> TRUE]  \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL*BOOL)", t.getConstantType("k")
-				.toString());
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testFunctionConstructorFail() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [<<x,y>> \\in {1}  |-> TRUE]  \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test (expected = TypeErrorException.class)
-	public void testFunctionConstructorFail2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [<<x,y,z>> \\in ({1} \\times {1}) |-> TRUE]  \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test
-	public void testFunctionConstructor3() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S, S2 \n"
-				+ "ASSUME k = [x,y \\in S, z \\in S2 |-> z] /\\ S = BOOLEAN /\\ S2 = {1}  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL*BOOL*INTEGER*INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(BOOL)", t.getConstantType("S"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S2"));
-	}
-
-	@Test
-	public void testFunctionConstructor4() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, S, S2 \n"
-				+ "ASSUME [x \\in S |-> k] = [x \\in S2 |-> x=k2] /\\ k2 = 1  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S2"));
-	}
-
-	@Test
-	public void testFunctionConstructor5() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS S, S2 \n"
-				+ "ASSUME [x \\in S, y \\in S2 |-> 1] = [x,y \\in {1} |-> 1]   \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("S"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testFunctionConstructorException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, S, S2 \n"
-				+ "ASSUME [x \\in S, y \\in S2 |-> 1] = [x \\in {1} |-> 1]   \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * recursive Function
-	 */
-	@Test
-	public void testRecursiveFunction() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "fact[n \\in {1,2}] == IF n = 0 THEN 1 ELSE n+ fact[n-1] \n"
-				+ "ASSUME k = fact /\\ fact[k2] = k3 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k3"));
-	}
-
-	/*
-	 * Function call
-	 */
-
-	@Test
-	public void testFunctionCall() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k[1] = TRUE \n" + "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testFunctionCall2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k[1,TRUE,2] = TRUE \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL*INTEGER*BOOL)", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testFunctionCall3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, S \n"
-				+ "ASSUME k[k2,TRUE] = k3 \n"
-				+ "ASSUME k = [x \\in {1}, y \\in S |-> 1]\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
-				.toString());
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k3"));
-		assertEquals("POW(BOOL)", t.getConstantType("S"));
-	}
-
-	@Test
-	public void testFunctionCall4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k[(TRUE /\\ TRUE)] = 2 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testFunctionCallException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, S \n"
-				+ "ASSUME k = [x \\in {1} |-> 1]\n"
-				+ "ASSUME k[k2,TRUE] = k3 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Domain
-	 */
-	@Test
-	public void testDomain() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> 1]\n"
-				+ "ASSUME k2 = DOMAIN k \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
-				.toString());
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testDomain2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> 1]\n"
-				+ "ASSUME k2 = DOMAIN k \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
-				.toString());
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-	}
-
-	/*
-	 * Set of Function
-	 */
-	@Test
-	public void testSetOfFunction() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [BOOLEAN -> {1}] \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(POW(BOOL*INTEGER))", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testSetOfFunction2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS S, S2 \n"
-				+ "ASSUME [x \\in BOOLEAN |-> 1] \\in [S -> S2] \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("S"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSetOfFunctionException() throws FrontEndException,
-			TLA2BException {
-		/*
-		 * A set of tuple is not a function in TLA+
-		 */
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS S, S2 \n"
-				+ "ASSUME {1} \\X BOOLEAN \\in [S -> S2] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Except
-	 */
-	@Test
-	public void testFunctionExcept() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [k2 EXCEPT ![TRUE] = 0]  \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-
-		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testFunctionExcept2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = [k2 EXCEPT ![TRUE,1] = k3] /\\ k3 = 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL*INTEGER*INTEGER)", t.getConstantType("k")
-				.toString());
-		assertEquals("POW(BOOL*INTEGER*INTEGER)", t.getConstantType("k2")
-				.toString());
-		assertEquals("INTEGER", t.getConstantType("k3"));
-
-	}
-
-	@Test
-	public void testFunctionExcept3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, k4, k5 \n"
-				+ "ASSUME k = [k2 EXCEPT ![k3,k4] = k5]\n"
-				+ "ASSUME k2 = [x \\in {1}, y \\in BOOLEAN |-> 1]"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
-				.toString());
-		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k2")
-				.toString());
-		assertEquals("INTEGER", t.getConstantType("k3"));
-		assertEquals("BOOL", t.getConstantType("k4"));
-		assertEquals("INTEGER", t.getConstantType("k5"));
-
-	}
-
-	@Test
-	public void testFunctionExcept4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, k4, k5 \n"
-				+ "ASSUME k = [k2 EXCEPT ![k3,k4] = k5]\n"
-				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> 1]"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
-				.toString());
-		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k2")
-				.toString());
-		assertEquals("INTEGER", t.getConstantType("k3"));
-		assertEquals("BOOL", t.getConstantType("k4"));
-		assertEquals("INTEGER", t.getConstantType("k5"));
-	}
-
-	@Test
-	public void testFunctionExcept6() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, k4\n"
-				+ "ASSUME k = [k2 EXCEPT ![k3] = k4, ![1] = TRUE ]\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k").toString());
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2").toString());
-		assertEquals("INTEGER", t.getConstantType("k3"));
-		assertEquals("BOOL", t.getConstantType("k4"));
-	}
-
-	@Test
-	public void testFunctionExcept5() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [k2 EXCEPT ![1][1] = 2]\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*POW(INTEGER*INTEGER))",
-				t.getConstantType("k"));
-		assertEquals("POW(INTEGER*POW(INTEGER*INTEGER))",
-				t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testFunctionExcept7() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [k2 EXCEPT ![<<1,2>>] = 2]\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*INTEGER*INTEGER)", t.getConstantType("k"));
-	}
-
-	/*
-	 * Except @
-	 */
-
-	@Test
-	public void testAt2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2,k3 \n"
-				+ "ASSUME k = [k2 EXCEPT ![1] = TRUE, ![2] = @=k3]  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("BOOL", t.getConstantType("k3"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testAtException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [k2 EXCEPT ![1] = TRUE, ![2] = @=1]  \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class FunctionTest {
+
+	/*
+	 * Function constructor
+	 */
+
+	@Test
+	public void testSimpleFunctionConstructor() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [x \\in {1} |-> 1] \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testFunctionConstructor() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, S \n"
+				+ "ASSUME k = [x \\in S |-> x = k2] /\\ k2 = 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S"));
+	}
+
+	@Test
+	public void testFunctionConstructorTwoVariables() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [x,y \\in {1} |-> TRUE]  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*INTEGER*BOOL)", t.getConstantType("k")
+				.toString());
+	}
+
+	@Test
+	public void testFunctionConstructor2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [<<x,y>> \\in {<<1,TRUE>>} |-> TRUE]  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL*BOOL)", t.getConstantType("k")
+				.toString());
+	}
+
+	@Test
+	public void testFunctionConstructor6() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [x \\in {1}, <<y,z>> \\in {<<1,TRUE>>} |-> TRUE]  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		//System.out.println(t.getConstantType("k").toString());
+		assertEquals("POW(INTEGER*(INTEGER*BOOL)*BOOL)", t.getConstantType("k")
+				.toString());
+	}
+
+	@Test
+	public void testFunctionConstructorTwoVariables2()
+			throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> TRUE]  \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL*BOOL)", t.getConstantType("k")
+				.toString());
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testFunctionConstructorFail() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [<<x,y>> \\in {1}  |-> TRUE]  \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test (expected = TypeErrorException.class)
+	public void testFunctionConstructorFail2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [<<x,y,z>> \\in ({1} \\times {1}) |-> TRUE]  \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test
+	public void testFunctionConstructor3() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S, S2 \n"
+				+ "ASSUME k = [x,y \\in S, z \\in S2 |-> z] /\\ S = BOOLEAN /\\ S2 = {1}  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL*BOOL*INTEGER*INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(BOOL)", t.getConstantType("S"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S2"));
+	}
+
+	@Test
+	public void testFunctionConstructor4() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, S, S2 \n"
+				+ "ASSUME [x \\in S |-> k] = [x \\in S2 |-> x=k2] /\\ k2 = 1  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S2"));
+	}
+
+	@Test
+	public void testFunctionConstructor5() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS S, S2 \n"
+				+ "ASSUME [x \\in S, y \\in S2 |-> 1] = [x,y \\in {1} |-> 1]   \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("S"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testFunctionConstructorException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, S, S2 \n"
+				+ "ASSUME [x \\in S, y \\in S2 |-> 1] = [x \\in {1} |-> 1]   \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * recursive Function
+	 */
+	@Test
+	public void testRecursiveFunction() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "fact[n \\in {1,2}] == IF n = 0 THEN 1 ELSE n+ fact[n-1] \n"
+				+ "ASSUME k = fact /\\ fact[k2] = k3 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k3"));
+	}
+
+	/*
+	 * Function call
+	 */
+
+	@Test
+	public void testFunctionCall() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k[1] = TRUE \n" + "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testFunctionCall2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k[1,TRUE,2] = TRUE \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL*INTEGER*BOOL)", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testFunctionCall3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, S \n"
+				+ "ASSUME k[k2,TRUE] = k3 \n"
+				+ "ASSUME k = [x \\in {1}, y \\in S |-> 1]\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
+				.toString());
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k3"));
+		assertEquals("POW(BOOL)", t.getConstantType("S"));
+	}
+
+	@Test
+	public void testFunctionCall4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k[(TRUE /\\ TRUE)] = 2 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testFunctionCallException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, S \n"
+				+ "ASSUME k = [x \\in {1} |-> 1]\n"
+				+ "ASSUME k[k2,TRUE] = k3 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Domain
+	 */
+	@Test
+	public void testDomain() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> 1]\n"
+				+ "ASSUME k2 = DOMAIN k \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
+				.toString());
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testDomain2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> 1]\n"
+				+ "ASSUME k2 = DOMAIN k \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
+				.toString());
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+	}
+
+	/*
+	 * Set of Function
+	 */
+	@Test
+	public void testSetOfFunction() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [BOOLEAN -> {1}] \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(POW(BOOL*INTEGER))", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testSetOfFunction2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS S, S2 \n"
+				+ "ASSUME [x \\in BOOLEAN |-> 1] \\in [S -> S2] \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("S"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSetOfFunctionException() throws FrontEndException,
+			TLA2BException {
+		/*
+		 * A set of tuple is not a function in TLA+
+		 */
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS S, S2 \n"
+				+ "ASSUME {1} \\X BOOLEAN \\in [S -> S2] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Except
+	 */
+	@Test
+	public void testFunctionExcept() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [k2 EXCEPT ![TRUE] = 0]  \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+
+		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testFunctionExcept2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = [k2 EXCEPT ![TRUE,1] = k3] /\\ k3 = 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL*INTEGER*INTEGER)", t.getConstantType("k")
+				.toString());
+		assertEquals("POW(BOOL*INTEGER*INTEGER)", t.getConstantType("k2")
+				.toString());
+		assertEquals("INTEGER", t.getConstantType("k3"));
+
+	}
+
+	@Test
+	public void testFunctionExcept3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, k4, k5 \n"
+				+ "ASSUME k = [k2 EXCEPT ![k3,k4] = k5]\n"
+				+ "ASSUME k2 = [x \\in {1}, y \\in BOOLEAN |-> 1]"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
+				.toString());
+		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k2")
+				.toString());
+		assertEquals("INTEGER", t.getConstantType("k3"));
+		assertEquals("BOOL", t.getConstantType("k4"));
+		assertEquals("INTEGER", t.getConstantType("k5"));
+
+	}
+
+	@Test
+	public void testFunctionExcept4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, k4, k5 \n"
+				+ "ASSUME k = [k2 EXCEPT ![k3,k4] = k5]\n"
+				+ "ASSUME k = [x \\in {1}, y \\in BOOLEAN |-> 1]"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k")
+				.toString());
+		assertEquals("POW(INTEGER*BOOL*INTEGER)", t.getConstantType("k2")
+				.toString());
+		assertEquals("INTEGER", t.getConstantType("k3"));
+		assertEquals("BOOL", t.getConstantType("k4"));
+		assertEquals("INTEGER", t.getConstantType("k5"));
+	}
+
+	@Test
+	public void testFunctionExcept6() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, k4\n"
+				+ "ASSUME k = [k2 EXCEPT ![k3] = k4, ![1] = TRUE ]\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k").toString());
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2").toString());
+		assertEquals("INTEGER", t.getConstantType("k3"));
+		assertEquals("BOOL", t.getConstantType("k4"));
+	}
+
+	@Test
+	public void testFunctionExcept5() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [k2 EXCEPT ![1][1] = 2]\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*POW(INTEGER*INTEGER))",
+				t.getConstantType("k"));
+		assertEquals("POW(INTEGER*POW(INTEGER*INTEGER))",
+				t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testFunctionExcept7() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [k2 EXCEPT ![<<1,2>>] = 2]\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*INTEGER*INTEGER)", t.getConstantType("k"));
+	}
+
+	/*
+	 * Except @
+	 */
+
+	@Test
+	public void testAt2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2,k3 \n"
+				+ "ASSUME k = [k2 EXCEPT ![1] = TRUE, ![2] = @=k3]  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("BOOL", t.getConstantType("k3"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testAtException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [k2 EXCEPT ![1] = TRUE, ![2] = @=1]  \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/InstanceTest.java b/src/test/java/de/tla2b/typechecking/InstanceTest.java
index 6ac9c7d201cb9dab69bde3bfa7ae12b15561ce84..b7f851f0f8f91b6a9c5567ddb4f25010d2819bb5 100644
--- a/src/test/java/de/tla2b/typechecking/InstanceTest.java
+++ b/src/test/java/de/tla2b/typechecking/InstanceTest.java
@@ -1,60 +1,60 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-public class InstanceTest {
-
-	private static String path = "src/test/resources/typechecking/modules/";
-
-	@Test
-	public void TestNamedInstanceCounter() throws Exception {
-		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstanceCounter.tla");
-		assertEquals("INTEGER", t.getVariableType("c"));
-		assertEquals("INTEGER", t.getConstantType("start"));
-	}
-
-	@Test
-	public void TestNamedInstancePoly() throws Exception {
-		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstancePoly.tla");
-		assertEquals("INTEGER", t.getVariableType("c"));
-	}
-
-	@Test
-	public void TestNamedInstancePoly2() throws Exception {
-		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstancePoly2.tla");
-		assertEquals("INTEGER", t.getVariableType("c"));
-	}
-
-	@Test
-	public void TestNamedInstancePoly3() throws Exception {
-		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstancePoly3.tla");
-		assertEquals("BOOL", t.getVariableType("c"));
-		assertEquals("INTEGER", t.getVariableType("c2"));
-	}
-
-	@Test
-	public void TestNamedInstancePoly4() throws Exception {
-		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstancePoly4.tla");
-		assertEquals("BOOL", t.getVariableType("c"));
-		assertEquals("INTEGER", t.getConstantType("k"));
-	}
-
-	@Test
-	public void TestInstanceValue() throws Exception {
-		TestTypeChecker t = TestUtil.typeCheck(path + "InstanceValue.tla");
-		assertEquals("INTEGER", t.getConstantType("c2"));
-		assertEquals("INTEGER", t.getConstantType("val2"));
-	}
-
-	@Test
-	public void TestInstanceValue2Times() throws Exception {
-		TestTypeChecker t = TestUtil.typeCheck(path + "InstanceValue2Times.tla");
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("BOOL", t.getConstantType("k2"));
-	}
-
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+public class InstanceTest {
+
+	private static String path = "src/test/resources/typechecking/modules/";
+
+	@Test
+	public void TestNamedInstanceCounter() throws Exception {
+		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstanceCounter.tla");
+		assertEquals("INTEGER", t.getVariableType("c"));
+		assertEquals("INTEGER", t.getConstantType("start"));
+	}
+
+	@Test
+	public void TestNamedInstancePoly() throws Exception {
+		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstancePoly.tla");
+		assertEquals("INTEGER", t.getVariableType("c"));
+	}
+
+	@Test
+	public void TestNamedInstancePoly2() throws Exception {
+		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstancePoly2.tla");
+		assertEquals("INTEGER", t.getVariableType("c"));
+	}
+
+	@Test
+	public void TestNamedInstancePoly3() throws Exception {
+		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstancePoly3.tla");
+		assertEquals("BOOL", t.getVariableType("c"));
+		assertEquals("INTEGER", t.getVariableType("c2"));
+	}
+
+	@Test
+	public void TestNamedInstancePoly4() throws Exception {
+		TestTypeChecker t = TestUtil.typeCheck(path + "NamedInstancePoly4.tla");
+		assertEquals("BOOL", t.getVariableType("c"));
+		assertEquals("INTEGER", t.getConstantType("k"));
+	}
+
+	@Test
+	public void TestInstanceValue() throws Exception {
+		TestTypeChecker t = TestUtil.typeCheck(path + "InstanceValue.tla");
+		assertEquals("INTEGER", t.getConstantType("c2"));
+		assertEquals("INTEGER", t.getConstantType("val2"));
+	}
+
+	@Test
+	public void TestInstanceValue2Times() throws Exception {
+		TestTypeChecker t = TestUtil.typeCheck(path + "InstanceValue2Times.tla");
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("BOOL", t.getConstantType("k2"));
+	}
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/LogicOperatorsTest.java b/src/test/java/de/tla2b/typechecking/LogicOperatorsTest.java
index c46e2f7b8543ea3814e77adef342b9db4b4f9785..1a0910f6cfa75633bf896d4067e98e3815b768fd 100644
--- a/src/test/java/de/tla2b/typechecking/LogicOperatorsTest.java
+++ b/src/test/java/de/tla2b/typechecking/LogicOperatorsTest.java
@@ -1,96 +1,96 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class LogicOperatorsTest {
-	
-	/*
-	 * equality and disequality: =, #,
-	 */
-	@Test
-	public void testEquality() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k = (k2 = 1)\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k").toString());
-		assertEquals("INTEGER", t.getConstantType("k2").toString());
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testEqualityError() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = TRUE\n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	@Test (expected = TypeErrorException.class)
-	public void testEqualityError2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = (1=1)\n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	
-	
-	/*
-	 * Logic Operators: \neg, \lnot, \land, \cl, \lor, \dl, \equiv, =>
-	 */
-	@Test
-	public void testLogicOperators() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3\n"
-				+ "ASSUME k = (k2 \\land k3) \n"
-				+ "=================================";
-		
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k").toString());
-		assertEquals("BOOL", t.getConstantType("k2").toString());
-		assertEquals("BOOL", t.getConstantType("k3").toString());
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testLogicOperatorsError() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3\n"
-				+ "ASSUME 1 = (k2 \\land k3) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	/*
-	 * Quantification: \A x \in S : P or \E x \in S : P.  
-	 */
-
-	
-	@Test 
-	public void testQuantification() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, S\n"
-				+ "ASSUME k = (\\A x \\in S : x = k2) /\\ k2 = 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k").toString());
-		assertEquals("INTEGER", t.getConstantType("k2").toString());
-		assertEquals("POW(INTEGER)", t.getConstantType("S").toString());
-	}
-	
-	@Test(expected = TypeErrorException.class)
-	public void testQuantificationException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME \\A <<x,y>> \\in {1} : TRUE \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class LogicOperatorsTest {
+	
+	/*
+	 * equality and disequality: =, #,
+	 */
+	@Test
+	public void testEquality() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k = (k2 = 1)\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k").toString());
+		assertEquals("INTEGER", t.getConstantType("k2").toString());
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testEqualityError() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = TRUE\n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	@Test (expected = TypeErrorException.class)
+	public void testEqualityError2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = (1=1)\n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	
+	
+	/*
+	 * Logic Operators: \neg, \lnot, \land, \cl, \lor, \dl, \equiv, =>
+	 */
+	@Test
+	public void testLogicOperators() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3\n"
+				+ "ASSUME k = (k2 \\land k3) \n"
+				+ "=================================";
+		
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k").toString());
+		assertEquals("BOOL", t.getConstantType("k2").toString());
+		assertEquals("BOOL", t.getConstantType("k3").toString());
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testLogicOperatorsError() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3\n"
+				+ "ASSUME 1 = (k2 \\land k3) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	/*
+	 * Quantification: \A x \in S : P or \E x \in S : P.  
+	 */
+
+	
+	@Test 
+	public void testQuantification() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, S\n"
+				+ "ASSUME k = (\\A x \\in S : x = k2) /\\ k2 = 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k").toString());
+		assertEquals("INTEGER", t.getConstantType("k2").toString());
+		assertEquals("POW(INTEGER)", t.getConstantType("S").toString());
+	}
+	
+	@Test(expected = TypeErrorException.class)
+	public void testQuantificationException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME \\A <<x,y>> \\in {1} : TRUE \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+}
diff --git a/src/test/java/de/tla2b/typechecking/MiscellaneousConstructsTest.java b/src/test/java/de/tla2b/typechecking/MiscellaneousConstructsTest.java
index 6ed199bc9d04ab258aeac58672f3e6fefa1c9ace..4a66162a0787e8729c50409e9638c1c4e60f8d8f 100644
--- a/src/test/java/de/tla2b/typechecking/MiscellaneousConstructsTest.java
+++ b/src/test/java/de/tla2b/typechecking/MiscellaneousConstructsTest.java
@@ -1,145 +1,145 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class MiscellaneousConstructsTest {
-
-	/*
-	 * IF THEN ELSE
-	 */
-	@Test
-	public void testIfThenElse() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, k4 \n"
-				+ "ASSUME k = (IF k2 THEN k3 ELSE k4) /\\ k4 = 1  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER",t.getConstantType("k"));
-		assertEquals("BOOL",t.getConstantType("k2"));
-		assertEquals("INTEGER",t.getConstantType("k3"));
-		assertEquals("INTEGER",t.getConstantType("k4"));
-	}
-	
-
-	/*
-	 * IF THEN ELSE
-	 */
-	@Test
-	public void testCase() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, e1, e2 \n"
-				+ "ASSUME k = (CASE k2 -> e1 [] k3 -> e2) /\\ e2 = 1  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("INTEGER",t.getConstantType("k"));
-		assertEquals("BOOL",t.getConstantType("k2"));
-		assertEquals("BOOL",t.getConstantType("k3"));
-		assertEquals("INTEGER",t.getConstantType("e1"));
-		assertEquals("INTEGER",t.getConstantType("e2"));
-	}
-	
-	@Test
-	public void testCase2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, e1, e2, e3 \n"
-				+ "ASSUME k = (CASE k2 -> e1 [] k3 -> e2 [] OTHER -> e3) /\\ e2 = 1  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("INTEGER",t.getConstantType("k"));
-		assertEquals("BOOL",t.getConstantType("k2"));
-		assertEquals("BOOL",t.getConstantType("k3"));
-		assertEquals("INTEGER",t.getConstantType("e1"));
-		assertEquals("INTEGER",t.getConstantType("e2"));
-		assertEquals("INTEGER",t.getConstantType("e3"));
-	}
-	
-	/*
-	 * LET d == exp IN e
-	 */
-	@Test
-	public void testLetIn() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = (LET d == k2 IN d = k3) /\\ k2 = 1  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("BOOL",t.getConstantType("k"));
-		assertEquals("INTEGER",t.getConstantType("k2"));
-		assertEquals("INTEGER",t.getConstantType("k3"));
-	}
-	
-	@Test
-	public void testLetIn2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = (LET d == k2 d2 == k3 IN d = d2) /\\ k2 = 1  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("BOOL",t.getConstantType("k"));
-		assertEquals("INTEGER",t.getConstantType("k2"));
-		assertEquals("INTEGER",t.getConstantType("k3"));
-	}
-	
-	@Test
-	public void testLetIn3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, k4 \n"
-				+ "ASSUME k = (LET d(a,b) == a=k2/\\b=k3 IN d(1,k4)) /\\ k4 = TRUE  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("BOOL",t.getConstantType("k"));
-		assertEquals("INTEGER",t.getConstantType("k2"));
-		assertEquals("BOOL",t.getConstantType("k3"));
-		assertEquals("BOOL",t.getConstantType("k4"));
-	}
-	
-	@Test
-	public void testBoundedChoose() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = CHOOSE x \\in {1}: TRUE  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("INTEGER",t.getConstantType("k"));
-	}
-	
-	@Test
-	public void testUnboundedChoose() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = CHOOSE x : x = 1  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("INTEGER",t.getConstantType("k"));
-	}
-	
-	@Test
-	public void testUnboundedChooseTuple() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = CHOOSE <<a,b>> : <<a,b>> = <<1,TRUE>>  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("INTEGER*BOOL",t.getConstantType("k"));
-	}
-	
-	@Test
-	public void testBoundedChooseTuple() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = CHOOSE <<a,b>> \\in {<<1,TRUE>>}: TRUE  \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("INTEGER*BOOL",t.getConstantType("k"));
-	}
-	
-	
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class MiscellaneousConstructsTest {
+
+	/*
+	 * IF THEN ELSE
+	 */
+	@Test
+	public void testIfThenElse() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, k4 \n"
+				+ "ASSUME k = (IF k2 THEN k3 ELSE k4) /\\ k4 = 1  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER",t.getConstantType("k"));
+		assertEquals("BOOL",t.getConstantType("k2"));
+		assertEquals("INTEGER",t.getConstantType("k3"));
+		assertEquals("INTEGER",t.getConstantType("k4"));
+	}
+	
+
+	/*
+	 * IF THEN ELSE
+	 */
+	@Test
+	public void testCase() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, e1, e2 \n"
+				+ "ASSUME k = (CASE k2 -> e1 [] k3 -> e2) /\\ e2 = 1  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("INTEGER",t.getConstantType("k"));
+		assertEquals("BOOL",t.getConstantType("k2"));
+		assertEquals("BOOL",t.getConstantType("k3"));
+		assertEquals("INTEGER",t.getConstantType("e1"));
+		assertEquals("INTEGER",t.getConstantType("e2"));
+	}
+	
+	@Test
+	public void testCase2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, e1, e2, e3 \n"
+				+ "ASSUME k = (CASE k2 -> e1 [] k3 -> e2 [] OTHER -> e3) /\\ e2 = 1  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("INTEGER",t.getConstantType("k"));
+		assertEquals("BOOL",t.getConstantType("k2"));
+		assertEquals("BOOL",t.getConstantType("k3"));
+		assertEquals("INTEGER",t.getConstantType("e1"));
+		assertEquals("INTEGER",t.getConstantType("e2"));
+		assertEquals("INTEGER",t.getConstantType("e3"));
+	}
+	
+	/*
+	 * LET d == exp IN e
+	 */
+	@Test
+	public void testLetIn() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = (LET d == k2 IN d = k3) /\\ k2 = 1  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("BOOL",t.getConstantType("k"));
+		assertEquals("INTEGER",t.getConstantType("k2"));
+		assertEquals("INTEGER",t.getConstantType("k3"));
+	}
+	
+	@Test
+	public void testLetIn2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = (LET d == k2 d2 == k3 IN d = d2) /\\ k2 = 1  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("BOOL",t.getConstantType("k"));
+		assertEquals("INTEGER",t.getConstantType("k2"));
+		assertEquals("INTEGER",t.getConstantType("k3"));
+	}
+	
+	@Test
+	public void testLetIn3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, k4 \n"
+				+ "ASSUME k = (LET d(a,b) == a=k2/\\b=k3 IN d(1,k4)) /\\ k4 = TRUE  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("BOOL",t.getConstantType("k"));
+		assertEquals("INTEGER",t.getConstantType("k2"));
+		assertEquals("BOOL",t.getConstantType("k3"));
+		assertEquals("BOOL",t.getConstantType("k4"));
+	}
+	
+	@Test
+	public void testBoundedChoose() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = CHOOSE x \\in {1}: TRUE  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("INTEGER",t.getConstantType("k"));
+	}
+	
+	@Test
+	public void testUnboundedChoose() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = CHOOSE x : x = 1  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("INTEGER",t.getConstantType("k"));
+	}
+	
+	@Test
+	public void testUnboundedChooseTuple() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = CHOOSE <<a,b>> : <<a,b>> = <<1,TRUE>>  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("INTEGER*BOOL",t.getConstantType("k"));
+	}
+	
+	@Test
+	public void testBoundedChooseTuple() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = CHOOSE <<a,b>> \\in {<<1,TRUE>>}: TRUE  \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("INTEGER*BOOL",t.getConstantType("k"));
+	}
+	
+	
+}
diff --git a/src/test/java/de/tla2b/typechecking/OpArgTest.java b/src/test/java/de/tla2b/typechecking/OpArgTest.java
index 0c96a265dbf4a29f782ac2f803032198b2eafe9a..3895f898e317c5ddfde4970d65016400b8b8ab3c 100644
--- a/src/test/java/de/tla2b/typechecking/OpArgTest.java
+++ b/src/test/java/de/tla2b/typechecking/OpArgTest.java
@@ -1,59 +1,59 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.ConfigFileErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-public class OpArgTest {
-
-	@Test
-	public void TestConOverridenByLessOp() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k(_,_), k2 \n"
-				+ "ASSUME k2 = k(1,2)\n" + "=================================";
-		final String config = "CONSTANTS k <- <";
-		TestTypeChecker t = TestUtil.typeCheckString(module, config);
-		assertEquals("BOOL", t.getConstantType("k2"));
-	}
-
-	@Test(expected = ConfigFileErrorException.class)
-	public void TestOverridenConstantWrongArityException() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k(_,_) \n"
-				+ "def == TRUE /\\ FALSE \n"
-				+ "=================================";
-		final String config = "CONSTANTS k <- def";
-		TestUtil.typeCheckString(module, config);
-	}
-
-	@Test(expected = ConfigFileErrorException.class)
-	public void TestOverridenDefWrongArityException() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "foo(a, b) == a /\\ b  \n"
-				+ "def == TRUE /\\ FALSE \n"
-				+ "ASSUME foo(TRUE, FALSE) \n"
-				+ "=================================";
-		final String config = "CONSTANTS foo <- def";
-		TestUtil.typeCheckString(module, config);
-	}
-
-	@Test
-	public void TestOverridenByDef() throws Exception {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k(_,_), k2 \n"
-				+ "def(a,b) == a /\\ b \n"
-				+ "ASSUME k2 = k(TRUE,TRUE)\n"
-				+ "=================================";
-		final String config = "CONSTANTS k <- def";
-		TestTypeChecker t = TestUtil.typeCheckString(module, config);
-		assertEquals("BOOL", t.getConstantType("k2"));
-		System.out.println(t.getDefinitionType("def"));
-		assertEquals("BOOL", t.getDefinitionType("def"));
-		assertEquals("BOOL", t.getDefinitionParamType("def", "a"));
-	}
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.ConfigFileErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+public class OpArgTest {
+
+	@Test
+	public void TestConOverridenByLessOp() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k(_,_), k2 \n"
+				+ "ASSUME k2 = k(1,2)\n" + "=================================";
+		final String config = "CONSTANTS k <- <";
+		TestTypeChecker t = TestUtil.typeCheckString(module, config);
+		assertEquals("BOOL", t.getConstantType("k2"));
+	}
+
+	@Test(expected = ConfigFileErrorException.class)
+	public void TestOverridenConstantWrongArityException() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k(_,_) \n"
+				+ "def == TRUE /\\ FALSE \n"
+				+ "=================================";
+		final String config = "CONSTANTS k <- def";
+		TestUtil.typeCheckString(module, config);
+	}
+
+	@Test(expected = ConfigFileErrorException.class)
+	public void TestOverridenDefWrongArityException() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "foo(a, b) == a /\\ b  \n"
+				+ "def == TRUE /\\ FALSE \n"
+				+ "ASSUME foo(TRUE, FALSE) \n"
+				+ "=================================";
+		final String config = "CONSTANTS foo <- def";
+		TestUtil.typeCheckString(module, config);
+	}
+
+	@Test
+	public void TestOverridenByDef() throws Exception {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k(_,_), k2 \n"
+				+ "def(a,b) == a /\\ b \n"
+				+ "ASSUME k2 = k(TRUE,TRUE)\n"
+				+ "=================================";
+		final String config = "CONSTANTS k <- def";
+		TestTypeChecker t = TestUtil.typeCheckString(module, config);
+		assertEquals("BOOL", t.getConstantType("k2"));
+		System.out.println(t.getDefinitionType("def"));
+		assertEquals("BOOL", t.getDefinitionType("def"));
+		assertEquals("BOOL", t.getDefinitionParamType("def", "a"));
+	}
+}
diff --git a/src/test/java/de/tla2b/typechecking/SetTest.java b/src/test/java/de/tla2b/typechecking/SetTest.java
index 3d5c323521209a7cb1d179e7818c89fcf3a092d9..a59047473a3fad2d6ef11df3fc185dfae920739a 100644
--- a/src/test/java/de/tla2b/typechecking/SetTest.java
+++ b/src/test/java/de/tla2b/typechecking/SetTest.java
@@ -1,498 +1,498 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-public class SetTest {
-
-	/*
-	 * Set Enumeration: {1,2,3}
-	 */
-
-	@Test
-	public void testSetEnumeration() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3\n"
-				+ "ASSUME k = {k2, k3} /\\ k3 = 1\n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k3"));
-
-	}
-
-	@Test
-	public void testSetEnumeration2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3\n"
-				+ "ASSUME k = {k2, k3} /\\ k = {1}\n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k3"));
-	}
-
-	@Test
-	public void testSetEnumeration3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3\n"
-				+ "ASSUME k = {k2,{k3}} /\\ k3 = 1\n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(POW(INTEGER))", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k3"));
-	}
-
-	@Test
-	public void testSetEnumeration4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k = {{1},{k2}}\n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(POW(INTEGER))", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSetEnumerationException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k = {1, TRUE}\n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSetEnumerationException2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME 1 = {1, 2}\n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Element of: \in, \notin
-	 */
-	@Test
-	public void testElementOfSet() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k \\in {k2} /\\ k2 = 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testElementOfSet2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k \\in {k2} /\\ k = 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testElementOfSet3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k \\in {<<TRUE>>}\n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testElementOfSetError() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = (1 \\in {1}) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testElementOfSetError2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 \\in 1 \n" + "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * set operators like difference, union, intersection
-	 */
-	@Test
-	public void testSetOperators() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3\n"
-				+ "ASSUME k = (k2 \\cup k3) /\\ k3 = {1} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k3"));
-	}
-
-	@Test
-	public void testSetOperators2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k = (k \\cup k2) /\\ k2 = {1} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSetOperatorsException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME 1 = k \\cup k2 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSetOperatorsException2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = {1} \\cup {TRUE} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * set constructor: {x \in S : p}.
-	 */
-	@Test
-	public void testSubsetOf() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S\n"
-				+ "ASSUME k = {x \\in S : x = 1} \n"
-				+ "=================================";
-		TestTypeChecker t =TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S"));
-	}
-
-	@Test
-	public void testSubsetOf2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2\n"
-				+ "ASSUME k = {x \\in {TRUE} : x = k2} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k"));
-		assertEquals("BOOL", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testSubsetOf3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S, k2\n"
-				+ "ASSUME k = {x \\in S : x = k2} /\\ k2 = TRUE \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k"));
-		assertEquals("POW(BOOL)", t.getConstantType("S"));
-		assertEquals("BOOL", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testSubsetOf4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S\n"
-				+ "ASSUME k = {x \\in S : TRUE} /\\ k = {TRUE} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k"));
-		assertEquals("POW(BOOL)", t.getConstantType("S"));
-	}
-
-	@Test (expected = TypeErrorException.class)
-	public void testSubsetOfException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = {<<x,y>> \\in {TRUE} : TRUE} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSubsetOfException2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = {x \\in 1 : TRUE} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test (expected = TypeErrorException.class)
-	public void testSubsetOfException3() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = {x \\in {} : 1 = 1} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test 
-	public void testSubsetOfTuple() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = {<<x,y>> \\in {1} \\times {TRUE} : TRUE} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-	}
-	
-	@Test 
-	public void testSubsetOfTuple2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S, S2\n"
-				+ "ASSUME k = {<<x,y>> \\in S \\times S2 : x = 1 /\\ y = TRUE} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S"));
-		assertEquals("POW(BOOL)", t.getConstantType("S2"));
-	}
-	
-	@Test 
-	public void testSubsetOfTuple3() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S\n"
-				+ "ASSUME k = {<<x,y>> \\in S : x = 1 /\\ y = TRUE} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("S"));
-	}
-	
-	/*
-	 * set constructor: {e : x \in S}
-	 */
-	@Test
-	public void testSetOfAll() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S, k2\n"
-				+ "ASSUME k = {x = k2 : x \\in S} /\\ k2 = 1  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testSetOfAll2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S\n"
-				+ "ASSUME k = {{x} : x \\in S} /\\ S = {1}  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(POW(INTEGER))", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S"));
-	}
-
-	@Test
-	public void testSetOfAll3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S, k2\n"
-				+ "ASSUME k = { x = y /\\ y = k2 : x,y \\in S} /\\ k2 = 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("S"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testSetOfAll4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S, S2, k2, k3\n"
-				+ "ASSUME k = { x = k2 /\\ y /\\ z = k3 : x \\in S, y,z \\in S2 } /\\ k2 = TRUE \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k"));
-		assertEquals("POW(BOOL)", t.getConstantType("S"));
-		assertEquals("BOOL", t.getConstantType("k2"));
-		assertEquals("BOOL", t.getConstantType("k3"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSetOfAllException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S\n"
-				+ "ASSUME 1 = {x : x \\in S} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSetOfAllException2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S\n"
-				+ "ASSUME k = {x : x \\in 1} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSetOfAllException3() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, S\n"
-				+ "ASSUME k = {x : <<x,y>> \\in S} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * SUBSET: conforms POW in B
-	 */
-	@Test
-	public void testSubset() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = SUBSET k2 /\\ k2 = 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testSubset2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = SUBSET k2 /\\ k = {1} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSubsetException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME 1 = SUBSET k \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * UNION
-	 */
-	@Test
-	public void testUnion() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = UNION k2 /\\ k = {1} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(POW(INTEGER))", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testUnion2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = UNION k2 /\\ k2 = {{1},{2}} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(POW(INTEGER))", t.getConstantType("k2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testUnionException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = UNION k2 /\\ k = 1 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testUnionException2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = UNION k2 /\\ k2 = {1,2} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Subseteq: subset or equal
-	 */
-	@Test
-	public void testSubseteq() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = (k2 \\subseteq k3) /\\ k3 = {1}  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k3"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSubseteqException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = (k2 \\subseteq 1)  \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testSubseteqException2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME 1 = (k \\subseteq k2)  \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+public class SetTest {
+
+	/*
+	 * Set Enumeration: {1,2,3}
+	 */
+
+	@Test
+	public void testSetEnumeration() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3\n"
+				+ "ASSUME k = {k2, k3} /\\ k3 = 1\n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k3"));
+
+	}
+
+	@Test
+	public void testSetEnumeration2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3\n"
+				+ "ASSUME k = {k2, k3} /\\ k = {1}\n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k3"));
+	}
+
+	@Test
+	public void testSetEnumeration3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3\n"
+				+ "ASSUME k = {k2,{k3}} /\\ k3 = 1\n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(POW(INTEGER))", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k3"));
+	}
+
+	@Test
+	public void testSetEnumeration4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k = {{1},{k2}}\n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(POW(INTEGER))", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSetEnumerationException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k = {1, TRUE}\n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSetEnumerationException2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME 1 = {1, 2}\n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Element of: \in, \notin
+	 */
+	@Test
+	public void testElementOfSet() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k \\in {k2} /\\ k2 = 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testElementOfSet2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k \\in {k2} /\\ k = 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testElementOfSet3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k \\in {<<TRUE>>}\n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testElementOfSetError() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = (1 \\in {1}) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testElementOfSetError2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 \\in 1 \n" + "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * set operators like difference, union, intersection
+	 */
+	@Test
+	public void testSetOperators() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3\n"
+				+ "ASSUME k = (k2 \\cup k3) /\\ k3 = {1} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k3"));
+	}
+
+	@Test
+	public void testSetOperators2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k = (k \\cup k2) /\\ k2 = {1} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSetOperatorsException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME 1 = k \\cup k2 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSetOperatorsException2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = {1} \\cup {TRUE} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * set constructor: {x \in S : p}.
+	 */
+	@Test
+	public void testSubsetOf() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S\n"
+				+ "ASSUME k = {x \\in S : x = 1} \n"
+				+ "=================================";
+		TestTypeChecker t =TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S"));
+	}
+
+	@Test
+	public void testSubsetOf2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2\n"
+				+ "ASSUME k = {x \\in {TRUE} : x = k2} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k"));
+		assertEquals("BOOL", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testSubsetOf3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S, k2\n"
+				+ "ASSUME k = {x \\in S : x = k2} /\\ k2 = TRUE \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k"));
+		assertEquals("POW(BOOL)", t.getConstantType("S"));
+		assertEquals("BOOL", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testSubsetOf4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S\n"
+				+ "ASSUME k = {x \\in S : TRUE} /\\ k = {TRUE} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k"));
+		assertEquals("POW(BOOL)", t.getConstantType("S"));
+	}
+
+	@Test (expected = TypeErrorException.class)
+	public void testSubsetOfException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = {<<x,y>> \\in {TRUE} : TRUE} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSubsetOfException2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = {x \\in 1 : TRUE} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test (expected = TypeErrorException.class)
+	public void testSubsetOfException3() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = {x \\in {} : 1 = 1} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test 
+	public void testSubsetOfTuple() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = {<<x,y>> \\in {1} \\times {TRUE} : TRUE} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+	}
+	
+	@Test 
+	public void testSubsetOfTuple2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S, S2\n"
+				+ "ASSUME k = {<<x,y>> \\in S \\times S2 : x = 1 /\\ y = TRUE} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S"));
+		assertEquals("POW(BOOL)", t.getConstantType("S2"));
+	}
+	
+	@Test 
+	public void testSubsetOfTuple3() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S\n"
+				+ "ASSUME k = {<<x,y>> \\in S : x = 1 /\\ y = TRUE} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("S"));
+	}
+	
+	/*
+	 * set constructor: {e : x \in S}
+	 */
+	@Test
+	public void testSetOfAll() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S, k2\n"
+				+ "ASSUME k = {x = k2 : x \\in S} /\\ k2 = 1  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testSetOfAll2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S\n"
+				+ "ASSUME k = {{x} : x \\in S} /\\ S = {1}  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(POW(INTEGER))", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S"));
+	}
+
+	@Test
+	public void testSetOfAll3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S, k2\n"
+				+ "ASSUME k = { x = y /\\ y = k2 : x,y \\in S} /\\ k2 = 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("S"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testSetOfAll4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S, S2, k2, k3\n"
+				+ "ASSUME k = { x = k2 /\\ y /\\ z = k3 : x \\in S, y,z \\in S2 } /\\ k2 = TRUE \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k"));
+		assertEquals("POW(BOOL)", t.getConstantType("S"));
+		assertEquals("BOOL", t.getConstantType("k2"));
+		assertEquals("BOOL", t.getConstantType("k3"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSetOfAllException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S\n"
+				+ "ASSUME 1 = {x : x \\in S} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSetOfAllException2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S\n"
+				+ "ASSUME k = {x : x \\in 1} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSetOfAllException3() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, S\n"
+				+ "ASSUME k = {x : <<x,y>> \\in S} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * SUBSET: conforms POW in B
+	 */
+	@Test
+	public void testSubset() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = SUBSET k2 /\\ k2 = 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testSubset2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = SUBSET k2 /\\ k = {1} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSubsetException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME 1 = SUBSET k \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * UNION
+	 */
+	@Test
+	public void testUnion() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = UNION k2 /\\ k = {1} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(POW(INTEGER))", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testUnion2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = UNION k2 /\\ k2 = {{1},{2}} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(POW(INTEGER))", t.getConstantType("k2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testUnionException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = UNION k2 /\\ k = 1 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testUnionException2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = UNION k2 /\\ k2 = {1,2} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Subseteq: subset or equal
+	 */
+	@Test
+	public void testSubseteq() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = (k2 \\subseteq k3) /\\ k3 = {1}  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k3"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSubseteqException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = (k2 \\subseteq 1)  \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testSubseteqException2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME 1 = (k \\subseteq k2)  \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/StringTest.java b/src/test/java/de/tla2b/typechecking/StringTest.java
index e606c6b9d6c87973384bc282dfa91eb87d695ab6..4e25488b91a5a8d5222718e21e474e0a4ab18fc2 100644
--- a/src/test/java/de/tla2b/typechecking/StringTest.java
+++ b/src/test/java/de/tla2b/typechecking/StringTest.java
@@ -1,90 +1,90 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class StringTest {
-	
-	/*
-	 * a String: "abc"
-	 */
-
-	@Test
-	public void testAString() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = \"abc\" \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("STRING", t.getConstantType("k").toString());
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testAStringException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = \"abc\" \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test
-	public void testStringAsSequence() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "ASSUME  \"a\" \\o \"bc\" = \"abc\"  \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test
-	public void testStringAsSequence2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "ASSUME SubSeq(\"abc\",1,1) = \"a\"  \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test
-	public void testStringAsSequence3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "ASSUME Len(\"abc\") = 3 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	
-	/*
-	 * STRING
-	 */
-	@Test 
-	public void testString() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = STRING \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(STRING)", t.getConstantType("k").toString());
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testStringException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = STRING \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-	
-	
-	
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class StringTest {
+	
+	/*
+	 * a String: "abc"
+	 */
+
+	@Test
+	public void testAString() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = \"abc\" \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("STRING", t.getConstantType("k").toString());
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testAStringException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = \"abc\" \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test
+	public void testStringAsSequence() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "ASSUME  \"a\" \\o \"bc\" = \"abc\"  \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test
+	public void testStringAsSequence2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "ASSUME SubSeq(\"abc\",1,1) = \"a\"  \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test
+	public void testStringAsSequence3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "ASSUME Len(\"abc\") = 3 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	
+	/*
+	 * STRING
+	 */
+	@Test 
+	public void testString() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = STRING \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(STRING)", t.getConstantType("k").toString());
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testStringException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = STRING \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+	
+	
+	
+}
diff --git a/src/test/java/de/tla2b/typechecking/StructTest.java b/src/test/java/de/tla2b/typechecking/StructTest.java
index 3b577f56ed0e6943f58553568389dcec420e1eed..ab8b8af6bfd6d2cced3cb462805c5e5006fb3ec0 100644
--- a/src/test/java/de/tla2b/typechecking/StructTest.java
+++ b/src/test/java/de/tla2b/typechecking/StructTest.java
@@ -1,282 +1,282 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-import util.ToolIO;
-
-public class StructTest {
-	static {
-		ToolIO.setMode(ToolIO.TOOL);
-	}
-
-	/*
-	 * Set of Records: [L1 : e1, L2 : e2]
-	 */
-	@Test
-	public void testStruct() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [a : {1}, b : BOOLEAN] \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(struct(a:INTEGER,b:BOOL))", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testStruct2() throws FrontEndException, TLA2BException {
-
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = [a : k2, b : k3] /\\ k2 = {1} /\\ k3 = BOOLEAN \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		
-		assertEquals("POW(struct(a:INTEGER,b:BOOL))", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testStruct3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME [a : {1}, b : BOOLEAN] = [a : k, b : k2] \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(BOOL)", t.getConstantType("k2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testStructException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME 1 = [a : 1, b : TRUE] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testStructException2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME [a : {1}, b : BOOLEAN] = [a : BOOLEAN, b : BOOLEAN] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testStructException3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME [aa : {1}, b : BOOLEAN] = [a : {1}, b : BOOLEAN] \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Record: [L1 |-> e1, L2 |-> e2]
-	 */
-
-	@Test
-	public void testRecord() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [a |-> 1, b |-> TRUE] \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-	}
-
-	@Test
-	public void testRecord2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = [a |-> k2, b |-> k3] /\\ k2 = 1 /\\ k3 = TRUE \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testRecordException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = [b |-> 1, a |-> TRUE] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test
-	public void testRecord3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME [a |-> k, b |-> k2] \\in [a: {1}, b: BOOLEAN]  \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("BOOL", t.getConstantType("k2"));
-	}
-
-	/*
-	 * Record Select: r.c
-	 */
-
-	@Test
-	public void testRecordSelect() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [a |-> 1, b |-> TRUE] /\\ k2 = k.a \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testRecordSelect2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k2 = k.a /\\ k = [a |-> 1, b |-> TRUE] \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test
-	public void testRecordSelect3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = [a |-> k2, b |-> k3]  /\\ k.a = 1 /\\ k.b = TRUE \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("BOOL", t.getConstantType("k3"));
-	}
-
-	@Test
-	public void testRecordSelect4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k \\in [a : k2, b : k3]  /\\ k.a = 1 /\\ k.b = TRUE \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
-		assertEquals("POW(BOOL)", t.getConstantType("k3"));
-	}
-
-	@Test
-	public void testRecordSelectException3() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [a |-> 1] /\\ TRUE = k.b \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test
-	public void testRecordSelect5() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME 1 = k.a /\\ TRUE = k.b  /\\ k = [a |-> 1] \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testRecordSelectException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME TRUE = k.a  /\\ k = [a |-> 1] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testRecordSelectException4() throws FrontEndException,
-			TLA2BException {
-
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [a |-> 1] /\\ TRUE = k.a \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Record Except
-	 */
-
-	@Test
-	public void testRecordExcept() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3, k4 \n"
-				+ "ASSUME k = [a|-> k2, b|-> k3] /\\ k4 = [k EXCEPT !.a = 1, !.b = TRUE]\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k4"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("BOOL", t.getConstantType("k3"));
-	}
-
-	@Test
-	public void testRecordExcept2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k.a = 1/\\ k2 = [k EXCEPT !.a = 1, !.b = TRUE] /\\ k2 = [a|->2, b |-> FALSE]\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
-		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k2"));
-	}
-
-	/*
-	 * Record Except @
-	 */
-
-	@Test
-	public void testRecordExceptAt() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = [a|-> TRUE] /\\ k2 = [k EXCEPT !.a = @ = k3]\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("struct(a:BOOL)", t.getConstantType("k"));
-		assertEquals("struct(a:BOOL)", t.getConstantType("k2"));
-		assertEquals("BOOL", t.getConstantType("k3"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testRecordExceptAtException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = [a|-> TRUE] /\\ k2 = [k EXCEPT !.a = @ = 1]\n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testRecord5() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = [k EXCEPT !.a = 1] /\\ k ={k2} \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+import util.ToolIO;
+
+public class StructTest {
+	static {
+		ToolIO.setMode(ToolIO.TOOL);
+	}
+
+	/*
+	 * Set of Records: [L1 : e1, L2 : e2]
+	 */
+	@Test
+	public void testStruct() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [a : {1}, b : BOOLEAN] \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(struct(a:INTEGER,b:BOOL))", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testStruct2() throws FrontEndException, TLA2BException {
+
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = [a : k2, b : k3] /\\ k2 = {1} /\\ k3 = BOOLEAN \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		
+		assertEquals("POW(struct(a:INTEGER,b:BOOL))", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testStruct3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME [a : {1}, b : BOOLEAN] = [a : k, b : k2] \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(BOOL)", t.getConstantType("k2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testStructException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME 1 = [a : 1, b : TRUE] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testStructException2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME [a : {1}, b : BOOLEAN] = [a : BOOLEAN, b : BOOLEAN] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testStructException3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME [aa : {1}, b : BOOLEAN] = [a : {1}, b : BOOLEAN] \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Record: [L1 |-> e1, L2 |-> e2]
+	 */
+
+	@Test
+	public void testRecord() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [a |-> 1, b |-> TRUE] \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+	}
+
+	@Test
+	public void testRecord2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = [a |-> k2, b |-> k3] /\\ k2 = 1 /\\ k3 = TRUE \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testRecordException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = [b |-> 1, a |-> TRUE] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test
+	public void testRecord3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME [a |-> k, b |-> k2] \\in [a: {1}, b: BOOLEAN]  \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("BOOL", t.getConstantType("k2"));
+	}
+
+	/*
+	 * Record Select: r.c
+	 */
+
+	@Test
+	public void testRecordSelect() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [a |-> 1, b |-> TRUE] /\\ k2 = k.a \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testRecordSelect2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k2 = k.a /\\ k = [a |-> 1, b |-> TRUE] \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test
+	public void testRecordSelect3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = [a |-> k2, b |-> k3]  /\\ k.a = 1 /\\ k.b = TRUE \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("BOOL", t.getConstantType("k3"));
+	}
+
+	@Test
+	public void testRecordSelect4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k \\in [a : k2, b : k3]  /\\ k.a = 1 /\\ k.b = TRUE \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
+		assertEquals("POW(BOOL)", t.getConstantType("k3"));
+	}
+
+	@Test
+	public void testRecordSelectException3() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [a |-> 1] /\\ TRUE = k.b \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test
+	public void testRecordSelect5() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME 1 = k.a /\\ TRUE = k.b  /\\ k = [a |-> 1] \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testRecordSelectException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME TRUE = k.a  /\\ k = [a |-> 1] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testRecordSelectException4() throws FrontEndException,
+			TLA2BException {
+
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [a |-> 1] /\\ TRUE = k.a \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Record Except
+	 */
+
+	@Test
+	public void testRecordExcept() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3, k4 \n"
+				+ "ASSUME k = [a|-> k2, b|-> k3] /\\ k4 = [k EXCEPT !.a = 1, !.b = TRUE]\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k4"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("BOOL", t.getConstantType("k3"));
+	}
+
+	@Test
+	public void testRecordExcept2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k.a = 1/\\ k2 = [k EXCEPT !.a = 1, !.b = TRUE] /\\ k2 = [a|->2, b |-> FALSE]\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k"));
+		assertEquals("struct(a:INTEGER,b:BOOL)", t.getConstantType("k2"));
+	}
+
+	/*
+	 * Record Except @
+	 */
+
+	@Test
+	public void testRecordExceptAt() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = [a|-> TRUE] /\\ k2 = [k EXCEPT !.a = @ = k3]\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("struct(a:BOOL)", t.getConstantType("k"));
+		assertEquals("struct(a:BOOL)", t.getConstantType("k2"));
+		assertEquals("BOOL", t.getConstantType("k3"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testRecordExceptAtException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = [a|-> TRUE] /\\ k2 = [k EXCEPT !.a = @ = 1]\n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testRecord5() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = [k EXCEPT !.a = 1] /\\ k ={k2} \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+}
diff --git a/src/test/java/de/tla2b/typechecking/TupleTest.java b/src/test/java/de/tla2b/typechecking/TupleTest.java
index 2581f924fb871393a9c58503f1e5480f88d25830..1317d15f0914dbbd41c64add817489aa294d2492 100644
--- a/src/test/java/de/tla2b/typechecking/TupleTest.java
+++ b/src/test/java/de/tla2b/typechecking/TupleTest.java
@@ -1,196 +1,196 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class TupleTest {
-
-	@Test
-	public void testSimpleTuple() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = <<1,TRUE>> \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER*BOOL", t.getConstantType("k").toString());
-	}
-	
-	
-	@Test
-	public void testTupleFunctionCall() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = <<1,TRUE,1>>[2] \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k").toString());
-	}
-	
-	@Test
-	public void testTupleFunctionCall2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = <<1,TRUE,\"str\">>[3] \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("STRING", t.getConstantType("k").toString());
-	}
-
-	@Test
-	public void testTuple3Components() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = <<1,TRUE,1>> \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER*BOOL*INTEGER", t.getConstantType("k").toString());
-	}
-	
-	@Test
-	public void testTuple3Components2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = <<1,1,1>> \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k").toString());
-	}
-
-	@Test
-	public void testTupleComponentsOfTheSameType() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = <<1,1>> \n" + "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k").toString());
-	}
-
-	@Test
-	public void testTuple1() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = <<1,k2>> /\\ k2 = TRUE \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER*BOOL", t.getConstantType("k").toString());
-		assertEquals("BOOL", t.getConstantType("k2").toString());
-	}
-
-	@Test
-	public void testCartesianProduct() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = {1} \\times BOOLEAN \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k").toString());
-	}
-
-	@Test
-	public void testTupleSingleElement() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = <<TRUE>> \n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k").toString());
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testTuple2Elements() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = <<k2, k3>> /\\ k3 = TRUE \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test
-	public void testUnifyTuple3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = <<k2, <<k3>> >> /\\ k3 = TRUE /\\ k2 = 1\n"
-				+ "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER*POW(INTEGER*BOOL)", t.getConstantType("k")
-				.toString());
-		assertEquals("INTEGER", t.getConstantType("k2").toString());
-		assertEquals("BOOL", t.getConstantType("k3").toString());
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testUnifyTuple4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k \\in <<TRUE>>\n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Cartesian Product
-	 */
-	@Test
-	public void testCartesianProduct2() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = BOOLEAN \\X {1} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k").toString());
-	}
-
-	@Test
-	public void testCartesianProduct3() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME BOOLEAN \\X {1} = k \\X k2 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(BOOL)", t.getConstantType("k").toString());
-		assertEquals("POW(INTEGER)", t.getConstantType("k2").toString());
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testCartesianProductException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = BOOLEAN \\X 1 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class TupleTest {
+
+	@Test
+	public void testSimpleTuple() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = <<1,TRUE>> \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER*BOOL", t.getConstantType("k").toString());
+	}
+	
+	
+	@Test
+	public void testTupleFunctionCall() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = <<1,TRUE,1>>[2] \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k").toString());
+	}
+	
+	@Test
+	public void testTupleFunctionCall2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = <<1,TRUE,\"str\">>[3] \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("STRING", t.getConstantType("k").toString());
+	}
+
+	@Test
+	public void testTuple3Components() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = <<1,TRUE,1>> \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER*BOOL*INTEGER", t.getConstantType("k").toString());
+	}
+	
+	@Test
+	public void testTuple3Components2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = <<1,1,1>> \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k").toString());
+	}
+
+	@Test
+	public void testTupleComponentsOfTheSameType() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = <<1,1>> \n" + "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k").toString());
+	}
+
+	@Test
+	public void testTuple1() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = <<1,k2>> /\\ k2 = TRUE \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER*BOOL", t.getConstantType("k").toString());
+		assertEquals("BOOL", t.getConstantType("k2").toString());
+	}
+
+	@Test
+	public void testCartesianProduct() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = {1} \\times BOOLEAN \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k").toString());
+	}
+
+	@Test
+	public void testTupleSingleElement() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = <<TRUE>> \n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k").toString());
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testTuple2Elements() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = <<k2, k3>> /\\ k3 = TRUE \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test
+	public void testUnifyTuple3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = <<k2, <<k3>> >> /\\ k3 = TRUE /\\ k2 = 1\n"
+				+ "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER*POW(INTEGER*BOOL)", t.getConstantType("k")
+				.toString());
+		assertEquals("INTEGER", t.getConstantType("k2").toString());
+		assertEquals("BOOL", t.getConstantType("k3").toString());
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testUnifyTuple4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k \\in <<TRUE>>\n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Cartesian Product
+	 */
+	@Test
+	public void testCartesianProduct2() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = BOOLEAN \\X {1} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL*INTEGER)", t.getConstantType("k").toString());
+	}
+
+	@Test
+	public void testCartesianProduct3() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME BOOLEAN \\X {1} = k \\X k2 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(BOOL)", t.getConstantType("k").toString());
+		assertEquals("POW(INTEGER)", t.getConstantType("k2").toString());
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testCartesianProductException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = BOOLEAN \\X 1 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/TupleVsSequenceTest.java b/src/test/java/de/tla2b/typechecking/TupleVsSequenceTest.java
index 97838b2afd1dedf53ee90b76d8b0a59a3b3b74f7..02e16b398acbd42d35aa85c9286a32319c525e2a 100644
--- a/src/test/java/de/tla2b/typechecking/TupleVsSequenceTest.java
+++ b/src/test/java/de/tla2b/typechecking/TupleVsSequenceTest.java
@@ -1,92 +1,92 @@
-package de.tla2b.typechecking;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class TupleVsSequenceTest {
-
-	@Test  
-	public void testTupleVsSequence() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Append(<<>>, TRUE) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-	}
-	
-	@Test  
-	public void testTupleVsSequence2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = Append(<<1,2,3>>, k2) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-	
-	@Test  
-	public void testTupleVsSequence3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS a, b, c\n"
-				+ "ASSUME <<1,2,3,4>> = <<a,b,c>> \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("a"));
-		assertEquals("INTEGER", t.getConstantType("b"));
-		assertEquals("INTEGER", t.getConstantType("c"));
-	}
-	
-	@Test  
-	public void testTupleVsSequence4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS a, b, c\n"
-				+ "ASSUME a = 1 /\\ b = TRUE /\\ c = <<a,b>>\n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("a"));
-		assertEquals("BOOL", t.getConstantType("b"));
-		assertEquals("INTEGER*BOOL", t.getConstantType("c"));
-	}
-	
-	@Test  
-	public void testTupleVsSequence5() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME k = <<1,2>> /\\ k \\in {1} \\X {2} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER*INTEGER", t.getConstantType("k"));
-	}
-	
-	
-	@Test  
-	public void testTupleVsSequence6() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k\n"
-				+ "ASSUME {k} = {<<x, y>> \\in {1} \\X {2}: TRUE} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER*INTEGER", t.getConstantType("k"));
-	}
-
-	@Test (expected = TypeErrorException.class)
-	public void testTupleVsSequence7() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "ASSUME 1 = <<1,TRUE>>[3] \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-}
+package de.tla2b.typechecking;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class TupleVsSequenceTest {
+
+	@Test  
+	public void testTupleVsSequence() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Append(<<>>, TRUE) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+	}
+	
+	@Test  
+	public void testTupleVsSequence2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = Append(<<1,2,3>>, k2) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+	
+	@Test  
+	public void testTupleVsSequence3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS a, b, c\n"
+				+ "ASSUME <<1,2,3,4>> = <<a,b,c>> \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("a"));
+		assertEquals("INTEGER", t.getConstantType("b"));
+		assertEquals("INTEGER", t.getConstantType("c"));
+	}
+	
+	@Test  
+	public void testTupleVsSequence4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS a, b, c\n"
+				+ "ASSUME a = 1 /\\ b = TRUE /\\ c = <<a,b>>\n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("a"));
+		assertEquals("BOOL", t.getConstantType("b"));
+		assertEquals("INTEGER*BOOL", t.getConstantType("c"));
+	}
+	
+	@Test  
+	public void testTupleVsSequence5() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME k = <<1,2>> /\\ k \\in {1} \\X {2} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER*INTEGER", t.getConstantType("k"));
+	}
+	
+	
+	@Test  
+	public void testTupleVsSequence6() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k\n"
+				+ "ASSUME {k} = {<<x, y>> \\in {1} \\X {2}: TRUE} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER*INTEGER", t.getConstantType("k"));
+	}
+
+	@Test (expected = TypeErrorException.class)
+	public void testTupleVsSequence7() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "ASSUME 1 = <<1,TRUE>>[3] \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+}
diff --git a/src/test/java/de/tla2b/typechecking/TypeConflictsTest.java b/src/test/java/de/tla2b/typechecking/TypeConflictsTest.java
index 9dd382d560d13e874fb3ba3dc41054db92c2c88b..6101e46cf12e5b820411c5da345403de720ad3b5 100644
--- a/src/test/java/de/tla2b/typechecking/TypeConflictsTest.java
+++ b/src/test/java/de/tla2b/typechecking/TypeConflictsTest.java
@@ -1,73 +1,73 @@
-package de.tla2b.typechecking;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestUtil;
-
-
-public class TypeConflictsTest {
-
-	@Test(expected = TypeErrorException.class)
-	public void testTypeConflict1() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = {k} \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testTypeConflict2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME {k} = k  \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test(expected = TypeErrorException.class)
-	public void testTypeConflict3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME {{k}} = k  \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test(expected = TypeErrorException.class)
-	public void testTypeConflict4() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [a |-> k]  \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test(expected = TypeErrorException.class)
-	public void testTypeConflict5() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Integers \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = [x \\in {} |-> k]  \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test(expected = TypeErrorException.class)
-	public void testTypeConflict6() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "CONSTANTS a,b \n"
-				+ "ASSUME a = [x|->1] /\\ b = [y|->a, x|->1] /\\ a=b  \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-}
+package de.tla2b.typechecking;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestUtil;
+
+
+public class TypeConflictsTest {
+
+	@Test(expected = TypeErrorException.class)
+	public void testTypeConflict1() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = {k} \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testTypeConflict2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME {k} = k  \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test(expected = TypeErrorException.class)
+	public void testTypeConflict3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME {{k}} = k  \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test(expected = TypeErrorException.class)
+	public void testTypeConflict4() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [a |-> k]  \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test(expected = TypeErrorException.class)
+	public void testTypeConflict5() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Integers \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = [x \\in {} |-> k]  \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test(expected = TypeErrorException.class)
+	public void testTypeConflict6() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "CONSTANTS a,b \n"
+				+ "ASSUME a = [x|->1] /\\ b = [y|->a, x|->1] /\\ a=b  \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+}
diff --git a/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleFiniteSets.java b/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleFiniteSets.java
index 44c102b1f759c4a690b19893db1294a614356edc..cd85ccc8e8500d21cea921301c740f93b27cd821 100644
--- a/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleFiniteSets.java
+++ b/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleFiniteSets.java
@@ -1,116 +1,116 @@
-package de.tla2b.typechecking.standardmodules;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class TestModuleFiniteSets {
-
-	/*
-	 * IsFiniteSet
-	 */
-	@Test
-	public void unifyIsFiniteSet() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = IsFiniteSet({1,2,3}) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k"));
-	}
-
-	@Test
-	public void unifyIsFiniteSet2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = IsFiniteSet(k2) /\\ k2 = {1} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
-
-	}
-
-	@Test
-	public void unifyIsFiniteSet3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = IsFiniteSet({}) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void unifyErrorIsFiniteSet() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "ASSUME IsFiniteSet(1)\n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void unifyErrorIsFiniteSet2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "ASSUME 1 = IsFiniteSet({1})\n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Cardinality
-	 */
-	@Test
-	public void unifyCardinality() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Cardinality({1,2,3}) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-	}
-
-	@Test
-	public void unifyCardinality2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = Cardinality(k2) /\\ k2 = {1} \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void unifyErrorCardinality() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "ASSUME Cardinality(1)\n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void unifyErrorCardinality2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS FiniteSets \n"
-				+ "ASSUME TRUE = Cardinality({1})\n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-}
+package de.tla2b.typechecking.standardmodules;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class TestModuleFiniteSets {
+
+	/*
+	 * IsFiniteSet
+	 */
+	@Test
+	public void unifyIsFiniteSet() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = IsFiniteSet({1,2,3}) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k"));
+	}
+
+	@Test
+	public void unifyIsFiniteSet2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = IsFiniteSet(k2) /\\ k2 = {1} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
+
+	}
+
+	@Test
+	public void unifyIsFiniteSet3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = IsFiniteSet({}) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void unifyErrorIsFiniteSet() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "ASSUME IsFiniteSet(1)\n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void unifyErrorIsFiniteSet2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "ASSUME 1 = IsFiniteSet({1})\n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Cardinality
+	 */
+	@Test
+	public void unifyCardinality() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Cardinality({1,2,3}) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+	}
+
+	@Test
+	public void unifyCardinality2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = Cardinality(k2) /\\ k2 = {1} \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("POW(INTEGER)", t.getConstantType("k2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void unifyErrorCardinality() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "ASSUME Cardinality(1)\n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void unifyErrorCardinality2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS FiniteSets \n"
+				+ "ASSUME TRUE = Cardinality({1})\n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleIntegers.java b/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleIntegers.java
index 66941f424a1c4e3194edf9b407e71406b0976d23..ea50115d366dd14ef89ec64608aab877816b9bf4 100644
--- a/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleIntegers.java
+++ b/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleIntegers.java
@@ -1,63 +1,63 @@
-package de.tla2b.typechecking.standardmodules;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class TestModuleIntegers {
-
-	/*
-	 * Int
-	 */
-	@Test
-	public void unifyInt() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Integers \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Int \n" + "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void unifyErrorInt() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Integers \n"
-				+ "ASSUME TRUE \\in Int \n"
-				+ "=================================";
-
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * unary minus: -x
-	 */
-	@Test
-	public void unifyUnaryMinus() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Integers \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = -k2 \n" + "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void unifyErrorUnaryMinus() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Integers \n"
-				+ "ASSUME TRUE = -1 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-}
+package de.tla2b.typechecking.standardmodules;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class TestModuleIntegers {
+
+	/*
+	 * Int
+	 */
+	@Test
+	public void unifyInt() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Integers \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Int \n" + "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void unifyErrorInt() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Integers \n"
+				+ "ASSUME TRUE \\in Int \n"
+				+ "=================================";
+
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * unary minus: -x
+	 */
+	@Test
+	public void unifyUnaryMinus() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Integers \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = -k2 \n" + "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void unifyErrorUnaryMinus() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Integers \n"
+				+ "ASSUME TRUE = -1 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleNaturals.java b/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleNaturals.java
index 5d6501c06b0cbfd9d9f3a138f623e6ec4acfdae3..b7807acd24d497cefe906e97d8a3e141523e5173 100644
--- a/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleNaturals.java
+++ b/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleNaturals.java
@@ -1,120 +1,120 @@
-package de.tla2b.typechecking.standardmodules;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class TestModuleNaturals {
-
-	/*
-	 * Relational operators: >, <, <=, >=
-	 */
-	@Test
-	public void testRelationalOperators() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = (k2 > k3) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testRelationalOperatorsException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME 1 = (2 > 1) \n" + "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Arithmetic operator: +, -, *, /, mod, exp
-	 */
-	@Test
-	public void testArithmeticOperators() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = k2 + k3 \n" + "=================================";
-
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k3"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testArithmeticOperatorsException() throws FrontEndException,
-			TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME TRUE = 1 + 1 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Interval operator: x .. y
-	 */
-
-	@Test
-	public void testDotDot() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = k2 .. k3 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-		assertEquals("INTEGER", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("k3"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void testDotDotException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS  k2, k3 \n"
-				+ "ASSUME TRUE \\in  k2 .. k3 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	/*
-	 * Nat
-	 */
-	@Test
-	public void testNat() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Nat \n" + "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER)", t.getConstantType("k"));
-	}
-
-	@Test(expected = TypeErrorException.class)
-	public void unifyErrorNat() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Naturals \n"
-				+ "ASSUME TRUE \\in Nat \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-}
+package de.tla2b.typechecking.standardmodules;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class TestModuleNaturals {
+
+	/*
+	 * Relational operators: >, <, <=, >=
+	 */
+	@Test
+	public void testRelationalOperators() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = (k2 > k3) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testRelationalOperatorsException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME 1 = (2 > 1) \n" + "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Arithmetic operator: +, -, *, /, mod, exp
+	 */
+	@Test
+	public void testArithmeticOperators() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = k2 + k3 \n" + "=================================";
+
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k3"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testArithmeticOperatorsException() throws FrontEndException,
+			TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME TRUE = 1 + 1 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Interval operator: x .. y
+	 */
+
+	@Test
+	public void testDotDot() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = k2 .. k3 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+		assertEquals("INTEGER", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("k3"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void testDotDotException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS  k2, k3 \n"
+				+ "ASSUME TRUE \\in  k2 .. k3 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	/*
+	 * Nat
+	 */
+	@Test
+	public void testNat() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Nat \n" + "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER)", t.getConstantType("k"));
+	}
+
+	@Test(expected = TypeErrorException.class)
+	public void unifyErrorNat() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Naturals \n"
+				+ "ASSUME TRUE \\in Nat \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+}
diff --git a/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleSequences.java b/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleSequences.java
index 7eccb44a531bce6005dc992aa54ae9fb794452ef..d5973ef2e6b56824ae5f750b6e7be69d126afacd 100644
--- a/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleSequences.java
+++ b/src/test/java/de/tla2b/typechecking/standardmodules/TestModuleSequences.java
@@ -1,352 +1,352 @@
-package de.tla2b.typechecking.standardmodules;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.exceptions.TypeErrorException;
-import de.tla2b.util.TestTypeChecker;
-import de.tla2b.util.TestUtil;
-
-
-public class TestModuleSequences {
-
-	/*
-	 * Seq(S): The set of all sequences of elements in S.
-	 */
-	@Test  
-	public void testSeq() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Seq({TRUE}) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(POW(INTEGER*BOOL))", t.getConstantType("k"));
-	}
-	
-	@Test  
-	public void testSeq2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME <<k>> \\in Seq({TRUE}) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("BOOL", t.getConstantType("k"));
-	}
-	
-	
-	
-	@Test (expected = TypeErrorException.class)
-	public void testSeqException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "ASSUME 1 = Seq({1}) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-
-	@Test (expected = TypeErrorException.class)
-	public void testSeqException2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Seq(1) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	
-	/*
-	 * Len(S)
-	 */
-	@Test  
-	public void testLen() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Len(<<1,2,3>>) \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testLenException() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME TRUE = Len(<<1,2,3>>) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testLenException2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME 3 = Len({1,2,3}) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testUnifyErrorLen2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME 1 = Len(1) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	
-	/*
-	 * s \o s2 - concatenation of s and s2
-	 */
-	@Test  
-	public void testUnifyConcatenation() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = k2 \\o <<TRUE>> \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-	}
-	
-	@Test  
-	public void testUnifyConcatenation2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME <<TRUE>> = k \\o k2 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-	}
-	
-	@Test  
-	public void testUnifyConcatenation3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k= k2 \\o k3 /\\ k3 = <<TRUE>> \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k3"));
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testUnifyErrorConcatenation() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2  \n"
-				+ "ASSUME k = 1 \\o k2 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testUnifyErrorConcatenation2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2  \n"
-				+ "ASSUME 1 = k \\o k2 \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testUnifyErrorConcatenation3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2  \n"
-				+ "ASSUME <<TRUE>> = <<1>> \\o <<2>> \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	
-	/*
-	 * Append(s, e)
-	 */
-	@Test  
-	public void testUnifyAppend() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = Append(k2, k3) /\\ k3 = TRUE \n"
-				+ "=================================";
-	
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-		assertEquals("BOOL", t.getConstantType("k3"));
-	}
-	
-	@Test  
-	public void testUnifyAppend2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = Append(k2, k3) /\\ k = <<TRUE>> \n"
-				+ "=================================";
-	
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-		assertEquals("BOOL", t.getConstantType("k3"));
-	}
-	
-	@Test  
-	public void testUnifyAppend3() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = Append(k2, 1) \n"
-				+ "=================================";
-	
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k2"));
-	}
-
-	
-	@Test (expected = TypeErrorException.class)
-	public void testUnifyErrorAppend() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2, k3 \n"
-				+ "ASSUME k = Append(1, k3) \n"
-				+ "=================================";
-	
-		TestUtil.typeCheckString(module);
-	}
-	
-
-	/*
-	 * Head(s): the first element of the seq
-	 */
-	@Test  
-	public void testUnifyHead() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = Head(k2) /\\ k2 = <<1>> \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k2"));
-	}
-	
-	@Test  
-	public void testUnifyHead2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = Head(k2) /\\ k = 1 \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("INTEGER", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k2"));
-	}
-	
-	@Test (expected = TypeErrorException.class) 
-	public void testUnifyErrorHead() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Head(1) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	/*
-	 * Tail(s): the sequence without the first element
-	 */
-	@Test  
-	public void testUnifyTail() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = Tail(k2) /\\ k = <<TRUE>> \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-	}
-	
-	@Test  
-	public void testUnifyTail2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2 \n"
-				+ "ASSUME k = Tail(k2) /\\ k2 = <<TRUE>> \n"
-				+ "=================================";
-	
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-	}
-	
-	@Test (expected = TypeErrorException.class)  
-	public void testUnifyErrorTail() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k \n"
-				+ "ASSUME k = Tail(1) \n"
-				+ "=================================";
-		TestUtil.typeCheckString(module);
-	}
-	
-	/*
-	 * SubSeq(s,m,n): The sequence <<s[m], s[m+1], ... , s[n]>>
-	 */
-	@Test  
-	public void testUnifySubSeq() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2, m, n \n"
-				+ "ASSUME k = SubSeq(k2, m, n) /\\ k = <<TRUE>> \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("m"));
-		assertEquals("INTEGER", t.getConstantType("n"));
-	}
-	
-	@Test  
-	public void testUnifySubSeq2() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2, m, n \n"
-				+ "ASSUME k = SubSeq(k2, m, n) /\\ k2= <<TRUE>> \n"
-				+ "=================================";
-		TestTypeChecker t = TestUtil.typeCheckString(module);
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
-		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
-		assertEquals("INTEGER", t.getConstantType("m"));
-		assertEquals("INTEGER", t.getConstantType("n"));
-	}
-	
-	@Test (expected = TypeErrorException.class)
-	public void testUnifyErrorSubSeq() throws FrontEndException, TLA2BException {
-		final String module = "-------------- MODULE Testing ----------------\n"
-				+ "EXTENDS Sequences \n"
-				+ "CONSTANTS k, k2, m, n \n"
-				+ "ASSUME k = SubSeq(1, m, n) \n"
-				+ "=================================";
-	
-		TestUtil.typeCheckString(module);
-	}
-}
+package de.tla2b.typechecking.standardmodules;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.exceptions.TypeErrorException;
+import de.tla2b.util.TestTypeChecker;
+import de.tla2b.util.TestUtil;
+
+
+public class TestModuleSequences {
+
+	/*
+	 * Seq(S): The set of all sequences of elements in S.
+	 */
+	@Test  
+	public void testSeq() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Seq({TRUE}) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(POW(INTEGER*BOOL))", t.getConstantType("k"));
+	}
+	
+	@Test  
+	public void testSeq2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME <<k>> \\in Seq({TRUE}) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("BOOL", t.getConstantType("k"));
+	}
+	
+	
+	
+	@Test (expected = TypeErrorException.class)
+	public void testSeqException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "ASSUME 1 = Seq({1}) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+
+	@Test (expected = TypeErrorException.class)
+	public void testSeqException2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Seq(1) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	
+	/*
+	 * Len(S)
+	 */
+	@Test  
+	public void testLen() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Len(<<1,2,3>>) \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testLenException() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME TRUE = Len(<<1,2,3>>) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testLenException2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME 3 = Len({1,2,3}) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testUnifyErrorLen2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME 1 = Len(1) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	
+	/*
+	 * s \o s2 - concatenation of s and s2
+	 */
+	@Test  
+	public void testUnifyConcatenation() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = k2 \\o <<TRUE>> \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+	}
+	
+	@Test  
+	public void testUnifyConcatenation2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME <<TRUE>> = k \\o k2 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+	}
+	
+	@Test  
+	public void testUnifyConcatenation3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k= k2 \\o k3 /\\ k3 = <<TRUE>> \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k3"));
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testUnifyErrorConcatenation() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2  \n"
+				+ "ASSUME k = 1 \\o k2 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testUnifyErrorConcatenation2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2  \n"
+				+ "ASSUME 1 = k \\o k2 \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testUnifyErrorConcatenation3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2  \n"
+				+ "ASSUME <<TRUE>> = <<1>> \\o <<2>> \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	
+	/*
+	 * Append(s, e)
+	 */
+	@Test  
+	public void testUnifyAppend() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = Append(k2, k3) /\\ k3 = TRUE \n"
+				+ "=================================";
+	
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+		assertEquals("BOOL", t.getConstantType("k3"));
+	}
+	
+	@Test  
+	public void testUnifyAppend2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = Append(k2, k3) /\\ k = <<TRUE>> \n"
+				+ "=================================";
+	
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+		assertEquals("BOOL", t.getConstantType("k3"));
+	}
+	
+	@Test  
+	public void testUnifyAppend3() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = Append(k2, 1) \n"
+				+ "=================================";
+	
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k2"));
+	}
+
+	
+	@Test (expected = TypeErrorException.class)
+	public void testUnifyErrorAppend() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2, k3 \n"
+				+ "ASSUME k = Append(1, k3) \n"
+				+ "=================================";
+	
+		TestUtil.typeCheckString(module);
+	}
+	
+
+	/*
+	 * Head(s): the first element of the seq
+	 */
+	@Test  
+	public void testUnifyHead() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = Head(k2) /\\ k2 = <<1>> \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k2"));
+	}
+	
+	@Test  
+	public void testUnifyHead2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = Head(k2) /\\ k = 1 \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("INTEGER", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*INTEGER)", t.getConstantType("k2"));
+	}
+	
+	@Test (expected = TypeErrorException.class) 
+	public void testUnifyErrorHead() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Head(1) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	/*
+	 * Tail(s): the sequence without the first element
+	 */
+	@Test  
+	public void testUnifyTail() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = Tail(k2) /\\ k = <<TRUE>> \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+	}
+	
+	@Test  
+	public void testUnifyTail2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2 \n"
+				+ "ASSUME k = Tail(k2) /\\ k2 = <<TRUE>> \n"
+				+ "=================================";
+	
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+	}
+	
+	@Test (expected = TypeErrorException.class)  
+	public void testUnifyErrorTail() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k \n"
+				+ "ASSUME k = Tail(1) \n"
+				+ "=================================";
+		TestUtil.typeCheckString(module);
+	}
+	
+	/*
+	 * SubSeq(s,m,n): The sequence <<s[m], s[m+1], ... , s[n]>>
+	 */
+	@Test  
+	public void testUnifySubSeq() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2, m, n \n"
+				+ "ASSUME k = SubSeq(k2, m, n) /\\ k = <<TRUE>> \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("m"));
+		assertEquals("INTEGER", t.getConstantType("n"));
+	}
+	
+	@Test  
+	public void testUnifySubSeq2() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2, m, n \n"
+				+ "ASSUME k = SubSeq(k2, m, n) /\\ k2= <<TRUE>> \n"
+				+ "=================================";
+		TestTypeChecker t = TestUtil.typeCheckString(module);
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k"));
+		assertEquals("POW(INTEGER*BOOL)", t.getConstantType("k2"));
+		assertEquals("INTEGER", t.getConstantType("m"));
+		assertEquals("INTEGER", t.getConstantType("n"));
+	}
+	
+	@Test (expected = TypeErrorException.class)
+	public void testUnifyErrorSubSeq() throws FrontEndException, TLA2BException {
+		final String module = "-------------- MODULE Testing ----------------\n"
+				+ "EXTENDS Sequences \n"
+				+ "CONSTANTS k, k2, m, n \n"
+				+ "ASSUME k = SubSeq(1, m, n) \n"
+				+ "=================================";
+	
+		TestUtil.typeCheckString(module);
+	}
+}
diff --git a/src/test/java/de/tla2b/util/Ast2String.java b/src/test/java/de/tla2b/util/Ast2String.java
index b38ab1af816fab03e129541320d6702bc3be4054..1aa95825c739506d23b8d1fc7b887a61a26e5ea1 100644
--- a/src/test/java/de/tla2b/util/Ast2String.java
+++ b/src/test/java/de/tla2b/util/Ast2String.java
@@ -1,66 +1,66 @@
-package de.tla2b.util;
-
-import de.be4.classicalb.core.parser.node.Node;
-import de.be4.classicalb.core.parser.node.Start;
-import de.be4.classicalb.core.parser.node.Token;
-
-public class Ast2String extends ExtendedDFAdapter {
-	private final StringBuilder builder = new StringBuilder();
-
-	@Override
-	public String toString() {
-		return builder.toString();
-	}
-
-	@Override
-	public void defaultIn(final Node node) {
-		super.defaultIn(node);
-		builder.append(node.getClass().getSimpleName());
-		builder.append("(");
-	}
-
-	@Override
-	public void defaultCase(final Node node) {
-		super.defaultCase(node);
-		if (node instanceof Token) {
-			builder.append(((Token) node).getText());
-		} else {
-			builder.append(node.toString());
-		}
-
-	}
-
-	@Override
-	public void defaultOut(final Node node) {
-		super.defaultOut(node);
-		builder.append(")");
-	}
-
-	@Override
-	public void beginList(final Node parent) {
-		builder.append('[');
-	}
-
-	@Override
-	public void betweenListElements(final Node parent) {
-		builder.append(',');
-	}
-
-	@Override
-	public void endList(final Node parent) {
-		builder.append(']');
-	}
-
-	@Override
-	public void betweenChildren(final Node parent) {
-		builder.append(',');
-	}
-
-	@Override
-	public void caseStart(final Start node) {
-		inStart(node);
-		node.getPParseUnit().apply(this);
-		node.getEOF().apply(this);
-		outStart(node);
-	}
-}
+package de.tla2b.util;
+
+import de.be4.classicalb.core.parser.node.Node;
+import de.be4.classicalb.core.parser.node.Start;
+import de.be4.classicalb.core.parser.node.Token;
+
+public class Ast2String extends ExtendedDFAdapter {
+	private final StringBuilder builder = new StringBuilder();
+
+	@Override
+	public String toString() {
+		return builder.toString();
+	}
+
+	@Override
+	public void defaultIn(final Node node) {
+		super.defaultIn(node);
+		builder.append(node.getClass().getSimpleName());
+		builder.append("(");
+	}
+
+	@Override
+	public void defaultCase(final Node node) {
+		super.defaultCase(node);
+		if (node instanceof Token) {
+			builder.append(((Token) node).getText());
+		} else {
+			builder.append(node.toString());
+		}
+
+	}
+
+	@Override
+	public void defaultOut(final Node node) {
+		super.defaultOut(node);
+		builder.append(")");
+	}
+
+	@Override
+	public void beginList(final Node parent) {
+		builder.append('[');
+	}
+
+	@Override
+	public void betweenListElements(final Node parent) {
+		builder.append(',');
+	}
+
+	@Override
+	public void endList(final Node parent) {
+		builder.append(']');
+	}
+
+	@Override
+	public void betweenChildren(final Node parent) {
+		builder.append(',');
+	}
+
+	@Override
+	public void caseStart(final Start node) {
+		inStart(node);
+		node.getPParseUnit().apply(this);
+		node.getEOF().apply(this);
+		outStart(node);
+	}
+}
diff --git a/src/test/java/de/tla2b/util/TestTypeChecker.java b/src/test/java/de/tla2b/util/TestTypeChecker.java
index 5e7af8bbaeb0be14e78e02ff381cbe440ef12f96..0610c0addd9e6a05336b07da2bd5069f7c681818 100644
--- a/src/test/java/de/tla2b/util/TestTypeChecker.java
+++ b/src/test/java/de/tla2b/util/TestTypeChecker.java
@@ -1,126 +1,126 @@
-package de.tla2b.util;
-
-import java.util.Hashtable;
-
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.global.TranslationGlobals;
-import de.tla2b.types.TLAType;
-import de.tla2bAst.Translator;
-import tla2sany.semantic.FormalParamNode;
-import tla2sany.semantic.ModuleNode;
-import tla2sany.semantic.OpDeclNode;
-import tla2sany.semantic.OpDefNode;
-import tla2sany.semantic.SemanticNode;
-
-public class TestTypeChecker implements TranslationGlobals {
-
-	public ModuleNode moduleNode;
-	public final int toolId = 5;
-	private Hashtable<String, TLAType> constants;
-	private Hashtable<String, TLAType> variables;
-	private Hashtable<String, DefCon> definitions;
-
-	public TestTypeChecker() {
-		constants = new Hashtable<String, TLAType>();
-		variables = new Hashtable<String, TLAType>();
-		definitions = new Hashtable<String, DefCon>();
-	}
-
-	public void startTest(String moduleString, String configString)
-			throws FrontEndException, TLA2BException {
-		Translator translator = new Translator(moduleString, configString);
-		translator.translate();
-		moduleNode = translator.getModuleNode();
-		init();
-	}
-	
-	public void start(String moduleFileName)
-			throws FrontEndException, TLA2BException {
-		Translator translator = new Translator(moduleFileName);
-		translator.translate();
-		moduleNode = translator.getModuleNode();
-		init();
-	}
-
-
-	private TLAType getBType(SemanticNode node){
-		TLAType type = (TLAType) node.getToolObject(toolId);
-		return type;
-	}
-	
-	private void init() {
-		for (int i = 0; i < moduleNode.getConstantDecls().length; i++) {
-			OpDeclNode con = moduleNode.getConstantDecls()[i];
-			constants.put(con.getName().toString(),
-					getBType(con));
-		}
-
-		for (int i = 0; i < moduleNode.getVariableDecls().length; i++) {
-			OpDeclNode var = moduleNode.getVariableDecls()[i];
-			variables.put(var.getName().toString(),
-					getBType(var));
-		}
-
-		for (int i = 0; i < moduleNode.getOpDefs().length; i++) {
-			OpDefNode def = moduleNode.getOpDefs()[i];
-			DefCon defCon = new DefCon(getBType(def));
-			if (defCon.getType() == null)
-				continue;
-
-			if (STANDARD_MODULES.contains(def
-					.getOriginallyDefinedInModuleNode().getName().toString())
-					|| STANDARD_MODULES.contains(def.getSource()
-							.getOriginallyDefinedInModuleNode().getName()
-							.toString())) {
-				continue;
-			}
-
-			for (int j = 0; j < def.getParams().length; j++) {
-				FormalParamNode p = def.getParams()[j];
-				defCon.parameters.put(p.getName().toString(),
-						getBType(p));
-			}
-			definitions.put(def.getName().toString(), defCon);
-		}
-	}
-
-	
-	public String getConstantType(String conName) {
-		return constants.get(conName).toString();
-	}
-	
-	public String getVariableType(String varName){
-		return variables.get(varName).toString();
-	}
-
-	public String getDefinitionType(String defName){
-		return definitions.get(defName).getType().toString();
-	}
-
-	public String getDefinitionParamType(String defName, String paramName){
-		return definitions.get(defName).getParams().get(paramName).toString();
-	}
-
-	public class DefCon {
-		private Hashtable<String, TLAType> parameters;
-		private TLAType type;
-
-		private DefCon(TLAType t) {
-			parameters = new Hashtable<String, TLAType>();
-			type = t;
-		}
-
-		public Hashtable<String, TLAType> getParams() {
-			return parameters;
-		}
-
-		public TLAType getType() {
-			return type;
-		}
-
-		public void setType(TLAType type) {
-			this.type = type;
-		}
-	}
-}
+package de.tla2b.util;
+
+import java.util.Hashtable;
+
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.global.TranslationGlobals;
+import de.tla2b.types.TLAType;
+import de.tla2bAst.Translator;
+import tla2sany.semantic.FormalParamNode;
+import tla2sany.semantic.ModuleNode;
+import tla2sany.semantic.OpDeclNode;
+import tla2sany.semantic.OpDefNode;
+import tla2sany.semantic.SemanticNode;
+
+public class TestTypeChecker implements TranslationGlobals {
+
+	public ModuleNode moduleNode;
+	public final int toolId = 5;
+	private Hashtable<String, TLAType> constants;
+	private Hashtable<String, TLAType> variables;
+	private Hashtable<String, DefCon> definitions;
+
+	public TestTypeChecker() {
+		constants = new Hashtable<String, TLAType>();
+		variables = new Hashtable<String, TLAType>();
+		definitions = new Hashtable<String, DefCon>();
+	}
+
+	public void startTest(String moduleString, String configString)
+			throws FrontEndException, TLA2BException {
+		Translator translator = new Translator(moduleString, configString);
+		translator.translate();
+		moduleNode = translator.getModuleNode();
+		init();
+	}
+	
+	public void start(String moduleFileName)
+			throws FrontEndException, TLA2BException {
+		Translator translator = new Translator(moduleFileName);
+		translator.translate();
+		moduleNode = translator.getModuleNode();
+		init();
+	}
+
+
+	private TLAType getBType(SemanticNode node){
+		TLAType type = (TLAType) node.getToolObject(toolId);
+		return type;
+	}
+	
+	private void init() {
+		for (int i = 0; i < moduleNode.getConstantDecls().length; i++) {
+			OpDeclNode con = moduleNode.getConstantDecls()[i];
+			constants.put(con.getName().toString(),
+					getBType(con));
+		}
+
+		for (int i = 0; i < moduleNode.getVariableDecls().length; i++) {
+			OpDeclNode var = moduleNode.getVariableDecls()[i];
+			variables.put(var.getName().toString(),
+					getBType(var));
+		}
+
+		for (int i = 0; i < moduleNode.getOpDefs().length; i++) {
+			OpDefNode def = moduleNode.getOpDefs()[i];
+			DefCon defCon = new DefCon(getBType(def));
+			if (defCon.getType() == null)
+				continue;
+
+			if (STANDARD_MODULES.contains(def
+					.getOriginallyDefinedInModuleNode().getName().toString())
+					|| STANDARD_MODULES.contains(def.getSource()
+							.getOriginallyDefinedInModuleNode().getName()
+							.toString())) {
+				continue;
+			}
+
+			for (int j = 0; j < def.getParams().length; j++) {
+				FormalParamNode p = def.getParams()[j];
+				defCon.parameters.put(p.getName().toString(),
+						getBType(p));
+			}
+			definitions.put(def.getName().toString(), defCon);
+		}
+	}
+
+	
+	public String getConstantType(String conName) {
+		return constants.get(conName).toString();
+	}
+	
+	public String getVariableType(String varName){
+		return variables.get(varName).toString();
+	}
+
+	public String getDefinitionType(String defName){
+		return definitions.get(defName).getType().toString();
+	}
+
+	public String getDefinitionParamType(String defName, String paramName){
+		return definitions.get(defName).getParams().get(paramName).toString();
+	}
+
+	public class DefCon {
+		private Hashtable<String, TLAType> parameters;
+		private TLAType type;
+
+		private DefCon(TLAType t) {
+			parameters = new Hashtable<String, TLAType>();
+			type = t;
+		}
+
+		public Hashtable<String, TLAType> getParams() {
+			return parameters;
+		}
+
+		public TLAType getType() {
+			return type;
+		}
+
+		public void setType(TLAType type) {
+			this.type = type;
+		}
+	}
+}
diff --git a/src/test/java/de/tla2b/util/TestUtil.java b/src/test/java/de/tla2b/util/TestUtil.java
index d0d9cf7c7eb4b05f435ce6f446f5967c2d70859e..d608f42dd69af89bf96aea08a49552ce53374444 100644
--- a/src/test/java/de/tla2b/util/TestUtil.java
+++ b/src/test/java/de/tla2b/util/TestUtil.java
@@ -1,183 +1,183 @@
-package de.tla2b.util;
-
-import static org.junit.Assert.*;
-
-import util.FileUtil;
-import de.be4.classicalb.core.parser.BParser;
-import de.be4.classicalb.core.parser.exceptions.BCompoundException;
-import de.be4.classicalb.core.parser.node.Node;
-import de.be4.classicalb.core.parser.node.Start;
-import de.tla2b.exceptions.FrontEndException;
-import de.tla2b.exceptions.TLA2BException;
-import de.tla2b.output.ASTPrettyPrinter;
-import de.tla2b.output.Renamer;
-import de.tla2bAst.Translator;
-import util.ToolIO;
-
-public class TestUtil {
-
-	public static void loadTlaFile(String tlaFile) throws Exception {
-		Translator t = new Translator(tlaFile);
-		t.translate();
-	}
-
-	public static void runModule(String tlaFile) throws Exception {
-		Translator t = new Translator(tlaFile);
-		Start start = t.translate();
-
-		System.out.println("-------------------");
-		ASTPrettyPrinter aP = new ASTPrettyPrinter(start);
-		start.apply(aP);
-		System.out.println(aP.getResultString());
-
-		final BParser parser = new BParser("testcase");
-		final Start ppStart = parser.parse(aP.getResultString(), false);
-
-		String result = getTreeAsString(start);
-		System.out.println(result);
-		String ppResult = getTreeAsString(ppStart);
-		System.out.println(ppResult);
-
-		System.out.println("-------------------");
-		// compare the generated AST and the AST of the pretty print
-		// assertEquals(result, ppResult);
-		// System.out.println(t.getBDefinitions().getDefinitionNames());
-	}
-
-	public static void compareExpr(String bExpr, String tlaExpr) throws Exception {
-		ToolIO.setMode(ToolIO.TOOL);
-		ToolIO.reset();
-		Start resultNode = Translator.translateTlaExpression(tlaExpr);
-		Renamer renamer = new Renamer(resultNode);
-		ASTPrettyPrinter aP = new ASTPrettyPrinter(resultNode, renamer);
-		resultNode.apply(aP);
-		System.out.println(aP.getResultString());
-		String bAstString = getAstStringofBExpressionString(bExpr);
-		String result = getAstStringofBExpressionString(aP.getResultString());
-		// String tlaAstString = getTreeAsString(resultNode);
-		assertEquals(bAstString, result);
-	}
-
-	public static void compareExprIncludingModel(String bExpr, String tlaExpr, String moduleString) throws Exception {
-		Translator trans = new Translator(moduleString, null);
-		trans.translate();
-		Start resultNode = trans.translateExpression(tlaExpr);
-		Renamer renamer = new Renamer(resultNode);
-		ASTPrettyPrinter aP = new ASTPrettyPrinter(resultNode, renamer);
-		resultNode.apply(aP);
-		String bAstString = getAstStringofBExpressionString(bExpr);
-		String result = getAstStringofBExpressionString(aP.getResultString());
-		assertEquals(bAstString, result);
-	}
-
-	public static void compare(final String bMachine, final String tlaModule) throws Exception {
-		ToolIO.setMode(ToolIO.TOOL);
-		String expected = getAstStringofBMachineString(bMachine);
-
-		Translator trans = new Translator(tlaModule, null);
-		Start resultNode = trans.translate();
-		String result = getTreeAsString(resultNode);
-		System.out.println(expected);
-		System.out.println(result);
-
-		ASTPrettyPrinter aP = new ASTPrettyPrinter(resultNode);
-		resultNode.apply(aP);
-		System.out.println("-------------------");
-		System.out.println(aP.getResultString());
-		final BParser parser = new BParser("testcase");
-		// Start ast = parser.parse(aP.getResultString(), false);
-		// BParser.printASTasProlog(System.out, new BParser(), new
-		// File("./test.mch"), resultNode, false, true, null);
-
-		// System.out.println("----------PP------------");
-		// System.out.println(aP.getResultString());
-		// System.out.println(getTreeAsString(ast));
-		assertEquals(expected, result);
-
-		// System.out.println(result);
-		// assertEquals(expected, getTreeAsString(ast));
-	}
-
-	public static void compare(String bMachine, String tlaModule, String config) throws Exception {
-		ToolIO.setMode(ToolIO.TOOL);
-		String expected = getAstStringofBMachineString(bMachine);
-		System.out.println(expected);
-
-		Translator trans = new Translator(tlaModule, config);
-		Start resultNode = trans.translate();
-
-		ASTPrettyPrinter aP = new ASTPrettyPrinter(resultNode);
-		resultNode.apply(aP);
-		System.out.println(aP.getResultString());
-
-		String result = getTreeAsString(resultNode);
-		System.out.println(result);
-		assertEquals(expected, result);
-	}
-
-	public static String getTreeAsString(Node node) {
-		final Ast2String ast2String = new Ast2String();
-		node.apply(ast2String);
-		return ast2String.toString();
-	}
-
-	public static void renamerTest(String tlaFile) throws Exception {
-		Translator t = new Translator(tlaFile);
-		Start start = t.translate();
-		Renamer renamer = new Renamer(start);
-		ASTPrettyPrinter aP = new ASTPrettyPrinter(start, renamer);
-		start.apply(aP);
-		System.out.println(aP.getResultString());
-
-		final BParser parser = new BParser("testcase");
-		parser.parse(aP.getResultString(), false);
-	}
-
-	public static TestTypeChecker typeCheckString(String moduleString) throws FrontEndException, TLA2BException {
-		ToolIO.setMode(ToolIO.TOOL);
-		ToolIO.reset();
-		TestTypeChecker testTypeChecker = new TestTypeChecker();
-		testTypeChecker.startTest(moduleString, null);
-		return testTypeChecker;
-
-	}
-
-	public static TestTypeChecker typeCheckString(String moduleString, String configString)
-			throws FrontEndException, TLA2BException {
-		ToolIO.setMode(ToolIO.TOOL);
-		ToolIO.reset();
-		TestTypeChecker testTypeChecker = new TestTypeChecker();
-		testTypeChecker.startTest(moduleString, configString);
-		return testTypeChecker;
-	}
-
-	public static TestTypeChecker typeCheck(String moduleFileName) throws FrontEndException, TLA2BException {
-		ToolIO.setMode(ToolIO.TOOL);
-		ToolIO.reset();
-		moduleFileName = moduleFileName.replace('/', FileUtil.separatorChar);
-		TestTypeChecker testTypeChecker = new TestTypeChecker();
-		testTypeChecker.start(moduleFileName);
-		return testTypeChecker;
-	}
-
-	public static String getAstStringofBMachineString(final String testMachine) throws BCompoundException {
-		final BParser parser = new BParser("testcase");
-		final Start startNode = parser.parse(testMachine, false);
-
-		final Ast2String ast2String = new Ast2String();
-		startNode.apply(ast2String);
-		final String string = ast2String.toString();
-		return string;
-	}
-
-	public static String getAstStringofBExpressionString(final String expr) throws BCompoundException {
-		final BParser parser = new BParser("testcase");
-		final Start startNode = parser.parse("#FORMULA " + expr, false);
-
-		final Ast2String ast2String = new Ast2String();
-		startNode.apply(ast2String);
-		final String string = ast2String.toString();
-		return string;
-	}
-
-}
+package de.tla2b.util;
+
+import static org.junit.Assert.*;
+
+import util.FileUtil;
+import de.be4.classicalb.core.parser.BParser;
+import de.be4.classicalb.core.parser.exceptions.BCompoundException;
+import de.be4.classicalb.core.parser.node.Node;
+import de.be4.classicalb.core.parser.node.Start;
+import de.tla2b.exceptions.FrontEndException;
+import de.tla2b.exceptions.TLA2BException;
+import de.tla2b.output.ASTPrettyPrinter;
+import de.tla2b.output.Renamer;
+import de.tla2bAst.Translator;
+import util.ToolIO;
+
+public class TestUtil {
+
+	public static void loadTlaFile(String tlaFile) throws Exception {
+		Translator t = new Translator(tlaFile);
+		t.translate();
+	}
+
+	public static void runModule(String tlaFile) throws Exception {
+		Translator t = new Translator(tlaFile);
+		Start start = t.translate();
+
+		System.out.println("-------------------");
+		ASTPrettyPrinter aP = new ASTPrettyPrinter(start);
+		start.apply(aP);
+		System.out.println(aP.getResultString());
+
+		final BParser parser = new BParser("testcase");
+		final Start ppStart = parser.parse(aP.getResultString(), false);
+
+		String result = getTreeAsString(start);
+		System.out.println(result);
+		String ppResult = getTreeAsString(ppStart);
+		System.out.println(ppResult);
+
+		System.out.println("-------------------");
+		// compare the generated AST and the AST of the pretty print
+		// assertEquals(result, ppResult);
+		// System.out.println(t.getBDefinitions().getDefinitionNames());
+	}
+
+	public static void compareExpr(String bExpr, String tlaExpr) throws Exception {
+		ToolIO.setMode(ToolIO.TOOL);
+		ToolIO.reset();
+		Start resultNode = Translator.translateTlaExpression(tlaExpr);
+		Renamer renamer = new Renamer(resultNode);
+		ASTPrettyPrinter aP = new ASTPrettyPrinter(resultNode, renamer);
+		resultNode.apply(aP);
+		System.out.println(aP.getResultString());
+		String bAstString = getAstStringofBExpressionString(bExpr);
+		String result = getAstStringofBExpressionString(aP.getResultString());
+		// String tlaAstString = getTreeAsString(resultNode);
+		assertEquals(bAstString, result);
+	}
+
+	public static void compareExprIncludingModel(String bExpr, String tlaExpr, String moduleString) throws Exception {
+		Translator trans = new Translator(moduleString, null);
+		trans.translate();
+		Start resultNode = trans.translateExpression(tlaExpr);
+		Renamer renamer = new Renamer(resultNode);
+		ASTPrettyPrinter aP = new ASTPrettyPrinter(resultNode, renamer);
+		resultNode.apply(aP);
+		String bAstString = getAstStringofBExpressionString(bExpr);
+		String result = getAstStringofBExpressionString(aP.getResultString());
+		assertEquals(bAstString, result);
+	}
+
+	public static void compare(final String bMachine, final String tlaModule) throws Exception {
+		ToolIO.setMode(ToolIO.TOOL);
+		String expected = getAstStringofBMachineString(bMachine);
+
+		Translator trans = new Translator(tlaModule, null);
+		Start resultNode = trans.translate();
+		String result = getTreeAsString(resultNode);
+		System.out.println(expected);
+		System.out.println(result);
+
+		ASTPrettyPrinter aP = new ASTPrettyPrinter(resultNode);
+		resultNode.apply(aP);
+		System.out.println("-------------------");
+		System.out.println(aP.getResultString());
+		final BParser parser = new BParser("testcase");
+		// Start ast = parser.parse(aP.getResultString(), false);
+		// BParser.printASTasProlog(System.out, new BParser(), new
+		// File("./test.mch"), resultNode, false, true, null);
+
+		// System.out.println("----------PP------------");
+		// System.out.println(aP.getResultString());
+		// System.out.println(getTreeAsString(ast));
+		assertEquals(expected, result);
+
+		// System.out.println(result);
+		// assertEquals(expected, getTreeAsString(ast));
+	}
+
+	public static void compare(String bMachine, String tlaModule, String config) throws Exception {
+		ToolIO.setMode(ToolIO.TOOL);
+		String expected = getAstStringofBMachineString(bMachine);
+		System.out.println(expected);
+
+		Translator trans = new Translator(tlaModule, config);
+		Start resultNode = trans.translate();
+
+		ASTPrettyPrinter aP = new ASTPrettyPrinter(resultNode);
+		resultNode.apply(aP);
+		System.out.println(aP.getResultString());
+
+		String result = getTreeAsString(resultNode);
+		System.out.println(result);
+		assertEquals(expected, result);
+	}
+
+	public static String getTreeAsString(Node node) {
+		final Ast2String ast2String = new Ast2String();
+		node.apply(ast2String);
+		return ast2String.toString();
+	}
+
+	public static void renamerTest(String tlaFile) throws Exception {
+		Translator t = new Translator(tlaFile);
+		Start start = t.translate();
+		Renamer renamer = new Renamer(start);
+		ASTPrettyPrinter aP = new ASTPrettyPrinter(start, renamer);
+		start.apply(aP);
+		System.out.println(aP.getResultString());
+
+		final BParser parser = new BParser("testcase");
+		parser.parse(aP.getResultString(), false);
+	}
+
+	public static TestTypeChecker typeCheckString(String moduleString) throws FrontEndException, TLA2BException {
+		ToolIO.setMode(ToolIO.TOOL);
+		ToolIO.reset();
+		TestTypeChecker testTypeChecker = new TestTypeChecker();
+		testTypeChecker.startTest(moduleString, null);
+		return testTypeChecker;
+
+	}
+
+	public static TestTypeChecker typeCheckString(String moduleString, String configString)
+			throws FrontEndException, TLA2BException {
+		ToolIO.setMode(ToolIO.TOOL);
+		ToolIO.reset();
+		TestTypeChecker testTypeChecker = new TestTypeChecker();
+		testTypeChecker.startTest(moduleString, configString);
+		return testTypeChecker;
+	}
+
+	public static TestTypeChecker typeCheck(String moduleFileName) throws FrontEndException, TLA2BException {
+		ToolIO.setMode(ToolIO.TOOL);
+		ToolIO.reset();
+		moduleFileName = moduleFileName.replace('/', FileUtil.separatorChar);
+		TestTypeChecker testTypeChecker = new TestTypeChecker();
+		testTypeChecker.start(moduleFileName);
+		return testTypeChecker;
+	}
+
+	public static String getAstStringofBMachineString(final String testMachine) throws BCompoundException {
+		final BParser parser = new BParser("testcase");
+		final Start startNode = parser.parse(testMachine, false);
+
+		final Ast2String ast2String = new Ast2String();
+		startNode.apply(ast2String);
+		final String string = ast2String.toString();
+		return string;
+	}
+
+	public static String getAstStringofBExpressionString(final String expr) throws BCompoundException {
+		final BParser parser = new BParser("testcase");
+		final Start startNode = parser.parse("#FORMULA " + expr, false);
+
+		final Ast2String ast2String = new Ast2String();
+		startNode.apply(ast2String);
+		final String string = ast2String.toString();
+		return string;
+	}
+
+}
diff --git a/src/test/resources/MCTests/CarTalkPuzzle/CarTalkPuzzle.tla b/src/test/resources/MCTests/CarTalkPuzzle/CarTalkPuzzle.tla
index 38fed758b966f4d740999392d291f99de121ea70..9ae1a790b5a547546a63a1a13a164569f018502b 100644
--- a/src/test/resources/MCTests/CarTalkPuzzle/CarTalkPuzzle.tla
+++ b/src/test/resources/MCTests/CarTalkPuzzle/CarTalkPuzzle.tla
@@ -1,158 +1,158 @@
----------------------------- MODULE CarTalkPuzzle ---------------------------
-(***************************************************************************)
-(* Car Talk is a U.S.  radio program about car repair.  Each show includes *)
-(* a puzzle, which is often a little mathematical problem.  Usually, those *)
-(* problems are easy for a mathematically sophisticated listener to solve. *)
-(* However, I was not able immediately to see how to solve the puzzle from *)
-(* the 22 October 2011 program.  I decided to specify the problem in TLA+  *)
-(* and let TLC (the TLA+ model checker) compute the solution.  This is the *)
-(* specification I wrote.  (I have tried to explain in comments all TLA+   *)
-(* notation that is not standard mathematical notation.) Once TLC had      *)
-(* found the solution, it was not hard to understand why it worked.        *)
-(*                                                                         *)
-(* Here is the problem.  A farmer has a 40 pound stone and a balance       *)
-(* scale.  How can he break the stone into 4 pieces so that, using those   *)
-(* pieces and the balance scale, he can weigh out any integral number of   *)
-(* pounds of corn from 1 pound through 40 pounds.                          *)
-(***************************************************************************)
-
-(***************************************************************************)
-(* The following statement imports the standard operators of arithmetic    *)
-(* such as + and =< (less than or equals).  It also defines the operator   *)
-(* ..  so that i..j is the set of all integers k with i =< k =< j.         *)
-(***************************************************************************)
-EXTENDS Integers 
-
-(***************************************************************************)
-(* For generality, I solve the problem of breaking an N pound stone into P *)
-(* pieces.  The following statement declares N and P to be unspecified     *)
-(* constant values.                                                        *)
-(***************************************************************************)
-CONSTANTS N, P
-
-(***************************************************************************)
-(* I define the operator Sum so that if f is any integer-valued function,  *)
-(* and S any finite subset of its domain, then Sum(f, S) is the sum of     *)
-(* f[x] for all x in S.  (In TLA+, function application is indicated by    *)
-(* square brackets instead of parentheses, as it is in ordinary math.)     *)
-(*                                                                         *)
-(* A RECURSIVE declaration must precede a recursively defined operator.    *)
-(* The operator CHOOSE is known to logicians as Hilbert's Epsilon.  It is  *)
-(* defined so that CHOOSE x \in S : P(x) equals some unspecified value v   *)
-(* such that P(v) is true, if such a value exists.                         *)
-(***************************************************************************)
-RECURSIVE Sum(_,_)
-Sum(f,S) == IF S = {} THEN 0
-                      ELSE LET x == CHOOSE x \in S : TRUE
-                           IN  f[x] + Sum(f, S \ {x})
-
-(***************************************************************************)
-(* I now define the set Break of all "breaks", where a break represents a  *)
-(* method of breaking the stone into P (integer-weight) pieces.  The       *)
-(* obvious definition of a break would be a set of weights.  However, that *)
-(* doesn't work because it doesn't handle the situation in which two of    *)
-(* pieces have the same weight.  Instead, I define a break of the N pound  *)
-(* stone into P pieces to be a function B from 1..P (the integers from 1   *)
-(* through P) into 1..N such that B[i] is the weight of piece number i.    *)
-(* To avoid solutions that differ only by how the pieces are numbered, I   *)
-(* consider only breaks in which the pieces are numbered in non-decreasing *)
-(* order of their weight.  This leads to the following definition of the   *)
-(* set Break of all breaks.                                                *)
-(*                                                                         *)
-(* In TLA+, [S -> T] is the set of all functions with domain S and range a *)
-(* subset of T.  \A and \E are the universal and existential quantifiers.  *)
-(***************************************************************************)
-Break == {B \in [1..P -> 1..N] :    Sum(B, 1..P) = N
-                                 /\ \A i \in 1..P : \A j \in (i+1)..P : B[i] =< B[j]}
-
-(***************************************************************************)
-(* To weigh a quantity of corn, we can put some of the weights on the same *)
-(* side of the balance scale as the corn and other weights on the other    *)
-(* side of the balance.  The following operator is true for a weight w, a  *)
-(* break B, and sets S and T of pieces if w plus the weight of the pieces  *)
-(* in S equals the weight of the pieces in T.  The elements of S and T are *)
-(* piece numbers (numbers in 1..P), so Sum(B, S) is the weight of the      *)
-(* pieces in S.                                                            *)
-(***************************************************************************)
-IsRepresentation(w, B, S, T) ==    S \cap T = {}
-                                 /\ w + Sum(B,S) = Sum(B,T)
-(***************************************************************************)
-(* I now define IsSolution(B) to be true iff break B solves the problem,   *)
-(* meaning that it can be used to balance any weight in 1..N.              *)
-(*                                                                         *)
-(* SUBSET S is the set of all subsets of S (the power set of S).           *)
-(***************************************************************************)
-IsSolution(B) ==  \A w \in 1..N : 
-                     \E S, T \in SUBSET (1..P) : IsRepresentation(w, B, S, T) 
-==========
-(***************************************************************************)
-(* I define AllSolutions to be the set of all breaks B that solve the      *)
-(* problem.                                                                *)
-(***************************************************************************)
-AllSolutions == { B \in Break : IsSolution(B) }
-
-(***************************************************************************)
-(* We can now have TLC compute the solution to the problem as follows.  We *)
-(* open this module in the TLA+ Toolbox (an Integrated Development         *)
-(* Environment for the TLA+ tools).  We then create a new TLC model in     *)
-(* which we assign the values 40 to N and 4 to P.  We specify in the model *)
-(* that TLC should compute the value of AllSolutions and run TLC on the    *)
-(* model.  After running for 22 seconds on my 3 year old 2.5 GHz laptop,   *)
-(* it prints the result                                                    *)
-(*                                                                         *)
-(*    { <<1, 3, 9, 27>> }                                                  *)
-(*                                                                         *)
-(* In TLA+, a k-tuple is represented as a function f with domain 1..k .    *)
-(* Therefore, TLC prints a break B, which with P = 4 is a function with    *)
-(* domain 1..4, as the tuple <<B[1], B[2], B[3], B[4]>>.  Its output       *)
-(* therefore indicates that there is a single break that solves the Car    *)
-(* Talk puzzle, and it breaks the stone into pieces of weights 1, 3, 9,    *)
-(* and 27 pounds.                                                          *)
-(*                                                                         *)
-(* You have undoubtedly observed that the weights of the four pieces are   *)
-(* 3^0, 3^1, 3^2, and 3^3.  You may also have observed that 40 equals 1111 *)
-(* base 3.  These facts should give you enough of a hint to be able to     *)
-(* answer this:                                                            *)
-(*                                                                         *)
-(*    For what values of N and P is the problem solvable, and what         *)
-(*    is a solution for those values?                                      *)
-(***************************************************************************)
------------------------------------------------------------------------------
-(***************************************************************************)
-(* It's a good idea to check that the definition of AllSolutions really    *)
-(* generates solutions.  The following operator defines ExpandSolutions to *)
-(* be a set of sequences, one for each solution in AllSolutions.  Each of  *)
-(* those sequences is of length N, where the element i shows how to weight *)
-(* i pounds of corn.  For example, for the single solution with N = 40 and *)
-(* P = 4, element 7 of the sequence is                                     *)
-(*                                                                         *)
-(*    <<7, {3}, {1, 9}>>                                                   *)
-(*                                                                         *)
-(* indicating that to weight 7 pounds of corn, we can put the 3 pound      *)
-(* weight on the same side of the balance as the corn and the 1 and 9      *)
-(* pound weights on the other side.  For simplicity, I have made the       *)
-(* definition work only only when the solution breaks the stone into       *)
-(* pieces with unequal weights.  As an exercise, modify the definition so  *)
-(* it prints the elements using sequences instead of sets, as in           *)
-(*                                                                         *)
-(*   << 7, <<3>>, <<1, 9>> >>                                              *)
-(*                                                                         *)
-(* so it works if the weights of the pieces are not all distinct.          *)
-(*                                                                         *)
-(* The definition below uses the following notation:                       *)
-(*                                                                         *)
-(*   \X is the Cartesian product of sets.                                  *)
-(*                                                                         *)
-(*   [w \in 1..N |-> F(w)]  is the N tuple with F(i) as element i.         *)
-(*                                                                         *)
-(***************************************************************************)
-ExpandSolutions ==
-  LET PiecesFor(w, B) == CHOOSE ST \in (SUBSET (1..P)) \X (SUBSET (1..P)) :
-                           IsRepresentation(w, B, ST[1], ST[2])
-      Image(S, B) == {B[x] : x \in S}
-      SolutionFor(w, B) == << w, 
-                              Image(PiecesFor(w, B)[1], B), 
-                              Image(PiecesFor(w, B)[2], B) >>
-  IN  { [w \in 1..N |-> SolutionFor(w, B)] : B \in AllSolutions }
-===============================================================================
-Created by Leslie Lamport on 26 October 2011
+---------------------------- MODULE CarTalkPuzzle ---------------------------
+(***************************************************************************)
+(* Car Talk is a U.S.  radio program about car repair.  Each show includes *)
+(* a puzzle, which is often a little mathematical problem.  Usually, those *)
+(* problems are easy for a mathematically sophisticated listener to solve. *)
+(* However, I was not able immediately to see how to solve the puzzle from *)
+(* the 22 October 2011 program.  I decided to specify the problem in TLA+  *)
+(* and let TLC (the TLA+ model checker) compute the solution.  This is the *)
+(* specification I wrote.  (I have tried to explain in comments all TLA+   *)
+(* notation that is not standard mathematical notation.) Once TLC had      *)
+(* found the solution, it was not hard to understand why it worked.        *)
+(*                                                                         *)
+(* Here is the problem.  A farmer has a 40 pound stone and a balance       *)
+(* scale.  How can he break the stone into 4 pieces so that, using those   *)
+(* pieces and the balance scale, he can weigh out any integral number of   *)
+(* pounds of corn from 1 pound through 40 pounds.                          *)
+(***************************************************************************)
+
+(***************************************************************************)
+(* The following statement imports the standard operators of arithmetic    *)
+(* such as + and =< (less than or equals).  It also defines the operator   *)
+(* ..  so that i..j is the set of all integers k with i =< k =< j.         *)
+(***************************************************************************)
+EXTENDS Integers 
+
+(***************************************************************************)
+(* For generality, I solve the problem of breaking an N pound stone into P *)
+(* pieces.  The following statement declares N and P to be unspecified     *)
+(* constant values.                                                        *)
+(***************************************************************************)
+CONSTANTS N, P
+
+(***************************************************************************)
+(* I define the operator Sum so that if f is any integer-valued function,  *)
+(* and S any finite subset of its domain, then Sum(f, S) is the sum of     *)
+(* f[x] for all x in S.  (In TLA+, function application is indicated by    *)
+(* square brackets instead of parentheses, as it is in ordinary math.)     *)
+(*                                                                         *)
+(* A RECURSIVE declaration must precede a recursively defined operator.    *)
+(* The operator CHOOSE is known to logicians as Hilbert's Epsilon.  It is  *)
+(* defined so that CHOOSE x \in S : P(x) equals some unspecified value v   *)
+(* such that P(v) is true, if such a value exists.                         *)
+(***************************************************************************)
+RECURSIVE Sum(_,_)
+Sum(f,S) == IF S = {} THEN 0
+                      ELSE LET x == CHOOSE x \in S : TRUE
+                           IN  f[x] + Sum(f, S \ {x})
+
+(***************************************************************************)
+(* I now define the set Break of all "breaks", where a break represents a  *)
+(* method of breaking the stone into P (integer-weight) pieces.  The       *)
+(* obvious definition of a break would be a set of weights.  However, that *)
+(* doesn't work because it doesn't handle the situation in which two of    *)
+(* pieces have the same weight.  Instead, I define a break of the N pound  *)
+(* stone into P pieces to be a function B from 1..P (the integers from 1   *)
+(* through P) into 1..N such that B[i] is the weight of piece number i.    *)
+(* To avoid solutions that differ only by how the pieces are numbered, I   *)
+(* consider only breaks in which the pieces are numbered in non-decreasing *)
+(* order of their weight.  This leads to the following definition of the   *)
+(* set Break of all breaks.                                                *)
+(*                                                                         *)
+(* In TLA+, [S -> T] is the set of all functions with domain S and range a *)
+(* subset of T.  \A and \E are the universal and existential quantifiers.  *)
+(***************************************************************************)
+Break == {B \in [1..P -> 1..N] :    Sum(B, 1..P) = N
+                                 /\ \A i \in 1..P : \A j \in (i+1)..P : B[i] =< B[j]}
+
+(***************************************************************************)
+(* To weigh a quantity of corn, we can put some of the weights on the same *)
+(* side of the balance scale as the corn and other weights on the other    *)
+(* side of the balance.  The following operator is true for a weight w, a  *)
+(* break B, and sets S and T of pieces if w plus the weight of the pieces  *)
+(* in S equals the weight of the pieces in T.  The elements of S and T are *)
+(* piece numbers (numbers in 1..P), so Sum(B, S) is the weight of the      *)
+(* pieces in S.                                                            *)
+(***************************************************************************)
+IsRepresentation(w, B, S, T) ==    S \cap T = {}
+                                 /\ w + Sum(B,S) = Sum(B,T)
+(***************************************************************************)
+(* I now define IsSolution(B) to be true iff break B solves the problem,   *)
+(* meaning that it can be used to balance any weight in 1..N.              *)
+(*                                                                         *)
+(* SUBSET S is the set of all subsets of S (the power set of S).           *)
+(***************************************************************************)
+IsSolution(B) ==  \A w \in 1..N : 
+                     \E S, T \in SUBSET (1..P) : IsRepresentation(w, B, S, T) 
+==========
+(***************************************************************************)
+(* I define AllSolutions to be the set of all breaks B that solve the      *)
+(* problem.                                                                *)
+(***************************************************************************)
+AllSolutions == { B \in Break : IsSolution(B) }
+
+(***************************************************************************)
+(* We can now have TLC compute the solution to the problem as follows.  We *)
+(* open this module in the TLA+ Toolbox (an Integrated Development         *)
+(* Environment for the TLA+ tools).  We then create a new TLC model in     *)
+(* which we assign the values 40 to N and 4 to P.  We specify in the model *)
+(* that TLC should compute the value of AllSolutions and run TLC on the    *)
+(* model.  After running for 22 seconds on my 3 year old 2.5 GHz laptop,   *)
+(* it prints the result                                                    *)
+(*                                                                         *)
+(*    { <<1, 3, 9, 27>> }                                                  *)
+(*                                                                         *)
+(* In TLA+, a k-tuple is represented as a function f with domain 1..k .    *)
+(* Therefore, TLC prints a break B, which with P = 4 is a function with    *)
+(* domain 1..4, as the tuple <<B[1], B[2], B[3], B[4]>>.  Its output       *)
+(* therefore indicates that there is a single break that solves the Car    *)
+(* Talk puzzle, and it breaks the stone into pieces of weights 1, 3, 9,    *)
+(* and 27 pounds.                                                          *)
+(*                                                                         *)
+(* You have undoubtedly observed that the weights of the four pieces are   *)
+(* 3^0, 3^1, 3^2, and 3^3.  You may also have observed that 40 equals 1111 *)
+(* base 3.  These facts should give you enough of a hint to be able to     *)
+(* answer this:                                                            *)
+(*                                                                         *)
+(*    For what values of N and P is the problem solvable, and what         *)
+(*    is a solution for those values?                                      *)
+(***************************************************************************)
+-----------------------------------------------------------------------------
+(***************************************************************************)
+(* It's a good idea to check that the definition of AllSolutions really    *)
+(* generates solutions.  The following operator defines ExpandSolutions to *)
+(* be a set of sequences, one for each solution in AllSolutions.  Each of  *)
+(* those sequences is of length N, where the element i shows how to weight *)
+(* i pounds of corn.  For example, for the single solution with N = 40 and *)
+(* P = 4, element 7 of the sequence is                                     *)
+(*                                                                         *)
+(*    <<7, {3}, {1, 9}>>                                                   *)
+(*                                                                         *)
+(* indicating that to weight 7 pounds of corn, we can put the 3 pound      *)
+(* weight on the same side of the balance as the corn and the 1 and 9      *)
+(* pound weights on the other side.  For simplicity, I have made the       *)
+(* definition work only only when the solution breaks the stone into       *)
+(* pieces with unequal weights.  As an exercise, modify the definition so  *)
+(* it prints the elements using sequences instead of sets, as in           *)
+(*                                                                         *)
+(*   << 7, <<3>>, <<1, 9>> >>                                              *)
+(*                                                                         *)
+(* so it works if the weights of the pieces are not all distinct.          *)
+(*                                                                         *)
+(* The definition below uses the following notation:                       *)
+(*                                                                         *)
+(*   \X is the Cartesian product of sets.                                  *)
+(*                                                                         *)
+(*   [w \in 1..N |-> F(w)]  is the N tuple with F(i) as element i.         *)
+(*                                                                         *)
+(***************************************************************************)
+ExpandSolutions ==
+  LET PiecesFor(w, B) == CHOOSE ST \in (SUBSET (1..P)) \X (SUBSET (1..P)) :
+                           IsRepresentation(w, B, ST[1], ST[2])
+      Image(S, B) == {B[x] : x \in S}
+      SolutionFor(w, B) == << w, 
+                              Image(PiecesFor(w, B)[1], B), 
+                              Image(PiecesFor(w, B)[2], B) >>
+  IN  { [w \in 1..N |-> SolutionFor(w, B)] : B \in AllSolutions }
+===============================================================================
+Created by Leslie Lamport on 26 October 2011
diff --git a/src/test/resources/MCTests/CarTalkPuzzle/MC.out b/src/test/resources/MCTests/CarTalkPuzzle/MC.out
index 17d5dd79a68cdebbb8e3efed4fd1c780bcc480f2..9e515c267db74f3b84e66ce42f25f2bfa43c8934 100644
--- a/src/test/resources/MCTests/CarTalkPuzzle/MC.out
+++ b/src/test/resources/MCTests/CarTalkPuzzle/MC.out
@@ -1,53 +1,53 @@
 @!@!@STARTMSG 2262:0 @!@!@
 TLC2 Version 2.03 of 20 July 2011
-@!@!@ENDMSG 2262 @!@!@
+@!@!@ENDMSG 2262 @!@!@
 @!@!@STARTMSG 2187:0 @!@!@
 Running in Model-Checking mode.
-@!@!@ENDMSG 2187 @!@!@
+@!@!@ENDMSG 2187 @!@!@
 @!@!@STARTMSG 2220:0 @!@!@
 Starting SANY...
-@!@!@ENDMSG 2220 @!@!@
-Parsing file MC.tla
-Parsing file CarTalkPuzzle.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\TLC.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Integers.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Naturals.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Sequences.tla
-Semantic processing of module Naturals
-Semantic processing of module Integers
-Semantic processing of module CarTalkPuzzle
-Semantic processing of module Sequences
-Semantic processing of module TLC
-Semantic processing of module MC
+@!@!@ENDMSG 2220 @!@!@
+Parsing file MC.tla
+Parsing file CarTalkPuzzle.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\TLC.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Integers.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Naturals.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Sequences.tla
+Semantic processing of module Naturals
+Semantic processing of module Integers
+Semantic processing of module CarTalkPuzzle
+Semantic processing of module Sequences
+Semantic processing of module TLC
+Semantic processing of module MC
 @!@!@STARTMSG 2219:0 @!@!@
 SANY finished.
-@!@!@ENDMSG 2219 @!@!@
+@!@!@ENDMSG 2219 @!@!@
 @!@!@STARTMSG 2185:0 @!@!@
 Starting... (2011-10-28 22:52:02)
-@!@!@ENDMSG 2185 @!@!@
-<<"$!@$!@$!@$!@$!", <<242, 121>>>>
+@!@!@ENDMSG 2185 @!@!@
+<<"$!@$!@$!@$!@$!", <<242, 121>>>>
 @!@!@STARTMSG 2189:0 @!@!@
 Computing initial states...
-@!@!@ENDMSG 2189 @!@!@
+@!@!@ENDMSG 2189 @!@!@
 @!@!@STARTMSG 2190:0 @!@!@
 Finished computing initial states: 0 distinct states generated.
-@!@!@ENDMSG 2190 @!@!@
+@!@!@ENDMSG 2190 @!@!@
 @!@!@STARTMSG 2193:0 @!@!@
 Model checking completed. No error has been found.
   Estimates of the probability that TLC did not check all reachable states
   because two distinct states had the same fingerprint:
   calculated (optimistic):  val = 0
   based on the actual fingerprints:  val = 1.1E-19
-@!@!@ENDMSG 2193 @!@!@
+@!@!@ENDMSG 2193 @!@!@
 @!@!@STARTMSG 2200:0 @!@!@
 Progress(0) at 2011-10-28 22:52:02: 0 states generated, 0 distinct states found, 0 states left on queue.
-@!@!@ENDMSG 2200 @!@!@
+@!@!@ENDMSG 2200 @!@!@
 @!@!@STARTMSG 2199:0 @!@!@
 0 states generated, 0 distinct states found, 0 states left on queue.
-@!@!@ENDMSG 2199 @!@!@
+@!@!@ENDMSG 2199 @!@!@
 @!@!@STARTMSG 2194:0 @!@!@
 The depth of the complete state graph search is 0.
-@!@!@ENDMSG 2194 @!@!@
+@!@!@ENDMSG 2194 @!@!@
 @!@!@STARTMSG 2186:0 @!@!@
 Finished. (2011-10-28 22:52:02)
-@!@!@ENDMSG 2186 @!@!@
+@!@!@ENDMSG 2186 @!@!@
diff --git a/src/test/resources/MCTests/CarTalkPuzzle/MC.tla b/src/test/resources/MCTests/CarTalkPuzzle/MC.tla
index 5aa206b9b3519d0818e4a37d0aade3bd1701afe7..fb7794be411449b1ff9ff30511bfe0d72a0aca3c 100644
--- a/src/test/resources/MCTests/CarTalkPuzzle/MC.tla
+++ b/src/test/resources/MCTests/CarTalkPuzzle/MC.tla
@@ -13,8 +13,8 @@ const_131986752161624000 ==
 
 \* Constant expression definition @modelExpressionEval
 const_expr_131986752163225000 == 
-\* ExpandSolutions
-\* CHOOSE B \in Break : IsSolution(B)
+\* ExpandSolutions
+\* CHOOSE B \in Break : IsSolution(B)
 <<3^5 - 1, 40 + 3^4>>
 ----
 
@@ -23,5 +23,5 @@ ASSUME PrintT(<<"$!@$!@$!@$!@$!",const_expr_131986752163225000>>)
 ----
 
 =============================================================================
-\* Modification History
-\* Created Fri Oct 28 22:52:01 PDT 2011 by lamport
+\* Modification History
+\* Created Fri Oct 28 22:52:01 PDT 2011 by lamport
diff --git a/src/test/resources/MCTests/CarTalkPuzzle/MC_TE.out b/src/test/resources/MCTests/CarTalkPuzzle/MC_TE.out
index 17d5dd79a68cdebbb8e3efed4fd1c780bcc480f2..9e515c267db74f3b84e66ce42f25f2bfa43c8934 100644
--- a/src/test/resources/MCTests/CarTalkPuzzle/MC_TE.out
+++ b/src/test/resources/MCTests/CarTalkPuzzle/MC_TE.out
@@ -1,53 +1,53 @@
 @!@!@STARTMSG 2262:0 @!@!@
 TLC2 Version 2.03 of 20 July 2011
-@!@!@ENDMSG 2262 @!@!@
+@!@!@ENDMSG 2262 @!@!@
 @!@!@STARTMSG 2187:0 @!@!@
 Running in Model-Checking mode.
-@!@!@ENDMSG 2187 @!@!@
+@!@!@ENDMSG 2187 @!@!@
 @!@!@STARTMSG 2220:0 @!@!@
 Starting SANY...
-@!@!@ENDMSG 2220 @!@!@
-Parsing file MC.tla
-Parsing file CarTalkPuzzle.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\TLC.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Integers.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Naturals.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Sequences.tla
-Semantic processing of module Naturals
-Semantic processing of module Integers
-Semantic processing of module CarTalkPuzzle
-Semantic processing of module Sequences
-Semantic processing of module TLC
-Semantic processing of module MC
+@!@!@ENDMSG 2220 @!@!@
+Parsing file MC.tla
+Parsing file CarTalkPuzzle.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\TLC.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Integers.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Naturals.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Sequences.tla
+Semantic processing of module Naturals
+Semantic processing of module Integers
+Semantic processing of module CarTalkPuzzle
+Semantic processing of module Sequences
+Semantic processing of module TLC
+Semantic processing of module MC
 @!@!@STARTMSG 2219:0 @!@!@
 SANY finished.
-@!@!@ENDMSG 2219 @!@!@
+@!@!@ENDMSG 2219 @!@!@
 @!@!@STARTMSG 2185:0 @!@!@
 Starting... (2011-10-28 22:52:02)
-@!@!@ENDMSG 2185 @!@!@
-<<"$!@$!@$!@$!@$!", <<242, 121>>>>
+@!@!@ENDMSG 2185 @!@!@
+<<"$!@$!@$!@$!@$!", <<242, 121>>>>
 @!@!@STARTMSG 2189:0 @!@!@
 Computing initial states...
-@!@!@ENDMSG 2189 @!@!@
+@!@!@ENDMSG 2189 @!@!@
 @!@!@STARTMSG 2190:0 @!@!@
 Finished computing initial states: 0 distinct states generated.
-@!@!@ENDMSG 2190 @!@!@
+@!@!@ENDMSG 2190 @!@!@
 @!@!@STARTMSG 2193:0 @!@!@
 Model checking completed. No error has been found.
   Estimates of the probability that TLC did not check all reachable states
   because two distinct states had the same fingerprint:
   calculated (optimistic):  val = 0
   based on the actual fingerprints:  val = 1.1E-19
-@!@!@ENDMSG 2193 @!@!@
+@!@!@ENDMSG 2193 @!@!@
 @!@!@STARTMSG 2200:0 @!@!@
 Progress(0) at 2011-10-28 22:52:02: 0 states generated, 0 distinct states found, 0 states left on queue.
-@!@!@ENDMSG 2200 @!@!@
+@!@!@ENDMSG 2200 @!@!@
 @!@!@STARTMSG 2199:0 @!@!@
 0 states generated, 0 distinct states found, 0 states left on queue.
-@!@!@ENDMSG 2199 @!@!@
+@!@!@ENDMSG 2199 @!@!@
 @!@!@STARTMSG 2194:0 @!@!@
 The depth of the complete state graph search is 0.
-@!@!@ENDMSG 2194 @!@!@
+@!@!@ENDMSG 2194 @!@!@
 @!@!@STARTMSG 2186:0 @!@!@
 Finished. (2011-10-28 22:52:02)
-@!@!@ENDMSG 2186 @!@!@
+@!@!@ENDMSG 2186 @!@!@
diff --git a/src/test/resources/MCTests/CarTalkPuzzle/Model2/CarTalkPuzzle.tla b/src/test/resources/MCTests/CarTalkPuzzle/Model2/CarTalkPuzzle.tla
index 1ef24e4f0d5f569ee40cde20ad75e5ca7c21d241..8cf47246694b13cd124b6a3f487d635f425ed027 100644
--- a/src/test/resources/MCTests/CarTalkPuzzle/Model2/CarTalkPuzzle.tla
+++ b/src/test/resources/MCTests/CarTalkPuzzle/Model2/CarTalkPuzzle.tla
@@ -1,158 +1,158 @@
----------------------------- MODULE CarTalkPuzzle ---------------------------
-(***************************************************************************)
-(* Car Talk is a U.S.  radio program about car repair.  Each show includes *)
-(* a puzzle, which is often a little mathematical problem.  Usually, those *)
-(* problems are easy for a mathematically sophisticated listener to solve. *)
-(* However, I was not able immediately to see how to solve the puzzle from *)
-(* the 22 October 2011 program.  I decided to specify the problem in TLA+  *)
-(* and let TLC (the TLA+ model checker) compute the solution.  This is the *)
-(* specification I wrote.  (I have tried to explain in comments all TLA+   *)
-(* notation that is not standard mathematical notation.) Once TLC had      *)
-(* found the solution, it was not hard to understand why it worked.        *)
-(*                                                                         *)
-(* Here is the problem.  A farmer has a 40 pound stone and a balance       *)
-(* scale.  How can he break the stone into 4 pieces so that, using those   *)
-(* pieces and the balance scale, he can weigh out any integral number of   *)
-(* pounds of corn from 1 pound through 40 pounds.                          *)
-(***************************************************************************)
-
-(***************************************************************************)
-(* The following statement imports the standard operators of arithmetic    *)
-(* such as + and =< (less than or equals).  It also defines the operator   *)
-(* ..  so that i..j is the set of all integers k with i =< k =< j.         *)
-(***************************************************************************)
-EXTENDS Integers 
-
-(***************************************************************************)
-(* For generality, I solve the problem of breaking an N pound stone into P *)
-(* pieces.  The following statement declares N and P to be unspecified     *)
-(* constant values.                                                        *)
-(***************************************************************************)
-CONSTANTS N, P
-
-(***************************************************************************)
-(* I define the operator Sum so that if f is any integer-valued function,  *)
-(* and S any finite subset of its domain, then Sum(f, S) is the sum of     *)
-(* f[x] for all x in S.  (In TLA+, function application is indicated by    *)
-(* square brackets instead of parentheses, as it is in ordinary math.)     *)
-(*                                                                         *)
-(* A RECURSIVE declaration must precede a recursively defined operator.    *)
-(* The operator CHOOSE is known to logicians as Hilbert's Epsilon.  It is  *)
-(* defined so that CHOOSE x \in S : P(x) equals some unspecified value v   *)
-(* such that P(v) is true, if such a value exists.                         *)
-(***************************************************************************)
-RECURSIVE Sum(_,_)
-Sum(f,S) == IF S = {} THEN 0
-                      ELSE LET x == CHOOSE x \in S : TRUE
-                           IN  f[x] + Sum(f, S \ {x})
-
-(***************************************************************************)
-(* I now define the set Break of all "breaks", where a break represents a  *)
-(* method of breaking the stone into P (integer-weight) pieces.  The       *)
-(* obvious definition of a break would be a set of weights.  However, that *)
-(* doesn't work because it doesn't handle the situation in which two of    *)
-(* pieces have the same weight.  Instead, I define a break of the N pound  *)
-(* stone into P pieces to be a function B from 1..P (the integers from 1   *)
-(* through P) into 1..N such that B[i] is the weight of piece number i.    *)
-(* To avoid solutions that differ only by how the pieces are numbered, I   *)
-(* consider only breaks in which the pieces are numbered in non-decreasing *)
-(* order of their weight.  This leads to the following definition of the   *)
-(* set Break of all breaks.                                                *)
-(*                                                                         *)
-(* In TLA+, [S -> T] is the set of all functions with domain S and range a *)
-(* subset of T.  \A and \E are the universal and existential quantifiers.  *)
-(***************************************************************************)
-Break == {B \in [1..P -> 1..N] :    Sum(B, 1..P) = N
-                                 /\ \A i \in 1..P : \A j \in (i+1)..P : B[i] =< B[j]}
-
-(***************************************************************************)
-(* To weigh a quantity of corn, we can put some of the weights on the same *)
-(* side of the balance scale as the corn and other weights on the other    *)
-(* side of the balance.  The following operator is true for a weight w, a  *)
-(* break B, and sets S and T of pieces if w plus the weight of the pieces  *)
-(* in S equals the weight of the pieces in T.  The elements of S and T are *)
-(* piece numbers (numbers in 1..P), so Sum(B, S) is the weight of the      *)
-(* pieces in S.                                                            *)
-(***************************************************************************)
-IsRepresentation(w, B, S, T) ==    S \cap T = {}
-                                 /\ w + Sum(B,S) = Sum(B,T)
-(***************************************************************************)
-(* I now define IsSolution(B) to be true iff break B solves the problem,   *)
-(* meaning that it can be used to balance any weight in 1..N.              *)
-(*                                                                         *)
-(* SUBSET S is the set of all subsets of S (the power set of S).           *)
-(***************************************************************************)
-IsSolution(B) ==  \A w \in 1..N : 
-                     \E S, T \in SUBSET (1..P) : IsRepresentation(w, B, S, T) 
-
-(***************************************************************************)
-(* I define AllSolutions to be the set of all breaks B that solve the      *)
-(* problem.                                                                *)
-(***************************************************************************)
-AllSolutions == { B \in Break : IsSolution(B) }
-
-(***************************************************************************)
-(* We can now have TLC compute the solution to the problem as follows.  We *)
-(* open this module in the TLA+ Toolbox (an Integrated Development         *)
-(* Environment for the TLA+ tools).  We then create a new TLC model in     *)
-(* which we assign the values 40 to N and 4 to P.  We specify in the model *)
-(* that TLC should compute the value of AllSolutions and run TLC on the    *)
-(* model.  After running for 22 seconds on my 3 year old 2.5 GHz laptop,   *)
-(* it prints the result                                                    *)
-(*                                                                         *)
-(*    { <<1, 3, 9, 27>> }                                                  *)
-(*                                                                         *)
-(* In TLA+, a k-tuple is represented as a function f with domain 1..k .    *)
-(* Therefore, TLC prints a break B, which with P = 4 is a function with    *)
-(* domain 1..4, as the tuple <<B[1], B[2], B[3], B[4]>>.  Its output       *)
-(* therefore indicates that there is a single break that solves the Car    *)
-(* Talk puzzle, and it breaks the stone into pieces of weights 1, 3, 9,    *)
-(* and 27 pounds.                                                          *)
-(*                                                                         *)
-(* You have undoubtedly observed that the weights of the four pieces are   *)
-(* 3^0, 3^1, 3^2, and 3^3.  You may also have observed that 40 equals 1111 *)
-(* base 3.  These facts should give you enough of a hint to be able to     *)
-(* answer this:                                                            *)
-(*                                                                         *)
-(*    For what values of N and P is the problem solvable, and what         *)
-(*    is a solution for those values?                                      *)
-(***************************************************************************)
------------------------------------------------------------------------------
-(***************************************************************************)
-(* It's a good idea to check that the definition of AllSolutions really    *)
-(* generates solutions.  The following operator defines ExpandSolutions to *)
-(* be a set of sequences, one for each solution in AllSolutions.  Each of  *)
-(* those sequences is of length N, where the element i shows how to weight *)
-(* i pounds of corn.  For example, for the single solution with N = 40 and *)
-(* P = 4, element 7 of the sequence is                                     *)
-(*                                                                         *)
-(*    <<7, {3}, {1, 9}>>                                                   *)
-(*                                                                         *)
-(* indicating that to weight 7 pounds of corn, we can put the 3 pound      *)
-(* weight on the same side of the balance as the corn and the 1 and 9      *)
-(* pound weights on the other side.  For simplicity, I have made the       *)
-(* definition work only only when the solution breaks the stone into       *)
-(* pieces with unequal weights.  As an exercise, modify the definition so  *)
-(* it prints the elements using sequences instead of sets, as in           *)
-(*                                                                         *)
-(*   << 7, <<3>>, <<1, 9>> >>                                              *)
-(*                                                                         *)
-(* so it works if the weights of the pieces are not all distinct.          *)
-(*                                                                         *)
-(* The definition below uses the following notation:                       *)
-(*                                                                         *)
-(*   \X is the Cartesian product of sets.                                  *)
-(*                                                                         *)
-(*   [w \in 1..N |-> F(w)]  is the N tuple with F(i) as element i.         *)
-(*                                                                         *)
-(***************************************************************************)
-ExpandSolutions ==
-  LET PiecesFor(w, B) == CHOOSE ST \in (SUBSET (1..P)) \X (SUBSET (1..P)) :
-                           IsRepresentation(w, B, ST[1], ST[2])
-      Image(S, B) == {B[x] : x \in S}
-      SolutionFor(w, B) == << w, 
-                              Image(PiecesFor(w, B)[1], B), 
-                              Image(PiecesFor(w, B)[2], B) >>
-  IN  { [w \in 1..N |-> SolutionFor(w, B)] : B \in AllSolutions }
-===============================================================================
-Created by Leslie Lamport on 26 October 2011
+---------------------------- MODULE CarTalkPuzzle ---------------------------
+(***************************************************************************)
+(* Car Talk is a U.S.  radio program about car repair.  Each show includes *)
+(* a puzzle, which is often a little mathematical problem.  Usually, those *)
+(* problems are easy for a mathematically sophisticated listener to solve. *)
+(* However, I was not able immediately to see how to solve the puzzle from *)
+(* the 22 October 2011 program.  I decided to specify the problem in TLA+  *)
+(* and let TLC (the TLA+ model checker) compute the solution.  This is the *)
+(* specification I wrote.  (I have tried to explain in comments all TLA+   *)
+(* notation that is not standard mathematical notation.) Once TLC had      *)
+(* found the solution, it was not hard to understand why it worked.        *)
+(*                                                                         *)
+(* Here is the problem.  A farmer has a 40 pound stone and a balance       *)
+(* scale.  How can he break the stone into 4 pieces so that, using those   *)
+(* pieces and the balance scale, he can weigh out any integral number of   *)
+(* pounds of corn from 1 pound through 40 pounds.                          *)
+(***************************************************************************)
+
+(***************************************************************************)
+(* The following statement imports the standard operators of arithmetic    *)
+(* such as + and =< (less than or equals).  It also defines the operator   *)
+(* ..  so that i..j is the set of all integers k with i =< k =< j.         *)
+(***************************************************************************)
+EXTENDS Integers 
+
+(***************************************************************************)
+(* For generality, I solve the problem of breaking an N pound stone into P *)
+(* pieces.  The following statement declares N and P to be unspecified     *)
+(* constant values.                                                        *)
+(***************************************************************************)
+CONSTANTS N, P
+
+(***************************************************************************)
+(* I define the operator Sum so that if f is any integer-valued function,  *)
+(* and S any finite subset of its domain, then Sum(f, S) is the sum of     *)
+(* f[x] for all x in S.  (In TLA+, function application is indicated by    *)
+(* square brackets instead of parentheses, as it is in ordinary math.)     *)
+(*                                                                         *)
+(* A RECURSIVE declaration must precede a recursively defined operator.    *)
+(* The operator CHOOSE is known to logicians as Hilbert's Epsilon.  It is  *)
+(* defined so that CHOOSE x \in S : P(x) equals some unspecified value v   *)
+(* such that P(v) is true, if such a value exists.                         *)
+(***************************************************************************)
+RECURSIVE Sum(_,_)
+Sum(f,S) == IF S = {} THEN 0
+                      ELSE LET x == CHOOSE x \in S : TRUE
+                           IN  f[x] + Sum(f, S \ {x})
+
+(***************************************************************************)
+(* I now define the set Break of all "breaks", where a break represents a  *)
+(* method of breaking the stone into P (integer-weight) pieces.  The       *)
+(* obvious definition of a break would be a set of weights.  However, that *)
+(* doesn't work because it doesn't handle the situation in which two of    *)
+(* pieces have the same weight.  Instead, I define a break of the N pound  *)
+(* stone into P pieces to be a function B from 1..P (the integers from 1   *)
+(* through P) into 1..N such that B[i] is the weight of piece number i.    *)
+(* To avoid solutions that differ only by how the pieces are numbered, I   *)
+(* consider only breaks in which the pieces are numbered in non-decreasing *)
+(* order of their weight.  This leads to the following definition of the   *)
+(* set Break of all breaks.                                                *)
+(*                                                                         *)
+(* In TLA+, [S -> T] is the set of all functions with domain S and range a *)
+(* subset of T.  \A and \E are the universal and existential quantifiers.  *)
+(***************************************************************************)
+Break == {B \in [1..P -> 1..N] :    Sum(B, 1..P) = N
+                                 /\ \A i \in 1..P : \A j \in (i+1)..P : B[i] =< B[j]}
+
+(***************************************************************************)
+(* To weigh a quantity of corn, we can put some of the weights on the same *)
+(* side of the balance scale as the corn and other weights on the other    *)
+(* side of the balance.  The following operator is true for a weight w, a  *)
+(* break B, and sets S and T of pieces if w plus the weight of the pieces  *)
+(* in S equals the weight of the pieces in T.  The elements of S and T are *)
+(* piece numbers (numbers in 1..P), so Sum(B, S) is the weight of the      *)
+(* pieces in S.                                                            *)
+(***************************************************************************)
+IsRepresentation(w, B, S, T) ==    S \cap T = {}
+                                 /\ w + Sum(B,S) = Sum(B,T)
+(***************************************************************************)
+(* I now define IsSolution(B) to be true iff break B solves the problem,   *)
+(* meaning that it can be used to balance any weight in 1..N.              *)
+(*                                                                         *)
+(* SUBSET S is the set of all subsets of S (the power set of S).           *)
+(***************************************************************************)
+IsSolution(B) ==  \A w \in 1..N : 
+                     \E S, T \in SUBSET (1..P) : IsRepresentation(w, B, S, T) 
+
+(***************************************************************************)
+(* I define AllSolutions to be the set of all breaks B that solve the      *)
+(* problem.                                                                *)
+(***************************************************************************)
+AllSolutions == { B \in Break : IsSolution(B) }
+
+(***************************************************************************)
+(* We can now have TLC compute the solution to the problem as follows.  We *)
+(* open this module in the TLA+ Toolbox (an Integrated Development         *)
+(* Environment for the TLA+ tools).  We then create a new TLC model in     *)
+(* which we assign the values 40 to N and 4 to P.  We specify in the model *)
+(* that TLC should compute the value of AllSolutions and run TLC on the    *)
+(* model.  After running for 22 seconds on my 3 year old 2.5 GHz laptop,   *)
+(* it prints the result                                                    *)
+(*                                                                         *)
+(*    { <<1, 3, 9, 27>> }                                                  *)
+(*                                                                         *)
+(* In TLA+, a k-tuple is represented as a function f with domain 1..k .    *)
+(* Therefore, TLC prints a break B, which with P = 4 is a function with    *)
+(* domain 1..4, as the tuple <<B[1], B[2], B[3], B[4]>>.  Its output       *)
+(* therefore indicates that there is a single break that solves the Car    *)
+(* Talk puzzle, and it breaks the stone into pieces of weights 1, 3, 9,    *)
+(* and 27 pounds.                                                          *)
+(*                                                                         *)
+(* You have undoubtedly observed that the weights of the four pieces are   *)
+(* 3^0, 3^1, 3^2, and 3^3.  You may also have observed that 40 equals 1111 *)
+(* base 3.  These facts should give you enough of a hint to be able to     *)
+(* answer this:                                                            *)
+(*                                                                         *)
+(*    For what values of N and P is the problem solvable, and what         *)
+(*    is a solution for those values?                                      *)
+(***************************************************************************)
+-----------------------------------------------------------------------------
+(***************************************************************************)
+(* It's a good idea to check that the definition of AllSolutions really    *)
+(* generates solutions.  The following operator defines ExpandSolutions to *)
+(* be a set of sequences, one for each solution in AllSolutions.  Each of  *)
+(* those sequences is of length N, where the element i shows how to weight *)
+(* i pounds of corn.  For example, for the single solution with N = 40 and *)
+(* P = 4, element 7 of the sequence is                                     *)
+(*                                                                         *)
+(*    <<7, {3}, {1, 9}>>                                                   *)
+(*                                                                         *)
+(* indicating that to weight 7 pounds of corn, we can put the 3 pound      *)
+(* weight on the same side of the balance as the corn and the 1 and 9      *)
+(* pound weights on the other side.  For simplicity, I have made the       *)
+(* definition work only only when the solution breaks the stone into       *)
+(* pieces with unequal weights.  As an exercise, modify the definition so  *)
+(* it prints the elements using sequences instead of sets, as in           *)
+(*                                                                         *)
+(*   << 7, <<3>>, <<1, 9>> >>                                              *)
+(*                                                                         *)
+(* so it works if the weights of the pieces are not all distinct.          *)
+(*                                                                         *)
+(* The definition below uses the following notation:                       *)
+(*                                                                         *)
+(*   \X is the Cartesian product of sets.                                  *)
+(*                                                                         *)
+(*   [w \in 1..N |-> F(w)]  is the N tuple with F(i) as element i.         *)
+(*                                                                         *)
+(***************************************************************************)
+ExpandSolutions ==
+  LET PiecesFor(w, B) == CHOOSE ST \in (SUBSET (1..P)) \X (SUBSET (1..P)) :
+                           IsRepresentation(w, B, ST[1], ST[2])
+      Image(S, B) == {B[x] : x \in S}
+      SolutionFor(w, B) == << w, 
+                              Image(PiecesFor(w, B)[1], B), 
+                              Image(PiecesFor(w, B)[2], B) >>
+  IN  { [w \in 1..N |-> SolutionFor(w, B)] : B \in AllSolutions }
+===============================================================================
+Created by Leslie Lamport on 26 October 2011
diff --git a/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC.out b/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC.out
index 40ef2681186aba297da21cf2d7727245c206b485..6d6b7f2f7168cf28d4501b8bb8dde67d511db46a 100644
--- a/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC.out
+++ b/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC.out
@@ -1,30 +1,30 @@
 @!@!@STARTMSG 2262:0 @!@!@
 TLC2 Version 2.03 of 20 July 2011
-@!@!@ENDMSG 2262 @!@!@
+@!@!@ENDMSG 2262 @!@!@
 @!@!@STARTMSG 2187:0 @!@!@
 Running in Model-Checking mode.
-@!@!@ENDMSG 2187 @!@!@
+@!@!@ENDMSG 2187 @!@!@
 @!@!@STARTMSG 2220:0 @!@!@
 Starting SANY...
-@!@!@ENDMSG 2220 @!@!@
-Parsing file MC.tla
-Parsing file CarTalkPuzzle.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\TLC.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Integers.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Naturals.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Sequences.tla
-Semantic processing of module Naturals
-Semantic processing of module Integers
-Semantic processing of module CarTalkPuzzle
-Semantic processing of module Sequences
-Semantic processing of module TLC
-Semantic processing of module MC
+@!@!@ENDMSG 2220 @!@!@
+Parsing file MC.tla
+Parsing file CarTalkPuzzle.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\TLC.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Integers.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Naturals.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Sequences.tla
+Semantic processing of module Naturals
+Semantic processing of module Integers
+Semantic processing of module CarTalkPuzzle
+Semantic processing of module Sequences
+Semantic processing of module TLC
+Semantic processing of module MC
 @!@!@STARTMSG 2219:0 @!@!@
 SANY finished.
-@!@!@ENDMSG 2219 @!@!@
+@!@!@ENDMSG 2219 @!@!@
 @!@!@STARTMSG 2185:0 @!@!@
 Starting... (2011-10-26 11:01:16)
-@!@!@ENDMSG 2185 @!@!@
+@!@!@ENDMSG 2185 @!@!@
 << "$!@$!@$!@$!@$!",
    { <<1, 1, 3, 10>>,
      <<1, 1, 4, 9>>,
@@ -36,29 +36,29 @@ Starting... (2011-10-26 11:01:16)
      <<1, 2, 6, 6>>,
      <<1, 3, 3, 8>>,
      <<1, 3, 4, 7>>,
-     <<1, 3, 5, 6>> } >>
+     <<1, 3, 5, 6>> } >>
 @!@!@STARTMSG 2189:0 @!@!@
 Computing initial states...
-@!@!@ENDMSG 2189 @!@!@
+@!@!@ENDMSG 2189 @!@!@
 @!@!@STARTMSG 2190:0 @!@!@
 Finished computing initial states: 0 distinct states generated.
-@!@!@ENDMSG 2190 @!@!@
+@!@!@ENDMSG 2190 @!@!@
 @!@!@STARTMSG 2193:0 @!@!@
 Model checking completed. No error has been found.
   Estimates of the probability that TLC did not check all reachable states
   because two distinct states had the same fingerprint:
   calculated (optimistic):  val = 0
   based on the actual fingerprints:  val = 1.1E-19
-@!@!@ENDMSG 2193 @!@!@
+@!@!@ENDMSG 2193 @!@!@
 @!@!@STARTMSG 2200:0 @!@!@
 Progress(0) at 2011-10-26 11:01:18: 0 states generated, 0 distinct states found, 0 states left on queue.
-@!@!@ENDMSG 2200 @!@!@
+@!@!@ENDMSG 2200 @!@!@
 @!@!@STARTMSG 2199:0 @!@!@
 0 states generated, 0 distinct states found, 0 states left on queue.
-@!@!@ENDMSG 2199 @!@!@
+@!@!@ENDMSG 2199 @!@!@
 @!@!@STARTMSG 2194:0 @!@!@
 The depth of the complete state graph search is 0.
-@!@!@ENDMSG 2194 @!@!@
+@!@!@ENDMSG 2194 @!@!@
 @!@!@STARTMSG 2186:0 @!@!@
 Finished. (2011-10-26 11:01:18)
-@!@!@ENDMSG 2186 @!@!@
+@!@!@ENDMSG 2186 @!@!@
diff --git a/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC.tla b/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC.tla
index f1e49a181c91f69c2a3d615f7fe042d72ccb71ee..1834f4abad7ea7d092214a017a9f0a58db1c840c 100644
--- a/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC.tla
+++ b/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC.tla
@@ -21,5 +21,5 @@ ASSUME PrintT(<<"$!@$!@$!@$!@$!",const_expr_131965207588737000>>)
 ----
 
 =============================================================================
-\* Modification History
-\* Created Wed Oct 26 11:01:15 PDT 2011 by lamport
+\* Modification History
+\* Created Wed Oct 26 11:01:15 PDT 2011 by lamport
diff --git a/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC_TE.out b/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC_TE.out
index 40ef2681186aba297da21cf2d7727245c206b485..6d6b7f2f7168cf28d4501b8bb8dde67d511db46a 100644
--- a/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC_TE.out
+++ b/src/test/resources/MCTests/CarTalkPuzzle/Model2/MC_TE.out
@@ -1,30 +1,30 @@
 @!@!@STARTMSG 2262:0 @!@!@
 TLC2 Version 2.03 of 20 July 2011
-@!@!@ENDMSG 2262 @!@!@
+@!@!@ENDMSG 2262 @!@!@
 @!@!@STARTMSG 2187:0 @!@!@
 Running in Model-Checking mode.
-@!@!@ENDMSG 2187 @!@!@
+@!@!@ENDMSG 2187 @!@!@
 @!@!@STARTMSG 2220:0 @!@!@
 Starting SANY...
-@!@!@ENDMSG 2220 @!@!@
-Parsing file MC.tla
-Parsing file CarTalkPuzzle.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\TLC.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Integers.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Naturals.tla
-Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Sequences.tla
-Semantic processing of module Naturals
-Semantic processing of module Integers
-Semantic processing of module CarTalkPuzzle
-Semantic processing of module Sequences
-Semantic processing of module TLC
-Semantic processing of module MC
+@!@!@ENDMSG 2220 @!@!@
+Parsing file MC.tla
+Parsing file CarTalkPuzzle.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\TLC.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Integers.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Naturals.tla
+Parsing file C:\lamport\tla\newtools\tla2-inria-workspace\tla2-inria\tlatools\class\tla2sany\StandardModules\Sequences.tla
+Semantic processing of module Naturals
+Semantic processing of module Integers
+Semantic processing of module CarTalkPuzzle
+Semantic processing of module Sequences
+Semantic processing of module TLC
+Semantic processing of module MC
 @!@!@STARTMSG 2219:0 @!@!@
 SANY finished.
-@!@!@ENDMSG 2219 @!@!@
+@!@!@ENDMSG 2219 @!@!@
 @!@!@STARTMSG 2185:0 @!@!@
 Starting... (2011-10-26 11:01:16)
-@!@!@ENDMSG 2185 @!@!@
+@!@!@ENDMSG 2185 @!@!@
 << "$!@$!@$!@$!@$!",
    { <<1, 1, 3, 10>>,
      <<1, 1, 4, 9>>,
@@ -36,29 +36,29 @@ Starting... (2011-10-26 11:01:16)
      <<1, 2, 6, 6>>,
      <<1, 3, 3, 8>>,
      <<1, 3, 4, 7>>,
-     <<1, 3, 5, 6>> } >>
+     <<1, 3, 5, 6>> } >>
 @!@!@STARTMSG 2189:0 @!@!@
 Computing initial states...
-@!@!@ENDMSG 2189 @!@!@
+@!@!@ENDMSG 2189 @!@!@
 @!@!@STARTMSG 2190:0 @!@!@
 Finished computing initial states: 0 distinct states generated.
-@!@!@ENDMSG 2190 @!@!@
+@!@!@ENDMSG 2190 @!@!@
 @!@!@STARTMSG 2193:0 @!@!@
 Model checking completed. No error has been found.
   Estimates of the probability that TLC did not check all reachable states
   because two distinct states had the same fingerprint:
   calculated (optimistic):  val = 0
   based on the actual fingerprints:  val = 1.1E-19
-@!@!@ENDMSG 2193 @!@!@
+@!@!@ENDMSG 2193 @!@!@
 @!@!@STARTMSG 2200:0 @!@!@
 Progress(0) at 2011-10-26 11:01:18: 0 states generated, 0 distinct states found, 0 states left on queue.
-@!@!@ENDMSG 2200 @!@!@
+@!@!@ENDMSG 2200 @!@!@
 @!@!@STARTMSG 2199:0 @!@!@
 0 states generated, 0 distinct states found, 0 states left on queue.
-@!@!@ENDMSG 2199 @!@!@
+@!@!@ENDMSG 2199 @!@!@
 @!@!@STARTMSG 2194:0 @!@!@
 The depth of the complete state graph search is 0.
-@!@!@ENDMSG 2194 @!@!@
+@!@!@ENDMSG 2194 @!@!@
 @!@!@STARTMSG 2186:0 @!@!@
 Finished. (2011-10-26 11:01:18)
-@!@!@ENDMSG 2186 @!@!@
+@!@!@ENDMSG 2186 @!@!@
diff --git a/src/test/resources/MCTests/DieHard/DieHard.tla b/src/test/resources/MCTests/DieHard/DieHard.tla
index 23591399929e95816ee40b382b444ab4117e78ea..4dff6ec889e830d43a4c99d4dd2cc6fc79aee2fe 100644
--- a/src/test/resources/MCTests/DieHard/DieHard.tla
+++ b/src/test/resources/MCTests/DieHard/DieHard.tla
@@ -1,136 +1,136 @@
------------------------------- MODULE DieHard ------------------------------- 
-(***************************************************************************)
-(* In the movie Die Hard 3, the heros must obtain exactly 4 gallons of     *)
-(* water using a 5 gallon jug, a 3 gallon jug, and a water faucet.  Our    *)
-(* goal: to get TLC to solve the problem for us.                           *)
-(*                                                                         *)
-(* First, we write a spec that describes all allowable behaviors of our    *)
-(* heros.                                                                  *)
-(***************************************************************************)
-EXTENDS Naturals
-  (*************************************************************************)
-  (* This statement imports the definitions of the ordinary operators on   *)
-  (* natural numbers, such as +.                                           *)
-  (*************************************************************************)
-  
-(***************************************************************************)
-(* We next declare the specification's variables.                          *)
-(***************************************************************************)
-VARIABLES big,   \* The number of gallons of water in the 5 gallon jug.
-          small  \* The number of gallons of water in the 3 gallon jug.
-
-
-(***************************************************************************)
-(* We now define TypeOK to be the type invariant, asserting that the value *)
-(* of each variable is an element of the appropriate set.  A type          *)
-(* invariant like this is not part of the specification, but it's          *)
-(* generally a good idea to include it because it helps the reader         *)
-(* understand the spec.  Moreover, having TLC check that it is an          *)
-(* invariant of the spec catches errors that, in a typed language, are     *)
-(* caught by type checking.                                                *)
-(*                                                                         *)
-(* Note: TLA+ uses the convention that a list of formulas bulleted by /\   *)
-(* or \/ denotes the conjunction or disjunction of those formulas.         *)
-(* Indentation of subitems is significant, allowing one to eliminate lots  *)
-(* of parentheses.  This makes a large formula much easier to read.        *)
-(* However, it does mean that you have to be careful with your indentation.*)
-(***************************************************************************)
-TypeOK == /\ small \in 0..3 
-          /\ big   \in 0..5
-
-
-(***************************************************************************)
-(* Now we define of the initial predicate, that specifies the initial      *)
-(* values of the variables.  I like to name this predicate Init, but the   *)
-(* name doesn't matter.                                                    *)
-(***************************************************************************)
-Init == /\ big = 0 
-        /\ small = 0
-
-(***************************************************************************)
-(* Now we define the actions that our hero can perform.  There are three   *)
-(* things they can do:                                                     *)
-(*                                                                         *)
-(*   - Pour water from the faucet into a jug.                              *)
-(*                                                                         *)
-(*   - Pour water from a jug onto the ground.                              *)
-(*                                                                         *)
-(*   - Pour water from one jug into another                                *)
-(*                                                                         *)
-(* We now consider the first two.  Since the jugs are not calibrated,      *)
-(* partially filling or partially emptying a jug accomplishes nothing.     *)
-(* So, the first two possibilities yield the following four possible       *)
-(* actions.                                                                *)
-(***************************************************************************)
-FillSmallJug  == /\ small' = 3 
-                 /\ big' = big
-
-FillBigJug    == /\ big' = 5 
-                 /\ small' = small
-
-EmptySmallJug == /\ small' = 0 
-                 /\ big' = big
-
-EmptyBigJug   == /\ big' = 0 
-                 /\ small' = small
-
-(***************************************************************************)
-(* We now consider pouring water from one jug into another.  Again, since  *)
-(* the jugs are not callibrated, when pouring from jug A to jug B, it      *)
-(* makes sense only to either fill B or empty A. And there's no point in   *)
-(* emptying A if this will cause B to overflow, since that could be        *)
-(* accomplished by the two actions of first filling B and then emptying A. *)
-(* So, pouring water from A to B leaves B with the lesser of (i) the water *)
-(* contained in both jugs and (ii) the volume of B. To express this        *)
-(* mathematically, we first define Min(m,n) to equal the minimum of the    *)
-(* numbers m and n.                                                        *)
-(***************************************************************************)
-Min(m,n) == IF m < n THEN m ELSE n
-
-(***************************************************************************)
-(* Now we define the last two pouring actions.  From the observation       *)
-(* above, these definitions should be clear.                               *)
-(***************************************************************************)
-SmallToBig == /\ big'   = Min(big + small, 5)
-              /\ small' = small - (big' - big)
-
-BigToSmall == /\ small' = Min(big + small, 3) 
-              /\ big'   = big - (small' - small)
-
-(***************************************************************************)
-(* We define the next-state relation, which I like to call Next.  A Next   *)
-(* step is a step of one of the six actions defined above.  Hence, Next is *)
-(* the disjunction of those actions.                                       *)
-(***************************************************************************)
-Next ==  \/ FillSmallJug 
-         \/ FillBigJug    
-         \/ EmptySmallJug 
-         \/ EmptyBigJug    
-         \/ SmallToBig    
-         \/ BigToSmall    
-
-(***************************************************************************)
-(* We define the formula Spec to be the complete specification, asserting  *)
-(* of a behavior that it begins in a state satisfying Init, and that every *)
-(* step either satisfies Next or else leaves the pair <<big, small>>       *)
-(* unchanged.                                                              *)
-(***************************************************************************)
-Spec == Init /\ [][Next]_<<big, small>> 
------------------------------------------------------------------------------
-
-(***************************************************************************)
-(* Remember that our heros must measure out 4 gallons of water.            *)
-(* Obviously, those 4 gallons must be in the 5 gallon jug.  So, they have  *)
-(* solved their problem when they reach a state with big = 4.  So, we      *)
-(* define NotSolved to be the predicate asserting that big # 4.            *)
-(***************************************************************************)
-NotSolved == big # 4
-
-(***************************************************************************)
-(* We find a solution by having TLC check if NotSolved is an invariant,    *)
-(* which will cause it to print out an "error trace" consisting of a       *)
-(* behavior ending in a states where NotSolved is false.  Such a           *)
-(* behavior is the desired solution.  (Because TLC uses a breadth-first    *)
-(* search, it will find the shortest solution.)                            *)
-(***************************************************************************)
-=============================================================================
+------------------------------ MODULE DieHard ------------------------------- 
+(***************************************************************************)
+(* In the movie Die Hard 3, the heros must obtain exactly 4 gallons of     *)
+(* water using a 5 gallon jug, a 3 gallon jug, and a water faucet.  Our    *)
+(* goal: to get TLC to solve the problem for us.                           *)
+(*                                                                         *)
+(* First, we write a spec that describes all allowable behaviors of our    *)
+(* heros.                                                                  *)
+(***************************************************************************)
+EXTENDS Naturals
+  (*************************************************************************)
+  (* This statement imports the definitions of the ordinary operators on   *)
+  (* natural numbers, such as +.                                           *)
+  (*************************************************************************)
+  
+(***************************************************************************)
+(* We next declare the specification's variables.                          *)
+(***************************************************************************)
+VARIABLES big,   \* The number of gallons of water in the 5 gallon jug.
+          small  \* The number of gallons of water in the 3 gallon jug.
+
+
+(***************************************************************************)
+(* We now define TypeOK to be the type invariant, asserting that the value *)
+(* of each variable is an element of the appropriate set.  A type          *)
+(* invariant like this is not part of the specification, but it's          *)
+(* generally a good idea to include it because it helps the reader         *)
+(* understand the spec.  Moreover, having TLC check that it is an          *)
+(* invariant of the spec catches errors that, in a typed language, are     *)
+(* caught by type checking.                                                *)
+(*                                                                         *)
+(* Note: TLA+ uses the convention that a list of formulas bulleted by /\   *)
+(* or \/ denotes the conjunction or disjunction of those formulas.         *)
+(* Indentation of subitems is significant, allowing one to eliminate lots  *)
+(* of parentheses.  This makes a large formula much easier to read.        *)
+(* However, it does mean that you have to be careful with your indentation.*)
+(***************************************************************************)
+TypeOK == /\ small \in 0..3 
+          /\ big   \in 0..5
+
+
+(***************************************************************************)
+(* Now we define of the initial predicate, that specifies the initial      *)
+(* values of the variables.  I like to name this predicate Init, but the   *)
+(* name doesn't matter.                                                    *)
+(***************************************************************************)
+Init == /\ big = 0 
+        /\ small = 0
+
+(***************************************************************************)
+(* Now we define the actions that our hero can perform.  There are three   *)
+(* things they can do:                                                     *)
+(*                                                                         *)
+(*   - Pour water from the faucet into a jug.                              *)
+(*                                                                         *)
+(*   - Pour water from a jug onto the ground.                              *)
+(*                                                                         *)
+(*   - Pour water from one jug into another                                *)
+(*                                                                         *)
+(* We now consider the first two.  Since the jugs are not calibrated,      *)
+(* partially filling or partially emptying a jug accomplishes nothing.     *)
+(* So, the first two possibilities yield the following four possible       *)
+(* actions.                                                                *)
+(***************************************************************************)
+FillSmallJug  == /\ small' = 3 
+                 /\ big' = big
+
+FillBigJug    == /\ big' = 5 
+                 /\ small' = small
+
+EmptySmallJug == /\ small' = 0 
+                 /\ big' = big
+
+EmptyBigJug   == /\ big' = 0 
+                 /\ small' = small
+
+(***************************************************************************)
+(* We now consider pouring water from one jug into another.  Again, since  *)
+(* the jugs are not callibrated, when pouring from jug A to jug B, it      *)
+(* makes sense only to either fill B or empty A. And there's no point in   *)
+(* emptying A if this will cause B to overflow, since that could be        *)
+(* accomplished by the two actions of first filling B and then emptying A. *)
+(* So, pouring water from A to B leaves B with the lesser of (i) the water *)
+(* contained in both jugs and (ii) the volume of B. To express this        *)
+(* mathematically, we first define Min(m,n) to equal the minimum of the    *)
+(* numbers m and n.                                                        *)
+(***************************************************************************)
+Min(m,n) == IF m < n THEN m ELSE n
+
+(***************************************************************************)
+(* Now we define the last two pouring actions.  From the observation       *)
+(* above, these definitions should be clear.                               *)
+(***************************************************************************)
+SmallToBig == /\ big'   = Min(big + small, 5)
+              /\ small' = small - (big' - big)
+
+BigToSmall == /\ small' = Min(big + small, 3) 
+              /\ big'   = big - (small' - small)
+
+(***************************************************************************)
+(* We define the next-state relation, which I like to call Next.  A Next   *)
+(* step is a step of one of the six actions defined above.  Hence, Next is *)
+(* the disjunction of those actions.                                       *)
+(***************************************************************************)
+Next ==  \/ FillSmallJug 
+         \/ FillBigJug    
+         \/ EmptySmallJug 
+         \/ EmptyBigJug    
+         \/ SmallToBig    
+         \/ BigToSmall    
+
+(***************************************************************************)
+(* We define the formula Spec to be the complete specification, asserting  *)
+(* of a behavior that it begins in a state satisfying Init, and that every *)
+(* step either satisfies Next or else leaves the pair <<big, small>>       *)
+(* unchanged.                                                              *)
+(***************************************************************************)
+Spec == Init /\ [][Next]_<<big, small>> 
+-----------------------------------------------------------------------------
+
+(***************************************************************************)
+(* Remember that our heros must measure out 4 gallons of water.            *)
+(* Obviously, those 4 gallons must be in the 5 gallon jug.  So, they have  *)
+(* solved their problem when they reach a state with big = 4.  So, we      *)
+(* define NotSolved to be the predicate asserting that big # 4.            *)
+(***************************************************************************)
+NotSolved == big # 4
+
+(***************************************************************************)
+(* We find a solution by having TLC check if NotSolved is an invariant,    *)
+(* which will cause it to print out an "error trace" consisting of a       *)
+(* behavior ending in a states where NotSolved is false.  Such a           *)
+(* behavior is the desired solution.  (Because TLC uses a breadth-first    *)
+(* search, it will find the shortest solution.)                            *)
+(***************************************************************************)
+=============================================================================
diff --git a/src/test/resources/MCTests/DieHarder/DieHarder.tla b/src/test/resources/MCTests/DieHarder/DieHarder.tla
index 62b5771ea83b2baba251e2847a39be659a324a1d..327319a613c3e815fdcddffd91eb91af82a85416 100644
--- a/src/test/resources/MCTests/DieHarder/DieHarder.tla
+++ b/src/test/resources/MCTests/DieHarder/DieHarder.tla
@@ -1,93 +1,93 @@
------------------------------ MODULE DieHarder ------------------------------ 
-(***************************************************************************)
-(* We now generalize the problem from Die Hard into one with an arbitrary  *)
-(* number of jugs, each holding some specified amount of water.            *)
-(***************************************************************************)
-EXTENDS Naturals
-
-(***************************************************************************)
-(* We now declare two constant parameters.                                 *)
-(***************************************************************************)
-
-CONSTANT Jug,      \* The set of all jugs.
-         Capacity, \* A function, where Capacity[j] is the capacity of jug j.
-         Goal      \* The quantity of water our heros must measure.
-(***************************************************************************)
-(* We make an assumption about these constants--namely, that Capacity is a *)
-(* function from jugs to positive integers, and Goal is a natural number.  *)
-(***************************************************************************)
-ASSUME /\ Capacity \in [Jug -> {n \in Nat : n > 0}]
-       /\ Goal \in Nat
-(***************************************************************************)
-(* We are going to need the Min operator again, so let's define it here.   *)
-(* (I prefer defining constant operators like this in the part of the      *)
-(* spec where constants are declared.                                      *)
-(***************************************************************************)
-Min(m,n) == IF m < n THEN m ELSE n
------------------------------------------------------------------------------
-(***************************************************************************)
-(* We declare the specification's single variable and define its type      *)
-(* invariant and initial predicate.                                        *)
-(***************************************************************************)
-VARIABLE contents \* contents[j] is the amount of water in jug j
-
-TypeOK == contents \in [Jug -> Nat]
-
-Init == contents = [j \in Jug |-> 0]
------------------------------------------------------------------------------
-(***************************************************************************)
-(* Now we define the actions that can be performed.  They are the obvious  *)
-(* generalizations of the ones from the simple DieHard spec.  First come   *)
-(* the actions of filling and emptying jug j, then the action of           *)
-(* pouring water from jug j to jug k.                                      *)
-(*                                                                         *)
-(* Note: The definitions use the TLA+ notation                             *)
-(*                                                                         *)
-(*          [f EXCEPT ![c]=e]                                              *)
-(*                                                                         *)
-(* which is the function g that is the same as f except g[c]=e.  In the    *)
-(* expression e, the symbol @ stands for f[c].  This has the more general  *)
-(* form                                                                    *)
-(*                                                                         *)
-(*         [f EXCEPT ![c1] = e1, ... , ![ck] = ek]                         *)
-(*                                                                         *)
-(* that has the expected meaning.                                          *)
-(***************************************************************************)
-FillJug(j)  == contents' = [contents EXCEPT ![j] = Capacity[j]]
-
-EmptyJug(j) == contents' = [contents EXCEPT ![j] = 0]
-  
-JugToJug(j, k) == 
-  LET amountPoured == Min(contents[j], Capacity[k]-contents[k])
-  IN  contents' = [contents EXCEPT ![j] = @ - amountPoured,
-                                   ![k] = @ + amountPoured]
-
-(***************************************************************************)
-(* As usual, the next-state relation Next is the disjunction of all        *)
-(* possible actions, where existential quantification is a general form of *)
-(* disjunction.                                                            *)
-(***************************************************************************)
-Next ==  \E j \in Jug : \/ FillJug(j)
-                        \/ EmptyJug(j)
-                        \/ \E k \in Jug \ {j} : JugToJug(j, k)
-
-(***************************************************************************)
-(* We define the formula Spec to be the complete specification, asserting  *)
-(* of a behavior that it begins in a state satisfying Init, and that every *)
-(* step either satisfies Next or else leaves contents unchanged.           *)
-(***************************************************************************)
-Spec == Init /\ [][Next]_contents
------------------------------------------------------------------------------
-(***************************************************************************)
-(* We define NotSolved to be true of a state iff no jug contains Goal      *)
-(* gallons of water.                                                       *)
-(***************************************************************************)
-NotSolved == \A j \in Jug : contents[j] # Goal
-
-(***************************************************************************)
-(* We find a solution by having TLC check if NotSolved is an invariant,    *)
-(* which will cause it to print out an "error trace" consisting of a       *)
-(* behavior ending in a states where NotSolved is false.  Such a           *)
-(* behavior is the desired solution.                                       *)
-(***************************************************************************)
-=============================================================================
+----------------------------- MODULE DieHarder ------------------------------ 
+(***************************************************************************)
+(* We now generalize the problem from Die Hard into one with an arbitrary  *)
+(* number of jugs, each holding some specified amount of water.            *)
+(***************************************************************************)
+EXTENDS Naturals
+
+(***************************************************************************)
+(* We now declare two constant parameters.                                 *)
+(***************************************************************************)
+
+CONSTANT Jug,      \* The set of all jugs.
+         Capacity, \* A function, where Capacity[j] is the capacity of jug j.
+         Goal      \* The quantity of water our heros must measure.
+(***************************************************************************)
+(* We make an assumption about these constants--namely, that Capacity is a *)
+(* function from jugs to positive integers, and Goal is a natural number.  *)
+(***************************************************************************)
+ASSUME /\ Capacity \in [Jug -> {n \in Nat : n > 0}]
+       /\ Goal \in Nat
+(***************************************************************************)
+(* We are going to need the Min operator again, so let's define it here.   *)
+(* (I prefer defining constant operators like this in the part of the      *)
+(* spec where constants are declared.                                      *)
+(***************************************************************************)
+Min(m,n) == IF m < n THEN m ELSE n
+-----------------------------------------------------------------------------
+(***************************************************************************)
+(* We declare the specification's single variable and define its type      *)
+(* invariant and initial predicate.                                        *)
+(***************************************************************************)
+VARIABLE contents \* contents[j] is the amount of water in jug j
+
+TypeOK == contents \in [Jug -> Nat]
+
+Init == contents = [j \in Jug |-> 0]
+-----------------------------------------------------------------------------
+(***************************************************************************)
+(* Now we define the actions that can be performed.  They are the obvious  *)
+(* generalizations of the ones from the simple DieHard spec.  First come   *)
+(* the actions of filling and emptying jug j, then the action of           *)
+(* pouring water from jug j to jug k.                                      *)
+(*                                                                         *)
+(* Note: The definitions use the TLA+ notation                             *)
+(*                                                                         *)
+(*          [f EXCEPT ![c]=e]                                              *)
+(*                                                                         *)
+(* which is the function g that is the same as f except g[c]=e.  In the    *)
+(* expression e, the symbol @ stands for f[c].  This has the more general  *)
+(* form                                                                    *)
+(*                                                                         *)
+(*         [f EXCEPT ![c1] = e1, ... , ![ck] = ek]                         *)
+(*                                                                         *)
+(* that has the expected meaning.                                          *)
+(***************************************************************************)
+FillJug(j)  == contents' = [contents EXCEPT ![j] = Capacity[j]]
+
+EmptyJug(j) == contents' = [contents EXCEPT ![j] = 0]
+  
+JugToJug(j, k) == 
+  LET amountPoured == Min(contents[j], Capacity[k]-contents[k])
+  IN  contents' = [contents EXCEPT ![j] = @ - amountPoured,
+                                   ![k] = @ + amountPoured]
+
+(***************************************************************************)
+(* As usual, the next-state relation Next is the disjunction of all        *)
+(* possible actions, where existential quantification is a general form of *)
+(* disjunction.                                                            *)
+(***************************************************************************)
+Next ==  \E j \in Jug : \/ FillJug(j)
+                        \/ EmptyJug(j)
+                        \/ \E k \in Jug \ {j} : JugToJug(j, k)
+
+(***************************************************************************)
+(* We define the formula Spec to be the complete specification, asserting  *)
+(* of a behavior that it begins in a state satisfying Init, and that every *)
+(* step either satisfies Next or else leaves contents unchanged.           *)
+(***************************************************************************)
+Spec == Init /\ [][Next]_contents
+-----------------------------------------------------------------------------
+(***************************************************************************)
+(* We define NotSolved to be true of a state iff no jug contains Goal      *)
+(* gallons of water.                                                       *)
+(***************************************************************************)
+NotSolved == \A j \in Jug : contents[j] # Goal
+
+(***************************************************************************)
+(* We find a solution by having TLC check if NotSolved is an invariant,    *)
+(* which will cause it to print out an "error trace" consisting of a       *)
+(* behavior ending in a states where NotSolved is false.  Such a           *)
+(* behavior is the desired solution.                                       *)
+(***************************************************************************)
+=============================================================================
diff --git a/src/test/resources/MCTests/DieHarder/MCDieHarder.cfg b/src/test/resources/MCTests/DieHarder/MCDieHarder.cfg
index a2b049287576d6aae25238d3e03b5aa4ae2e6371..2e38d93e721429f850aacba12a9712bcc21c504b 100644
--- a/src/test/resources/MCTests/DieHarder/MCDieHarder.cfg
+++ b/src/test/resources/MCTests/DieHarder/MCDieHarder.cfg
@@ -1,7 +1,7 @@
-CONSTANTS Goal     =  4
-          Jug      <- MCJug
-          Capacity <- MCCapacity 
-
-SPECIFICATION Spec
-INVARIANTS TypeOK NotSolved
-
+CONSTANTS Goal     =  4
+          Jug      <- MCJug
+          Capacity <- MCCapacity 
+
+SPECIFICATION Spec
+INVARIANTS TypeOK NotSolved
+
diff --git a/src/test/resources/MCTests/DieHarder/MCDieHarder.tla b/src/test/resources/MCTests/DieHarder/MCDieHarder.tla
index a4b83157f22f1012b090f53ac80472286199dd3c..440c4a163a6800d19e8dcaeb95dcd4439a60d6d6 100644
--- a/src/test/resources/MCTests/DieHarder/MCDieHarder.tla
+++ b/src/test/resources/MCTests/DieHarder/MCDieHarder.tla
@@ -1,20 +1,20 @@
----------------------------- MODULE MCDieHarder ----------------------------- 
-EXTENDS DieHarder
-
-(***************************************************************************)
-(* To have TLC find a solution, we must tell it what values to use for the *)
-(* constant parameters Jug, Capacity, and Goal.  However, TLC does not     *)
-(* allow one to write write function-valued expressions in a configuration *)
-(* file.  So, we use this module, which extends module DieHarder, to       *)
-(* define a function MCCapacity and have the configuration file TLC to     *)
-(* substitute MCCapacity for Capacity.  Since we need to know the value of *)
-(* Jug to define Capacity (which is a function having Jug as its domain),  *)
-(* we also define MCJug and tell TLC to substitute it for Jug.             *)
-(***************************************************************************)
-
-\* The following definitions duplicate the original Die Hard problem.
-MCJug == {"j1", "j2"}
-MCCapacity ==
-  [j \in MCJug |-> CASE j = "j1" -> 3
-                     [] j = "j2" -> 5 ]
-=============================================================================
+---------------------------- MODULE MCDieHarder ----------------------------- 
+EXTENDS DieHarder
+
+(***************************************************************************)
+(* To have TLC find a solution, we must tell it what values to use for the *)
+(* constant parameters Jug, Capacity, and Goal.  However, TLC does not     *)
+(* allow one to write write function-valued expressions in a configuration *)
+(* file.  So, we use this module, which extends module DieHarder, to       *)
+(* define a function MCCapacity and have the configuration file TLC to     *)
+(* substitute MCCapacity for Capacity.  Since we need to know the value of *)
+(* Jug to define Capacity (which is a function having Jug as its domain),  *)
+(* we also define MCJug and tell TLC to substitute it for Jug.             *)
+(***************************************************************************)
+
+\* The following definitions duplicate the original Die Hard problem.
+MCJug == {"j1", "j2"}
+MCCapacity ==
+  [j \in MCJug |-> CASE j = "j1" -> 3
+                     [] j = "j2" -> 5 ]
+=============================================================================
diff --git a/src/test/resources/MCTests/MCDieHarder/DieHarder.tla b/src/test/resources/MCTests/MCDieHarder/DieHarder.tla
index 62b5771ea83b2baba251e2847a39be659a324a1d..327319a613c3e815fdcddffd91eb91af82a85416 100644
--- a/src/test/resources/MCTests/MCDieHarder/DieHarder.tla
+++ b/src/test/resources/MCTests/MCDieHarder/DieHarder.tla
@@ -1,93 +1,93 @@
------------------------------ MODULE DieHarder ------------------------------ 
-(***************************************************************************)
-(* We now generalize the problem from Die Hard into one with an arbitrary  *)
-(* number of jugs, each holding some specified amount of water.            *)
-(***************************************************************************)
-EXTENDS Naturals
-
-(***************************************************************************)
-(* We now declare two constant parameters.                                 *)
-(***************************************************************************)
-
-CONSTANT Jug,      \* The set of all jugs.
-         Capacity, \* A function, where Capacity[j] is the capacity of jug j.
-         Goal      \* The quantity of water our heros must measure.
-(***************************************************************************)
-(* We make an assumption about these constants--namely, that Capacity is a *)
-(* function from jugs to positive integers, and Goal is a natural number.  *)
-(***************************************************************************)
-ASSUME /\ Capacity \in [Jug -> {n \in Nat : n > 0}]
-       /\ Goal \in Nat
-(***************************************************************************)
-(* We are going to need the Min operator again, so let's define it here.   *)
-(* (I prefer defining constant operators like this in the part of the      *)
-(* spec where constants are declared.                                      *)
-(***************************************************************************)
-Min(m,n) == IF m < n THEN m ELSE n
------------------------------------------------------------------------------
-(***************************************************************************)
-(* We declare the specification's single variable and define its type      *)
-(* invariant and initial predicate.                                        *)
-(***************************************************************************)
-VARIABLE contents \* contents[j] is the amount of water in jug j
-
-TypeOK == contents \in [Jug -> Nat]
-
-Init == contents = [j \in Jug |-> 0]
------------------------------------------------------------------------------
-(***************************************************************************)
-(* Now we define the actions that can be performed.  They are the obvious  *)
-(* generalizations of the ones from the simple DieHard spec.  First come   *)
-(* the actions of filling and emptying jug j, then the action of           *)
-(* pouring water from jug j to jug k.                                      *)
-(*                                                                         *)
-(* Note: The definitions use the TLA+ notation                             *)
-(*                                                                         *)
-(*          [f EXCEPT ![c]=e]                                              *)
-(*                                                                         *)
-(* which is the function g that is the same as f except g[c]=e.  In the    *)
-(* expression e, the symbol @ stands for f[c].  This has the more general  *)
-(* form                                                                    *)
-(*                                                                         *)
-(*         [f EXCEPT ![c1] = e1, ... , ![ck] = ek]                         *)
-(*                                                                         *)
-(* that has the expected meaning.                                          *)
-(***************************************************************************)
-FillJug(j)  == contents' = [contents EXCEPT ![j] = Capacity[j]]
-
-EmptyJug(j) == contents' = [contents EXCEPT ![j] = 0]
-  
-JugToJug(j, k) == 
-  LET amountPoured == Min(contents[j], Capacity[k]-contents[k])
-  IN  contents' = [contents EXCEPT ![j] = @ - amountPoured,
-                                   ![k] = @ + amountPoured]
-
-(***************************************************************************)
-(* As usual, the next-state relation Next is the disjunction of all        *)
-(* possible actions, where existential quantification is a general form of *)
-(* disjunction.                                                            *)
-(***************************************************************************)
-Next ==  \E j \in Jug : \/ FillJug(j)
-                        \/ EmptyJug(j)
-                        \/ \E k \in Jug \ {j} : JugToJug(j, k)
-
-(***************************************************************************)
-(* We define the formula Spec to be the complete specification, asserting  *)
-(* of a behavior that it begins in a state satisfying Init, and that every *)
-(* step either satisfies Next or else leaves contents unchanged.           *)
-(***************************************************************************)
-Spec == Init /\ [][Next]_contents
------------------------------------------------------------------------------
-(***************************************************************************)
-(* We define NotSolved to be true of a state iff no jug contains Goal      *)
-(* gallons of water.                                                       *)
-(***************************************************************************)
-NotSolved == \A j \in Jug : contents[j] # Goal
-
-(***************************************************************************)
-(* We find a solution by having TLC check if NotSolved is an invariant,    *)
-(* which will cause it to print out an "error trace" consisting of a       *)
-(* behavior ending in a states where NotSolved is false.  Such a           *)
-(* behavior is the desired solution.                                       *)
-(***************************************************************************)
-=============================================================================
+----------------------------- MODULE DieHarder ------------------------------ 
+(***************************************************************************)
+(* We now generalize the problem from Die Hard into one with an arbitrary  *)
+(* number of jugs, each holding some specified amount of water.            *)
+(***************************************************************************)
+EXTENDS Naturals
+
+(***************************************************************************)
+(* We now declare two constant parameters.                                 *)
+(***************************************************************************)
+
+CONSTANT Jug,      \* The set of all jugs.
+         Capacity, \* A function, where Capacity[j] is the capacity of jug j.
+         Goal      \* The quantity of water our heros must measure.
+(***************************************************************************)
+(* We make an assumption about these constants--namely, that Capacity is a *)
+(* function from jugs to positive integers, and Goal is a natural number.  *)
+(***************************************************************************)
+ASSUME /\ Capacity \in [Jug -> {n \in Nat : n > 0}]
+       /\ Goal \in Nat
+(***************************************************************************)
+(* We are going to need the Min operator again, so let's define it here.   *)
+(* (I prefer defining constant operators like this in the part of the      *)
+(* spec where constants are declared.                                      *)
+(***************************************************************************)
+Min(m,n) == IF m < n THEN m ELSE n
+-----------------------------------------------------------------------------
+(***************************************************************************)
+(* We declare the specification's single variable and define its type      *)
+(* invariant and initial predicate.                                        *)
+(***************************************************************************)
+VARIABLE contents \* contents[j] is the amount of water in jug j
+
+TypeOK == contents \in [Jug -> Nat]
+
+Init == contents = [j \in Jug |-> 0]
+-----------------------------------------------------------------------------
+(***************************************************************************)
+(* Now we define the actions that can be performed.  They are the obvious  *)
+(* generalizations of the ones from the simple DieHard spec.  First come   *)
+(* the actions of filling and emptying jug j, then the action of           *)
+(* pouring water from jug j to jug k.                                      *)
+(*                                                                         *)
+(* Note: The definitions use the TLA+ notation                             *)
+(*                                                                         *)
+(*          [f EXCEPT ![c]=e]                                              *)
+(*                                                                         *)
+(* which is the function g that is the same as f except g[c]=e.  In the    *)
+(* expression e, the symbol @ stands for f[c].  This has the more general  *)
+(* form                                                                    *)
+(*                                                                         *)
+(*         [f EXCEPT ![c1] = e1, ... , ![ck] = ek]                         *)
+(*                                                                         *)
+(* that has the expected meaning.                                          *)
+(***************************************************************************)
+FillJug(j)  == contents' = [contents EXCEPT ![j] = Capacity[j]]
+
+EmptyJug(j) == contents' = [contents EXCEPT ![j] = 0]
+  
+JugToJug(j, k) == 
+  LET amountPoured == Min(contents[j], Capacity[k]-contents[k])
+  IN  contents' = [contents EXCEPT ![j] = @ - amountPoured,
+                                   ![k] = @ + amountPoured]
+
+(***************************************************************************)
+(* As usual, the next-state relation Next is the disjunction of all        *)
+(* possible actions, where existential quantification is a general form of *)
+(* disjunction.                                                            *)
+(***************************************************************************)
+Next ==  \E j \in Jug : \/ FillJug(j)
+                        \/ EmptyJug(j)
+                        \/ \E k \in Jug \ {j} : JugToJug(j, k)
+
+(***************************************************************************)
+(* We define the formula Spec to be the complete specification, asserting  *)
+(* of a behavior that it begins in a state satisfying Init, and that every *)
+(* step either satisfies Next or else leaves contents unchanged.           *)
+(***************************************************************************)
+Spec == Init /\ [][Next]_contents
+-----------------------------------------------------------------------------
+(***************************************************************************)
+(* We define NotSolved to be true of a state iff no jug contains Goal      *)
+(* gallons of water.                                                       *)
+(***************************************************************************)
+NotSolved == \A j \in Jug : contents[j] # Goal
+
+(***************************************************************************)
+(* We find a solution by having TLC check if NotSolved is an invariant,    *)
+(* which will cause it to print out an "error trace" consisting of a       *)
+(* behavior ending in a states where NotSolved is false.  Such a           *)
+(* behavior is the desired solution.                                       *)
+(***************************************************************************)
+=============================================================================
diff --git a/src/test/resources/MCTests/MCDieHarder/MCDieHarder.cfg b/src/test/resources/MCTests/MCDieHarder/MCDieHarder.cfg
index a2b049287576d6aae25238d3e03b5aa4ae2e6371..2e38d93e721429f850aacba12a9712bcc21c504b 100644
--- a/src/test/resources/MCTests/MCDieHarder/MCDieHarder.cfg
+++ b/src/test/resources/MCTests/MCDieHarder/MCDieHarder.cfg
@@ -1,7 +1,7 @@
-CONSTANTS Goal     =  4
-          Jug      <- MCJug
-          Capacity <- MCCapacity 
-
-SPECIFICATION Spec
-INVARIANTS TypeOK NotSolved
-
+CONSTANTS Goal     =  4
+          Jug      <- MCJug
+          Capacity <- MCCapacity 
+
+SPECIFICATION Spec
+INVARIANTS TypeOK NotSolved
+
diff --git a/src/test/resources/MCTests/MCDieHarder/MCDieHarder.tla b/src/test/resources/MCTests/MCDieHarder/MCDieHarder.tla
index a4b83157f22f1012b090f53ac80472286199dd3c..440c4a163a6800d19e8dcaeb95dcd4439a60d6d6 100644
--- a/src/test/resources/MCTests/MCDieHarder/MCDieHarder.tla
+++ b/src/test/resources/MCTests/MCDieHarder/MCDieHarder.tla
@@ -1,20 +1,20 @@
----------------------------- MODULE MCDieHarder ----------------------------- 
-EXTENDS DieHarder
-
-(***************************************************************************)
-(* To have TLC find a solution, we must tell it what values to use for the *)
-(* constant parameters Jug, Capacity, and Goal.  However, TLC does not     *)
-(* allow one to write write function-valued expressions in a configuration *)
-(* file.  So, we use this module, which extends module DieHarder, to       *)
-(* define a function MCCapacity and have the configuration file TLC to     *)
-(* substitute MCCapacity for Capacity.  Since we need to know the value of *)
-(* Jug to define Capacity (which is a function having Jug as its domain),  *)
-(* we also define MCJug and tell TLC to substitute it for Jug.             *)
-(***************************************************************************)
-
-\* The following definitions duplicate the original Die Hard problem.
-MCJug == {"j1", "j2"}
-MCCapacity ==
-  [j \in MCJug |-> CASE j = "j1" -> 3
-                     [] j = "j2" -> 5 ]
-=============================================================================
+---------------------------- MODULE MCDieHarder ----------------------------- 
+EXTENDS DieHarder
+
+(***************************************************************************)
+(* To have TLC find a solution, we must tell it what values to use for the *)
+(* constant parameters Jug, Capacity, and Goal.  However, TLC does not     *)
+(* allow one to write write function-valued expressions in a configuration *)
+(* file.  So, we use this module, which extends module DieHarder, to       *)
+(* define a function MCCapacity and have the configuration file TLC to     *)
+(* substitute MCCapacity for Capacity.  Since we need to know the value of *)
+(* Jug to define Capacity (which is a function having Jug as its domain),  *)
+(* we also define MCJug and tell TLC to substitute it for Jug.             *)
+(***************************************************************************)
+
+\* The following definitions duplicate the original Die Hard problem.
+MCJug == {"j1", "j2"}
+MCCapacity ==
+  [j \in MCJug |-> CASE j = "j1" -> 3
+                     [] j = "j2" -> 5 ]
+=============================================================================
diff --git a/src/test/resources/examples/instance/Counter/InstanceDefinition.mch b/src/test/resources/examples/instance/Counter/InstanceDefinition.mch
index 688146d036fac93fdd9ed749cca16db291bd37a4..3f4b1abd3b9440a6c1377299469325fba6d00dcf 100644
--- a/src/test/resources/examples/instance/Counter/InstanceDefinition.mch
+++ b/src/test/resources/examples/instance/Counter/InstanceDefinition.mch
@@ -1,13 +1,13 @@
-MACHINE InstanceDefinition
-DEFINITIONS
- val == 5
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(c = 0)
-OPERATIONS
- Next_Op = ANY c_n
-	WHERE c_n : INTEGER & c_n = c + val
-	THEN c := c_n END
+MACHINE InstanceDefinition
+DEFINITIONS
+ val == 5
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(c = 0)
+OPERATIONS
+ Next_Op = ANY c_n
+	WHERE c_n : INTEGER & c_n = c + val
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/Counter/InstanceDefinition.tla b/src/test/resources/examples/instance/Counter/InstanceDefinition.tla
index 303d8b59e063b0550108b125949b6943ec2d4f4b..8f81bf21bdd73e48ec60bf42b6a8cd417082aaad 100644
--- a/src/test/resources/examples/instance/Counter/InstanceDefinition.tla
+++ b/src/test/resources/examples/instance/Counter/InstanceDefinition.tla
@@ -1,5 +1,5 @@
--------------- MODULE InstanceDefinition ----------------
-VARIABLES c
-val == 5 (* the val definition of the Counter module will be automatically overriden by SANY  *)
-INSTANCE Counter WITH x <- c, start <- 0
+-------------- MODULE InstanceDefinition ----------------
+VARIABLES c
+val == 5 (* the val definition of the Counter module will be automatically overriden by SANY  *)
+INSTANCE Counter WITH x <- c, start <- 0
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/Counter/InstanceNoName.mch b/src/test/resources/examples/instance/Counter/InstanceNoName.mch
index ad110dca9e20e37494cfdf54fe03a6569d974b29..db14ef851bef6fae8b48769d4c9a37a5b571e1e7 100644
--- a/src/test/resources/examples/instance/Counter/InstanceNoName.mch
+++ b/src/test/resources/examples/instance/Counter/InstanceNoName.mch
@@ -1,18 +1,18 @@
-MACHINE InstanceNoName
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- Init == c = start;
-
- val == 1
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(Init)
-OPERATIONS
- Next_Op = ANY c_n
-	WHERE c_n : INTEGER & c_n = c + val
-	THEN c := c_n END
+MACHINE InstanceNoName
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ Init == c = start;
+
+ val == 1
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(Init)
+OPERATIONS
+ Next_Op = ANY c_n
+	WHERE c_n : INTEGER & c_n = c + val
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/Counter/InstanceNoName.tla b/src/test/resources/examples/instance/Counter/InstanceNoName.tla
index b2e5e4d0d3b1562d88e5b9e5cf43f7d857126f64..c37e2ea3f7d8120465ee3a2b618096915cad5135 100644
--- a/src/test/resources/examples/instance/Counter/InstanceNoName.tla
+++ b/src/test/resources/examples/instance/Counter/InstanceNoName.tla
@@ -1,6 +1,6 @@
--------------- MODULE InstanceNoName ----------------
-CONSTANTS start
-VARIABLES c
-INSTANCE Counter WITH x <- c
-Spec == Init /\ [][Next]_c
+-------------- MODULE InstanceNoName ----------------
+CONSTANTS start
+VARIABLES c
+INSTANCE Counter WITH x <- c
+Spec == Init /\ [][Next]_c
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/Counter/ModConstantAssignment.cfg b/src/test/resources/examples/instance/Counter/ModConstantAssignment.cfg
index e4eda93e3f0fcbb23080a8e7dc29081ce42ffe76..b444b17e4e8ee15d3a4b03519dd8e50eb61a8104 100644
--- a/src/test/resources/examples/instance/Counter/ModConstantAssignment.cfg
+++ b/src/test/resources/examples/instance/Counter/ModConstantAssignment.cfg
@@ -1,3 +1,3 @@
-INIT Init
-NEXT Next
+INIT Init
+NEXT Next
 CONSTANTS val = [Counter] 7
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/Counter/OneInstanced.mch b/src/test/resources/examples/instance/Counter/OneInstanced.mch
index 0a7a02dad5d328d1f245e4bdd03d6b7f3264577c..4cd5bc2c3ee07e1d797365c4c14aa3b0bb6cc146 100644
--- a/src/test/resources/examples/instance/Counter/OneInstanced.mch
+++ b/src/test/resources/examples/instance/Counter/OneInstanced.mch
@@ -1,19 +1,19 @@
-MACHINE OneInstanced
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- count_Init == c = start;
-
- count_val == 1;
-
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(count_Init)
-OPERATIONS
- count_Next_Op = ANY c_n
-	WHERE c_n : INTEGER & c_n = c + count_val
-	THEN c := c_n END
+MACHINE OneInstanced
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ count_Init == c = start;
+
+ count_val == 1;
+
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(count_Init)
+OPERATIONS
+ count_Next_Op = ANY c_n
+	WHERE c_n : INTEGER & c_n = c + count_val
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/Counter/TwoInstance.mch b/src/test/resources/examples/instance/Counter/TwoInstance.mch
index d23db8b678843cd223a8bac4cceb4fe0d07c3fb8..162a3580fe50d066958c05dbb821839cd69ac058 100644
--- a/src/test/resources/examples/instance/Counter/TwoInstance.mch
+++ b/src/test/resources/examples/instance/Counter/TwoInstance.mch
@@ -1,32 +1,32 @@
-MACHINE TwoInstanced
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- count_Init == c = start;
-
- count_val == 1;
-
- count_Next == c_n = c + count_val;
-
- count2_Init == c2 = 0;
-
- count2_val == 1;
-
- count2_Next == c2_n = c2 + count2_val;
-
-VARIABLES c, c2
-INVARIANT
- c : INTEGER
- & c2 : INTEGER
-INITIALISATION
- c, c2:(count_Init & count2_Init)
-OPERATIONS
- Next1_Op = ANY c_n
-	WHERE c_n : INTEGER & count_Next & TRUE = TRUE
-	THEN c := c_n END;
-
- Next2_Op = ANY c2_n
-	WHERE c2_n : INTEGER & count2_Next & TRUE = TRUE
-	THEN c2 := c2_n END
-END
+MACHINE TwoInstanced
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ count_Init == c = start;
+
+ count_val == 1;
+
+ count_Next == c_n = c + count_val;
+
+ count2_Init == c2 = 0;
+
+ count2_val == 1;
+
+ count2_Next == c2_n = c2 + count2_val;
+
+VARIABLES c, c2
+INVARIANT
+ c : INTEGER
+ & c2 : INTEGER
+INITIALISATION
+ c, c2:(count_Init & count2_Init)
+OPERATIONS
+ Next1_Op = ANY c_n
+	WHERE c_n : INTEGER & count_Next & TRUE = TRUE
+	THEN c := c_n END;
+
+ Next2_Op = ANY c2_n
+	WHERE c2_n : INTEGER & count2_Next & TRUE = TRUE
+	THEN c2 := c2_n END
+END
diff --git a/src/test/resources/examples/instance/Counter/TwoInstance.tla b/src/test/resources/examples/instance/Counter/TwoInstance.tla
index 5939e9dcb2ab565f85bc6844159d0a6a7414ded8..ff6ade281a76721169792803cfdb99b6005f70d2 100644
--- a/src/test/resources/examples/instance/Counter/TwoInstance.tla
+++ b/src/test/resources/examples/instance/Counter/TwoInstance.tla
@@ -1,9 +1,9 @@
--------------- MODULE TwoInstanced --------------
-CONSTANTS start
-VARIABLES c, c2
-count == INSTANCE Counter WITH x <- c
-count2 == INSTANCE Counter WITH x <- c2, start <- 0
-Init == count!Init /\ count2!Init
-Next == 	\/ (count!Next /\ UNCHANGED c2)
-			\/ (count2!Next /\ UNCHANGED c)
+-------------- MODULE TwoInstanced --------------
+CONSTANTS start
+VARIABLES c, c2
+count == INSTANCE Counter WITH x <- c
+count2 == INSTANCE Counter WITH x <- c2, start <- 0
+Init == count!Init /\ count2!Init
+Next == 	\/ (count!Next /\ UNCHANGED c2)
+			\/ (count2!Next /\ UNCHANGED c)
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/Counter/TwoInstanced.mch b/src/test/resources/examples/instance/Counter/TwoInstanced.mch
index d23db8b678843cd223a8bac4cceb4fe0d07c3fb8..162a3580fe50d066958c05dbb821839cd69ac058 100644
--- a/src/test/resources/examples/instance/Counter/TwoInstanced.mch
+++ b/src/test/resources/examples/instance/Counter/TwoInstanced.mch
@@ -1,32 +1,32 @@
-MACHINE TwoInstanced
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- count_Init == c = start;
-
- count_val == 1;
-
- count_Next == c_n = c + count_val;
-
- count2_Init == c2 = 0;
-
- count2_val == 1;
-
- count2_Next == c2_n = c2 + count2_val;
-
-VARIABLES c, c2
-INVARIANT
- c : INTEGER
- & c2 : INTEGER
-INITIALISATION
- c, c2:(count_Init & count2_Init)
-OPERATIONS
- Next1_Op = ANY c_n
-	WHERE c_n : INTEGER & count_Next & TRUE = TRUE
-	THEN c := c_n END;
-
- Next2_Op = ANY c2_n
-	WHERE c2_n : INTEGER & count2_Next & TRUE = TRUE
-	THEN c2 := c2_n END
-END
+MACHINE TwoInstanced
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ count_Init == c = start;
+
+ count_val == 1;
+
+ count_Next == c_n = c + count_val;
+
+ count2_Init == c2 = 0;
+
+ count2_val == 1;
+
+ count2_Next == c2_n = c2 + count2_val;
+
+VARIABLES c, c2
+INVARIANT
+ c : INTEGER
+ & c2 : INTEGER
+INITIALISATION
+ c, c2:(count_Init & count2_Init)
+OPERATIONS
+ Next1_Op = ANY c_n
+	WHERE c_n : INTEGER & count_Next & TRUE = TRUE
+	THEN c := c_n END;
+
+ Next2_Op = ANY c2_n
+	WHERE c2_n : INTEGER & count2_Next & TRUE = TRUE
+	THEN c2 := c2_n END
+END
diff --git a/src/test/resources/examples/instance/Counter/TwoInstanced.tla b/src/test/resources/examples/instance/Counter/TwoInstanced.tla
index 5939e9dcb2ab565f85bc6844159d0a6a7414ded8..ff6ade281a76721169792803cfdb99b6005f70d2 100644
--- a/src/test/resources/examples/instance/Counter/TwoInstanced.tla
+++ b/src/test/resources/examples/instance/Counter/TwoInstanced.tla
@@ -1,9 +1,9 @@
--------------- MODULE TwoInstanced --------------
-CONSTANTS start
-VARIABLES c, c2
-count == INSTANCE Counter WITH x <- c
-count2 == INSTANCE Counter WITH x <- c2, start <- 0
-Init == count!Init /\ count2!Init
-Next == 	\/ (count!Next /\ UNCHANGED c2)
-			\/ (count2!Next /\ UNCHANGED c)
+-------------- MODULE TwoInstanced --------------
+CONSTANTS start
+VARIABLES c, c2
+count == INSTANCE Counter WITH x <- c
+count2 == INSTANCE Counter WITH x <- c2, start <- 0
+Init == count!Init /\ count2!Init
+Next == 	\/ (count!Next /\ UNCHANGED c2)
+			\/ (count2!Next /\ UNCHANGED c)
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/OpArg/OpArg.tla b/src/test/resources/examples/instance/OpArg/OpArg.tla
index 60a318106bbc6e701b724430bdb0a27c879d2035..f3e3cb213c240cd2eca30fc135aba9c29255de06 100644
--- a/src/test/resources/examples/instance/OpArg/OpArg.tla
+++ b/src/test/resources/examples/instance/OpArg/OpArg.tla
@@ -1,7 +1,7 @@
--------------- MODULE OpArg ----------------
-EXTENDS Naturals
-CONSTANTS k(_,_)
-VARIABLES c
-Init == c = 1 
-Next == c' = c + k(1, 2)
+-------------- MODULE OpArg ----------------
+EXTENDS Naturals
+CONSTANTS k(_,_)
+VARIABLES c
+Init == c = 1 
+Next == c' = c + k(1, 2)
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/OpArg/OpArgInstanced.mch b/src/test/resources/examples/instance/OpArg/OpArgInstanced.mch
index a9e7cf31d3ead0f7a3936d849ad61bd5310d9150..2093e6cc1fee9c704e58cf39c6b7b395891e5822 100644
--- a/src/test/resources/examples/instance/OpArg/OpArgInstanced.mch
+++ b/src/test/resources/examples/instance/OpArg/OpArgInstanced.mch
@@ -1,14 +1,14 @@
-MACHINE OpArgInstanced
-DEFINITIONS
- foo(a,b) == a + b;
-
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(c = 1)
-OPERATIONS
- Next_Op = ANY c_n
-	WHERE c_n : INTEGER & c_n = c + foo(1,2)
-	THEN c := c_n END
+MACHINE OpArgInstanced
+DEFINITIONS
+ foo(a,b) == a + b;
+
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(c = 1)
+OPERATIONS
+ Next_Op = ANY c_n
+	WHERE c_n : INTEGER & c_n = c + foo(1,2)
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/OpArg/OpArgInstanced.tla b/src/test/resources/examples/instance/OpArg/OpArgInstanced.tla
index 07e36d098a26749032f3c488f1daabf76e3eab9e..2f565a5d325ed5dc1320027bd210fd444f853e98 100644
--- a/src/test/resources/examples/instance/OpArg/OpArgInstanced.tla
+++ b/src/test/resources/examples/instance/OpArg/OpArgInstanced.tla
@@ -1,6 +1,6 @@
--------------- MODULE OpArgInstanced --------------
-EXTENDS Naturals
-VARIABLES c
-foo(a,b) == a + b
-INSTANCE OpArg WITH k <- foo
+-------------- MODULE OpArgInstanced --------------
+EXTENDS Naturals
+VARIABLES c
+foo(a,b) == a + b
+INSTANCE OpArg WITH k <- foo
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/configOverride/InstanceCounter.cfg b/src/test/resources/examples/instance/configOverride/InstanceCounter.cfg
index 3471675f8ebd5b9b1474da75830d4a8fe9c3a5bc..2d739f434f9133cb609752113d5904f755bea612 100644
--- a/src/test/resources/examples/instance/configOverride/InstanceCounter.cfg
+++ b/src/test/resources/examples/instance/configOverride/InstanceCounter.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS 
+INIT Init
+NEXT Next
+CONSTANTS 
 val =[Counter] 4
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/configOverride/InstanceCounter.mch b/src/test/resources/examples/instance/configOverride/InstanceCounter.mch
index 5b0c40aab287f28cbea784919bd1b0e12479680a..c123ac0d1db4ef274dcf85b0ff850bc47a173a57 100644
--- a/src/test/resources/examples/instance/configOverride/InstanceCounter.mch
+++ b/src/test/resources/examples/instance/configOverride/InstanceCounter.mch
@@ -1,16 +1,16 @@
-MACHINE InstanceCounter
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- val == 4
-VARIABLES x
-INVARIANT
- x : INTEGER
-INITIALISATION
- x:(x = start)
-OPERATIONS
- Next_Op = ANY x_n
-	WHERE x_n : INTEGER & x_n = x + val
-	THEN x := x_n END
-END
+MACHINE InstanceCounter
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ val == 4
+VARIABLES x
+INVARIANT
+ x : INTEGER
+INITIALISATION
+ x:(x = start)
+OPERATIONS
+ Next_Op = ANY x_n
+	WHERE x_n : INTEGER & x_n = x + val
+	THEN x := x_n END
+END
diff --git a/src/test/resources/examples/instance/configOverride/InstanceCounter.tla b/src/test/resources/examples/instance/configOverride/InstanceCounter.tla
index de92f0f504ca2bdaf151bcc0ae87dd43f01dcf7c..d4ce0e802d460074374cea59832ecf4c2bb57a59 100644
--- a/src/test/resources/examples/instance/configOverride/InstanceCounter.tla
+++ b/src/test/resources/examples/instance/configOverride/InstanceCounter.tla
@@ -1,5 +1,5 @@
--------------- MODULE InstanceCounter ----------------
-CONSTANTS start 
-VARIABLES x
-INSTANCE Counter
+-------------- MODULE InstanceCounter ----------------
+CONSTANTS start 
+VARIABLES x
+INSTANCE Counter
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/configOverride/InstanceCounterException.cfg b/src/test/resources/examples/instance/configOverride/InstanceCounterException.cfg
index efebca9fc0b6e5d9309a96fc72fd7a0695c0c2f7..a6fd3ed1c4d35426efa857d42adca579acd20f6b 100644
--- a/src/test/resources/examples/instance/configOverride/InstanceCounterException.cfg
+++ b/src/test/resources/examples/instance/configOverride/InstanceCounterException.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS
+INIT Init
+NEXT Next
+CONSTANTS
 start <-[Counter] foo
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/configOverride/InstanceCounterException.tla b/src/test/resources/examples/instance/configOverride/InstanceCounterException.tla
index 268aa31239fdcc8d64990010afda015c70795a52..9543a8b50a1a75f3bc30c8519a469b1fae62691b 100644
--- a/src/test/resources/examples/instance/configOverride/InstanceCounterException.tla
+++ b/src/test/resources/examples/instance/configOverride/InstanceCounterException.tla
@@ -1,6 +1,6 @@
--------------- MODULE InstanceCounterException ----------------
-CONSTANTS start
-VARIABLES x
-INSTANCE Counter 
-foo == 11
+-------------- MODULE InstanceCounterException ----------------
+CONSTANTS start
+VARIABLES x
+INSTANCE Counter 
+foo == 11
 ==========================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/constantSubstitution/InstanceInstanceOpArg.tla b/src/test/resources/examples/instance/constantSubstitution/InstanceInstanceOpArg.tla
index 52ffeda8a2e77e841a1ac85e538fcb3e47b980cb..4b3f075ef40ef18ce384efdb07b55ef499b99596 100644
--- a/src/test/resources/examples/instance/constantSubstitution/InstanceInstanceOpArg.tla
+++ b/src/test/resources/examples/instance/constantSubstitution/InstanceInstanceOpArg.tla
@@ -1,7 +1,7 @@
--------------- MODULE InstanceInstanceOpArg ----------------
-EXTENDS Naturals
-CONSTANTS c3, foo3(_,_)
-bazz(a,b) == a + b
-INSTANCE InstanceOpArg WITH c2 <- c3, foo2 <- foo3
-ASSUME def /\ c3 = 3 
+-------------- MODULE InstanceInstanceOpArg ----------------
+EXTENDS Naturals
+CONSTANTS c3, foo3(_,_)
+bazz(a,b) == a + b
+INSTANCE InstanceOpArg WITH c2 <- c3, foo2 <- foo3
+ASSUME def /\ c3 = 3 
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg.tla b/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg.tla
index 74d8d2c25c59d1c9b9d1c732ccbd2ae9980075b8..ce6eccca25a863efac8dd68123874770f6a72c8c 100644
--- a/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg.tla
+++ b/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg.tla
@@ -1,5 +1,5 @@
--------------------------- MODULE InstanceOpArg -----------------------------
-CONSTANTS c2, foo2(_,_)
-INSTANCE OpArg WITH c <- c2, foo <- foo2
-
-=======================================================================
+-------------------------- MODULE InstanceOpArg -----------------------------
+CONSTANTS c2, foo2(_,_)
+INSTANCE OpArg WITH c <- c2, foo <- foo2
+
+=======================================================================
diff --git a/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg2.tla b/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg2.tla
index 72a3bb64df1b6e79622182987c51c3f11e23209c..c000cb1da8c6459405da71eda0b5ebbd00b67126 100644
--- a/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg2.tla
+++ b/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg2.tla
@@ -1,7 +1,7 @@
--------------- MODULE InstanceOpArg2 ----------------
-EXTENDS Naturals
-CONSTANTS c2
-bar(a,b) == a + b 
-INSTANCE OpArg WITH c <- c2, foo <- bar
-ASSUME def /\ c2 = 3 
+-------------- MODULE InstanceOpArg2 ----------------
+EXTENDS Naturals
+CONSTANTS c2
+bar(a,b) == a + b 
+INSTANCE OpArg WITH c <- c2, foo <- bar
+ASSUME def /\ c2 = 3 
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg3.tla b/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg3.tla
index 7b37512bf2d05d014722c0b7dc9db29b0f51ceb1..fd87d953d9eba01028f9b3c95ecbded67c394b12 100644
--- a/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg3.tla
+++ b/src/test/resources/examples/instance/constantSubstitution/InstanceOpArg3.tla
@@ -1,7 +1,7 @@
--------------- MODULE InstanceOpArg3 ----------------
-EXTENDS Naturals
-CONSTANTS c2, bar(_,_)
-bazz(a,b) == a + b
-INSTANCE OpArg WITH c <- c2, foo <- bar
-ASSUME def /\ c2 = 3
+-------------- MODULE InstanceOpArg3 ----------------
+EXTENDS Naturals
+CONSTANTS c2, bar(_,_)
+bazz(a,b) == a + b
+INSTANCE OpArg WITH c <- c2, foo <- bar
+ASSUME def /\ c2 = 3
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/constantSubstitution/InstanceOpArgException.tla b/src/test/resources/examples/instance/constantSubstitution/InstanceOpArgException.tla
index 0d79faacfda771f54fd5385e3a7415b914b9594c..3ed2e2b500691a84004efef2adc7d0fb7a642744 100644
--- a/src/test/resources/examples/instance/constantSubstitution/InstanceOpArgException.tla
+++ b/src/test/resources/examples/instance/constantSubstitution/InstanceOpArgException.tla
@@ -1,6 +1,6 @@
--------------- MODULE InstanceOpArgException ----------------
-EXTENDS Naturals
-CONSTANTS c2, bar(_,_)
-INSTANCE OpArg WITH c <- c2, foo <- bar
-ASSUME def /\ c2 = 3 
+-------------- MODULE InstanceOpArgException ----------------
+EXTENDS Naturals
+CONSTANTS c2, bar(_,_)
+INSTANCE OpArg WITH c <- c2, foo <- bar
+ASSUME def /\ c2 = 3 
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/constantSubstitution/InstanceValue.tla b/src/test/resources/examples/instance/constantSubstitution/InstanceValue.tla
index 1b29c5f56f7706acc5b3a362389689431dae235c..59a5daa3285dfb7d4ea7d2a959be034abf20c956 100644
--- a/src/test/resources/examples/instance/constantSubstitution/InstanceValue.tla
+++ b/src/test/resources/examples/instance/constantSubstitution/InstanceValue.tla
@@ -1,6 +1,6 @@
--------------- MODULE InstanceValue ----------------
-EXTENDS Naturals
-CONSTANTS c
-INSTANCE Value WITH val <- 1+1
-ASSUME def
+-------------- MODULE InstanceValue ----------------
+EXTENDS Naturals
+CONSTANTS c
+INSTANCE Value WITH val <- 1+1
+ASSUME def
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/constantSubstitution/OpArg.tla b/src/test/resources/examples/instance/constantSubstitution/OpArg.tla
index d129ef51a7e4112c0c1d9165f48d3416b9b6882c..9aad97d13e0f4219071eb6a2139cd05d6451b3c2 100644
--- a/src/test/resources/examples/instance/constantSubstitution/OpArg.tla
+++ b/src/test/resources/examples/instance/constantSubstitution/OpArg.tla
@@ -1,5 +1,5 @@
--------------------------- MODULE OpArg -----------------------------
-CONSTANTS c, foo(_,_)
-def == c = foo(1,2)
-
-=======================================================================
+-------------------------- MODULE OpArg -----------------------------
+CONSTANTS c, foo(_,_)
+def == c = foo(1,2)
+
+=======================================================================
diff --git a/src/test/resources/examples/instance/let/InstanceLet.mch b/src/test/resources/examples/instance/let/InstanceLet.mch
index 39f7baa86628f762aa896dc57e8d51e5e12aee8e..6a9508088d7c38d23a99e520f71b1dca26a59fac 100644
--- a/src/test/resources/examples/instance/let/InstanceLet.mch
+++ b/src/test/resources/examples/instance/let/InstanceLet.mch
@@ -1,26 +1,26 @@
-MACHINE InstanceLet
-DEFINITIONS
- inst_Init == c = 1;
-
- inst_val == 4;
-
- inst_foo(p) == 1 + e + p;
- inst_Next == #e.(e : {1, 2} & c_n = c + inst_foo(3) + inst_val);
-
- inst2_Init == c2 = 1;
-
- inst2_val == 4;
-
- inst2_foo(p) == 1 + e + p;
- inst2_Next == #e.(e : {1, 2} & c2_n = c2 + inst2_foo(3) + inst2_val)
-VARIABLES c, c2
-INVARIANT
- c : INTEGER
- & c2 : INTEGER
-INITIALISATION
- c, c2:(inst_Init & inst2_Init)
-OPERATIONS
- Next_Op = ANY c_n, c2_n
-	WHERE c_n : INTEGER & c2_n : INTEGER & inst_Next & inst2_Next
-	THEN c, c2 := c_n, c2_n END
-END
+MACHINE InstanceLet
+DEFINITIONS
+ inst_Init == c = 1;
+
+ inst_val == 4;
+
+ inst_foo(p) == 1 + e + p;
+ inst_Next == #e.(e : {1, 2} & c_n = c + inst_foo(3) + inst_val);
+
+ inst2_Init == c2 = 1;
+
+ inst2_val == 4;
+
+ inst2_foo(p) == 1 + e + p;
+ inst2_Next == #e.(e : {1, 2} & c2_n = c2 + inst2_foo(3) + inst2_val)
+VARIABLES c, c2
+INVARIANT
+ c : INTEGER
+ & c2 : INTEGER
+INITIALISATION
+ c, c2:(inst_Init & inst2_Init)
+OPERATIONS
+ Next_Op = ANY c_n, c2_n
+	WHERE c_n : INTEGER & c2_n : INTEGER & inst_Next & inst2_Next
+	THEN c, c2 := c_n, c2_n END
+END
diff --git a/src/test/resources/examples/instance/let/InstanceLet.tla b/src/test/resources/examples/instance/let/InstanceLet.tla
index 91f6f079b2169857c61d0a0321ecefe927eb2c59..0a6fc7fe51e30ddd389cb1aa20d76a7bede40118 100644
--- a/src/test/resources/examples/instance/let/InstanceLet.tla
+++ b/src/test/resources/examples/instance/let/InstanceLet.tla
@@ -1,7 +1,7 @@
--------------- MODULE InstanceLet ----------------
-VARIABLES c, c2
-inst == INSTANCE Let WITH x <- c
-inst2 == INSTANCE Let WITH x <- c2
-Init == inst!Init /\ inst2!Init
-Next == inst!Next /\ inst2!Next
+-------------- MODULE InstanceLet ----------------
+VARIABLES c, c2
+inst == INSTANCE Let WITH x <- c
+inst2 == INSTANCE Let WITH x <- c2
+Init == inst!Init /\ inst2!Init
+Next == inst!Next /\ inst2!Next
 =================================
\ No newline at end of file
diff --git a/src/test/resources/examples/instance/twoInstanced/first.tla b/src/test/resources/examples/instance/twoInstanced/first.tla
index 3a03509da1cd4b153600b0dd37de4a89a9a39b72..2acdd83a265a210b7cfd0bf5b5aef2e5829763bc 100644
--- a/src/test/resources/examples/instance/twoInstanced/first.tla
+++ b/src/test/resources/examples/instance/twoInstanced/first.tla
@@ -1,5 +1,5 @@
--------------------------- MODULE first -----------------------------
-EXTENDS Naturals
-CONSTANTS c2
-INSTANCE second WITH c1 <- c2
-=======================================================================
+-------------------------- MODULE first -----------------------------
+EXTENDS Naturals
+CONSTANTS c2
+INSTANCE second WITH c1 <- c2
+=======================================================================
diff --git a/src/test/resources/examples/instance/twoInstanced/second.tla b/src/test/resources/examples/instance/twoInstanced/second.tla
index d41e27a04046fe739ec5bbee89ee0be663fbafca..35bf32a585aa2cb6a4036bceb35872442fdfc2a0 100644
--- a/src/test/resources/examples/instance/twoInstanced/second.tla
+++ b/src/test/resources/examples/instance/twoInstanced/second.tla
@@ -1,6 +1,6 @@
--------------------------- MODULE first -----------------------------
-EXTENDS Naturals
-CONSTANTS c1
-
-val == c1 + 1
-=======================================================================
+-------------------------- MODULE first -----------------------------
+EXTENDS Naturals
+CONSTANTS c1
+
+val == c1 + 1
+=======================================================================
diff --git a/src/test/resources/main/Test.cfg b/src/test/resources/main/Test.cfg
index 8b6cfcba421df1370704ac1a8ae8fe807d7a6a57..647db03515f896fda377c6760f9db2bb57cc380c 100644
--- a/src/test/resources/main/Test.cfg
+++ b/src/test/resources/main/Test.cfg
@@ -1,2 +1,2 @@
-INIT Init
+INIT Init
 NEXT Next
\ No newline at end of file
diff --git a/src/test/resources/main/TypeError.tla b/src/test/resources/main/TypeError.tla
index bd182b1d0e88d7baac77415b9e8d00c236e708dc..53a254665886970adc93d1822f488dd4fb0c63d5 100644
--- a/src/test/resources/main/TypeError.tla
+++ b/src/test/resources/main/TypeError.tla
@@ -1,3 +1,3 @@
----- MODULE TypeError ----
-ASSUME 1 = TRUE
+---- MODULE TypeError ----
+ASSUME 1 = TRUE
 ======
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/BBuildIns/BBuildIns.tla b/src/test/resources/prettyprint/BBuildIns/BBuildIns.tla
index 2874304ba44656de7f8f18c9af1a8b626a6d56d8..2acfab92b207249a6407cf65692ee6febdb0318b 100644
--- a/src/test/resources/prettyprint/BBuildIns/BBuildIns.tla
+++ b/src/test/resources/prettyprint/BBuildIns/BBuildIns.tla
@@ -1,3 +1,3 @@
---------- MODULE BBuildIns ---------
-POW1(S) == (SUBSET S) \ {} 
+--------- MODULE BBuildIns ---------
+POW1(S) == (SUBSET S) \ {} 
 ==============================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/BBuildIns/Pow1.tla b/src/test/resources/prettyprint/BBuildIns/Pow1.tla
index 2079e5f38e9d8b483f3fe55479d68f2c68d7b4b7..ed383ade909e1a6e820b6e7d85ea1dbca4536546 100644
--- a/src/test/resources/prettyprint/BBuildIns/Pow1.tla
+++ b/src/test/resources/prettyprint/BBuildIns/Pow1.tla
@@ -1,4 +1,4 @@
----- MODULE Pow1 ----
-EXTENDS BBuildIns
-ASSUME {{1}} = POW1({1})
+---- MODULE Pow1 ----
+EXTENDS BBuildIns
+ASSUME {{1}} = POW1({1})
 ======
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/constantWithArgs/Counter.tla b/src/test/resources/prettyprint/constantWithArgs/Counter.tla
index bdc49ce5f29f253a510dd071d8cedd9f4f4e904e..3921fc811eb0f41137821ac4c13b64f986b9f03a 100644
--- a/src/test/resources/prettyprint/constantWithArgs/Counter.tla
+++ b/src/test/resources/prettyprint/constantWithArgs/Counter.tla
@@ -1,9 +1,9 @@
--------------------------- MODULE Counter -----------------------------
-EXTENDS Naturals
-CONSTANTS start, _\prec_
-VARIABLE x
------------------------------------------------------------------------
-Init  ==  x = start
-val == 1
-Next  ==  1 \prec 2 /\  x' = x + val
-=======================================================================
+-------------------------- MODULE Counter -----------------------------
+EXTENDS Naturals
+CONSTANTS start, _\prec_
+VARIABLE x
+-----------------------------------------------------------------------
+Init  ==  x = start
+val == 1
+Next  ==  1 \prec 2 /\  x' = x + val
+=======================================================================
diff --git a/src/test/resources/prettyprint/constantWithArgs/InstanceCounter.mch b/src/test/resources/prettyprint/constantWithArgs/InstanceCounter.mch
index 47967bf450665d0756cf20e0b5cfba63600d1179..e307c230951ce992a2f1e88700b78186c6a9a1fe 100644
--- a/src/test/resources/prettyprint/constantWithArgs/InstanceCounter.mch
+++ b/src/test/resources/prettyprint/constantWithArgs/InstanceCounter.mch
@@ -1,15 +1,15 @@
-MACHINE InstanceCounter
-DEFINITIONS
- prec(a, b) == a < b;
-
- val == 1
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(c = 0)
-OPERATIONS
- Next_Op = ANY c_n
-	WHERE c_n : INTEGER & prec(1, 2) & c_n = c + val
-	THEN c := c_n END
+MACHINE InstanceCounter
+DEFINITIONS
+ prec(a, b) == a < b;
+
+ val == 1
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(c = 0)
+OPERATIONS
+ Next_Op = ANY c_n
+	WHERE c_n : INTEGER & prec(1, 2) & c_n = c + val
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/defOverriding/Counter.tla b/src/test/resources/prettyprint/defOverriding/Counter.tla
index 21b60bf30d1a78649117bfe7d0114b457cd97b7e..f6fbc2dc0960d67c5c3dd2b3243aeb626c156083 100644
--- a/src/test/resources/prettyprint/defOverriding/Counter.tla
+++ b/src/test/resources/prettyprint/defOverriding/Counter.tla
@@ -1,9 +1,9 @@
--------------------------- MODULE Counter -----------------------------
-EXTENDS Naturals
-CONSTANTS start, foo(_)
-VARIABLE x
------------------------------------------------------------------------
-Init  ==  x = start
-val == foo(1)
-Next  ==  x' = x + val
-=======================================================================
+-------------------------- MODULE Counter -----------------------------
+EXTENDS Naturals
+CONSTANTS start, foo(_)
+VARIABLE x
+-----------------------------------------------------------------------
+Init  ==  x = start
+val == foo(1)
+Next  ==  x' = x + val
+=======================================================================
diff --git a/src/test/resources/prettyprint/defOverriding/DefOverriding.cfg b/src/test/resources/prettyprint/defOverriding/DefOverriding.cfg
index 03ac00882f2c3cecfe405c6b927ef18091c0f5b8..bb17240de4b1191850513e516a5004c5f7a9984a 100644
--- a/src/test/resources/prettyprint/defOverriding/DefOverriding.cfg
+++ b/src/test/resources/prettyprint/defOverriding/DefOverriding.cfg
@@ -1,2 +1,2 @@
-CONSTANTS
+CONSTANTS
 foo <- bar
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/defOverriding/InstanceDefOverriding.cfg b/src/test/resources/prettyprint/defOverriding/InstanceDefOverriding.cfg
index 1e8b350dc77bc05843ca9b8c0b407a624fb13a30..9679097c3f540a4867b2e738248c3819513ae115 100644
--- a/src/test/resources/prettyprint/defOverriding/InstanceDefOverriding.cfg
+++ b/src/test/resources/prettyprint/defOverriding/InstanceDefOverriding.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS
+INIT Init
+NEXT Next
+CONSTANTS
 foo <- bar
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/extends/ExtendsCounter.cfg b/src/test/resources/prettyprint/extends/ExtendsCounter.cfg
index 0209aca647b51caf2210cd783361933e3d6e5d7e..3d1c31f56d34b77a907293a830dfa7e9ad3e3349 100644
--- a/src/test/resources/prettyprint/extends/ExtendsCounter.cfg
+++ b/src/test/resources/prettyprint/extends/ExtendsCounter.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS
+INIT Init
+NEXT Next
+CONSTANTS
 start = 2
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/extends/ExtendsCounter.mch b/src/test/resources/prettyprint/extends/ExtendsCounter.mch
index efbedb91c45df59c016e4e852d485bfd31ed789b..a04621166c342d53e084b7bbe7f72b7b8ebcc96b 100644
--- a/src/test/resources/prettyprint/extends/ExtendsCounter.mch
+++ b/src/test/resources/prettyprint/extends/ExtendsCounter.mch
@@ -1,16 +1,16 @@
-MACHINE ExtendsCounter
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start = 2
-DEFINITIONS
- val == 1
-VARIABLES x
-INVARIANT
- x : INTEGER
-INITIALISATION
- x:(x = start)
-OPERATIONS
- Next_Op = ANY x_n
-	WHERE x_n : INTEGER & x_n = x + val
-	THEN x := x_n END
+MACHINE ExtendsCounter
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start = 2
+DEFINITIONS
+ val == 1
+VARIABLES x
+INVARIANT
+ x : INTEGER
+INITIALISATION
+ x:(x = start)
+OPERATIONS
+ Next_Op = ANY x_n
+	WHERE x_n : INTEGER & x_n = x + val
+	THEN x := x_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/extends/ExtendsCounter.tla b/src/test/resources/prettyprint/extends/ExtendsCounter.tla
index 37137860beebfb718d868a26ab0366c9e99cafa1..9286cdd790db1574495c23ab4c8068a2b1d44f8b 100644
--- a/src/test/resources/prettyprint/extends/ExtendsCounter.tla
+++ b/src/test/resources/prettyprint/extends/ExtendsCounter.tla
@@ -1,3 +1,3 @@
--------------- MODULE ExtendsCounter ----------------
-EXTENDS Counter
+-------------- MODULE ExtendsCounter ----------------
+EXTENDS Counter
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/extends/ExtendsCounter2.cfg b/src/test/resources/prettyprint/extends/ExtendsCounter2.cfg
index 6b25f9936a8770c60dcc76d86df7a452a75367b5..b7b28db23ab4ea2af212eba9fbe74470bc1ed581 100644
--- a/src/test/resources/prettyprint/extends/ExtendsCounter2.cfg
+++ b/src/test/resources/prettyprint/extends/ExtendsCounter2.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS
+INIT Init
+NEXT Next
+CONSTANTS
 start = [Counter] 2
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/extends/ExtendsCounter2.mch b/src/test/resources/prettyprint/extends/ExtendsCounter2.mch
index efbedb91c45df59c016e4e852d485bfd31ed789b..a04621166c342d53e084b7bbe7f72b7b8ebcc96b 100644
--- a/src/test/resources/prettyprint/extends/ExtendsCounter2.mch
+++ b/src/test/resources/prettyprint/extends/ExtendsCounter2.mch
@@ -1,16 +1,16 @@
-MACHINE ExtendsCounter
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start = 2
-DEFINITIONS
- val == 1
-VARIABLES x
-INVARIANT
- x : INTEGER
-INITIALISATION
- x:(x = start)
-OPERATIONS
- Next_Op = ANY x_n
-	WHERE x_n : INTEGER & x_n = x + val
-	THEN x := x_n END
+MACHINE ExtendsCounter
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start = 2
+DEFINITIONS
+ val == 1
+VARIABLES x
+INVARIANT
+ x : INTEGER
+INITIALISATION
+ x:(x = start)
+OPERATIONS
+ Next_Op = ANY x_n
+	WHERE x_n : INTEGER & x_n = x + val
+	THEN x := x_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/Counter/InstanceDefinition.mch b/src/test/resources/prettyprint/instance/Counter/InstanceDefinition.mch
index 688146d036fac93fdd9ed749cca16db291bd37a4..3f4b1abd3b9440a6c1377299469325fba6d00dcf 100644
--- a/src/test/resources/prettyprint/instance/Counter/InstanceDefinition.mch
+++ b/src/test/resources/prettyprint/instance/Counter/InstanceDefinition.mch
@@ -1,13 +1,13 @@
-MACHINE InstanceDefinition
-DEFINITIONS
- val == 5
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(c = 0)
-OPERATIONS
- Next_Op = ANY c_n
-	WHERE c_n : INTEGER & c_n = c + val
-	THEN c := c_n END
+MACHINE InstanceDefinition
+DEFINITIONS
+ val == 5
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(c = 0)
+OPERATIONS
+ Next_Op = ANY c_n
+	WHERE c_n : INTEGER & c_n = c + val
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/Counter/InstanceDefinition.tla b/src/test/resources/prettyprint/instance/Counter/InstanceDefinition.tla
index 303d8b59e063b0550108b125949b6943ec2d4f4b..8f81bf21bdd73e48ec60bf42b6a8cd417082aaad 100644
--- a/src/test/resources/prettyprint/instance/Counter/InstanceDefinition.tla
+++ b/src/test/resources/prettyprint/instance/Counter/InstanceDefinition.tla
@@ -1,5 +1,5 @@
--------------- MODULE InstanceDefinition ----------------
-VARIABLES c
-val == 5 (* the val definition of the Counter module will be automatically overriden by SANY  *)
-INSTANCE Counter WITH x <- c, start <- 0
+-------------- MODULE InstanceDefinition ----------------
+VARIABLES c
+val == 5 (* the val definition of the Counter module will be automatically overriden by SANY  *)
+INSTANCE Counter WITH x <- c, start <- 0
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/Counter/InstanceNoName.mch b/src/test/resources/prettyprint/instance/Counter/InstanceNoName.mch
index ad110dca9e20e37494cfdf54fe03a6569d974b29..db14ef851bef6fae8b48769d4c9a37a5b571e1e7 100644
--- a/src/test/resources/prettyprint/instance/Counter/InstanceNoName.mch
+++ b/src/test/resources/prettyprint/instance/Counter/InstanceNoName.mch
@@ -1,18 +1,18 @@
-MACHINE InstanceNoName
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- Init == c = start;
-
- val == 1
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(Init)
-OPERATIONS
- Next_Op = ANY c_n
-	WHERE c_n : INTEGER & c_n = c + val
-	THEN c := c_n END
+MACHINE InstanceNoName
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ Init == c = start;
+
+ val == 1
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(Init)
+OPERATIONS
+ Next_Op = ANY c_n
+	WHERE c_n : INTEGER & c_n = c + val
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/Counter/InstanceNoName.tla b/src/test/resources/prettyprint/instance/Counter/InstanceNoName.tla
index b2e5e4d0d3b1562d88e5b9e5cf43f7d857126f64..c37e2ea3f7d8120465ee3a2b618096915cad5135 100644
--- a/src/test/resources/prettyprint/instance/Counter/InstanceNoName.tla
+++ b/src/test/resources/prettyprint/instance/Counter/InstanceNoName.tla
@@ -1,6 +1,6 @@
--------------- MODULE InstanceNoName ----------------
-CONSTANTS start
-VARIABLES c
-INSTANCE Counter WITH x <- c
-Spec == Init /\ [][Next]_c
+-------------- MODULE InstanceNoName ----------------
+CONSTANTS start
+VARIABLES c
+INSTANCE Counter WITH x <- c
+Spec == Init /\ [][Next]_c
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/Counter/ModConstantAssignment.cfg b/src/test/resources/prettyprint/instance/Counter/ModConstantAssignment.cfg
index e4eda93e3f0fcbb23080a8e7dc29081ce42ffe76..b444b17e4e8ee15d3a4b03519dd8e50eb61a8104 100644
--- a/src/test/resources/prettyprint/instance/Counter/ModConstantAssignment.cfg
+++ b/src/test/resources/prettyprint/instance/Counter/ModConstantAssignment.cfg
@@ -1,3 +1,3 @@
-INIT Init
-NEXT Next
+INIT Init
+NEXT Next
 CONSTANTS val = [Counter] 7
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/Counter/OneInstanced.mch b/src/test/resources/prettyprint/instance/Counter/OneInstanced.mch
index 0a7a02dad5d328d1f245e4bdd03d6b7f3264577c..4cd5bc2c3ee07e1d797365c4c14aa3b0bb6cc146 100644
--- a/src/test/resources/prettyprint/instance/Counter/OneInstanced.mch
+++ b/src/test/resources/prettyprint/instance/Counter/OneInstanced.mch
@@ -1,19 +1,19 @@
-MACHINE OneInstanced
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- count_Init == c = start;
-
- count_val == 1;
-
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(count_Init)
-OPERATIONS
- count_Next_Op = ANY c_n
-	WHERE c_n : INTEGER & c_n = c + count_val
-	THEN c := c_n END
+MACHINE OneInstanced
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ count_Init == c = start;
+
+ count_val == 1;
+
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(count_Init)
+OPERATIONS
+ count_Next_Op = ANY c_n
+	WHERE c_n : INTEGER & c_n = c + count_val
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/Counter/TwoInstance.mch b/src/test/resources/prettyprint/instance/Counter/TwoInstance.mch
index d23db8b678843cd223a8bac4cceb4fe0d07c3fb8..162a3580fe50d066958c05dbb821839cd69ac058 100644
--- a/src/test/resources/prettyprint/instance/Counter/TwoInstance.mch
+++ b/src/test/resources/prettyprint/instance/Counter/TwoInstance.mch
@@ -1,32 +1,32 @@
-MACHINE TwoInstanced
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- count_Init == c = start;
-
- count_val == 1;
-
- count_Next == c_n = c + count_val;
-
- count2_Init == c2 = 0;
-
- count2_val == 1;
-
- count2_Next == c2_n = c2 + count2_val;
-
-VARIABLES c, c2
-INVARIANT
- c : INTEGER
- & c2 : INTEGER
-INITIALISATION
- c, c2:(count_Init & count2_Init)
-OPERATIONS
- Next1_Op = ANY c_n
-	WHERE c_n : INTEGER & count_Next & TRUE = TRUE
-	THEN c := c_n END;
-
- Next2_Op = ANY c2_n
-	WHERE c2_n : INTEGER & count2_Next & TRUE = TRUE
-	THEN c2 := c2_n END
-END
+MACHINE TwoInstanced
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ count_Init == c = start;
+
+ count_val == 1;
+
+ count_Next == c_n = c + count_val;
+
+ count2_Init == c2 = 0;
+
+ count2_val == 1;
+
+ count2_Next == c2_n = c2 + count2_val;
+
+VARIABLES c, c2
+INVARIANT
+ c : INTEGER
+ & c2 : INTEGER
+INITIALISATION
+ c, c2:(count_Init & count2_Init)
+OPERATIONS
+ Next1_Op = ANY c_n
+	WHERE c_n : INTEGER & count_Next & TRUE = TRUE
+	THEN c := c_n END;
+
+ Next2_Op = ANY c2_n
+	WHERE c2_n : INTEGER & count2_Next & TRUE = TRUE
+	THEN c2 := c2_n END
+END
diff --git a/src/test/resources/prettyprint/instance/Counter/TwoInstance.tla b/src/test/resources/prettyprint/instance/Counter/TwoInstance.tla
index 5939e9dcb2ab565f85bc6844159d0a6a7414ded8..ff6ade281a76721169792803cfdb99b6005f70d2 100644
--- a/src/test/resources/prettyprint/instance/Counter/TwoInstance.tla
+++ b/src/test/resources/prettyprint/instance/Counter/TwoInstance.tla
@@ -1,9 +1,9 @@
--------------- MODULE TwoInstanced --------------
-CONSTANTS start
-VARIABLES c, c2
-count == INSTANCE Counter WITH x <- c
-count2 == INSTANCE Counter WITH x <- c2, start <- 0
-Init == count!Init /\ count2!Init
-Next == 	\/ (count!Next /\ UNCHANGED c2)
-			\/ (count2!Next /\ UNCHANGED c)
+-------------- MODULE TwoInstanced --------------
+CONSTANTS start
+VARIABLES c, c2
+count == INSTANCE Counter WITH x <- c
+count2 == INSTANCE Counter WITH x <- c2, start <- 0
+Init == count!Init /\ count2!Init
+Next == 	\/ (count!Next /\ UNCHANGED c2)
+			\/ (count2!Next /\ UNCHANGED c)
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/Counter/TwoInstanced.mch b/src/test/resources/prettyprint/instance/Counter/TwoInstanced.mch
index d23db8b678843cd223a8bac4cceb4fe0d07c3fb8..162a3580fe50d066958c05dbb821839cd69ac058 100644
--- a/src/test/resources/prettyprint/instance/Counter/TwoInstanced.mch
+++ b/src/test/resources/prettyprint/instance/Counter/TwoInstanced.mch
@@ -1,32 +1,32 @@
-MACHINE TwoInstanced
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- count_Init == c = start;
-
- count_val == 1;
-
- count_Next == c_n = c + count_val;
-
- count2_Init == c2 = 0;
-
- count2_val == 1;
-
- count2_Next == c2_n = c2 + count2_val;
-
-VARIABLES c, c2
-INVARIANT
- c : INTEGER
- & c2 : INTEGER
-INITIALISATION
- c, c2:(count_Init & count2_Init)
-OPERATIONS
- Next1_Op = ANY c_n
-	WHERE c_n : INTEGER & count_Next & TRUE = TRUE
-	THEN c := c_n END;
-
- Next2_Op = ANY c2_n
-	WHERE c2_n : INTEGER & count2_Next & TRUE = TRUE
-	THEN c2 := c2_n END
-END
+MACHINE TwoInstanced
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ count_Init == c = start;
+
+ count_val == 1;
+
+ count_Next == c_n = c + count_val;
+
+ count2_Init == c2 = 0;
+
+ count2_val == 1;
+
+ count2_Next == c2_n = c2 + count2_val;
+
+VARIABLES c, c2
+INVARIANT
+ c : INTEGER
+ & c2 : INTEGER
+INITIALISATION
+ c, c2:(count_Init & count2_Init)
+OPERATIONS
+ Next1_Op = ANY c_n
+	WHERE c_n : INTEGER & count_Next & TRUE = TRUE
+	THEN c := c_n END;
+
+ Next2_Op = ANY c2_n
+	WHERE c2_n : INTEGER & count2_Next & TRUE = TRUE
+	THEN c2 := c2_n END
+END
diff --git a/src/test/resources/prettyprint/instance/Counter/TwoInstanced.tla b/src/test/resources/prettyprint/instance/Counter/TwoInstanced.tla
index 5939e9dcb2ab565f85bc6844159d0a6a7414ded8..ff6ade281a76721169792803cfdb99b6005f70d2 100644
--- a/src/test/resources/prettyprint/instance/Counter/TwoInstanced.tla
+++ b/src/test/resources/prettyprint/instance/Counter/TwoInstanced.tla
@@ -1,9 +1,9 @@
--------------- MODULE TwoInstanced --------------
-CONSTANTS start
-VARIABLES c, c2
-count == INSTANCE Counter WITH x <- c
-count2 == INSTANCE Counter WITH x <- c2, start <- 0
-Init == count!Init /\ count2!Init
-Next == 	\/ (count!Next /\ UNCHANGED c2)
-			\/ (count2!Next /\ UNCHANGED c)
+-------------- MODULE TwoInstanced --------------
+CONSTANTS start
+VARIABLES c, c2
+count == INSTANCE Counter WITH x <- c
+count2 == INSTANCE Counter WITH x <- c2, start <- 0
+Init == count!Init /\ count2!Init
+Next == 	\/ (count!Next /\ UNCHANGED c2)
+			\/ (count2!Next /\ UNCHANGED c)
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/OpArg/OpArg.tla b/src/test/resources/prettyprint/instance/OpArg/OpArg.tla
index 60a318106bbc6e701b724430bdb0a27c879d2035..f3e3cb213c240cd2eca30fc135aba9c29255de06 100644
--- a/src/test/resources/prettyprint/instance/OpArg/OpArg.tla
+++ b/src/test/resources/prettyprint/instance/OpArg/OpArg.tla
@@ -1,7 +1,7 @@
--------------- MODULE OpArg ----------------
-EXTENDS Naturals
-CONSTANTS k(_,_)
-VARIABLES c
-Init == c = 1 
-Next == c' = c + k(1, 2)
+-------------- MODULE OpArg ----------------
+EXTENDS Naturals
+CONSTANTS k(_,_)
+VARIABLES c
+Init == c = 1 
+Next == c' = c + k(1, 2)
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/OpArg/OpArgInstanced.mch b/src/test/resources/prettyprint/instance/OpArg/OpArgInstanced.mch
index a9e7cf31d3ead0f7a3936d849ad61bd5310d9150..2093e6cc1fee9c704e58cf39c6b7b395891e5822 100644
--- a/src/test/resources/prettyprint/instance/OpArg/OpArgInstanced.mch
+++ b/src/test/resources/prettyprint/instance/OpArg/OpArgInstanced.mch
@@ -1,14 +1,14 @@
-MACHINE OpArgInstanced
-DEFINITIONS
- foo(a,b) == a + b;
-
-VARIABLES c
-INVARIANT
- c : INTEGER
-INITIALISATION
- c:(c = 1)
-OPERATIONS
- Next_Op = ANY c_n
-	WHERE c_n : INTEGER & c_n = c + foo(1,2)
-	THEN c := c_n END
+MACHINE OpArgInstanced
+DEFINITIONS
+ foo(a,b) == a + b;
+
+VARIABLES c
+INVARIANT
+ c : INTEGER
+INITIALISATION
+ c:(c = 1)
+OPERATIONS
+ Next_Op = ANY c_n
+	WHERE c_n : INTEGER & c_n = c + foo(1,2)
+	THEN c := c_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/OpArg/OpArgInstanced.tla b/src/test/resources/prettyprint/instance/OpArg/OpArgInstanced.tla
index 07e36d098a26749032f3c488f1daabf76e3eab9e..2f565a5d325ed5dc1320027bd210fd444f853e98 100644
--- a/src/test/resources/prettyprint/instance/OpArg/OpArgInstanced.tla
+++ b/src/test/resources/prettyprint/instance/OpArg/OpArgInstanced.tla
@@ -1,6 +1,6 @@
--------------- MODULE OpArgInstanced --------------
-EXTENDS Naturals
-VARIABLES c
-foo(a,b) == a + b
-INSTANCE OpArg WITH k <- foo
+-------------- MODULE OpArgInstanced --------------
+EXTENDS Naturals
+VARIABLES c
+foo(a,b) == a + b
+INSTANCE OpArg WITH k <- foo
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.cfg b/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.cfg
index 3471675f8ebd5b9b1474da75830d4a8fe9c3a5bc..2d739f434f9133cb609752113d5904f755bea612 100644
--- a/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.cfg
+++ b/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS 
+INIT Init
+NEXT Next
+CONSTANTS 
 val =[Counter] 4
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.mch b/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.mch
index 5b0c40aab287f28cbea784919bd1b0e12479680a..c123ac0d1db4ef274dcf85b0ff850bc47a173a57 100644
--- a/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.mch
+++ b/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.mch
@@ -1,16 +1,16 @@
-MACHINE InstanceCounter
-ABSTRACT_CONSTANTS start
-PROPERTIES
- start : INTEGER
-DEFINITIONS
- val == 4
-VARIABLES x
-INVARIANT
- x : INTEGER
-INITIALISATION
- x:(x = start)
-OPERATIONS
- Next_Op = ANY x_n
-	WHERE x_n : INTEGER & x_n = x + val
-	THEN x := x_n END
-END
+MACHINE InstanceCounter
+ABSTRACT_CONSTANTS start
+PROPERTIES
+ start : INTEGER
+DEFINITIONS
+ val == 4
+VARIABLES x
+INVARIANT
+ x : INTEGER
+INITIALISATION
+ x:(x = start)
+OPERATIONS
+ Next_Op = ANY x_n
+	WHERE x_n : INTEGER & x_n = x + val
+	THEN x := x_n END
+END
diff --git a/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.tla b/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.tla
index de92f0f504ca2bdaf151bcc0ae87dd43f01dcf7c..d4ce0e802d460074374cea59832ecf4c2bb57a59 100644
--- a/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.tla
+++ b/src/test/resources/prettyprint/instance/configOverride/InstanceCounter.tla
@@ -1,5 +1,5 @@
--------------- MODULE InstanceCounter ----------------
-CONSTANTS start 
-VARIABLES x
-INSTANCE Counter
+-------------- MODULE InstanceCounter ----------------
+CONSTANTS start 
+VARIABLES x
+INSTANCE Counter
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/configOverride/InstanceCounterException.cfg b/src/test/resources/prettyprint/instance/configOverride/InstanceCounterException.cfg
index efebca9fc0b6e5d9309a96fc72fd7a0695c0c2f7..a6fd3ed1c4d35426efa857d42adca579acd20f6b 100644
--- a/src/test/resources/prettyprint/instance/configOverride/InstanceCounterException.cfg
+++ b/src/test/resources/prettyprint/instance/configOverride/InstanceCounterException.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS
+INIT Init
+NEXT Next
+CONSTANTS
 start <-[Counter] foo
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/configOverride/InstanceCounterException.tla b/src/test/resources/prettyprint/instance/configOverride/InstanceCounterException.tla
index 268aa31239fdcc8d64990010afda015c70795a52..9543a8b50a1a75f3bc30c8519a469b1fae62691b 100644
--- a/src/test/resources/prettyprint/instance/configOverride/InstanceCounterException.tla
+++ b/src/test/resources/prettyprint/instance/configOverride/InstanceCounterException.tla
@@ -1,6 +1,6 @@
--------------- MODULE InstanceCounterException ----------------
-CONSTANTS start
-VARIABLES x
-INSTANCE Counter 
-foo == 11
+-------------- MODULE InstanceCounterException ----------------
+CONSTANTS start
+VARIABLES x
+INSTANCE Counter 
+foo == 11
 ==========================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceInstanceOpArg.tla b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceInstanceOpArg.tla
index 52ffeda8a2e77e841a1ac85e538fcb3e47b980cb..4b3f075ef40ef18ce384efdb07b55ef499b99596 100644
--- a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceInstanceOpArg.tla
+++ b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceInstanceOpArg.tla
@@ -1,7 +1,7 @@
--------------- MODULE InstanceInstanceOpArg ----------------
-EXTENDS Naturals
-CONSTANTS c3, foo3(_,_)
-bazz(a,b) == a + b
-INSTANCE InstanceOpArg WITH c2 <- c3, foo2 <- foo3
-ASSUME def /\ c3 = 3 
+-------------- MODULE InstanceInstanceOpArg ----------------
+EXTENDS Naturals
+CONSTANTS c3, foo3(_,_)
+bazz(a,b) == a + b
+INSTANCE InstanceOpArg WITH c2 <- c3, foo2 <- foo3
+ASSUME def /\ c3 = 3 
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg.tla b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg.tla
index 74d8d2c25c59d1c9b9d1c732ccbd2ae9980075b8..ce6eccca25a863efac8dd68123874770f6a72c8c 100644
--- a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg.tla
+++ b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg.tla
@@ -1,5 +1,5 @@
--------------------------- MODULE InstanceOpArg -----------------------------
-CONSTANTS c2, foo2(_,_)
-INSTANCE OpArg WITH c <- c2, foo <- foo2
-
-=======================================================================
+-------------------------- MODULE InstanceOpArg -----------------------------
+CONSTANTS c2, foo2(_,_)
+INSTANCE OpArg WITH c <- c2, foo <- foo2
+
+=======================================================================
diff --git a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg2.tla b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg2.tla
index 72a3bb64df1b6e79622182987c51c3f11e23209c..c000cb1da8c6459405da71eda0b5ebbd00b67126 100644
--- a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg2.tla
+++ b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg2.tla
@@ -1,7 +1,7 @@
--------------- MODULE InstanceOpArg2 ----------------
-EXTENDS Naturals
-CONSTANTS c2
-bar(a,b) == a + b 
-INSTANCE OpArg WITH c <- c2, foo <- bar
-ASSUME def /\ c2 = 3 
+-------------- MODULE InstanceOpArg2 ----------------
+EXTENDS Naturals
+CONSTANTS c2
+bar(a,b) == a + b 
+INSTANCE OpArg WITH c <- c2, foo <- bar
+ASSUME def /\ c2 = 3 
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg3.tla b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg3.tla
index 7b37512bf2d05d014722c0b7dc9db29b0f51ceb1..fd87d953d9eba01028f9b3c95ecbded67c394b12 100644
--- a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg3.tla
+++ b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArg3.tla
@@ -1,7 +1,7 @@
--------------- MODULE InstanceOpArg3 ----------------
-EXTENDS Naturals
-CONSTANTS c2, bar(_,_)
-bazz(a,b) == a + b
-INSTANCE OpArg WITH c <- c2, foo <- bar
-ASSUME def /\ c2 = 3
+-------------- MODULE InstanceOpArg3 ----------------
+EXTENDS Naturals
+CONSTANTS c2, bar(_,_)
+bazz(a,b) == a + b
+INSTANCE OpArg WITH c <- c2, foo <- bar
+ASSUME def /\ c2 = 3
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArgException.tla b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArgException.tla
index 0d79faacfda771f54fd5385e3a7415b914b9594c..3ed2e2b500691a84004efef2adc7d0fb7a642744 100644
--- a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArgException.tla
+++ b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceOpArgException.tla
@@ -1,6 +1,6 @@
--------------- MODULE InstanceOpArgException ----------------
-EXTENDS Naturals
-CONSTANTS c2, bar(_,_)
-INSTANCE OpArg WITH c <- c2, foo <- bar
-ASSUME def /\ c2 = 3 
+-------------- MODULE InstanceOpArgException ----------------
+EXTENDS Naturals
+CONSTANTS c2, bar(_,_)
+INSTANCE OpArg WITH c <- c2, foo <- bar
+ASSUME def /\ c2 = 3 
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceValue.tla b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceValue.tla
index 1b29c5f56f7706acc5b3a362389689431dae235c..59a5daa3285dfb7d4ea7d2a959be034abf20c956 100644
--- a/src/test/resources/prettyprint/instance/constantSubstitution/InstanceValue.tla
+++ b/src/test/resources/prettyprint/instance/constantSubstitution/InstanceValue.tla
@@ -1,6 +1,6 @@
--------------- MODULE InstanceValue ----------------
-EXTENDS Naturals
-CONSTANTS c
-INSTANCE Value WITH val <- 1+1
-ASSUME def
+-------------- MODULE InstanceValue ----------------
+EXTENDS Naturals
+CONSTANTS c
+INSTANCE Value WITH val <- 1+1
+ASSUME def
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/constantSubstitution/OpArg.tla b/src/test/resources/prettyprint/instance/constantSubstitution/OpArg.tla
index d129ef51a7e4112c0c1d9165f48d3416b9b6882c..9aad97d13e0f4219071eb6a2139cd05d6451b3c2 100644
--- a/src/test/resources/prettyprint/instance/constantSubstitution/OpArg.tla
+++ b/src/test/resources/prettyprint/instance/constantSubstitution/OpArg.tla
@@ -1,5 +1,5 @@
--------------------------- MODULE OpArg -----------------------------
-CONSTANTS c, foo(_,_)
-def == c = foo(1,2)
-
-=======================================================================
+-------------------------- MODULE OpArg -----------------------------
+CONSTANTS c, foo(_,_)
+def == c = foo(1,2)
+
+=======================================================================
diff --git a/src/test/resources/prettyprint/instance/let/InstanceLet.mch b/src/test/resources/prettyprint/instance/let/InstanceLet.mch
index 39f7baa86628f762aa896dc57e8d51e5e12aee8e..6a9508088d7c38d23a99e520f71b1dca26a59fac 100644
--- a/src/test/resources/prettyprint/instance/let/InstanceLet.mch
+++ b/src/test/resources/prettyprint/instance/let/InstanceLet.mch
@@ -1,26 +1,26 @@
-MACHINE InstanceLet
-DEFINITIONS
- inst_Init == c = 1;
-
- inst_val == 4;
-
- inst_foo(p) == 1 + e + p;
- inst_Next == #e.(e : {1, 2} & c_n = c + inst_foo(3) + inst_val);
-
- inst2_Init == c2 = 1;
-
- inst2_val == 4;
-
- inst2_foo(p) == 1 + e + p;
- inst2_Next == #e.(e : {1, 2} & c2_n = c2 + inst2_foo(3) + inst2_val)
-VARIABLES c, c2
-INVARIANT
- c : INTEGER
- & c2 : INTEGER
-INITIALISATION
- c, c2:(inst_Init & inst2_Init)
-OPERATIONS
- Next_Op = ANY c_n, c2_n
-	WHERE c_n : INTEGER & c2_n : INTEGER & inst_Next & inst2_Next
-	THEN c, c2 := c_n, c2_n END
-END
+MACHINE InstanceLet
+DEFINITIONS
+ inst_Init == c = 1;
+
+ inst_val == 4;
+
+ inst_foo(p) == 1 + e + p;
+ inst_Next == #e.(e : {1, 2} & c_n = c + inst_foo(3) + inst_val);
+
+ inst2_Init == c2 = 1;
+
+ inst2_val == 4;
+
+ inst2_foo(p) == 1 + e + p;
+ inst2_Next == #e.(e : {1, 2} & c2_n = c2 + inst2_foo(3) + inst2_val)
+VARIABLES c, c2
+INVARIANT
+ c : INTEGER
+ & c2 : INTEGER
+INITIALISATION
+ c, c2:(inst_Init & inst2_Init)
+OPERATIONS
+ Next_Op = ANY c_n, c2_n
+	WHERE c_n : INTEGER & c2_n : INTEGER & inst_Next & inst2_Next
+	THEN c, c2 := c_n, c2_n END
+END
diff --git a/src/test/resources/prettyprint/instance/let/InstanceLet.tla b/src/test/resources/prettyprint/instance/let/InstanceLet.tla
index 91f6f079b2169857c61d0a0321ecefe927eb2c59..0a6fc7fe51e30ddd389cb1aa20d76a7bede40118 100644
--- a/src/test/resources/prettyprint/instance/let/InstanceLet.tla
+++ b/src/test/resources/prettyprint/instance/let/InstanceLet.tla
@@ -1,7 +1,7 @@
--------------- MODULE InstanceLet ----------------
-VARIABLES c, c2
-inst == INSTANCE Let WITH x <- c
-inst2 == INSTANCE Let WITH x <- c2
-Init == inst!Init /\ inst2!Init
-Next == inst!Next /\ inst2!Next
+-------------- MODULE InstanceLet ----------------
+VARIABLES c, c2
+inst == INSTANCE Let WITH x <- c
+inst2 == INSTANCE Let WITH x <- c2
+Init == inst!Init /\ inst2!Init
+Next == inst!Next /\ inst2!Next
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/instance/twoInstanced/first.tla b/src/test/resources/prettyprint/instance/twoInstanced/first.tla
index 3a03509da1cd4b153600b0dd37de4a89a9a39b72..2acdd83a265a210b7cfd0bf5b5aef2e5829763bc 100644
--- a/src/test/resources/prettyprint/instance/twoInstanced/first.tla
+++ b/src/test/resources/prettyprint/instance/twoInstanced/first.tla
@@ -1,5 +1,5 @@
--------------------------- MODULE first -----------------------------
-EXTENDS Naturals
-CONSTANTS c2
-INSTANCE second WITH c1 <- c2
-=======================================================================
+-------------------------- MODULE first -----------------------------
+EXTENDS Naturals
+CONSTANTS c2
+INSTANCE second WITH c1 <- c2
+=======================================================================
diff --git a/src/test/resources/prettyprint/instance/twoInstanced/second.tla b/src/test/resources/prettyprint/instance/twoInstanced/second.tla
index d41e27a04046fe739ec5bbee89ee0be663fbafca..35bf32a585aa2cb6a4036bceb35872442fdfc2a0 100644
--- a/src/test/resources/prettyprint/instance/twoInstanced/second.tla
+++ b/src/test/resources/prettyprint/instance/twoInstanced/second.tla
@@ -1,6 +1,6 @@
--------------------------- MODULE first -----------------------------
-EXTENDS Naturals
-CONSTANTS c1
-
-val == c1 + 1
-=======================================================================
+-------------------------- MODULE first -----------------------------
+EXTENDS Naturals
+CONSTANTS c1
+
+val == c1 + 1
+=======================================================================
diff --git a/src/test/resources/prettyprint/realworld/fowler.mch b/src/test/resources/prettyprint/realworld/fowler.mch
index df9602cdf4f980e91261510e756845221d49c6da..e5898445bd47a1e0817381eaa88f7c3adbe4d507 100644
--- a/src/test/resources/prettyprint/realworld/fowler.mch
+++ b/src/test/resources/prettyprint/realworld/fowler.mch
@@ -1,17 +1,17 @@
-MACHINE fowler
-DEFINITIONS
- Init == (((state = "idle" & light = "off") & draw = "closed") & door = "unlocked") & panel = "locked";
-VARIABLES state, light, draw, panel, door
-INVARIANT
-(((state : STRING & light : STRING) & draw : STRING) & panel : STRING) & door : STRING
-INITIALISATION
-state, light, draw, panel, door:(Init)
-OPERATIONS
- CloseDoor = SELECT (door = "unlocked" & TRUE = TRUE) & TRUE = TRUE THEN door,state := "locked","active" END;
-
- LightOn = ANY state_n, panel_n, door_n WHERE ((((light = "off" & state_n : STRING) & panel_n : STRING) & door_n : STRING) & ((draw = "opened" => (state_n = "unlockedPanel" & panel_n = "unlocked") & door_n = "locked") & (not(draw = "opened") => state_n = "waitingForDraw" & TRUE = TRUE))) & TRUE = TRUE THEN light,state,panel,door := "on",state_n,panel_n,door_n END;
-
- OpenDraw = ANY state_n, panel_n, door_n WHERE ((((draw = "closed" & state_n : STRING) & panel_n : STRING) & door_n : STRING) & ((light = "on" => (state_n = "unlockedPanel" & panel_n = "unlocked") & door_n = "locked") & (not(light = "on") => state_n = "waitingForLight" & TRUE = TRUE))) & TRUE = TRUE THEN draw,state,panel,door := "opened",state_n,panel_n,door_n END;
-
- ClosePanel = SELECT panel = "unlocked" THEN panel,light,draw,door,state := "locked","off","closed","unlocked","idle" END
+MACHINE fowler
+DEFINITIONS
+ Init == (((state = "idle" & light = "off") & draw = "closed") & door = "unlocked") & panel = "locked";
+VARIABLES state, light, draw, panel, door
+INVARIANT
+(((state : STRING & light : STRING) & draw : STRING) & panel : STRING) & door : STRING
+INITIALISATION
+state, light, draw, panel, door:(Init)
+OPERATIONS
+ CloseDoor = SELECT (door = "unlocked" & TRUE = TRUE) & TRUE = TRUE THEN door,state := "locked","active" END;
+
+ LightOn = ANY state_n, panel_n, door_n WHERE ((((light = "off" & state_n : STRING) & panel_n : STRING) & door_n : STRING) & ((draw = "opened" => (state_n = "unlockedPanel" & panel_n = "unlocked") & door_n = "locked") & (not(draw = "opened") => state_n = "waitingForDraw" & TRUE = TRUE))) & TRUE = TRUE THEN light,state,panel,door := "on",state_n,panel_n,door_n END;
+
+ OpenDraw = ANY state_n, panel_n, door_n WHERE ((((draw = "closed" & state_n : STRING) & panel_n : STRING) & door_n : STRING) & ((light = "on" => (state_n = "unlockedPanel" & panel_n = "unlocked") & door_n = "locked") & (not(light = "on") => state_n = "waitingForLight" & TRUE = TRUE))) & TRUE = TRUE THEN draw,state,panel,door := "opened",state_n,panel_n,door_n END;
+
+ ClosePanel = SELECT panel = "unlocked" THEN panel,light,draw,door,state := "locked","off","closed","unlocked","idle" END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/realworld/microwave.cfg b/src/test/resources/prettyprint/realworld/microwave.cfg
index 97359debc947e0aa4856f7b06f9e06cce96b35fa..4ca2dc21d4ecf0a7af7f01719c7fc92496b6e187 100644
--- a/src/test/resources/prettyprint/realworld/microwave.cfg
+++ b/src/test/resources/prettyprint/realworld/microwave.cfg
@@ -1,2 +1,2 @@
-SPECIFICATION Spec
+SPECIFICATION Spec
 INVARIANT Door_Locked_When_Heating
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/realworld/microwave.mch b/src/test/resources/prettyprint/realworld/microwave.mch
index 479ea776d580db4c7bdcb17744c7311115d5f9f6..02907c11f90cc93ec108833d51983eb42587f7a2 100644
--- a/src/test/resources/prettyprint/realworld/microwave.mch
+++ b/src/test/resources/prettyprint/realworld/microwave.mch
@@ -1,24 +1,24 @@
-MACHINE microwave
-DEFINITIONS
- Init == (((magnetron_running = FALSE & door_open = FALSE) & button_locked = FALSE) & error = FALSE) & time = 0;
- Action_Start == (((((error = FALSE & magnetron_running = FALSE) & door_open = FALSE) & time /= 0) & magnetron_running_n = TRUE) & button_locked_n = TRUE) & TRUE = TRUE;
- Action_Stop == (((magnetron_running = TRUE & magnetron_running_n = FALSE) & button_locked_n = FALSE) & time_n = 0) & TRUE = TRUE;
- Door_Locked_When_Heating == (magnetron_running = TRUE => door_open = FALSE) & (magnetron_running = TRUE => button_locked = TRUE);
-VARIABLES magnetron_running, door_open, button_locked, time, error
-INVARIANT
-((((magnetron_running : BOOL & door_open : BOOL) & button_locked : BOOL) & time : INTEGER) & error : BOOL) & Door_Locked_When_Heating
-INITIALISATION
-magnetron_running, door_open, button_locked, time, error:(Init)
-OPERATIONS
- Action_Open_Door = SELECT (((button_locked = FALSE & magnetron_running = FALSE) & door_open = FALSE) & TRUE = TRUE) & TRUE = TRUE THEN door_open := TRUE END;
-
- Action_Close_Door = SELECT (door_open = TRUE & TRUE = TRUE) & TRUE = TRUE THEN door_open := FALSE END;
-
- Action_Change_Time = ANY time_n WHERE ((magnetron_running = FALSE & time_n : INTEGER) & (((((((time = 180 & time_n = 120) or (time = 120 & time_n = 90)) or (time = 90 & time_n = 60)) or (time = 60 & time_n = 30)) or (time = 30 & time_n = 15)) or (time = 15 & time_n = 180)) or (time = 0 & time_n = 180))) & TRUE = TRUE THEN time := time_n END;
-
- Action_Button_S = ANY magnetron_running_n, door_open_n, button_locked_n, time_n, error_n WHERE ((((magnetron_running_n : BOOL & door_open_n : BOOL) & button_locked_n : BOOL) & time_n : INTEGER) & error_n : BOOL) & ((magnetron_running = FALSE => Action_Start) & (not(magnetron_running = FALSE) => Action_Stop)) THEN magnetron_running,door_open,button_locked,time,error := magnetron_running_n,door_open_n,button_locked_n,time_n,error_n END;
-
- Action_Error = BEGIN error,magnetron_running := TRUE,FALSE END;
-
- Action_Tick = ANY magnetron_running_n, door_open_n, button_locked_n, time_n, error_n WHERE (((((magnetron_running = TRUE & magnetron_running_n : BOOL) & door_open_n : BOOL) & button_locked_n : BOOL) & time_n : INTEGER) & error_n : BOOL) & ((time /= 1 => time_n = time - 1 & TRUE = TRUE) & (not(time /= 1) => ((time_n = 0 & magnetron_running_n = FALSE) & button_locked_n = FALSE) & TRUE = TRUE)) THEN magnetron_running,door_open,button_locked,time,error := magnetron_running_n,door_open_n,button_locked_n,time_n,error_n END
+MACHINE microwave
+DEFINITIONS
+ Init == (((magnetron_running = FALSE & door_open = FALSE) & button_locked = FALSE) & error = FALSE) & time = 0;
+ Action_Start == (((((error = FALSE & magnetron_running = FALSE) & door_open = FALSE) & time /= 0) & magnetron_running_n = TRUE) & button_locked_n = TRUE) & TRUE = TRUE;
+ Action_Stop == (((magnetron_running = TRUE & magnetron_running_n = FALSE) & button_locked_n = FALSE) & time_n = 0) & TRUE = TRUE;
+ Door_Locked_When_Heating == (magnetron_running = TRUE => door_open = FALSE) & (magnetron_running = TRUE => button_locked = TRUE);
+VARIABLES magnetron_running, door_open, button_locked, time, error
+INVARIANT
+((((magnetron_running : BOOL & door_open : BOOL) & button_locked : BOOL) & time : INTEGER) & error : BOOL) & Door_Locked_When_Heating
+INITIALISATION
+magnetron_running, door_open, button_locked, time, error:(Init)
+OPERATIONS
+ Action_Open_Door = SELECT (((button_locked = FALSE & magnetron_running = FALSE) & door_open = FALSE) & TRUE = TRUE) & TRUE = TRUE THEN door_open := TRUE END;
+
+ Action_Close_Door = SELECT (door_open = TRUE & TRUE = TRUE) & TRUE = TRUE THEN door_open := FALSE END;
+
+ Action_Change_Time = ANY time_n WHERE ((magnetron_running = FALSE & time_n : INTEGER) & (((((((time = 180 & time_n = 120) or (time = 120 & time_n = 90)) or (time = 90 & time_n = 60)) or (time = 60 & time_n = 30)) or (time = 30 & time_n = 15)) or (time = 15 & time_n = 180)) or (time = 0 & time_n = 180))) & TRUE = TRUE THEN time := time_n END;
+
+ Action_Button_S = ANY magnetron_running_n, door_open_n, button_locked_n, time_n, error_n WHERE ((((magnetron_running_n : BOOL & door_open_n : BOOL) & button_locked_n : BOOL) & time_n : INTEGER) & error_n : BOOL) & ((magnetron_running = FALSE => Action_Start) & (not(magnetron_running = FALSE) => Action_Stop)) THEN magnetron_running,door_open,button_locked,time,error := magnetron_running_n,door_open_n,button_locked_n,time_n,error_n END;
+
+ Action_Error = BEGIN error,magnetron_running := TRUE,FALSE END;
+
+ Action_Tick = ANY magnetron_running_n, door_open_n, button_locked_n, time_n, error_n WHERE (((((magnetron_running = TRUE & magnetron_running_n : BOOL) & door_open_n : BOOL) & button_locked_n : BOOL) & time_n : INTEGER) & error_n : BOOL) & ((time /= 1 => time_n = time - 1 & TRUE = TRUE) & (not(time /= 1) => ((time_n = 0 & magnetron_running_n = FALSE) & button_locked_n = FALSE) & TRUE = TRUE)) THEN magnetron_running,door_open,button_locked,time,error := magnetron_running_n,door_open_n,button_locked_n,time_n,error_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/standardModules/MinOfSet.tla b/src/test/resources/prettyprint/standardModules/MinOfSet.tla
index 808f1cdd3a89fbacc36f42e96b5a9bae75a2b635..6797d5f683256a85c9851f64f4bb9cc67a0be038 100644
--- a/src/test/resources/prettyprint/standardModules/MinOfSet.tla
+++ b/src/test/resources/prettyprint/standardModules/MinOfSet.tla
@@ -1,4 +1,4 @@
--------------- MODULE MinOfSet ----------------
-EXTENDS TLA2B
-ASSUME MinOfSet({1,2,3}) = 1
+-------------- MODULE MinOfSet ----------------
+EXTENDS TLA2B
+ASSUME MinOfSet({1,2,3}) = 1
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/standardModules/PermutedSequences.tla b/src/test/resources/prettyprint/standardModules/PermutedSequences.tla
index 3b4df8bd58b070db68b8903203aeb6fa93aae36d..556d26a9c2c3340eb4fbbcee8ccef1a56564faaa 100644
--- a/src/test/resources/prettyprint/standardModules/PermutedSequences.tla
+++ b/src/test/resources/prettyprint/standardModules/PermutedSequences.tla
@@ -1,4 +1,4 @@
--------------- MODULE PermutedSequences ----------------
-EXTENDS TLA2B
-ASSUME PermutedSequences({1,2}) = {<<1,2>>,<<2,1>>}
+-------------- MODULE PermutedSequences ----------------
+EXTENDS TLA2B
+ASSUME PermutedSequences({1,2}) = {<<1,2>>,<<2,1>>}
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/standardModules/SetProduct.tla b/src/test/resources/prettyprint/standardModules/SetProduct.tla
index e3efb9532de40ad829a75c6581ee3558aa11760a..7bf4cdf3af1191be8b8d60691c3f081a7da5c6f1 100644
--- a/src/test/resources/prettyprint/standardModules/SetProduct.tla
+++ b/src/test/resources/prettyprint/standardModules/SetProduct.tla
@@ -1,4 +1,4 @@
--------------- MODULE SetProduct ----------------
-EXTENDS TLA2B
-ASSUME SetProduct({1,2,3}) = 6
+-------------- MODULE SetProduct ----------------
+EXTENDS TLA2B
+ASSUME SetProduct({1,2,3}) = 6
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/standardModules/SetSummation.tla b/src/test/resources/prettyprint/standardModules/SetSummation.tla
index e8bae967f7281ac7603f071ae1cb7c93f9bb792b..10868b2bf87bebf08293ed20a003368c006e6589 100644
--- a/src/test/resources/prettyprint/standardModules/SetSummation.tla
+++ b/src/test/resources/prettyprint/standardModules/SetSummation.tla
@@ -1,4 +1,4 @@
-------------- MODULE SetSummation ----------------
-EXTENDS TLA2B
-ASSUME SetSummation({1,2,3}) = 6
+------------- MODULE SetSummation ----------------
+EXTENDS TLA2B
+ASSUME SetSummation({1,2,3}) = 6
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/standardModules/TLA2B.tla b/src/test/resources/prettyprint/standardModules/TLA2B.tla
index c4d1b5d2f962ca06b608c4ab482115a2cf895aeb..76595cbe3f00819b026d98477b9028e86578e697 100644
--- a/src/test/resources/prettyprint/standardModules/TLA2B.tla
+++ b/src/test/resources/prettyprint/standardModules/TLA2B.tla
@@ -1,9 +1,9 @@
---------- MODULE TLA2B ---------
-LOCAL INSTANCE Naturals
-LOCAL INSTANCE Sequences
-MinOfSet(S) == CHOOSE p \in S: \A n \in S: p \leq n
-MaxOfSet(S) == CHOOSE p \in S: \A n \in S: p \geq n
-SetProduct(S)  == S
-SetSummation(S) == S
-PermutedSequences(S) == S
+--------- MODULE TLA2B ---------
+LOCAL INSTANCE Naturals
+LOCAL INSTANCE Sequences
+MinOfSet(S) == CHOOSE p \in S: \A n \in S: p \leq n
+MaxOfSet(S) == CHOOSE p \in S: \A n \in S: p \geq n
+SetProduct(S)  == S
+SetSummation(S) == S
+PermutedSequences(S) == S
 ==============================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/unchanged/OneUnchangedVariable.mch b/src/test/resources/prettyprint/unchanged/OneUnchangedVariable.mch
index 01eac55e9633c9630b66afc119ab898e4bfc282b..17d049798c744a5708d760f38815fc9ce256a0ee 100644
--- a/src/test/resources/prettyprint/unchanged/OneUnchangedVariable.mch
+++ b/src/test/resources/prettyprint/unchanged/OneUnchangedVariable.mch
@@ -1,12 +1,12 @@
-MACHINE OneUnchangedVariable
-VARIABLES a, b
-INVARIANT
- a : INTEGER
- & b : INTEGER
-INITIALISATION
- a, b:(a = 0 & b = 0)
-OPERATIONS
- Next_Op = ANY a_n
-	WHERE a_n : INTEGER & a = 1 & TRUE = TRUE
-	THEN a := a_n END
+MACHINE OneUnchangedVariable
+VARIABLES a, b
+INVARIANT
+ a : INTEGER
+ & b : INTEGER
+INITIALISATION
+ a, b:(a = 0 & b = 0)
+OPERATIONS
+ Next_Op = ANY a_n
+	WHERE a_n : INTEGER & a = 1 & TRUE = TRUE
+	THEN a := a_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/unchanged/OneUnchangedVariable.tla b/src/test/resources/prettyprint/unchanged/OneUnchangedVariable.tla
index e96976aca605b20721773ed685d8d06198c4beae..9b9252eda2c64f56e14568e6b922db4533b80096 100644
--- a/src/test/resources/prettyprint/unchanged/OneUnchangedVariable.tla
+++ b/src/test/resources/prettyprint/unchanged/OneUnchangedVariable.tla
@@ -1,5 +1,5 @@
------MODULE OneUnchangedVariable -----
-VARIABLES a, b
-Init == a= 0 /\ b = 0
-Next == a = 1 /\ UNCHANGED b
+-----MODULE OneUnchangedVariable -----
+VARIABLES a, b
+Init == a= 0 /\ b = 0
+Next == a = 1 /\ UNCHANGED b
 =================================
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/unchanged/SeveralUnchangedVariables.mch b/src/test/resources/prettyprint/unchanged/SeveralUnchangedVariables.mch
index 9d5d58e93578d2ff7c4384b4f24ba6a90c040029..0bcbb31e43ab6122806aa210f8afecc0a6241aee 100644
--- a/src/test/resources/prettyprint/unchanged/SeveralUnchangedVariables.mch
+++ b/src/test/resources/prettyprint/unchanged/SeveralUnchangedVariables.mch
@@ -1,15 +1,15 @@
-MACHINE SeveralUnchangedVariables
-VARIABLES a, b, c, d, e
-INVARIANT
- a : INTEGER
- & b : INTEGER
- & c : INTEGER
- & d : INTEGER
- & e : INTEGER
-INITIALISATION
- a, b, c, d, e:(a = 0 & b = 0 & c = 0 & d = 0 & e = 0)
-OPERATIONS
- Next_Op = ANY a_n
-	WHERE a_n : INTEGER & a = 1 & TRUE = TRUE
-	THEN a := a_n END
+MACHINE SeveralUnchangedVariables
+VARIABLES a, b, c, d, e
+INVARIANT
+ a : INTEGER
+ & b : INTEGER
+ & c : INTEGER
+ & d : INTEGER
+ & e : INTEGER
+INITIALISATION
+ a, b, c, d, e:(a = 0 & b = 0 & c = 0 & d = 0 & e = 0)
+OPERATIONS
+ Next_Op = ANY a_n
+	WHERE a_n : INTEGER & a = 1 & TRUE = TRUE
+	THEN a := a_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/prettyprint/unchanged/SeveralUnchangedVariables.tla b/src/test/resources/prettyprint/unchanged/SeveralUnchangedVariables.tla
index 4bc2e367fbcf4f092a894391a027466db81b1c59..dbf451ebdf459733657f9b23eab405a469eaf2d4 100644
--- a/src/test/resources/prettyprint/unchanged/SeveralUnchangedVariables.tla
+++ b/src/test/resources/prettyprint/unchanged/SeveralUnchangedVariables.tla
@@ -1,5 +1,5 @@
- ----- MODULE SeveralUnchangedVariables -----
-VARIABLES a,b,c,d,e
-Init == a= 0 /\ b = 0 /\ c = 0 /\ d = 0 /\ e = 0
-Next == a = 1 /\ UNCHANGED <<b,c,d,e>>
+ ----- MODULE SeveralUnchangedVariables -----
+VARIABLES a,b,c,d,e
+Init == a= 0 /\ b = 0 /\ c = 0 /\ d = 0 /\ e = 0
+Next == a = 1 /\ UNCHANGED <<b,c,d,e>>
 =================================
\ No newline at end of file
diff --git a/src/test/resources/regression/AsynchInterface/AsynchInterface.mch b/src/test/resources/regression/AsynchInterface/AsynchInterface.mch
index b15fa61cbb52d4a8ff4113e35f1fe357d841d675..3aa3f74adfa2d3c2569759ba3d2bf5317336e019 100644
--- a/src/test/resources/regression/AsynchInterface/AsynchInterface.mch
+++ b/src/test/resources/regression/AsynchInterface/AsynchInterface.mch
@@ -1,33 +1,33 @@
-MACHINE AsynchInterface
-ABSTRACT_CONSTANTS Data
-PROPERTIES
- Data : POW(INTEGER)
- & Data = 0 .. 7
-DEFINITIONS
- TypeInvariant == val : Data
-	 & rdy : {0, 1}
-	 & ack : {0, 1}
-VARIABLES val, rdy, ack
-INVARIANT
- val : INTEGER
- & rdy : INTEGER
- & ack : INTEGER
- & TypeInvariant
-INITIALISATION
- val, rdy, ack:(val : Data
- & rdy : {0, 1}
- & ack = rdy)
-OPERATIONS
- Snd_Op = ANY val_n, rdy_n
-	WHERE val_n : INTEGER & rdy_n : INTEGER & rdy = ack
-	 & val_n : Data
-	 & rdy_n = 1 - rdy
-	 & TRUE = TRUE
-	THEN val, rdy := val_n, rdy_n END;
-
- Rcv_Op = ANY ack_n
-	WHERE ack_n : INTEGER & rdy /= ack
-	 & ack_n = 1 - ack
-	 & TRUE = TRUE
-	THEN ack := ack_n END
-END
+MACHINE AsynchInterface
+ABSTRACT_CONSTANTS Data
+PROPERTIES
+ Data : POW(INTEGER)
+ & Data = 0 .. 7
+DEFINITIONS
+ TypeInvariant == val : Data
+	 & rdy : {0, 1}
+	 & ack : {0, 1}
+VARIABLES val, rdy, ack
+INVARIANT
+ val : INTEGER
+ & rdy : INTEGER
+ & ack : INTEGER
+ & TypeInvariant
+INITIALISATION
+ val, rdy, ack:(val : Data
+ & rdy : {0, 1}
+ & ack = rdy)
+OPERATIONS
+ Snd_Op = ANY val_n, rdy_n
+	WHERE val_n : INTEGER & rdy_n : INTEGER & rdy = ack
+	 & val_n : Data
+	 & rdy_n = 1 - rdy
+	 & TRUE = TRUE
+	THEN val, rdy := val_n, rdy_n END;
+
+ Rcv_Op = ANY ack_n
+	WHERE ack_n : INTEGER & rdy /= ack
+	 & ack_n = 1 - ack
+	 & TRUE = TRUE
+	THEN ack := ack_n END
+END
diff --git a/src/test/resources/regression/Channel/Channel.cfg b/src/test/resources/regression/Channel/Channel.cfg
index dbaae4075b4171db16d9b608eba70fe121c7e4fb..aa11c0b20e49104b053472238fe96d66fe816ab8 100644
--- a/src/test/resources/regression/Channel/Channel.cfg
+++ b/src/test/resources/regression/Channel/Channel.cfg
@@ -1,5 +1,5 @@
-CONSTANTS
-Data = {d1,d2}
-INIT Init
-NEXT Next
+CONSTANTS
+Data = {d1,d2}
+INIT Init
+NEXT Next
 INVARIANTS TypeInvariant
\ No newline at end of file
diff --git a/src/test/resources/regression/Club/Club.cfg b/src/test/resources/regression/Club/Club.cfg
index 2f57580b8191246f34e4691675619b0af85f3b86..74ade45754c402a5997e897eacee1ecb7fe4676e 100644
--- a/src/test/resources/regression/Club/Club.cfg
+++ b/src/test/resources/regression/Club/Club.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS
-NAME = {n1,n2,n3}
+INIT Init
+NEXT Next
+CONSTANTS
+NAME = {n1,n2,n3}
diff --git a/src/test/resources/regression/Club/Club.tla b/src/test/resources/regression/Club/Club.tla
index 905b0ac493bf0e07438e80ce03c0f457ed0046a0..592008415ed424656b07acf4f7142e5ae9b86256 100644
--- a/src/test/resources/regression/Club/Club.tla
+++ b/src/test/resources/regression/Club/Club.tla
@@ -1,31 +1,31 @@
------------------------------- MODULE Club ------------------------------- 
-EXTENDS Naturals, FiniteSets
-CONSTANTS capacity, NAME, total
-ASSUME capacity \in Nat /\ capacity = 2
-ASSUME Cardinality(NAME) > capacity
-ASSUME total \in Nat /\ total > 2
-
-VARIABLES member, waiting
-----------------------------------------------------------------------------
-Inv == member \subseteq NAME /\ waiting \subseteq NAME
-	/\ member \cup waiting = {}
-	/\ Cardinality(member) \leq 4096
-	/\ Cardinality(waiting) \leq total
-
-Init == member = {} /\ waiting = {}
-----------------------------------------------------------------------------
-
-join_queue(nn) == nn \notin member /\ nn \notin waiting 
-	/\ Cardinality(waiting) < total /\ waiting' = waiting \cup {nn}
-	/\ UNCHANGED member
-
-join(nn) == nn \in waiting /\ Cardinality(member) < capacity
-	/\ member' = member \cup {nn} /\ waiting' = waiting\{nn} 
-
-remove(nn) == nn \in member /\ member' = member\{nn} /\ UNCHANGED waiting
-
-
-Next == \/ (\E nn \in NAME: join_queue(nn))
-	\/ (\E nn \in NAME: join(nn))
-	\/ (\E nn \in NAME: remove(nn))
-=============================================================================
+------------------------------ MODULE Club ------------------------------- 
+EXTENDS Naturals, FiniteSets
+CONSTANTS capacity, NAME, total
+ASSUME capacity \in Nat /\ capacity = 2
+ASSUME Cardinality(NAME) > capacity
+ASSUME total \in Nat /\ total > 2
+
+VARIABLES member, waiting
+----------------------------------------------------------------------------
+Inv == member \subseteq NAME /\ waiting \subseteq NAME
+	/\ member \cup waiting = {}
+	/\ Cardinality(member) \leq 4096
+	/\ Cardinality(waiting) \leq total
+
+Init == member = {} /\ waiting = {}
+----------------------------------------------------------------------------
+
+join_queue(nn) == nn \notin member /\ nn \notin waiting 
+	/\ Cardinality(waiting) < total /\ waiting' = waiting \cup {nn}
+	/\ UNCHANGED member
+
+join(nn) == nn \in waiting /\ Cardinality(member) < capacity
+	/\ member' = member \cup {nn} /\ waiting' = waiting\{nn} 
+
+remove(nn) == nn \in member /\ member' = member\{nn} /\ UNCHANGED waiting
+
+
+Next == \/ (\E nn \in NAME: join_queue(nn))
+	\/ (\E nn \in NAME: join(nn))
+	\/ (\E nn \in NAME: remove(nn))
+=============================================================================
diff --git a/src/test/resources/regression/Counter/Counter.cfg b/src/test/resources/regression/Counter/Counter.cfg
index c2c935a8c9abab6cadd624ad796e68ced5cf767a..f6c1792a4fdf071007ef9b82f171cea3ae8c2516 100644
--- a/src/test/resources/regression/Counter/Counter.cfg
+++ b/src/test/resources/regression/Counter/Counter.cfg
@@ -1,4 +1,4 @@
-INIT Init
-NEXT Next
-CONSTANTS
+INIT Init
+NEXT Next
+CONSTANTS
 k = 10
\ No newline at end of file
diff --git a/src/test/resources/regression/Counter/Counter.mch b/src/test/resources/regression/Counter/Counter.mch
index 4e14b6b3049b1b69b6ae420875357230ed082f72..976f3bffb811d675c4f562f62c9faa7c5814e06c 100644
--- a/src/test/resources/regression/Counter/Counter.mch
+++ b/src/test/resources/regression/Counter/Counter.mch
@@ -1,18 +1,18 @@
-MACHINE Counter
-ABSTRACT_CONSTANTS k
-PROPERTIES
- k = 10
-VARIABLES a
-INVARIANT
- a : INTEGER
-INITIALISATION
- a:(a = 0)
-OPERATIONS
- Inc_Op = ANY a_n
-	WHERE a_n : INTEGER & a < k & a_n = a + 1
-	THEN a := a_n END;
-
- Dec_Op = ANY a_n
-	WHERE a_n : INTEGER & a > 0 & a_n = a - 1
-	THEN a := a_n END
-END
+MACHINE Counter
+ABSTRACT_CONSTANTS k
+PROPERTIES
+ k = 10
+VARIABLES a
+INVARIANT
+ a : INTEGER
+INITIALISATION
+ a:(a = 0)
+OPERATIONS
+ Inc_Op = ANY a_n
+	WHERE a_n : INTEGER & a < k & a_n = a + 1
+	THEN a := a_n END;
+
+ Dec_Op = ANY a_n
+	WHERE a_n : INTEGER & a > 0 & a_n = a - 1
+	THEN a := a_n END
+END
diff --git a/src/test/resources/regression/Counter/Counter.tla b/src/test/resources/regression/Counter/Counter.tla
index 42bd73e75f3091951825706e13424488b4433a81..f3a567e23e3ad8bfd828566e7635d27b170fdc57 100644
--- a/src/test/resources/regression/Counter/Counter.tla
+++ b/src/test/resources/regression/Counter/Counter.tla
@@ -1,13 +1,13 @@
------------------------------- MODULE Counter ------------------------------- 
-EXTENDS Naturals
-CONSTANTS k
-
-VARIABLES a
-
-Init == a = 0
-
-Inc ==  a < k /\ a' = a+1
-Dec == a > 0 /\ a' = a-1
-Next == Inc \/ Dec
-
+------------------------------ MODULE Counter ------------------------------- 
+EXTENDS Naturals
+CONSTANTS k
+
+VARIABLES a
+
+Init == a = 0
+
+Inc ==  a < k /\ a' = a+1
+Dec == a > 0 /\ a' = a-1
+Next == Inc \/ Dec
+
 =============================================================================
\ No newline at end of file
diff --git a/src/test/resources/regression/DieHard/DieHard.cfg b/src/test/resources/regression/DieHard/DieHard.cfg
index 08aa2418b9aa2ed935c9a2eff7293c55a2b15681..7544c040af752dc5bbde1e2b12ad5c068ffb7834 100644
--- a/src/test/resources/regression/DieHard/DieHard.cfg
+++ b/src/test/resources/regression/DieHard/DieHard.cfg
@@ -1,3 +1,3 @@
-INIT Init
-NEXT Next
-INVARIANTS TypeOK NotSolved
+INIT Init
+NEXT Next
+INVARIANTS TypeOK NotSolved
diff --git a/src/test/resources/regression/DieHard/DieHard.mch b/src/test/resources/regression/DieHard/DieHard.mch
index b65ad6e09ef0c59c6f6c8a7b1dffadfd49115de6..0d967b7a6f40537488c93c6858265d39442a3a42 100644
--- a/src/test/resources/regression/DieHard/DieHard.mch
+++ b/src/test/resources/regression/DieHard/DieHard.mch
@@ -1,49 +1,49 @@
-MACHINE DieHard
-DEFINITIONS
- IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE);
- TypeOK == small : 0 .. 3
-	 & big : 0 .. 5;
-
- Min(m,n) == IF_THEN_ELSE(bool(m < n), m, n);
-
- NotSolved == big /= 4
-VARIABLES big, small
-INVARIANT
- big : INTEGER
- & small : INTEGER
- & TypeOK
- & NotSolved
-INITIALISATION
- big, small:(big = 0
- & small = 0)
-OPERATIONS
- FillSmallJug_Op = ANY big_n, small_n
-	WHERE big_n : INTEGER & small_n : INTEGER & small_n = 3
-	 & big_n = big
-	THEN big, small := big_n, small_n END;
-
- FillBigJug_Op = ANY big_n, small_n
-	WHERE big_n : INTEGER & small_n : INTEGER & big_n = 5
-	 & small_n = small
-	THEN big, small := big_n, small_n END;
-
- EmptySmallJug_Op = ANY big_n, small_n
-	WHERE big_n : INTEGER & small_n : INTEGER & small_n = 0
-	 & big_n = big
-	THEN big, small := big_n, small_n END;
-
- EmptyBigJug_Op = ANY big_n, small_n
-	WHERE big_n : INTEGER & small_n : INTEGER & big_n = 0
-	 & small_n = small
-	THEN big, small := big_n, small_n END;
-
- SmallToBig_Op = ANY big_n, small_n
-	WHERE big_n : INTEGER & small_n : INTEGER & big_n = Min(big + small, 5)
-	 & small_n = small - (big_n - big)
-	THEN big, small := big_n, small_n END;
-
- BigToSmall_Op = ANY big_n, small_n
-	WHERE big_n : INTEGER & small_n : INTEGER & small_n = Min(big + small, 3)
-	 & big_n = big - (small_n - small)
-	THEN big, small := big_n, small_n END
-END
+MACHINE DieHard
+DEFINITIONS
+ IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE);
+ TypeOK == small : 0 .. 3
+	 & big : 0 .. 5;
+
+ Min(m,n) == IF_THEN_ELSE(bool(m < n), m, n);
+
+ NotSolved == big /= 4
+VARIABLES big, small
+INVARIANT
+ big : INTEGER
+ & small : INTEGER
+ & TypeOK
+ & NotSolved
+INITIALISATION
+ big, small:(big = 0
+ & small = 0)
+OPERATIONS
+ FillSmallJug_Op = ANY big_n, small_n
+	WHERE big_n : INTEGER & small_n : INTEGER & small_n = 3
+	 & big_n = big
+	THEN big, small := big_n, small_n END;
+
+ FillBigJug_Op = ANY big_n, small_n
+	WHERE big_n : INTEGER & small_n : INTEGER & big_n = 5
+	 & small_n = small
+	THEN big, small := big_n, small_n END;
+
+ EmptySmallJug_Op = ANY big_n, small_n
+	WHERE big_n : INTEGER & small_n : INTEGER & small_n = 0
+	 & big_n = big
+	THEN big, small := big_n, small_n END;
+
+ EmptyBigJug_Op = ANY big_n, small_n
+	WHERE big_n : INTEGER & small_n : INTEGER & big_n = 0
+	 & small_n = small
+	THEN big, small := big_n, small_n END;
+
+ SmallToBig_Op = ANY big_n, small_n
+	WHERE big_n : INTEGER & small_n : INTEGER & big_n = Min(big + small, 5)
+	 & small_n = small - (big_n - big)
+	THEN big, small := big_n, small_n END;
+
+ BigToSmall_Op = ANY big_n, small_n
+	WHERE big_n : INTEGER & small_n : INTEGER & small_n = Min(big + small, 3)
+	 & big_n = big - (small_n - small)
+	THEN big, small := big_n, small_n END
+END
diff --git a/src/test/resources/regression/DieHard/DieHard.tla b/src/test/resources/regression/DieHard/DieHard.tla
index 0447532ccd6c21e6d42c16ce99b31b63cdea0b20..c8c3ead49a5ac2cf7da218fbbf53a4a59b3f1147 100644
--- a/src/test/resources/regression/DieHard/DieHard.tla
+++ b/src/test/resources/regression/DieHard/DieHard.tla
@@ -1,129 +1,129 @@
------------------------------- MODULE DieHard ------------------------------- 
-(***************************************************************************)
-(* In the movie Die Hard 3, the heros must obtain exactly 4 gallons of     *)
-(* water using a 5 gallon jug, a 3 gallon jug, and a water faucet.  Our    *)
-(* goal: to get TLC to solve the problem for us.                           *)
-(*                                                                         *)
-(* First, we write a spec that describes all allowable behaviors of our    *)
-(* heros.                                                                  *)
-(***************************************************************************)
-EXTENDS Naturals
-  (*************************************************************************)
-  (* This statement imports the definitions of the ordinary operators on   *)
-  (* natural numbers, such as +.                                           *)
-  (*************************************************************************)
-  
-(***************************************************************************)
-(* We next declare the specification's variables.                          *)
-(***************************************************************************)
-VARIABLES big,   \* The number of gallons of water in the 5 gallon jug.
-          small  \* The number of gallons of water in the 3 gallon jug.
-
-
-(***************************************************************************)
-(* We now define TypeOK to be the type invariant, asserting that the value *)
-(* of each variable is an element of the appropriate set.  A type          *)
-(* invariant like this is not part of the specification, but it's          *)
-(* generally a good idea to include it because it helps the reader         *)
-(* understand the spec.  Moreover, having TLC check that it is an          *)
-(* invariant of the spec catches errors that, in a typed language, are     *)
-(* caught by type checking.                                                *)
-(*                                                                         *)
-(* Note: TLA+ uses the convention that a list of formulas bulleted by /\   *)
-(* or \/ denotes the conjunction or disjunction of those formulas.         *)
-(* Indentation of subitems is significant, allowing one to eliminate lots  *)
-(* of parentheses.  This makes a large formula much easier to read.        *)
-(* However, it does mean that you have to be careful with your indentation.*)
-(***************************************************************************)
-TypeOK == /\ small \in 0..3 
-          /\ big   \in 0..5
-
-
-(***************************************************************************)
-(* Now we define of the initial predicate, that specifies the initial      *)
-(* values of the variables.  I like to name this predicate Init, but the   *)
-(* name doesn't matter.                                                    *)
-(***************************************************************************)
-Init == /\ big = 0 
-        /\ small = 0
-
-(***************************************************************************)
-(* Now we define the actions that our hero can perform.  There are three   *)
-(* things they can do:                                                     *)
-(*                                                                         *)
-(*   - Pour water from the faucet into a jug.                              *)
-(*                                                                         *)
-(*   - Pour water from a jug onto the ground.                              *)
-(*                                                                         *)
-(*   - Pour water from one jug into another                                *)
-(*                                                                         *)
-(* We now consider the first two.  Since the jugs are not calibrated,      *)
-(* partially filling or partially emptying a jug accomplishes nothing.     *)
-(* So, the first two possibilities yield the following four possible       *)
-(* actions.                                                                *)
-(***************************************************************************)
-FillSmallJug  == /\ small' = 3 
-                 /\ big' = big
-
-FillBigJug    == /\ big' = 5 
-                 /\ small' = small
-
-EmptySmallJug == /\ small' = 0 
-                 /\ big' = big
-
-EmptyBigJug   == /\ big' = 0 
-                 /\ small' = small
-
-(***************************************************************************)
-(* We now consider pouring water from one jug into another.  Again, since  *)
-(* the jugs are not callibrated, when pouring from jug A to jug B, it      *)
-(* makes sense only to either fill B or empty A. And there's no point in   *)
-(* emptying A if this will cause B to overflow, since that could be        *)
-(* accomplished by the two actions of first filling B and then emptying A. *)
-(* So, pouring water from A to B leaves B with the lesser of (i) the water *)
-(* contained in both jugs and (ii) the volume of B. To express this        *)
-(* mathematically, we first define Min(m,n) to equal the minimum of the    *)
-(* numbers m and n.                                                        *)
-(***************************************************************************)
-Min(m,n) == IF m < n THEN m ELSE n
-
-(***************************************************************************)
-(* Now we define the last two pouring actions.  From the observation       *)
-(* above, these definitions should be clear.                               *)
-(***************************************************************************)
-SmallToBig == /\ big'   = Min(big + small, 5)
-              /\ small' = small - (big' - big)
-
-BigToSmall == /\ small' = Min(big + small, 3) 
-              /\ big'   = big - (small' - small)
-
-(***************************************************************************)
-(* We define the next-state relation, which I like to call Next.  A Next   *)
-(* step is a step of one of the six actions defined above.  Hence, Next is *)
-(* the disjunction of those actions.                                       *)
-(***************************************************************************)
-Next ==  \/ FillSmallJug 
-         \/ FillBigJug    
-         \/ EmptySmallJug 
-         \/ EmptyBigJug    
-         \/ SmallToBig    
-         \/ BigToSmall    
-
------------------------------------------------------------------------------
-
-(***************************************************************************)
-(* Remember that our heros must measure out 4 gallons of water.            *)
-(* Obviously, those 4 gallons must be in the 5 gallon jug.  So, they have  *)
-(* solved their problem when they reach a state with big = 4.  So, we      *)
-(* define NotSolved to be the predicate asserting that big # 4.            *)
-(***************************************************************************)
-NotSolved == big # 4
-
-(***************************************************************************)
-(* We find a solution by having TLC check if NotSolved is an invariant,    *)
-(* which will cause it to print out an "error trace" consisting of a       *)
-(* behavior ending in a states where NotSolved is false.  Such a           *)
-(* behavior is the desired solution.  (Because TLC uses a breadth-first    *)
-(* search, it will find the shortest solution.)                            *)
-(***************************************************************************)
-=============================================================================
+------------------------------ MODULE DieHard ------------------------------- 
+(***************************************************************************)
+(* In the movie Die Hard 3, the heros must obtain exactly 4 gallons of     *)
+(* water using a 5 gallon jug, a 3 gallon jug, and a water faucet.  Our    *)
+(* goal: to get TLC to solve the problem for us.                           *)
+(*                                                                         *)
+(* First, we write a spec that describes all allowable behaviors of our    *)
+(* heros.                                                                  *)
+(***************************************************************************)
+EXTENDS Naturals
+  (*************************************************************************)
+  (* This statement imports the definitions of the ordinary operators on   *)
+  (* natural numbers, such as +.                                           *)
+  (*************************************************************************)
+  
+(***************************************************************************)
+(* We next declare the specification's variables.                          *)
+(***************************************************************************)
+VARIABLES big,   \* The number of gallons of water in the 5 gallon jug.
+          small  \* The number of gallons of water in the 3 gallon jug.
+
+
+(***************************************************************************)
+(* We now define TypeOK to be the type invariant, asserting that the value *)
+(* of each variable is an element of the appropriate set.  A type          *)
+(* invariant like this is not part of the specification, but it's          *)
+(* generally a good idea to include it because it helps the reader         *)
+(* understand the spec.  Moreover, having TLC check that it is an          *)
+(* invariant of the spec catches errors that, in a typed language, are     *)
+(* caught by type checking.                                                *)
+(*                                                                         *)
+(* Note: TLA+ uses the convention that a list of formulas bulleted by /\   *)
+(* or \/ denotes the conjunction or disjunction of those formulas.         *)
+(* Indentation of subitems is significant, allowing one to eliminate lots  *)
+(* of parentheses.  This makes a large formula much easier to read.        *)
+(* However, it does mean that you have to be careful with your indentation.*)
+(***************************************************************************)
+TypeOK == /\ small \in 0..3 
+          /\ big   \in 0..5
+
+
+(***************************************************************************)
+(* Now we define of the initial predicate, that specifies the initial      *)
+(* values of the variables.  I like to name this predicate Init, but the   *)
+(* name doesn't matter.                                                    *)
+(***************************************************************************)
+Init == /\ big = 0 
+        /\ small = 0
+
+(***************************************************************************)
+(* Now we define the actions that our hero can perform.  There are three   *)
+(* things they can do:                                                     *)
+(*                                                                         *)
+(*   - Pour water from the faucet into a jug.                              *)
+(*                                                                         *)
+(*   - Pour water from a jug onto the ground.                              *)
+(*                                                                         *)
+(*   - Pour water from one jug into another                                *)
+(*                                                                         *)
+(* We now consider the first two.  Since the jugs are not calibrated,      *)
+(* partially filling or partially emptying a jug accomplishes nothing.     *)
+(* So, the first two possibilities yield the following four possible       *)
+(* actions.                                                                *)
+(***************************************************************************)
+FillSmallJug  == /\ small' = 3 
+                 /\ big' = big
+
+FillBigJug    == /\ big' = 5 
+                 /\ small' = small
+
+EmptySmallJug == /\ small' = 0 
+                 /\ big' = big
+
+EmptyBigJug   == /\ big' = 0 
+                 /\ small' = small
+
+(***************************************************************************)
+(* We now consider pouring water from one jug into another.  Again, since  *)
+(* the jugs are not callibrated, when pouring from jug A to jug B, it      *)
+(* makes sense only to either fill B or empty A. And there's no point in   *)
+(* emptying A if this will cause B to overflow, since that could be        *)
+(* accomplished by the two actions of first filling B and then emptying A. *)
+(* So, pouring water from A to B leaves B with the lesser of (i) the water *)
+(* contained in both jugs and (ii) the volume of B. To express this        *)
+(* mathematically, we first define Min(m,n) to equal the minimum of the    *)
+(* numbers m and n.                                                        *)
+(***************************************************************************)
+Min(m,n) == IF m < n THEN m ELSE n
+
+(***************************************************************************)
+(* Now we define the last two pouring actions.  From the observation       *)
+(* above, these definitions should be clear.                               *)
+(***************************************************************************)
+SmallToBig == /\ big'   = Min(big + small, 5)
+              /\ small' = small - (big' - big)
+
+BigToSmall == /\ small' = Min(big + small, 3) 
+              /\ big'   = big - (small' - small)
+
+(***************************************************************************)
+(* We define the next-state relation, which I like to call Next.  A Next   *)
+(* step is a step of one of the six actions defined above.  Hence, Next is *)
+(* the disjunction of those actions.                                       *)
+(***************************************************************************)
+Next ==  \/ FillSmallJug 
+         \/ FillBigJug    
+         \/ EmptySmallJug 
+         \/ EmptyBigJug    
+         \/ SmallToBig    
+         \/ BigToSmall    
+
+-----------------------------------------------------------------------------
+
+(***************************************************************************)
+(* Remember that our heros must measure out 4 gallons of water.            *)
+(* Obviously, those 4 gallons must be in the 5 gallon jug.  So, they have  *)
+(* solved their problem when they reach a state with big = 4.  So, we      *)
+(* define NotSolved to be the predicate asserting that big # 4.            *)
+(***************************************************************************)
+NotSolved == big # 4
+
+(***************************************************************************)
+(* We find a solution by having TLC check if NotSolved is an invariant,    *)
+(* which will cause it to print out an "error trace" consisting of a       *)
+(* behavior ending in a states where NotSolved is false.  Such a           *)
+(* behavior is the desired solution.  (Because TLC uses a breadth-first    *)
+(* search, it will find the shortest solution.)                            *)
+(***************************************************************************)
+=============================================================================
diff --git a/src/test/resources/regression/DieHard/DieHarder.cfg b/src/test/resources/regression/DieHard/DieHarder.cfg
index 7d9d78bce48c7e2a77fb26d922f50cb56aae20c5..c17d90d52d5a248be3e0badd1c848e2cad3f2583 100644
--- a/src/test/resources/regression/DieHard/DieHarder.cfg
+++ b/src/test/resources/regression/DieHard/DieHarder.cfg
@@ -1,7 +1,7 @@
-INIT Init
-NEXT Next
-INVARIANT NotSolved
-CONSTANTS
-Goal = 4
-Jug <- MCJug
+INIT Init
+NEXT Next
+INVARIANT NotSolved
+CONSTANTS
+Goal = 4
+Jug <- MCJug
 Capacity <- MCCapacity
\ No newline at end of file
diff --git a/src/test/resources/regression/DieHard/DieHarder.mch b/src/test/resources/regression/DieHard/DieHarder.mch
index fbb17293bacc05ea51b0941f0cad06aacebce1c8..77e915c3dc51c6f2ca20ede44107faab9940e5af 100644
--- a/src/test/resources/regression/DieHard/DieHarder.mch
+++ b/src/test/resources/regression/DieHard/DieHarder.mch
@@ -1,44 +1,44 @@
-MACHINE DieHarder
-ABSTRACT_CONSTANTS Goal
-PROPERTIES
- Goal = 4
- & MCCapacity : MCJug --> {n|n : NATURAL & n > 0}
- & Goal : NATURAL
-DEFINITIONS
- IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE);
- MCJug == {"j1", "j2"};
-
- MCCapacity == %j_1.(j_1 : MCJug| (%t_.(t_ = 0 & j_1 = "j1" | 3) \/ %t_.(t_ = 0 & j_1 = "j2" | 5))(0));
-
- Min(m,n) == IF_THEN_ELSE(bool(m < n), m, n);
-
- FillJug(j) == contents_n = contents <+ {j |-> MCCapacity(j)};
-
- EmptyJug(j) == contents_n = contents <+ {j |-> 0};
-
- amountPoured(j, k) == Min(contents(j), MCCapacity(k) - contents(k));
- JugToJug(j,k) == contents_n = contents <+ {j |-> contents(j) - amountPoured(j, k), k |-> contents(k) + amountPoured(j, k)};
-
- NotSolved == !j.(j : MCJug => contents(j) /= Goal)
-VARIABLES contents
-INVARIANT
- contents : POW(STRING*INTEGER)
- & NotSolved
-INITIALISATION
- contents:(contents = %j.(j : MCJug| 0))
-OPERATIONS
- FillJug_Op(j) = ANY contents_n
-	WHERE j : MCJug & 
-	 contents_n : POW(STRING*INTEGER) & FillJug(j)
-	THEN contents := contents_n END;
-
- EmptyJug_Op(j) = ANY contents_n
-	WHERE j : MCJug & 
-	 contents_n : POW(STRING*INTEGER) & EmptyJug(j)
-	THEN contents := contents_n END;
-
- JugToJug_Op(j, k) = ANY contents_n
-	WHERE j : MCJug & k : MCJug - {j} & 
-	 contents_n : POW(STRING*INTEGER) & JugToJug(j, k)
-	THEN contents := contents_n END
+MACHINE DieHarder
+ABSTRACT_CONSTANTS Goal
+PROPERTIES
+ Goal = 4
+ & MCCapacity : MCJug --> {n|n : NATURAL & n > 0}
+ & Goal : NATURAL
+DEFINITIONS
+ IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE);
+ MCJug == {"j1", "j2"};
+
+ MCCapacity == %j_1.(j_1 : MCJug| (%t_.(t_ = 0 & j_1 = "j1" | 3) \/ %t_.(t_ = 0 & j_1 = "j2" | 5))(0));
+
+ Min(m,n) == IF_THEN_ELSE(bool(m < n), m, n);
+
+ FillJug(j) == contents_n = contents <+ {j |-> MCCapacity(j)};
+
+ EmptyJug(j) == contents_n = contents <+ {j |-> 0};
+
+ amountPoured(j, k) == Min(contents(j), MCCapacity(k) - contents(k));
+ JugToJug(j,k) == contents_n = contents <+ {j |-> contents(j) - amountPoured(j, k), k |-> contents(k) + amountPoured(j, k)};
+
+ NotSolved == !j.(j : MCJug => contents(j) /= Goal)
+VARIABLES contents
+INVARIANT
+ contents : POW(STRING*INTEGER)
+ & NotSolved
+INITIALISATION
+ contents:(contents = %j.(j : MCJug| 0))
+OPERATIONS
+ FillJug_Op(j) = ANY contents_n
+	WHERE j : MCJug & 
+	 contents_n : POW(STRING*INTEGER) & FillJug(j)
+	THEN contents := contents_n END;
+
+ EmptyJug_Op(j) = ANY contents_n
+	WHERE j : MCJug & 
+	 contents_n : POW(STRING*INTEGER) & EmptyJug(j)
+	THEN contents := contents_n END;
+
+ JugToJug_Op(j, k) = ANY contents_n
+	WHERE j : MCJug & k : MCJug - {j} & 
+	 contents_n : POW(STRING*INTEGER) & JugToJug(j, k)
+	THEN contents := contents_n END
 END
\ No newline at end of file
diff --git a/src/test/resources/regression/Doors/Doors.cfg b/src/test/resources/regression/Doors/Doors.cfg
index 3cae8360b34554c2ab9e1645c5118898db10cb37..1da72276bf122d540a9cc8e9520a36dd362cc7db 100644
--- a/src/test/resources/regression/Doors/Doors.cfg
+++ b/src/test/resources/regression/Doors/Doors.cfg
@@ -1,8 +1,8 @@
-INIT Init
-NEXT Next
-CONSTANTS
-DOOR = {D1,D2,D3}
-open = open
-closed = closed
-INVARIANT
+INIT Init
+NEXT Next
+CONSTANTS
+DOOR = {D1,D2,D3}
+open = open
+closed = closed
+INVARIANT
 Inv
\ No newline at end of file
diff --git a/src/test/resources/regression/Doors/Doors.tla b/src/test/resources/regression/Doors/Doors.tla
index 4c42a68c8654ec445d3ee7ab747ff299e002eac3..393291f52fa4401706bc6ae23067a18d675f1387 100644
--- a/src/test/resources/regression/Doors/Doors.tla
+++ b/src/test/resources/regression/Doors/Doors.tla
@@ -1,15 +1,15 @@
------------------------------- MODULE Doors ------------------------------- 
-EXTENDS Naturals
-CONSTANTS DOOR, POSITION, open, closed
-ASSUME POSITION = {open,closed}
-VARIABLES position
-
-Inv == position \in [DOOR -> POSITION]
-Init == position = [x \in DOOR |-> closed] 
-
-opening(dd)== dd \in DOOR /\ position' = [position EXCEPT ![dd] = open ]
-
-closedoor(dd)== dd \in DOOR /\  position' =  [position EXCEPT ![dd] = closed ]
-
-Next == \E dd \in DOOR : opening(dd) \/ closedoor(dd)
+------------------------------ MODULE Doors ------------------------------- 
+EXTENDS Naturals
+CONSTANTS DOOR, POSITION, open, closed
+ASSUME POSITION = {open,closed}
+VARIABLES position
+
+Inv == position \in [DOOR -> POSITION]
+Init == position = [x \in DOOR |-> closed] 
+
+opening(dd)== dd \in DOOR /\ position' = [position EXCEPT ![dd] = open ]
+
+closedoor(dd)== dd \in DOOR /\  position' =  [position EXCEPT ![dd] = closed ]
+
+Next == \E dd \in DOOR : opening(dd) \/ closedoor(dd)
 =============================================================================
\ No newline at end of file
diff --git a/src/test/resources/regression/GraphIso/GraphIso.cfg b/src/test/resources/regression/GraphIso/GraphIso.cfg
index f4de133b686366e3e6ac5098eb8d2734d459ddd3..717b05cb74f6edc705d59240b6610f46cc0ab264 100644
--- a/src/test/resources/regression/GraphIso/GraphIso.cfg
+++ b/src/test/resources/regression/GraphIso/GraphIso.cfg
@@ -1,2 +1,2 @@
-INIT Init
+INIT Init
 NEXT Solve
\ No newline at end of file
diff --git a/src/test/resources/regression/Jukebox/Jukebox.cfg b/src/test/resources/regression/Jukebox/Jukebox.cfg
index edf388f92669546052fc55cd316adfaf814c64e5..981ed5a3327d711f466598937546eb7c45601cb3 100644
--- a/src/test/resources/regression/Jukebox/Jukebox.cfg
+++ b/src/test/resources/regression/Jukebox/Jukebox.cfg
@@ -1,5 +1,5 @@
-INIT Init
-NEXT Next
-INVARIANT Inv
-CONSTANTS
+INIT Init
+NEXT Next
+INVARIANT Inv
+CONSTANTS
 TRACK = {t1,t2,t3}
\ No newline at end of file
diff --git a/src/test/resources/regression/Jukebox/Jukebox.mch b/src/test/resources/regression/Jukebox/Jukebox.mch
index bd120d8fc316e8bce4b0d4cfdf69861c37e6ff09..81dfed582723edd3fca44199bf0e0ec4219c9185 100644
--- a/src/test/resources/regression/Jukebox/Jukebox.mch
+++ b/src/test/resources/regression/Jukebox/Jukebox.mch
@@ -1,48 +1,48 @@
-MACHINE Jukebox
-SETS
- ENUM1 = {t1, t2, t3}
-ABSTRACT_CONSTANTS TRACK, limit
-PROPERTIES
- TRACK = ENUM1
- & limit : INTEGER
- & limit : NATURAL & limit > 0
-DEFINITIONS
- IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE);
- Inv == credit : NATURAL & credit <= limit & playset <: TRACK;
-
- minimum(a,b) == IF_THEN_ELSE(bool(a < b), a, b);
-
- pay(cc) == cc > 0 & credit_n = minimum(credit + cc, limit);
-
- select(tt) == credit > 0 & (credit_n = credit - 1 or credit_n = credit) & playset_n = playset \/ {tt}
-VARIABLES credit, playset
-INVARIANT
- credit : INTEGER
- & playset : POW(ENUM1)
- & Inv
-INITIALISATION
- credit, playset:(credit = 0 & playset = {})
-OPERATIONS
- pay_Op(cc) = ANY credit_n, playset_n
-	WHERE cc : NATURAL & 
-	 credit_n : INTEGER & playset_n : POW(ENUM1) & pay(cc)
-	THEN credit, playset := credit_n, playset_n END;
-
- select_Op(tt) = ANY credit_n, playset_n
-	WHERE tt : TRACK & 
-	 credit_n : INTEGER & playset_n : POW(ENUM1) & select(tt)
-	THEN credit, playset := credit_n, playset_n END;
-
- play_Op = ANY playset_n
-	WHERE playset_n : POW(ENUM1) & playset /= {} & #tr.(tr : playset & playset_n = playset - {tr}) & TRUE = TRUE
-	THEN playset := playset_n END;
-
- removeCredit_Op = ANY credit_n
-	WHERE credit_n : INTEGER & credit > 0 & credit_n = credit - 1 & TRUE = TRUE
-	THEN credit := credit_n END;
-
- dropTrack_Op(tt) = ANY playset_n
-	WHERE tt : playset & 
-	 playset_n : POW(ENUM1) & playset_n = playset - {tt} & TRUE = TRUE
-	THEN playset := playset_n END
-END
+MACHINE Jukebox
+SETS
+ ENUM1 = {t1, t2, t3}
+ABSTRACT_CONSTANTS TRACK, limit
+PROPERTIES
+ TRACK = ENUM1
+ & limit : INTEGER
+ & limit : NATURAL & limit > 0
+DEFINITIONS
+ IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE);
+ Inv == credit : NATURAL & credit <= limit & playset <: TRACK;
+
+ minimum(a,b) == IF_THEN_ELSE(bool(a < b), a, b);
+
+ pay(cc) == cc > 0 & credit_n = minimum(credit + cc, limit);
+
+ select(tt) == credit > 0 & (credit_n = credit - 1 or credit_n = credit) & playset_n = playset \/ {tt}
+VARIABLES credit, playset
+INVARIANT
+ credit : INTEGER
+ & playset : POW(ENUM1)
+ & Inv
+INITIALISATION
+ credit, playset:(credit = 0 & playset = {})
+OPERATIONS
+ pay_Op(cc) = ANY credit_n, playset_n
+	WHERE cc : NATURAL & 
+	 credit_n : INTEGER & playset_n : POW(ENUM1) & pay(cc)
+	THEN credit, playset := credit_n, playset_n END;
+
+ select_Op(tt) = ANY credit_n, playset_n
+	WHERE tt : TRACK & 
+	 credit_n : INTEGER & playset_n : POW(ENUM1) & select(tt)
+	THEN credit, playset := credit_n, playset_n END;
+
+ play_Op = ANY playset_n
+	WHERE playset_n : POW(ENUM1) & playset /= {} & #tr.(tr : playset & playset_n = playset - {tr}) & TRUE = TRUE
+	THEN playset := playset_n END;
+
+ removeCredit_Op = ANY credit_n
+	WHERE credit_n : INTEGER & credit > 0 & credit_n = credit - 1 & TRUE = TRUE
+	THEN credit := credit_n END;
+
+ dropTrack_Op(tt) = ANY playset_n
+	WHERE tt : playset & 
+	 playset_n : POW(ENUM1) & playset_n = playset - {tt} & TRUE = TRUE
+	THEN playset := playset_n END
+END
diff --git a/src/test/resources/regression/Jukebox/Jukebox.tla b/src/test/resources/regression/Jukebox/Jukebox.tla
index 7e187bfb5e6d8b1e7c635fbcf65e07550fa0f077..2a7fec0b30c6a054b9465aae929260f128dc692f 100644
--- a/src/test/resources/regression/Jukebox/Jukebox.tla
+++ b/src/test/resources/regression/Jukebox/Jukebox.tla
@@ -1,48 +1,48 @@
--------------------------- MODULE Jukebox -----------------------------
-EXTENDS Naturals
-CONSTANT TRACK, limit
-ASSUME limit \in Nat /\ limit > 0
-
-VARIABLE credit, playset
-Init == credit = 0 /\ playset = {}
-Inv  ==  credit \in Nat /\ credit \leq limit /\ playset \subseteq TRACK
------------------------------------------------------------------------
-
-(* A user can purchase some credits to make some selections from the
-jukebox. The limit cannot be exceeded.  *)
-
-minimum(a,b) == IF a < b THEN a ELSE b
-pay(cc) ==  cc > 0 /\ credit' = minimum(credit + cc, limit)
-
-
-(* The select action occasionally provides free selections.  The
-intention is that this should occur occasionally, and randomly.  Note that even a free selection can only be made if the credit total is positive. *)
-
-select(tt) == credit > 0 /\ (credit' = credit - 1 \/ credit' = credit)
-	 /\ playset' = playset \cup {tt}
-
-
-(* Any track that is currently in the set to be played can be output
-by this action. *)
-
-play == playset # {} /\ (\E tr \in playset: playset' = playset\{tr}) /\ UNCHANGED credit
-
-
-(* the penalty action, invoked when the jukebox is mistreated,
-either removes a credit if there are any left, or drops a tack from
-the playset, if there are any left.  If both are possible, then it can
-do either of these.*)
-
-removeCredit == credit > 0 /\ credit' = credit -1 /\ UNCHANGED playset
-dropTrack == \E tt \in playset: playset' = playset\{tt} /\ UNCHANGED credit
-penalty == removeCredit \/ dropTrack
-
-
-(* Disjunction of all actions *)
-
-Next == \/ (\E cc \in Nat: pay(cc))
-	\/ (\E tt \in TRACK: select(tt))
-	\/ play
-	\/ penalty
-
-=======================================================================
+-------------------------- MODULE Jukebox -----------------------------
+EXTENDS Naturals
+CONSTANT TRACK, limit
+ASSUME limit \in Nat /\ limit > 0
+
+VARIABLE credit, playset
+Init == credit = 0 /\ playset = {}
+Inv  ==  credit \in Nat /\ credit \leq limit /\ playset \subseteq TRACK
+-----------------------------------------------------------------------
+
+(* A user can purchase some credits to make some selections from the
+jukebox. The limit cannot be exceeded.  *)
+
+minimum(a,b) == IF a < b THEN a ELSE b
+pay(cc) ==  cc > 0 /\ credit' = minimum(credit + cc, limit)
+
+
+(* The select action occasionally provides free selections.  The
+intention is that this should occur occasionally, and randomly.  Note that even a free selection can only be made if the credit total is positive. *)
+
+select(tt) == credit > 0 /\ (credit' = credit - 1 \/ credit' = credit)
+	 /\ playset' = playset \cup {tt}
+
+
+(* Any track that is currently in the set to be played can be output
+by this action. *)
+
+play == playset # {} /\ (\E tr \in playset: playset' = playset\{tr}) /\ UNCHANGED credit
+
+
+(* the penalty action, invoked when the jukebox is mistreated,
+either removes a credit if there are any left, or drops a tack from
+the playset, if there are any left.  If both are possible, then it can
+do either of these.*)
+
+removeCredit == credit > 0 /\ credit' = credit -1 /\ UNCHANGED playset
+dropTrack == \E tt \in playset: playset' = playset\{tt} /\ UNCHANGED credit
+penalty == removeCredit \/ dropTrack
+
+
+(* Disjunction of all actions *)
+
+Next == \/ (\E cc \in Nat: pay(cc))
+	\/ (\E tt \in TRACK: select(tt))
+	\/ play
+	\/ penalty
+
+=======================================================================
diff --git a/src/test/resources/regression/Queens/Queens.cfg b/src/test/resources/regression/Queens/Queens.cfg
index f4de133b686366e3e6ac5098eb8d2734d459ddd3..717b05cb74f6edc705d59240b6610f46cc0ab264 100644
--- a/src/test/resources/regression/Queens/Queens.cfg
+++ b/src/test/resources/regression/Queens/Queens.cfg
@@ -1,2 +1,2 @@
-INIT Init
+INIT Init
 NEXT Solve
\ No newline at end of file
diff --git a/src/test/resources/regression/Queens/Queens.mch b/src/test/resources/regression/Queens/Queens.mch
index fafa8565590097078c66768b2b607e6083eb9293..12255a4d2fcf3e084d24ff1e9fb79afea8489ae8 100644
--- a/src/test/resources/regression/Queens/Queens.mch
+++ b/src/test/resources/regression/Queens/Queens.mch
@@ -1,19 +1,19 @@
-MACHINE Queens
-VARIABLES q, n, solved
-INVARIANT
- q : POW(INTEGER*INTEGER)
- & n : INTEGER
- & solved : INTEGER
-INITIALISATION
- q, n, solved:(q = %i.(i : 1 .. 2| 0)
- & n = 7
- & solved = 0)
-OPERATIONS
- Solve_Op = ANY q_n, n_n, solved_n
-	WHERE q_n : POW(INTEGER*INTEGER) & n_n : INTEGER & solved_n : INTEGER & solved = 0
-	 & q_n : 1 .. n --> 1 .. n
-	 & !i.(i : 1 .. n => !j.(j : 2 .. n => (i < j => q_n(i) /= q_n(j) & q_n(i) + (i - j) /= q_n(j) & q_n(i) - i + j /= q_n(j))))
-	 & solved_n = 1
-	 & n_n = n
-	THEN q, n, solved := q_n, n_n, solved_n END
-END
+MACHINE Queens
+VARIABLES q, n, solved
+INVARIANT
+ q : POW(INTEGER*INTEGER)
+ & n : INTEGER
+ & solved : INTEGER
+INITIALISATION
+ q, n, solved:(q = %i.(i : 1 .. 2| 0)
+ & n = 7
+ & solved = 0)
+OPERATIONS
+ Solve_Op = ANY q_n, n_n, solved_n
+	WHERE q_n : POW(INTEGER*INTEGER) & n_n : INTEGER & solved_n : INTEGER & solved = 0
+	 & q_n : 1 .. n --> 1 .. n
+	 & !i.(i : 1 .. n => !j.(j : 2 .. n => (i < j => q_n(i) /= q_n(j) & q_n(i) + (i - j) /= q_n(j) & q_n(i) - i + j /= q_n(j))))
+	 & solved_n = 1
+	 & n_n = n
+	THEN q, n, solved := q_n, n_n, solved_n END
+END
diff --git a/src/test/resources/regression/Queens/Queens2.cfg b/src/test/resources/regression/Queens/Queens2.cfg
index ac11778eb3b8b6b8991288bc9e419219926ae0c8..d2dafcfdba013024244d3360e23c8d1f69bbc405 100644
--- a/src/test/resources/regression/Queens/Queens2.cfg
+++ b/src/test/resources/regression/Queens/Queens2.cfg
@@ -1,5 +1,5 @@
-INIT Init
-NEXT PlaceQueen
-INVARIANT TypeInvariant Invariant
-CONSTANTS
+INIT Init
+NEXT PlaceQueen
+INVARIANT TypeInvariant Invariant
+CONSTANTS
 N =5
\ No newline at end of file
diff --git a/src/test/resources/regression/Queens/Queens2.tla b/src/test/resources/regression/Queens/Queens2.tla
index 0c466eaf9a2ff44745b1910d733404371e3cb178..04885c4dbe149e81441b422677595cd2113c8f70 100644
--- a/src/test/resources/regression/Queens/Queens2.tla
+++ b/src/test/resources/regression/Queens/Queens2.tla
@@ -1,85 +1,85 @@
-------------------------------- MODULE Queens2 -------------------------------
-EXTENDS Naturals, Sequences
-(***************************************************************************)
-(* Formulation of the N-queens problem and an iterative algorithm to solve *)
-(* the problem in TLA+. Since there must be exactly one queen in every row *)
-(* we represent placements of queens as functions of the form              *)
-(*    queens \in [ 1..N -> 1..N ]                                          *)
-(* where queens[i] gives the column of the queen in row i. Note that such  *)
-(* a function is just a sequence of length N.                              *)
-(* We will also consider partial solutions, also represented as sequences  *)
-(* of length \leq N.                                                       *)
-(***************************************************************************)
-
-CONSTANT N              \** number of queens and size of the board
-ASSUME N \in Nat \ {0}
-
-(* The following predicate determines if queens i and j attack each other
-   in a placement of queens (represented by a sequence as above). *)
-Attacks(queens,i,j) ==
-  \/ queens[i] = queens[j]                 \** same column
-  \/ queens[i] - queens[j] = i - j         \** first diagonal
-  \/ queens[j] - queens[i] = i - j         \** second diagonal
-
-(* A placement represents a (partial) solution if no two different queens
-   attack each other in it. *)
-IsSolution(queens) ==
-  \A i \in 1 .. Len(queens)-1 : \A j \in i+1 .. Len(queens) : 
-       ~ Attacks(queens,i,j) 
-
-(* Compute the set of solutions of the N-queens problem. *)
-Solutions == { queens \in [1..N -> 1..N] : IsSolution(queens) }
-
-(***************************************************************************)
-(* We now describe an algorithm that iteratively computes the set of       *)
-(* solutions of the N-queens problem by successively placing queens.       *)
-(* The current state of the algorithm is given by two variables:           *)
-(* - todo contains a set of partial solutions,                             *)
-(* - sols contains the set of full solutions found so far.                 *)
-(* At every step, the algorithm picks some partial solution and computes   *)
-(* all possible extensions by the next queen. If N queens have been placed *)
-(* these extensions are in fact full solutions, otherwise they are added   *)
-(* to the set todo.                                                        *)
-(***************************************************************************)
-
-VARIABLES todo, sols
-
-Init == /\ todo = { << >> }   \** << >> is a partial (but not full) solution
-        /\ sols = {}          \** no full solution found so far
-
-PlaceQueen == \E queens \in todo :
-  \** extend some partial solution by placing the next queen
-  LET nxtQ == Len(queens) + 1   \** number of queen to place
-      cols == \** set of columns on which queen can be placed without any
-              \** conflict with some queen already placed
-              { c \in 1..N : ~ \E i \in 1 .. Len(queens) :
-                                  Attacks( Append(queens, c), i, nxtQ ) }
-      exts == { Append(queens, c) : c \in cols }  \** possible extensions
-  IN  IF nxtQ = N  \** completed solution
-      THEN /\ todo' = todo \ {queens}
-           /\ sols' = sols \union exts
-      ELSE /\ todo' = (todo \ {queens}) \union exts
-           /\ sols' = sols
-
-vars == <<todo,sols>>
-Spec == Init /\ [][PlaceQueen]_vars /\ WF_vars(PlaceQueen)
-
-TypeInvariant ==
-  /\ todo \in SUBSET Seq(1 .. N) /\ \A s \in todo : Len(s) < N
-  /\ sols \in SUBSET Seq(1 .. N) /\ \A s \in sols : Len(s) = N
-
-(* The set of sols contains only solutions, and contains all solutions
-   when todo is empty. *)
-Invariant ==
-  /\ sols \subseteq Solutions
-  /\ todo = {} => Solutions \subseteq sols
-
-Termination == <>(todo = {})
-
-(* Assert that no solutions are ever computed so that TLC displays one *)
-NoSolutions == sols = {}
-
-=============================================================================
-\* Modification History
-\* Last modified Sat Dec 11 09:58:48 CET 2010 by merz
-\* Created Sat Dec 11 08:50:24 CET 2010 by merz
+------------------------------- MODULE Queens2 -------------------------------
+EXTENDS Naturals, Sequences
+(***************************************************************************)
+(* Formulation of the N-queens problem and an iterative algorithm to solve *)
+(* the problem in TLA+. Since there must be exactly one queen in every row *)
+(* we represent placements of queens as functions of the form              *)
+(*    queens \in [ 1..N -> 1..N ]                                          *)
+(* where queens[i] gives the column of the queen in row i. Note that such  *)
+(* a function is just a sequence of length N.                              *)
+(* We will also consider partial solutions, also represented as sequences  *)
+(* of length \leq N.                                                       *)
+(***************************************************************************)
+
+CONSTANT N              \** number of queens and size of the board
+ASSUME N \in Nat \ {0}
+
+(* The following predicate determines if queens i and j attack each other
+   in a placement of queens (represented by a sequence as above). *)
+Attacks(queens,i,j) ==
+  \/ queens[i] = queens[j]                 \** same column
+  \/ queens[i] - queens[j] = i - j         \** first diagonal
+  \/ queens[j] - queens[i] = i - j         \** second diagonal
+
+(* A placement represents a (partial) solution if no two different queens
+   attack each other in it. *)
+IsSolution(queens) ==
+  \A i \in 1 .. Len(queens)-1 : \A j \in i+1 .. Len(queens) : 
+       ~ Attacks(queens,i,j) 
+
+(* Compute the set of solutions of the N-queens problem. *)
+Solutions == { queens \in [1..N -> 1..N] : IsSolution(queens) }
+
+(***************************************************************************)
+(* We now describe an algorithm that iteratively computes the set of       *)
+(* solutions of the N-queens problem by successively placing queens.       *)
+(* The current state of the algorithm is given by two variables:           *)
+(* - todo contains a set of partial solutions,                             *)
+(* - sols contains the set of full solutions found so far.                 *)
+(* At every step, the algorithm picks some partial solution and computes   *)
+(* all possible extensions by the next queen. If N queens have been placed *)
+(* these extensions are in fact full solutions, otherwise they are added   *)
+(* to the set todo.                                                        *)
+(***************************************************************************)
+
+VARIABLES todo, sols
+
+Init == /\ todo = { << >> }   \** << >> is a partial (but not full) solution
+        /\ sols = {}          \** no full solution found so far
+
+PlaceQueen == \E queens \in todo :
+  \** extend some partial solution by placing the next queen
+  LET nxtQ == Len(queens) + 1   \** number of queen to place
+      cols == \** set of columns on which queen can be placed without any
+              \** conflict with some queen already placed
+              { c \in 1..N : ~ \E i \in 1 .. Len(queens) :
+                                  Attacks( Append(queens, c), i, nxtQ ) }
+      exts == { Append(queens, c) : c \in cols }  \** possible extensions
+  IN  IF nxtQ = N  \** completed solution
+      THEN /\ todo' = todo \ {queens}
+           /\ sols' = sols \union exts
+      ELSE /\ todo' = (todo \ {queens}) \union exts
+           /\ sols' = sols
+
+vars == <<todo,sols>>
+Spec == Init /\ [][PlaceQueen]_vars /\ WF_vars(PlaceQueen)
+
+TypeInvariant ==
+  /\ todo \in SUBSET Seq(1 .. N) /\ \A s \in todo : Len(s) < N
+  /\ sols \in SUBSET Seq(1 .. N) /\ \A s \in sols : Len(s) = N
+
+(* The set of sols contains only solutions, and contains all solutions
+   when todo is empty. *)
+Invariant ==
+  /\ sols \subseteq Solutions
+  /\ todo = {} => Solutions \subseteq sols
+
+Termination == <>(todo = {})
+
+(* Assert that no solutions are ever computed so that TLC displays one *)
+NoSolutions == sols = {}
+
+=============================================================================
+\* Modification History
+\* Last modified Sat Dec 11 09:58:48 CET 2010 by merz
+\* Created Sat Dec 11 08:50:24 CET 2010 by merz
diff --git a/src/test/resources/regression/RecursiveFunction/RecursiveFunction.mch b/src/test/resources/regression/RecursiveFunction/RecursiveFunction.mch
index 4f24de357d3586b3298c7c9bcbb7e291ecac7c53..8aec8ef83fe1bb85d06f5a4feddc6d49b92c4233 100644
--- a/src/test/resources/regression/RecursiveFunction/RecursiveFunction.mch
+++ b/src/test/resources/regression/RecursiveFunction/RecursiveFunction.mch
@@ -1,11 +1,11 @@
-MACHINE RecursiveFunction
-ABSTRACT_CONSTANTS k, k2, k3, fact
-PROPERTIES
- k : INTEGER
- & k2 : INTEGER
- & k3 : INTEGER
- & k = fact(0) & k2 = fact(3) & k3 = fact(4)
- & fact = %n.(n : NATURAL & n = 0 | 1) \/ %n.(n : NATURAL & not(n = 0) | n * fact(n - 1))
-DEFINITIONS
- IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE)
-END
+MACHINE RecursiveFunction
+ABSTRACT_CONSTANTS k, k2, k3, fact
+PROPERTIES
+ k : INTEGER
+ & k2 : INTEGER
+ & k3 : INTEGER
+ & k = fact(0) & k2 = fact(3) & k3 = fact(4)
+ & fact = %n.(n : NATURAL & n = 0 | 1) \/ %n.(n : NATURAL & not(n = 0) | n * fact(n - 1))
+DEFINITIONS
+ IF_THEN_ELSE(P, a, b) == (%t_.(t_ = TRUE & P = TRUE | a )\/%t_.(t_= TRUE & not(P= TRUE) | b ))(TRUE)
+END
diff --git a/src/test/resources/regression/RecursiveFunction/RecursiveFunction.tla b/src/test/resources/regression/RecursiveFunction/RecursiveFunction.tla
index 958c71a1be9f6f155df4d1c517a4cc99335e1145..de32356f99b882da4b2adb535c0e15af46a23d2f 100644
--- a/src/test/resources/regression/RecursiveFunction/RecursiveFunction.tla
+++ b/src/test/resources/regression/RecursiveFunction/RecursiveFunction.tla
@@ -1,7 +1,7 @@
------ MODULE RecursiveFunction -----
-EXTENDS Naturals
-CONSTANTS k, k2, k3
-fact[n \in Nat] == IF n = 0 THEN 1 ELSE n * fact[n-1]
-ASSUME k = fact[0] /\ k2 = fact[3] /\ k3 = fact[4]
-=======================
-
+----- MODULE RecursiveFunction -----
+EXTENDS Naturals
+CONSTANTS k, k2, k3
+fact[n \in Nat] == IF n = 0 THEN 1 ELSE n * fact[n-1]
+ASSUME k = fact[0] /\ k2 = fact[3] /\ k3 = fact[4]
+=======================
+
diff --git a/src/test/resources/regression/Scheduler/Scheduler.cfg b/src/test/resources/regression/Scheduler/Scheduler.cfg
index 5d1dbd39ff05ef5075420c2f426df29f659b6dfe..01b6bc623c0d923067988a0dc7d4892833743ab0 100644
--- a/src/test/resources/regression/Scheduler/Scheduler.cfg
+++ b/src/test/resources/regression/Scheduler/Scheduler.cfg
@@ -1,5 +1,5 @@
-INIT Init
-NEXT Next
-INVARIANT Inv
-CONSTANTS
-PID = {p1,p2,p3,p4,p5,p6,p7}
+INIT Init
+NEXT Next
+INVARIANT Inv
+CONSTANTS
+PID = {p1,p2,p3,p4,p5,p6,p7}
diff --git a/src/test/resources/regression/Scheduler/Scheduler.mch b/src/test/resources/regression/Scheduler/Scheduler.mch
index 7bb32cbd8c3997cdef1a7c61990d0442b5e5ef42..6c31d69d11809506e2edd70d181e6a6e8387b8b7 100644
--- a/src/test/resources/regression/Scheduler/Scheduler.mch
+++ b/src/test/resources/regression/Scheduler/Scheduler.mch
@@ -1,48 +1,48 @@
-MACHINE Scheduler
-SETS
- ENUM1 = {p1, p2, p3, p4, p5, p6, p7}
-ABSTRACT_CONSTANTS PID
-PROPERTIES
- PID = ENUM1
-DEFINITIONS
- Inv == active : POW(PID) & ready : POW(PID) & waiting : POW(PID) & active <: PID & ready <: PID & waiting <: PID & ready /\ waiting = {} & card(active) <= 1 & (active = {} => ready = {});
-
- new(pp) == pp /: active & pp /: ready \/ waiting & waiting_n = waiting \/ {pp} & TRUE = TRUE;
-
- del(pp) == pp : waiting & waiting_n = waiting - {pp} & TRUE = TRUE;
-
- ready_(rr) == rr : waiting & waiting_n = waiting - {rr} & ((active = {} 
-	  => active_n = {rr} & ready_n = ready) 
-	 & (not(active = {}) 
-	  => ready_n = ready \/ {rr} & active_n = active))
-VARIABLES active, ready, waiting
-INVARIANT
- active : POW(ENUM1)
- & ready : POW(ENUM1)
- & waiting : POW(ENUM1)
- & Inv
-INITIALISATION
- active, ready, waiting:(active = {} & ready = {} & waiting = {})
-OPERATIONS
- new_Op(pp) = ANY waiting_n
-	WHERE pp : PID & 
-	 waiting_n : POW(ENUM1) & new(pp)
-	THEN waiting := waiting_n END;
-
- del_Op(pp) = ANY waiting_n
-	WHERE pp : PID & 
-	 waiting_n : POW(ENUM1) & del(pp)
-	THEN waiting := waiting_n END;
-
- ready__Op(rr) = ANY active_n, ready_n, waiting_n
-	WHERE rr : PID & 
-	 active_n : POW(ENUM1) & ready_n : POW(ENUM1) & waiting_n : POW(ENUM1) & ready_(rr)
-	THEN active, ready, waiting := active_n, ready_n, waiting_n END;
-
- swap_Op = ANY active_n, ready_n, waiting_n
-	WHERE active_n : POW(ENUM1) & ready_n : POW(ENUM1) & waiting_n : POW(ENUM1) & active /= {} & waiting_n = waiting \/ active & ((ready = {} 
-	  => active_n = {} & ready_n = ready) 
-	 & (not(ready = {}) 
-	  => #pp.(pp : ready & (active_n = {pp} & ready_n = ready - {pp}))))
-	THEN active, ready, waiting := active_n, ready_n, waiting_n END
-END
+MACHINE Scheduler
+SETS
+ ENUM1 = {p1, p2, p3, p4, p5, p6, p7}
+ABSTRACT_CONSTANTS PID
+PROPERTIES
+ PID = ENUM1
+DEFINITIONS
+ Inv == active : POW(PID) & ready : POW(PID) & waiting : POW(PID) & active <: PID & ready <: PID & waiting <: PID & ready /\ waiting = {} & card(active) <= 1 & (active = {} => ready = {});
+
+ new(pp) == pp /: active & pp /: ready \/ waiting & waiting_n = waiting \/ {pp} & TRUE = TRUE;
+
+ del(pp) == pp : waiting & waiting_n = waiting - {pp} & TRUE = TRUE;
+
+ ready_(rr) == rr : waiting & waiting_n = waiting - {rr} & ((active = {} 
+	  => active_n = {rr} & ready_n = ready) 
+	 & (not(active = {}) 
+	  => ready_n = ready \/ {rr} & active_n = active))
+VARIABLES active, ready, waiting
+INVARIANT
+ active : POW(ENUM1)
+ & ready : POW(ENUM1)
+ & waiting : POW(ENUM1)
+ & Inv
+INITIALISATION
+ active, ready, waiting:(active = {} & ready = {} & waiting = {})
+OPERATIONS
+ new_Op(pp) = ANY waiting_n
+	WHERE pp : PID & 
+	 waiting_n : POW(ENUM1) & new(pp)
+	THEN waiting := waiting_n END;
+
+ del_Op(pp) = ANY waiting_n
+	WHERE pp : PID & 
+	 waiting_n : POW(ENUM1) & del(pp)
+	THEN waiting := waiting_n END;
+
+ ready__Op(rr) = ANY active_n, ready_n, waiting_n
+	WHERE rr : PID & 
+	 active_n : POW(ENUM1) & ready_n : POW(ENUM1) & waiting_n : POW(ENUM1) & ready_(rr)
+	THEN active, ready, waiting := active_n, ready_n, waiting_n END;
+
+ swap_Op = ANY active_n, ready_n, waiting_n
+	WHERE active_n : POW(ENUM1) & ready_n : POW(ENUM1) & waiting_n : POW(ENUM1) & active /= {} & waiting_n = waiting \/ active & ((ready = {} 
+	  => active_n = {} & ready_n = ready) 
+	 & (not(ready = {}) 
+	  => #pp.(pp : ready & (active_n = {pp} & ready_n = ready - {pp}))))
+	THEN active, ready, waiting := active_n, ready_n, waiting_n END
+END
diff --git a/src/test/resources/regression/Scheduler/Scheduler.tla b/src/test/resources/regression/Scheduler/Scheduler.tla
index f93545ac3ffba7e5f97646eb10d33032f4d6b4bb..75720a05ffe75a3499790174848c01d4a1be725a 100644
--- a/src/test/resources/regression/Scheduler/Scheduler.tla
+++ b/src/test/resources/regression/Scheduler/Scheduler.tla
@@ -1,29 +1,29 @@
------------------------------- MODULE Scheduler ------------------------------- 
-EXTENDS Naturals, FiniteSets
-CONSTANTS PID
-VARIABLES active, ready, waiting
-Inv == active \in SUBSET(PID) /\ ready \in SUBSET(PID) /\ waiting \in SUBSET(PID)
-	 /\ active \subseteq PID /\ ready \subseteq PID /\ waiting \subseteq PID
-	/\ (ready \cap waiting) = {} /\ Cardinality(active) \leq 1
-	/\ (active = {} => ready = {})
-Init == active = {} /\ ready = {} /\ waiting = {}
-------------------------------------------------------------------------------
-new(pp) == pp \notin active /\ pp \notin (ready \cup waiting) /\ waiting' = waiting \cup {pp} /\ UNCHANGED <<ready,active>>
-
-del(pp) == pp \in waiting /\ waiting' = waiting\{pp} /\ UNCHANGED <<ready,active>>
-
-ready_(rr) == rr \in waiting /\ waiting' =  waiting\{rr} /\
-	IF active = {} THEN active' = {rr} /\ UNCHANGED ready
-	ELSE ready' = ready \cup {rr} /\ UNCHANGED active
-
-swap == active # {} /\ waiting' = waiting \cup active 
-	/\ IF ready = {} THEN active' = {} /\ UNCHANGED ready
-	ELSE \E pp \in ready: active' ={pp} /\ ready' = ready\{pp}
-
-
-
-Next ==  \/ (\E pp \in PID : new(pp))
-	\/ (\E pp \in PID : del(pp))
-	\/ (\E rr \in PID : ready_(rr))
-	\/ swap
-=============================================================================
+------------------------------ MODULE Scheduler ------------------------------- 
+EXTENDS Naturals, FiniteSets
+CONSTANTS PID
+VARIABLES active, ready, waiting
+Inv == active \in SUBSET(PID) /\ ready \in SUBSET(PID) /\ waiting \in SUBSET(PID)
+	 /\ active \subseteq PID /\ ready \subseteq PID /\ waiting \subseteq PID
+	/\ (ready \cap waiting) = {} /\ Cardinality(active) \leq 1
+	/\ (active = {} => ready = {})
+Init == active = {} /\ ready = {} /\ waiting = {}
+------------------------------------------------------------------------------
+new(pp) == pp \notin active /\ pp \notin (ready \cup waiting) /\ waiting' = waiting \cup {pp} /\ UNCHANGED <<ready,active>>
+
+del(pp) == pp \in waiting /\ waiting' = waiting\{pp} /\ UNCHANGED <<ready,active>>
+
+ready_(rr) == rr \in waiting /\ waiting' =  waiting\{rr} /\
+	IF active = {} THEN active' = {rr} /\ UNCHANGED ready
+	ELSE ready' = ready \cup {rr} /\ UNCHANGED active
+
+swap == active # {} /\ waiting' = waiting \cup active 
+	/\ IF ready = {} THEN active' = {} /\ UNCHANGED ready
+	ELSE \E pp \in ready: active' ={pp} /\ ready' = ready\{pp}
+
+
+
+Next ==  \/ (\E pp \in PID : new(pp))
+	\/ (\E pp \in PID : del(pp))
+	\/ (\E rr \in PID : ready_(rr))
+	\/ swap
+=============================================================================
diff --git a/src/test/resources/typechecking/modules/Counter2.tla b/src/test/resources/typechecking/modules/Counter2.tla
index 2dd5137a1f1f4d3037c43842a6982cf26b90edfa..087ff777f9339ddbc1e8b854fea22529bff7c8aa 100644
--- a/src/test/resources/typechecking/modules/Counter2.tla
+++ b/src/test/resources/typechecking/modules/Counter2.tla
@@ -1,10 +1,10 @@
--------------------------- MODULE Counter2 -----------------------------
-EXTENDS Naturals
-CONSTANTS start
-VARIABLE x
------------------------------------------------------------------------
-Init  ==  x = start
-plus(a,b) == a + b
-Inc == x' = plus(x, 2)
-Next  ==  Inc
-=======================================================================
+-------------------------- MODULE Counter2 -----------------------------
+EXTENDS Naturals
+CONSTANTS start
+VARIABLE x
+-----------------------------------------------------------------------
+Init  ==  x = start
+plus(a,b) == a + b
+Inc == x' = plus(x, 2)
+Next  ==  Inc
+=======================================================================
diff --git a/src/test/resources/typechecking/modules/ExtendsCounter.tla b/src/test/resources/typechecking/modules/ExtendsCounter.tla
index 224a5f096b79157393b654f41a8051c909514e02..c0b3513f1690b78fd722aa22657fa06f1b81d84c 100644
--- a/src/test/resources/typechecking/modules/ExtendsCounter.tla
+++ b/src/test/resources/typechecking/modules/ExtendsCounter.tla
@@ -1,3 +1,3 @@
--------------- MODULE ExtendsCounter ----------------
-EXTENDS Counter
-=================================
+-------------- MODULE ExtendsCounter ----------------
+EXTENDS Counter
+=================================
diff --git a/src/test/resources/typechecking/modules/InstCounter.tla b/src/test/resources/typechecking/modules/InstCounter.tla
index a79c0aeca4fc2564b0ba525da66e42fd6e612ce4..2f69e14b8733f54dd520a074fc852201543487dd 100644
--- a/src/test/resources/typechecking/modules/InstCounter.tla
+++ b/src/test/resources/typechecking/modules/InstCounter.tla
@@ -1,11 +1,11 @@
--------------------------- MODULE InstCounter -----------------------------
-EXTENDS Naturals
-CONSTANTS k
-VARIABLE u
-bar == 1
-inst == INSTANCE Counter WITH x <- u, start <- bar + k
-inst2 == INSTANCE Counter WITH x <- u, start <- bar + inst!val
-Init == inst!Init
-
------------------------------------------------------------------------
+-------------------------- MODULE InstCounter -----------------------------
+EXTENDS Naturals
+CONSTANTS k
+VARIABLE u
+bar == 1
+inst == INSTANCE Counter WITH x <- u, start <- bar + k
+inst2 == INSTANCE Counter WITH x <- u, start <- bar + inst!val
+Init == inst!Init
+
+-----------------------------------------------------------------------
 =======================================================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/InstanceValue.tla b/src/test/resources/typechecking/modules/InstanceValue.tla
index 2e9335379f0e026861ae317e4dc180b88307f882..bb4836499cca819402e6e57a6dd8995453817c54 100644
--- a/src/test/resources/typechecking/modules/InstanceValue.tla
+++ b/src/test/resources/typechecking/modules/InstanceValue.tla
@@ -1,5 +1,5 @@
--------------- MODULE InstanceValue ----------------
-CONSTANTS c2, val2
-INSTANCE Value WITH val <- val2, c <- c2
-ASSUME def
+-------------- MODULE InstanceValue ----------------
+CONSTANTS c2, val2
+INSTANCE Value WITH val <- val2, c <- c2
+ASSUME def
 =================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/InstanceValue2Times.tla b/src/test/resources/typechecking/modules/InstanceValue2Times.tla
index 949f9ad1668c2532dc184b9257f9cb6aeeac5067..55340819e07a0535c905155a3ac823e0f5a229ed 100644
--- a/src/test/resources/typechecking/modules/InstanceValue2Times.tla
+++ b/src/test/resources/typechecking/modules/InstanceValue2Times.tla
@@ -1,6 +1,6 @@
- -------------- MODULE InstanceValue2Times ----------------
-CONSTANTS k, k2
-Inst == INSTANCE Value WITH val <- 1, c <- k
-Inst2 == INSTANCE Value WITH val <- TRUE, c <- k2
-ASSUME Inst!def /\ Inst2!def
+ -------------- MODULE InstanceValue2Times ----------------
+CONSTANTS k, k2
+Inst == INSTANCE Value WITH val <- 1, c <- k
+Inst2 == INSTANCE Value WITH val <- TRUE, c <- k2
+ASSUME Inst!def /\ Inst2!def
 =================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/InstanceValues2Times.tla b/src/test/resources/typechecking/modules/InstanceValues2Times.tla
index 949f9ad1668c2532dc184b9257f9cb6aeeac5067..55340819e07a0535c905155a3ac823e0f5a229ed 100644
--- a/src/test/resources/typechecking/modules/InstanceValues2Times.tla
+++ b/src/test/resources/typechecking/modules/InstanceValues2Times.tla
@@ -1,6 +1,6 @@
- -------------- MODULE InstanceValue2Times ----------------
-CONSTANTS k, k2
-Inst == INSTANCE Value WITH val <- 1, c <- k
-Inst2 == INSTANCE Value WITH val <- TRUE, c <- k2
-ASSUME Inst!def /\ Inst2!def
+ -------------- MODULE InstanceValue2Times ----------------
+CONSTANTS k, k2
+Inst == INSTANCE Value WITH val <- 1, c <- k
+Inst2 == INSTANCE Value WITH val <- TRUE, c <- k2
+ASSUME Inst!def /\ Inst2!def
 =================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/NamedInstanceCounter.tla b/src/test/resources/typechecking/modules/NamedInstanceCounter.tla
index 7d242f88d24195b6e5630dae50ca0ff00909bdb6..2d3c4bf74efb83033a8ea166a4f47ed6ab79c0a4 100644
--- a/src/test/resources/typechecking/modules/NamedInstanceCounter.tla
+++ b/src/test/resources/typechecking/modules/NamedInstanceCounter.tla
@@ -1,7 +1,7 @@
--------------- MODULE NamedInstanceCounter ----------------
-CONSTANTS start
-VARIABLES c
-count == INSTANCE Counter WITH x <- c
-Init == count!Init
-Next == count!Next
+-------------- MODULE NamedInstanceCounter ----------------
+CONSTANTS start
+VARIABLES c
+count == INSTANCE Counter WITH x <- c
+Init == count!Init
+Next == count!Next
 =================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/NamedInstancePoly.tla b/src/test/resources/typechecking/modules/NamedInstancePoly.tla
index bb4b9b3a6c9f580f32fc34271007bd57c025b533..8ff23845f9376024ec38e21e1ad8f0d3e9534650 100644
--- a/src/test/resources/typechecking/modules/NamedInstancePoly.tla
+++ b/src/test/resources/typechecking/modules/NamedInstancePoly.tla
@@ -1,5 +1,5 @@
--------------- MODULE NamedInstancePoly ----------------
-VARIABLES c
-count == INSTANCE Poly WITH x <- c
-Init == count!foo = 1
+-------------- MODULE NamedInstancePoly ----------------
+VARIABLES c
+count == INSTANCE Poly WITH x <- c
+Init == count!foo = 1
 =================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/NamedInstancePoly2.tla b/src/test/resources/typechecking/modules/NamedInstancePoly2.tla
index 85944c43bb260107065ab8cd7e85d9d4804a9b32..90f722a42c716d0936dbb97e598d56489c47046e 100644
--- a/src/test/resources/typechecking/modules/NamedInstancePoly2.tla
+++ b/src/test/resources/typechecking/modules/NamedInstancePoly2.tla
@@ -1,5 +1,5 @@
--------------- MODULE NamedInstancePoly2 ----------------
-VARIABLES c
-count == INSTANCE Poly WITH x <- c
-Init == count!bar(1)
+-------------- MODULE NamedInstancePoly2 ----------------
+VARIABLES c
+count == INSTANCE Poly WITH x <- c
+Init == count!bar(1)
 =================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/NamedInstancePoly3.tla b/src/test/resources/typechecking/modules/NamedInstancePoly3.tla
index 77e062761ac7671415347a04be0ae4f8efa0248b..ba44cba357c27271c21753aff921aad385502050 100644
--- a/src/test/resources/typechecking/modules/NamedInstancePoly3.tla
+++ b/src/test/resources/typechecking/modules/NamedInstancePoly3.tla
@@ -1,8 +1,8 @@
------------ MODULE NamedInstancePoly3 ----------------
-VARIABLES c, c2
-count == INSTANCE Poly WITH x <- c
-count2 == INSTANCE Poly WITH x <- c2
-foo == count!foo = TRUE
-foo2 == count2!foo = 1
-Init == foo /\ foo2
+----------- MODULE NamedInstancePoly3 ----------------
+VARIABLES c, c2
+count == INSTANCE Poly WITH x <- c
+count2 == INSTANCE Poly WITH x <- c2
+foo == count!foo = TRUE
+foo2 == count2!foo = 1
+Init == foo /\ foo2
 =================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/NamedInstancePoly4.tla b/src/test/resources/typechecking/modules/NamedInstancePoly4.tla
index 7ac2ec82c584a3bb0a23510e792a49b17213b63f..8f348b65ddfdec4467658431b5de8c39ad549511 100644
--- a/src/test/resources/typechecking/modules/NamedInstancePoly4.tla
+++ b/src/test/resources/typechecking/modules/NamedInstancePoly4.tla
@@ -1,7 +1,7 @@
--------------- MODULE NamedInstancePoly4 ----------------
-CONSTANTS k
-VARIABLES c
-poly == INSTANCE Poly WITH x <- c
-Init == poly!foo = TRUE
-ASSUME poly!baz(1,k)
+-------------- MODULE NamedInstancePoly4 ----------------
+CONSTANTS k
+VARIABLES c
+poly == INSTANCE Poly WITH x <- c
+Init == poly!foo = TRUE
+ASSUME poly!baz(1,k)
 =================================
\ No newline at end of file
diff --git a/src/test/resources/typechecking/modules/Poly.tla b/src/test/resources/typechecking/modules/Poly.tla
index b4d1d8121ea07062557e4375e25525538bc929c3..2243719affd471ca3890db7da943e6d6bfb0ca64 100644
--- a/src/test/resources/typechecking/modules/Poly.tla
+++ b/src/test/resources/typechecking/modules/Poly.tla
@@ -1,7 +1,7 @@
--------------------------- MODULE Poly -----------------------------
-VARIABLE x
------------------------------------------------------------------------
-foo  ==  x
-bar(a) == x = a
-baz(a,b) == a = b
-=======================================================================
+-------------------------- MODULE Poly -----------------------------
+VARIABLE x
+-----------------------------------------------------------------------
+foo  ==  x
+bar(a) == x = a
+baz(a,b) == a = b
+=======================================================================
diff --git a/src/test/resources/typechecking/modules/ext.tla b/src/test/resources/typechecking/modules/ext.tla
index 68c7e74cd63fe6b97117aff2451ba70f9c7e04a5..81505de28948af73bcaf66dbdd6e430f836dd5f7 100644
--- a/src/test/resources/typechecking/modules/ext.tla
+++ b/src/test/resources/typechecking/modules/ext.tla
@@ -1,9 +1,9 @@
--------------------------- MODULE ext-----------------------------
-EXTENDS Naturals
------------------------------------------------------------------------
-
-ext1 == 1
-ext2 == 1
-ext5 == 1
-ext3 == 1
-=======================================================================
+-------------------------- MODULE ext-----------------------------
+EXTENDS Naturals
+-----------------------------------------------------------------------
+
+ext1 == 1
+ext2 == 1
+ext5 == 1
+ext3 == 1
+=======================================================================
diff --git a/src/test/resources/typechecking/modules/test.tla b/src/test/resources/typechecking/modules/test.tla
index 53debdc3b0700c5ebcf810ca420c0b7720dd80ad..0760eb56c423aaf9664559e1be78d3ba081461f0 100644
--- a/src/test/resources/typechecking/modules/test.tla
+++ b/src/test/resources/typechecking/modules/test.tla
@@ -1,5 +1,5 @@
--------------------------- MODULE test-----------------------------
-cc == INSTANCE ext
------------------------------------------------------------------------
-test == 1
-=======================================================================
+-------------------------- MODULE test-----------------------------
+cc == INSTANCE ext
+-----------------------------------------------------------------------
+test == 1
+=======================================================================