Home / AI Fundamentals & Careers / First-Order Logic: The Rules Behind the Answers
AI Fundamentals & Careers #1124 6 min read 22 views

First-Order Logic: The Rules Behind the Answers

Chatbots often get "all," "some," and "not" wrong while sounding certain. This post explains the logic behind those errors and how to check an answer before you trust it.

share

Ask a chatbot whether all of a group passed a test, and it will often answer with confidence while getting the “all” wrong. Give it a bad premise and it builds on it. Correct it and it either repeats the mistake or flips to agreement. These failures look random, but they follow a pattern, and the pattern goes back to a branch of logic from the 1800s.

Where the rules came from

Computers run on binary. A bit is either true or false, and a handful of truth functions combine those values. AND returns true only when both inputs are true. OR returns true when at least one is. NOT flips the value. Engineers turn these into logic gates, and gates are the parts that add numbers, make decisions, and store state. Everything above the hardware is built on that foundation.

Propositional logic works at that level. It handles whole statements as single units: “it rains” is true or false, and the rules tell you how to combine such statements. What it cannot do is look inside a statement.

What first-order logic adds

First-order logic, developed by Frege in 1879, lets you talk about objects and what is true of them. It adds predicates, which describe properties, and two quantifiers: “for all” and “there exists.”

Take the classic example. “All humans are mortal. Socrates is human. So Socrates is mortal.” In first-order notation, that becomes a universal rule (every x that is human is mortal), one fact about Socrates, and a conclusion that follows by a fixed rule. The conclusion is not a guess. If the premises are true, the conclusion must be true.

That guarantee is the whole point of the system. A machine can check it step by step.

Symbolic AI kept the guarantees

Early AI took this seriously. Expert systems stored facts and rules and answered questions by deduction. Prolog, a language built on a subset of first-order logic, let a program answer “is Socrates mortal?” by working through the rules. The answer was only as good as the rules, but it was traceable. You could see exactly why the system said what it said.

Symbolic systems were brittle, though. Writing rules for the messy real world was slow, and the systems struggled with language. That is part of why the field moved toward statistical models.

Where LLMs fit

Large language models don’t run first-order logic. They learned from text, which contains plenty of logical reasoning, but they predict likely next words rather than apply rules. The result is fluent reasoning that usually works and sometimes doesn’t, with no built-in way to tell which is which.

Researchers have measured the gaps. A 2023 study by Gupta tested models ranging from 125 million to 175 billion parameters and found that LLMs do not do as well as expected with quantifiers, and that bigger models did not reliably fix it. A separate study by Truong and colleagues found that LLMs show insensitivity to the presence of negation. Quantifiers and negation are the two places where a single word changes the entire meaning, which is why they’re hard.

A survey of language model behavior reports that autoregressive models generate more incorrect completions after “few”-type quantifiers, which ties directly to the “every vs some” problem.

A third pattern is the rain-and-match mistake. If it rains, the match is cancelled, and the match was cancelled, a model may conclude it rained. That’s affirming the consequent, and it is invalid. A recent study of syllogistic reasoning describes such conclusions as factually correct yet logically invalid, and treats accepting them as a sign of belief bias.

A 2026 ACL paper on immediate inference adds that models which solve a reasoning problem often fail on logically equivalent versions of it. That’s the same unstable behavior you see when a model caves under correction.

What the research points toward

The most promising fix is neurosymbolic. The language model translates a sentence into first-order logic, and a solver checks whether the conclusion follows. The model handles the messy language, and the logic handles the guarantee. The approach is still early, but it is the clearest attempt to recover what symbolic AI had and what statistical models dropped.

Using first-order logic with a chatbot

You don’t need to write formulas. You only need to notice three words: all, some, and not. Those are the quantifiers and negations where chatbots slip most often.

Turn the claim into a rule. Before you trust an answer, restate the claim as “every X is Y” or “some X is Y.” If the answer says “every” and the source only supports “some,” the answer is overclaiming.

Ask for one counterexample. Ask the chatbot, “Give me one case where this is false.” A universal claim (“all,” “every,” “always”) fails if you can find one exception. If the model can’t name a single case, it’s probably guessing.

Check the if-then chain. If the model says “if A, then B, and B is true, so A is true,” stop there. That’s the rain-and-match mistake. B being true doesn’t prove A. Ask, “Could B happen for another reason?”

Check the premise first. Models build on whatever you give them. If your question says “all experts agree,” the answer may accept that without checking. Ask, “Is that premise true?” before you ask for a conclusion.

Watch for “and” versus “or.” The same facts can produce different answers depending on which one the model uses. If the answer depends on both conditions, ask it to spell out each one.

A quick test you can run yourself: ask a chatbot, “Does every person in this group have access, or only some?” Then change one word in the group description and see whether the answer changes the way it should. If it doesn’t, don’t rely on the answer.

The point isn’t to become a logician. It’s to catch the one word that decides whether the answer holds.

Sources

Share this
Jaren Cudilla
Jaren Cudilla
// chaos engineer · anti-hype practitioner

I trained as a software engineer before moving into QA, and I run EngineeredAI.net. I got into this topic by testing AI answers that looked right and weren't.

// stay in the loop
Get EngineeredAI posts in your inbox
Workflow experiments, tool breakdowns, field notes. No hype. Subscribe free.
subscribe →
// Leave a Comment

What is First-Order Logic: The Rules Behind the Answers?

Ask a chatbot whether all of a group passed a test, and it will often answer with confidence while getting the "all" wrong.