This is a pre-copyedited, author-produced version of an article accepted for publication in Journal of Computer and System Sciences following peer review. The version of record is available at http://www.sciencedirect.com/science/article/pii/S0022000017300272