A question is a query with typed holes (Foundations, part 2)
Part 2 of Foundations. Part 1 argued similarity isn't memory. This one's about what a question actually is.
Ask "Who directed the film that won Best Picture in 2020?" and you haven't asked for text that looks like your words. You've drawn a shape: some unknown person, connected by a directed edge to a film, which is connected by a won edge to an award, pinned to a year. The question is a small graph with one piece missing — a hole. And the hole isn't anonymous. It's typed. Whatever fills it has to be a person.
This idea has serious ancestry, and I want the credits on the record. Montague made the founding bet back in the 1970s: natural language is a formal language, translatable into logic by rules. The program stalled on coverage, but the bet was right. Semantic parsing — the whole line of work turning questions into database queries — carried it forward and made it practical. And database theory gave us the exact object a question becomes: the conjunctive query, a pattern of variables and relations that either maps into your data or doesn't. The result we lean on hardest is Yannakakis's algorithm (1981): for the tree-shaped queries natural questions almost always are, you can match efficiently and completely. No missed answers. No wasted search.
Why typed holes change everything
The whole question squeezes every part. In a query graph, every edge touching a variable narrows it. That person-hole doesn't get filled by scanning all people — it gets squeezed through the film, which gets squeezed through the award and the year. Systems that break questions into independent keyword lookups throw this away. That's why they hand you the 2005 remake when you asked about the 1997 original.
The match is the proof. When the pattern maps into memory, the map itself tells you which stored fact witnessed each edge and what filled each hole. The answer shows up with its evidence attached. Not a score — a derivation.
Failure tells you something. When no map exists, the algorithm knows exactly which edge couldn't be witnessed. "I know a film that won Best Picture in 2020, but I have no directed-by fact for it" beats silence by a mile. It tells you what's missing — which tells you what to feed the memory next.
The genuinely hard part
Getting from a sentence to that typed graph is the front half of the problem, and it's where most of our engineering lives. The same machinery that reads statements has to read questions — one reader, two purposes — so the question's math and the memory's math can never disagree about what words mean. A statement is a pattern with no holes. A question is the same pattern with some.
That symmetry is the quiet thesis of this whole series: understanding a question and remembering a fact are the same act, pointed in opposite directions.