anchor.diff:                                    then true
                                     else false) newRules)) 
           then newRules.Remove(rule) |> ignore 
  +  //  for rule in toAdd do
  +    //    let nt = snd(getElements rule.body [] [] true) 
  +      //  let c = (fst (collectNontermsAndUnitRules (newRules |> Seq.toList))) |> Seq.filter (fun x -> )
       if startIsEps then 
           let start = (Seq.find (fun x -> x.isStart = true) newRules).name
           newRules.Add(createRule start [] (PSeq([], None, None)) true [] ) |> ignore
  
positive.code:                                                                   |> List.map (fun x -> createRule rule.name rule.args (PNeg(PSeq(x, None, None))) rule.isStart rule.metaArgs)
                                                         createRule rule.name rule.args (createConj (pos @ neg |> List.toSeq)) rule.isStart rule.metaArgs |> filter))
                      else
                          newRules.UnionWith(rulesToAdd 
                                             |> Seq.collect 
                                                (fun x -> 
                                                         let pos = fst elements |> List.map (fun x -> createRule rule.name rule.args (PSeq(x, None, None)) rule.isStart rule.metaArgs)
                                                         let neg = List.except([c]) (snd elements) |> List.map (fun x -> createRule rule.name rule.args (PNeg(PSeq(x, None, None))) rule.isStart rule.metaArgs)
                                                         let altsWithNegList = 
                                                             if List.isEmpty (fst (getElements x.body [] [] true) |> List.filter (fun x -> not (List.isEmpty x)) |> List.map (fun x -> createRule rule.name rule.args (PNeg(PSeq(x, None, None))) rule.isStart rule.metaArgs))
                                                             then [createRule rule.name rule.args (createConj (pos @ neg |> List.toSeq)) rule.isStart rule.metaArgs]                                                                          
                                                             else
                                                                 (fst (getElements x.body [] [] true) |> List.filter (fun x -> not (List.isEmpty x)) |> List.map (fun x -> createRule rule.name rule.args (PNeg(PSeq(x, None, None))) rule.isStart rule.metaArgs))
                                                                  |> List.map (fun x -> createRule rule.name rule.args (PConj(x.body, createConj (pos @ neg |> List.toSeq))) rule.isStart rule.metaArgs)
                                                         let altsList = 
                                                             if List.isEmpty (snd (getElements x.body [] [] true) |> List.filter(fun x -> not (List.isEmpty x)) |> List.map (fun x -> createRule rule.name rule.args (PSeq(x, None, None)) rule.isStart rule.metaArgs))
                                                             then altsWithNegList                                                                         
                                                             else
                                                                 (snd (getElements x.body [] [] true) |> List.filter (fun x -> not (List.isEmpty x)) |> List.map (fun x -> createRule rule.name rule.args (PSeq(x, None, None)) rule.isStart rule.metaArgs))
                                                                  |> List.map (fun x -> createRule rule.name rule.args (PConj(x.body, createConj altsWithNegList)) rule.isStart rule.metaArgs)                                                     
                                                         altsList |> Seq.map filter))                 
                  newRules.Remove(rule) |> ignore
          oldRules.Clear()
          oldRules.UnionWith(newRules)
  
negative.code:                 then newRules.Add(b1.[0]) |> ignore
                  else newRules.Add(createRule rule.name rule.args (createConj (b1 @ b2)) rule.isStart rule.metaArgs) |> ignore
              if (fst elements).Length = 0 && (snd elements).Length > 2 && el.Length = 1 && match el.[0].rule with PToken t -> true | _ -> false 
              then toAdd.Add(rule) |> ignore
          if not (Seq.isEmpty (Seq.filter (fun x -> 
                                    let el1, el2 = fst (getElements x.body [] [] true), snd(getElements x.body [] [] true) 
                                    if not (x = rule)
  