Why Logic? From Natural Language to Formal Reasoning

Unit 5: Introduction to Logic in AI — Section 5.1

Imagine you are programming a medical triage system. A nurse enters the note: "The patient has a fever or an infection." Should the system flag the patient for antibiotics? For fluids? For both? The answer depends entirely on what "or" means — and English does not say.

The Ambiguity Problem

Natural language evolved for human communication, not machine reasoning. Humans fill gaps with context, tone, shared history, and intuition. Computers have none of those shortcuts. When a program must act on a sentence, every word must have exactly one meaning.

Consider these three sentences:

  1. "I saw the man with the telescope."

  2. "Flying planes can be dangerous."

  3. "Every student failed a test."

Each is grammatically correct English. Each is also deeply ambiguous.

Sentence 1 could mean you used a telescope to see the man, or the man you saw was holding a telescope. Sentence 2 could mean that the act of piloting planes is dangerous, or that planes currently in flight are a hazard. Sentence 3 could mean there is one specific test that every student failed, or that each student failed some test (possibly a different one for each student).

Before reading on, try resolving the three ambiguities above on your own.

For each sentence, write out both interpretations in plain English. Then consider: if you had to give a yes/no instruction to a machine based on sentence 3, which interpretation would you choose — and how would you write a rule that forced that specific meaning?

Human readers handle ambiguity effortlessly because they bring world knowledge to the interpretation. An AI system processing medical records, scheduling flights, or grading exams does not have that luxury. It must act on exactly what it is told, and it must act consistently every time.

Ambiguity

A property of a statement or expression that admits more than one valid interpretation. Natural language is rife with ambiguity at the levels of individual words (lexical ambiguity), sentence structure (syntactic ambiguity), and intended scope (scope ambiguity). Formal logic eliminates all three by enforcing precise syntax and unambiguous semantics.

What Formal Logic Provides

Formal logic is a mathematical language with three key properties that natural language lacks.

Precise syntax. A formal language has an exact grammar that specifies which strings of symbols are legal formulas and which are not. There is no guessing. Either P ∧ Q is a well-formed formula or it is not — and the rules decide, not context.

Unambiguous semantics. Every legal formula has an interpretation rule that assigns it a truth value given a description of the world. The symbol always means inclusive-or: true when at least one side is true. The meaning does not shift depending on who is reading.

Sound inference. Logical inference rules are guaranteed to preserve truth. If the premises are true and you apply a valid rule, the conclusion is necessarily true. This lets AI systems derive new facts with certainty, not just probability.

The three properties of formal logic — precise syntax, unambiguous semantics, and sound inference — are exactly what AI systems need to represent knowledge reliably and reason correctly. Natural language has none of these properties by default.

Propositions: The Atoms of Logic

The simplest unit of formal logic is the proposition — a declarative statement that is either true or false, but not both, and not neither.

Proposition

A declarative statement with a definite truth value. A proposition is either true (T) or false (F). Questions, commands, and expressions whose truth depends on an unspecified variable are not propositions.

Propositions:

  • "The sky is blue." (True)

  • "2 + 2 = 5." (False, but still a proposition — it makes a definite claim)

  • "Charlotte, NC is the capital of North Carolina." (False)

  • "Python is a programming language." (True)

Not propositions:

  • "What time is it?" (a question, not a claim)

  • "Close the door." (a command)

  • "x + 2 = 5" (truth depends on the value of x — it is a predicate, not a proposition)

  • "This statement is false." (a paradox with no consistent truth value)

In propositional logic, we typically name propositions with capital letters: P, Q, R. These stand for atomic facts about the world — "it is raining," "the door is locked," "the patient has a fever." We can then build complex statements by combining atoms with connectives.

From English to Logic: A First Look

The key move in formalization is replacing ambiguous English words with precise logical symbols. Consider the medical example from the opening of this section.

English: "The patient has a fever or an infection."

Step 1 — Identify the atomic claims: * Let F = "The patient has a fever." * Let I = "The patient has an infection."

