Complete pattern matching algorithmls