Pattern matching. Seems simple. In programming, though, I expect it's quite complicated. The definition in game is a bit ambiguous, but the programming does not match the definition. The definition does not specify that ALL attributes must be the same or different, so clearly at least one set of attributes must be different in order to form a set. But what if 3 attributes are different? The programming doesn't recognize this. I'll give an example from level 4. Colors are magenta, teal, and green. Patterns are striped, blank, and filled. Shapes are triangle, square, and circle. Only the number is the same for each in the set: two. But the programming doesn't recognize this set, even though it fits the definition.
By the way, the definition implies that it is possible to match cards that are completely identical in every way (all four attributes match) but clearly the game doesn't provide such opportunities. So perhaps the definition should be revised to clarify how the programming actually handles sets internally.