Characterizing Pattern Matching and Its Limits on Compositional Task Structures