public bool IsInCNF() { return(rules.All(r => { return r.Value.All(rs => { switch (rs.Count()) { case 1: return TS.IsSupersetOf(rs.Symbols); case 2: return NTS.IsSupersetOf(rs.Symbols); default: return false; } }) && (r.Key.Symbols[0].Equals(S) || r.Value.All(rs => !rs.Contains(""))); })); }