let delete_rule_in_tree entry =
                  let rec delete_in_tree symbols tree =
                    match (symbols, tree) with
                    | (s :: sl, Node n) ->
                        if Tools.logically_eq_symbols entry s n.node
                        then delete_son sl n
                        else
                          (match delete_in_tree symbols n.brother with
                           | Some ((dsl, t)) ->
                               Some
                                 ((dsl,
                                   (Node
                                      {
                                        node = n.node;
                                        son = n.son;
                                        brother = t;
                                      })))
                           | None -> None)
                    | (_ :: _, _) -> None
                    | ([], Node n) ->
                        (match delete_in_tree [] n.brother with
                         | Some ((dsl, t)) ->
                             Some
                               ((dsl,
                                 (Node
                                    {
                                      node = n.node;
                                      son = n.son;
                                      brother = t;
                                    })))
                         | None -> None)
                    | ([], DeadEnd-> None
                    | ([], LocAct (_, [])) -> Some (((Some []), DeadEnd))
                    | ([], LocAct (_, (action :: list))) ->
                        Some ((None, (LocAct (action, list))))
                  and delete_son sl n =
                    match delete_in_tree sl n.son with
                    | Some ((Some dsl, DeadEnd)) ->
                        Some (((Some (n.node :: dsl)), (n.brother)))
                    | Some ((Some dsl, t)) ->
                        let t =
                          Node
                            { node = n.node; son = t; brother = n.brother; }
                        in Some (((Some (n.node :: dsl)), t))
                    | Some ((None, t)) ->
                        let t =
                          Node
                            { node = n.node; son = t; brother = n.brother; }
                        in Some ((None, t))
                    | None -> None
                  in delete_in_tree