Step 2 — Choose the correct connective: * F ∨ I (inclusive-or): true if the patient has a fever, an infection, or both. * (F ∨ I) ∧ ¬(F ∧ I) (exclusive-or): true if the patient has exactly one of the two.

The English sentence is ambiguous between these two. The formal notation is not. Choosing F ∨ I commits to inclusive-or; choosing the exclusive-or formula commits to the other interpretation. The doctor who writes the rule must decide, once, which was intended. After that, the system applies the rule consistently every time.

Translating ambiguous English into precise logic:

| English Statement | Interpretation | Logical Formula | |---|---|---| | "Fever or infection" (inclusive) | At least one condition | F ∨ I | | "Fever or infection, not both" | Exactly one condition | (F ∨ I) ∧ ¬(F ∧ I) | | "If it rains, the ground is wet" | Conditional rule | R → W | | "The patient is sick and fatigued" | Both conditions | S ∧ T | | "The system is not compromised" | Negation | ¬C |

Each formula captures a precise, single meaning. Each English sentence (without context) could mean something slightly different.

Why AI Systems Cannot Work Without Logic

Consider three areas where AI must reason formally.

Knowledge representation. An AI must store facts about the world in a way that supports reasoning. Storing raw text fails because the system cannot "know" that "mammals nurse their young" and "whales are mammals" together imply "whales nurse their young." Logical representation makes the implication explicit and machine-processable.

Automated decision-making. Expert systems and rule engines operate by matching facts against stored rules. A rule like "If the patient has fever AND elevated white blood cell count, THEN consider bacterial infection" only works if the system can evaluate the conjunction of two conditions. That requires propositional logic.

Verification and correctness. Safety-critical software (autopilots, insulin pumps, pacemakers) must be provably correct. Formal methods use logic to mathematically verify that software behaves as specified under all possible inputs. No amount of testing can provide that guarantee — but logic can.

The Intel Pentium FDIV bug of 1994 cost Intel approximately $475 million in replacement chips. The error was a flaw in the floating-point division unit that testing failed to catch. Modern chip designs use formal verification — automated logical proof — to check that hardware behaves correctly for every possible input, not just the ones testers thought to try.

The Formalization Process

Translating a real-world problem into formal logic is called formalization. It is as much an art as a science, and it requires careful thought about what the formula is supposed to capture.

Five steps for formalizing an English statement:

  1. Identify the atomic facts. What are the simplest true/false claims in the sentence?

  2. Name each atom. Assign a letter or short label (P, Q, R, or descriptive names like Fever, Infected).

  3. Identify the logical connectives. Does the sentence say "and," "or," "not," "if…​then," "if and only if"?

  4. Resolve ambiguities. When the English is unclear (especially with "or"), decide which interpretation is intended.

  5. Build the formula. Combine atoms and connectives using parentheses to make scope explicit.

Formalization

The process of translating a natural language statement into a formal logical formula. Good formalization preserves the intended meaning of the original statement while eliminating all ambiguity. Formalization always requires a human decision about intended meaning — the formal language enforces precision, but it cannot supply intention.

Beyond Propositions: A Preview

Propositional logic handles statements about specific, named situations. But many important statements are general. "All mammals are warm-blooded" is not a statement about one mammal — it is a claim about every mammal that exists or could exist.

Propositional logic cannot express this efficiently. You would need one statement for every mammal: "Dog is warm-blooded," "Cat is warm-blooded," "Whale is warm-blooded," and so on forever.

First-order logic (covered in Section 5.5) introduces variables and quantifiers that let us write a single formula covering all cases:

∀x (Mammal(x) → WarmBlooded(x))

"For all x, if x is a mammal, then x is warm-blooded."

One formula, infinite coverage. This is why first-order logic is the standard representation language for AI knowledge bases.

Formal logic solves the three fundamental problems that natural language poses for AI: ambiguity of meaning, inability to verify correctness, and inability to derive new facts automatically. Propositional logic is the foundation; first-order logic extends it to handle general statements about objects and their relationships.

Test your understanding of why AI needs formal logic.


Adapted from forall x: Calgary by P.D. Magnus et al., licensed under CC BY 4.0.

This work is licensed under CC BY-SA 4.0.