public TreeRule Normalize()
{
if (output == null)
return this;
ExprSet[] given = new ExprSet[lookahead.Length];
for (int i = 0; i < lookahead.Length; i++)
given[i] = new ExprSet(lookahead[i]);
foreach (var state_child in GetStatesOf(output))
if (!TreeTheory.IsIdentityState(state_child[0])) //filter out identity states
given[(GetVariableIndex(state_child[1])) - 1].Add(state_child[0]);
return new TreeRule(state, symbol, guard, output, given);
}