NWA: Move poststar, prestar, and related functions to query/automata