E ExamMaster

Artificial Intelligence · AI Foundations

Propositional Logic

In AI because propositional logic is the simplest language in which 'the machine concluded X' has an exact meaning — and the constraint layer of modern systems still speaks it.

Before an agent can reason, its knowledge needs a language with exact meaning. Propositional logic is the smallest such language: atomic claims, four connectives, and a definition of truth so precise that a program can check it. This lesson builds that semantics from the ground up — worlds, models, and the one connective everyone misreads.

  • Artificial Intelligence
  • Medium level
  • 6 concepts

1Propositions and the knowledge base

A proposition is a claim that is definitely true or false: 'the ground is wet', 'this transfer exceeds the limit'. No third value and no matter of degree — that severity is a design choice, and it is what will later make guarantees possible.

Commands, questions and open formulas ('x > 3' with x unbound) are not propositions: there is no truth value to reason about.

A knowledge base (KB) is a set of propositions a system has accepted as true — its committed picture of the world. Everything in this topic and the next is machinery for one question: given what the KB accepts, what else must be true? The word 'must' is the whole subject.

The test is a truth value: could the sentence, exactly as it stands, be definitely true or definitely false?

Proposition or not
SentenceProposition?Why
The ground is wetyestrue or false, even if we do not know which
Close the doornoa command claims nothing
x > 3not yetno truth value until x is fixed
This transfer exceeds 10,000yesthe numbers settle it either way

2Four connectives, fixed meanings

Compound claims are built from atomic ones by four connectives, each with one fixed meaning that never depends on subject matter: \neg p (not), p \wedge q (and), p \vee q (or), p \to q (if-then).

A rules engine treats 'over limit implies block' exactly as it treats 'rain implies wet' — the machinery sees the shape of the claim, never its topic. That indifference is the feature: it is what lets one evaluator serve every domain.

Precedence mirrors arithmetic: \neg binds tightest, then \wedge, then \vee, then \to; parentheses override all of it.

The four connectives
ConnectiveRead asTrue exactly when
\neg pnot pp is false
p \wedge qp and qboth sides are true
p \vee qp or qat least one side is true
p \to qif p then qnot: p true with q false
In propositional logic, what does syntax specifically govern?
  1. The truth value assignments across possible world interpretations
  2. The execution speed of inference engines running on hardware
  3. The probability distribution assigned to atomic proposition symbols
  4. The formal rules determining which symbol arrangements constitute well-formed sentences

Syntax defines the grammatical structure of legal statements, whereas semantics defines what sentences mean and their truth values in possible worlds.

3Worlds and models

A world (an interpretation) assigns true or false to every atom — one complete way things could be. Two atoms, rain and wet, give exactly four worlds; n atoms give 2^n.

A model of a formula is a world that makes the formula true. 'Model' is a technical word here and a load-bearing one: satisfiability, validity and — next lesson — entailment are all statements about which worlds are models of what.

The exponential count is not a footnote. It is why brute-force reasoning dies around thirty atoms, why SAT solvers exist, and why the enumeration procedure in the next topic is a definition of correctness before it is a practical algorithm.

Figure. Every box is one complete way things could be: an assignment of true or false to each atom. Formulas do not create worlds; they carve this fixed set into models and non-models.

Why enumeration dies

Count the worlds a brute-force reasoner must inspect as the knowledge base grows.

  • 2 atoms: worlds = 2²4
  • 10 atoms: 2¹⁰1,024
  • 30 atoms: 2³⁰≈ 1.07 × 10⁹
  • 50 atoms: 2⁵⁰≈ 1.13 × 10¹⁵

Pro tip. A real knowledge base easily holds thousands of atoms. Model checking defines what the right answer is; SAT solvers and inference rules exist to reach it without visiting 2^n worlds.

4The conditional, precisely

'If p then q' is a promise about one specific failure: it is false exactly when p is true and q is false, and true in every other world.

The rows that surprise everyone are the false-premise rows. 'If it rained, the ground is wet' is not broken by a dry sunny day — nothing was promised about days without rain. A rule you have never triggered is a rule you have never broken.

