factor an opaque lemma out of path_factorization for a 2x speedup