Three rules
One gate answers one question. Yes or no.
But connect the answer from one gate into the next, and now a gate is answering a question about a question. Do that a thousand times and you can express any rule, any condition, any comparison imaginable. Is this number bigger than that one? Is this password correct? Does this face match this photo? Every one of those is just a very long chain of yes/no questions, all the way down.
AND, OR, NOT. That's all the questions there are.
Ok, but how?