This is why p \to q says exactly what \neg p \vee q says, and why a knowledge base full of rules stays true in worlds where no rule fires. Safety rules in deployed systems inherit the same reading: a limit that never triggered was never violated.

Figure. The full truth table for p \to q, one row per world: a single row falsifies it — true premise, false conclusion — and both false-premise rows come out true, because an untriggered promise is an unbroken one.

Reading the arrow

  1. A promise, not a causep \to q claims only this: you will not find p true with q false. No causation and no relevance — just that one excluded combination.
  2. One way to break itFind a world with p true and q false. That world, and only that world, falsifies the conditional.
  3. Untriggered is unbrokenIn every world where p is false the promise was never tested, so it stands — the two rows that read strangest in the table.

Coding lab. Print the truth table for p -> q runs in the app, with checks on your output.

5Evaluating a formula in a world

A formula gets its truth value from a world by recursion: look the atoms up, then apply the connective tables from the inside out. There is no judgement anywhere in the procedure — which is the point, since that is what lets a program do it.

The shape of the computation is the formula's own parse tree: values enter at the leaves and one value comes out at the root.

Everything later — model checking, satisfiability, the entailment lab in the next topic — is this loop run over many worlds. Make it reflexive on one world first.

Figure. The parse tree of the formula 'if rain then wet, and not rain', evaluated bottom-up in the world rain = false, wet = true: atom values enter at the leaves, each connective applies its table, and a single value leaves the root.

Inside out

  1. Atoms firstThe world hands every atom its value: here rain = false, wet = true.
  2. Connectives nextEach connective combines already-known values by its table: the conditional comes out true (false premise) and the negation comes out true.
  3. Root lastThe top connective combines the two: true AND true — the formula holds, so this world is one of its models.

One world through one formula

Evaluate (\text{rain} \to \text{wet}) \wedge \neg \text{rain} in the world where rain is false and wet is true.

  • \text{rain} \to \text{wet}, with rain falsetrue (false premise)
  • \neg \text{rain}, with rain falsetrue
  • \text{true} \wedge \text{true}true — this world is a model

6Satisfiable, valid, unsatisfiable

Three classes cover every formula. Satisfiable: true in at least one world. Valid (a tautology): true in every world. Unsatisfiable: true in none.

The classes interlock: \varphi is valid exactly when \neg\varphi is unsatisfiable, so one honest check buys the other. Every later reduction of the shape 'to prove it, refute its negation' is this line.

Deciding satisfiability is SAT — the first problem ever proved NP-complete. Modern SAT solvers nonetheless crack industrial instances with millions of clauses, which is why hardware and software verification tools encode 'can my system reach a bad state?' as a satisfiability question.

The three classes
ClassTrue in...Example
satisfiableat least one worldp \wedge q
validevery worldp \vee \neg p
unsatisfiableno worldp \wedge \neg p

Notes

  • Propositional syntax and semantics: worlds, models, and truth.
  • A proposition is a claim that is definitely true or false; connectives build compound claims with fixed meanings.
  • A world assigns a truth value to every atom, and n atoms give 2 to the n worlds.
  • 'If p then q' fails only when p is true and q is false — a false premise never breaks it.

Exam traps & shortcuts

  • 'If p then q' is false only when p is true and q is false — a false premise never breaks a rule.
  • A formula has no truth value until every atom has one: write the world down first, then evaluate.
  • Valid means true in every world, not 'true in the worlds you tried' — one unchecked world is an unproved claim.

Recap

Hold these points before the next lesson.

Propositions
A proposition is a claim that is definitely true or false; a knowledge base is a set of such claims accepted as true.
Worlds and models
A world assigns true or false to every atom; n atoms give 2 to the n worlds, and a model of a formula is a world that makes it true.
The conditional
'If p then q' is false only when p is true and q is false — a false premise never breaks it.
Satisfiable, valid, unsatisfiable
True somewhere, true everywhere, true nowhere — and 'valid' is exactly 'negation unsatisfiable'.

Practise Propositional Logic

Reading is free and needs no account. Practice, mocks and progress live in the app.

  • 1 quick check with worked explanations
  • Timed mocks scored with the real marking scheme
  • Readiness tracked per topic, kept on your device
Continue with Google — freeNo card, no trial. Works offline once installed.