Imagine you come back to your apartment and the Wi-Fi is gone. Your first thought might be that the router is broken. But then you notice your roommate also lost connection, while your phone still has cellular service. You restart the router and nothing changes. Then you check your internet provider and see an outage in your area.

Without really thinking about it, you just performed a small chain of reasoning. You started with several observations, connected them with things you already knew, eliminated some possibilities, and eventually arrived at a conclusion.

That sounds extremely normal because humans do it constantly. But it also represents a very different way of thinking about artificial intelligence. Today, we mostly associate AI with models that learn patterns from enormous amounts of data. Give a model enough examples, and it becomes surprisingly good at predicting what should come next.

There is another tradition in AI, though, built around a slightly different question: What if we gave a machine knowledge and allowed it to reason from it?

That is the idea behind a logical agent.

An AI with a notebook

The easiest way I have found to think about a logical agent is to imagine an AI carrying around a notebook. Inside the notebook are things it believes to be true:

  • The router has power.
  • My computer cannot connect.
  • My roommate's computer cannot connect either.

It might also contain general rules:

  • If multiple devices cannot connect, the problem probably isn't one specific device.
  • If the router has no connection to the provider, restarting a laptop will not fix the problem.

Whenever the agent observes something new, it adds that information to its notebook. Then it can ask questions about what follows from everything written there. In classical AI, this notebook is called a knowledge base.

The terminology is almost charmingly simple. New information is added using an operation called TELL, while questions are made using ASK. The important requirement is that the agent's conclusions must actually follow from what is in its knowledge base, rather than appearing out of nowhere.

So instead of:

Input → mysterious model → answer

We get something closer to:

Observation → knowledge → reasoning → conclusion → action

And I think that difference is more interesting than it initially sounds.

Knowing that you don't know

One of my favorite things about logical reasoning is that unknown is allowed to remain unknown. Suppose our internet agent knows: Either the router is malfunctioning or the provider is having an outage.

At this moment, it cannot simply decide that one of those explanations is true. There are three possibilities:

  • True
  • False
  • Not enough information yet

That third category matters. Humans are not always very good at respecting this gap. We often replace "I don't know" with whatever explanation seems most convenient. A logical system, at least in theory, does not get that luxury. It has to wait until there is enough information to make the next inference.

Now imagine that the agent discovers that hundreds of other customers nearby are also offline. Suddenly, one possibility becomes much stronger. The reasoning is not very sophisticated:

  • My router or my provider could be responsible.
  • Other nearby customers are also offline.
  • My individual router cannot explain their outages.
  • Therefore, the provider is the more relevant explanation.

What makes the process interesting isn't the conclusion. A human could reach it instantly. What matters is that we can describe why the conclusion changed when new knowledge arrived.

Prediction and reasoning are not the same thing

This is where logical AI begins to feel especially relevant today. Modern machine learning systems are incredibly good at recognizing patterns. Show a model thousands of pictures of dogs and eventually it can recognize another dog. Show a language model enormous amounts of text and it can become remarkably good at producing language.

This is powerful because writing explicit rules for everything in the world would be impossible. Imagine trying to define a dog with pure logic: If four legs AND fur AND tail AND... You would immediately run into exceptions. Machine learning handles these messy patterns much better.

But there are situations where we care about something slightly different. Suppose a system recommends that an industrial machine should be shut down. There is a meaningful difference between:

  • "The model predicts an 87% chance of failure."
  • "Sensor A indicates overheating, sensor B shows abnormal pressure, and according to safety rule C, those conditions require shutdown."

The first is a prediction. The second resembles an argument. Neither is automatically better; they answer different kinds of questions.

The strange little cave that explains all of this

Wumpus World — a 4x4 grid cave with a monster, pits, and gold

One of the classic examples used to explain logical agents is called Wumpus World. It is basically a tiny cave containing a monster, pits, and some gold. The agent cannot see the entire cave. Instead, it receives clues. A breeze means there is a pit nearby. A stench means the monster is nearby. By combining clues from different locations, the agent can eventually infer which places are dangerous without actually entering them.

It's a deliberately simple world, but the interesting part is not really the monster. The interesting part is this: The agent acts on things it has never directly observed.

It might never see a pit. Instead, it can reason:

  • I felt a breeze here.
  • A breeze requires a neighboring pit.
  • Two neighboring locations are already known to be safe.
  • Therefore the remaining location must contain the pit.

This kind of reasoning shows how information gathered at different moments can be combined into a conclusion about an unseen environment. That is a surprisingly deep idea hiding inside a very silly cave.

The appeal of an AI that can show its work

There is something satisfying about a system whose reasoning can be inspected. Suppose an AI concludes: Do not perform action X.

Naturally, we might ask: Why? A logical system can potentially respond with the structure of its reasoning:

  • I know A.
  • I observed B.
  • Rule C says that A and B imply D.
  • If D is true, X is unsafe.
  • Therefore I rejected X.

You can disagree with the rule. You can discover that one of the facts was wrong. You can inspect where the reasoning failed. That does not mean logical systems are magically trustworthy. A system with incorrect knowledge will still produce a bad conclusion.

But at least the mistake has somewhere to live. Maybe the fact was wrong. Maybe the rule was wrong. Maybe the inference was wrong. There is a structure that can be examined.

Logic also has a serious weakness

There is an obvious problem with all of this: someone has to give the machine its knowledge.

The real world is messy. Consider trying to create rules for determining whether someone will enjoy a movie. Or whether a photograph contains a cat. Or whether a sentence sounds sarcastic. Writing down every relevant rule would be absurd.

This is one reason learning became so crucial in AI. Supplying knowledge manually is hard, but practical intelligent systems can combine both declarative knowledge and procedural behavior. And that makes the modern question much more interesting than simply asking: Logic or machine learning?

The more interesting question might be: Where should each one take over?

A learning model is great at recognizing what is happening, but a reasoning system is better at determining what follows from it. A model can extract information from messy language, but logic can enforce constraints on what actions are actually allowed. Learning handles ambiguity well. Reasoning handles the rules we absolutely do not want the system to casually violate.

Neither one alone gets you very far. But the combination feels much closer to intelligence than either approach on its own.

Maybe intelligence needs both guessing and knowing

Humans constantly operate somewhere between these two modes. Sometimes we recognize something instantly: a face, a voice, a familiar street. We don't consciously reason our way toward the answer.

Other times, we slow down. If this is true, and that happened, then this cannot be true. One feels like pattern recognition. The other feels like reasoning.

AI has become extraordinarily impressive at the first kind. Logical agents are a reminder that there is another interesting ability hiding underneath the word "intelligence": being able to say not only what you believe, but also what made that belief follow from everything you knew before.

And as AI systems become responsible for more than generating text and pictures, I suspect that distinction is going to matter a lot more.