public static Module createTuple(int n) {

	if (n <= 1) {
	    return null; 
	}

	ModuleName modName = new ModuleName(n+"TUPLE");
	Module result = new Module(Module.INITIAL, modName);
    
	try {
	    result.importModule(createBool());

	    // create n parameters
	    Module triv = createTriv();
	    for (int i=1; i<=n; i++) {
		result.addParameter("C"+i, triv, new HashMap());
	    }

	    result.levels = new int[] { n };
	    
	    // define sort nTuple
	    InitialSort tuple = new InitialSort("Tuple"+n, modName);
	    result.addSort(tuple);

	    // define operation << ... >>
            String compName = "<<";
	    for (int i=1; i<n; i++) {
		compName += "_;";
	    }
	    compName += "_>>";

	    Sort[] elts = result.getSortsByName("Elt");
	    Sort[] args = new Sort[n];
	    for (int i=0; i<elts.length; i++) {
		args[i] = elts[n-i-1];
	    }

	    Operation comp = new Operation(compName, args, tuple, modName);
	    result.addOperation(comp);
	    
	    // define projection 1* 2* ... n*
	    ArrayList oplist = new ArrayList();
	    for (int i=1; i<=n; i++) {
		Operation proj = new Operation(i+"*_", 
					       new Sort[] { tuple },
					       args[i-1],
					       modName);
		result.addOperation(proj);
		oplist.add(proj);
	    }

	    // define variables e1 : Elt , ..., en : Elt 
	    ArrayList varlist = new ArrayList();
	    Term[] terms = new Term[n];

	    for (int i=1; i<=n; i++) {
		Variable var = new Variable("e"+i, 
					    args[i-1]);
		result.addVariable(var);
	        varlist.add(var);
		terms[i-1] = new Term(var);
	    }

	    // define equations for projections
	    Term share = new Term(comp, terms);
	    for (int i=1; i<=n; i++) {
		Term left = new Term((Operation)oplist.get(i-1),
				     new Term[] { share } );
		Term right = terms[i-1];
		Equation eq = new Equation(left, right);
		result.equations.add(eq);
	    }

	} catch (Exception e) { 
	}
	return result;     

    }