public boolean equalsHelper (Expression theorem, Expression e) {
		// base case
		if (theorem == null || e == null) {
			return true;
		} 
		
		/*  The given expression must contain at least all of the operators in the theorem. This if statement checks that all of
		 * the theorem's operators are present in the given expression.
		*/
		if (operators.contains(theorem.getRoot()) && operators.contains(e.getRoot()) && (theorem.getRoot() != (e.getRoot()))) {
			return false;
		}
		
		// Checks if a mapping exists from the variable in the theorem to variable or larger expression in the given expression
		for (Expression exp : expCompare.keySet()) {
			if (exp.equals(theorem)) {
				
				if (e.equals(expCompare.get(exp))) {
					
					return true;
				} else {
					
					//if this mapping fails, then it is not a valid use of the theorem
					return false;
				}
			}
		}
		
		// If the mapping didn't exist, create one
		expCompare.put(theorem, e);

		// Call recursively on the left and right nodes of the expressions
		return equalsHelper(theorem.getLeft(), e.getLeft()) && equalsHelper(theorem.getRight(), e.getRight()); 
	}