Move PatternMatcher to core/algorithm.