Parameter pattern matching

Can someone explain to me how parameter pattern matching works exactly?

def foo({a,b}) do
...
end
foo({1,2})

Pattern matching that happens: {a,b} = {1,2}

def equal(a,a), do: true

equal(1,1)
Pattern matching that happens?

I was wondering because if it happens like a=1 and then a=1 then equal(1,2) would have matched fine because a=1 and then a=2 is totally legal.