sub-pattern merging