seq resolver by prolog