- In words
Equivalent forms
- Negation normal form
- Prenex form (in worlds with at least one object)
Predicate logic explorer
A truth table settles ¬(P ∧ Q) ↔ ¬P ∨ ¬Q, but it cannot tell you whether “every circle has a square next to it” is the same as “one square is next to every circle”. Those sentences are about objects, and to judge them you need a world. Here it is a board of shapes you can add, move, recolour and name. Type sentences with ∀, ∃, ¬, ∧, ∨, →, ↔ and = over predicates such as Circle, Red, LeftOf and Adjacent, and each one is marked true or false in the world in front of you, with the reason: the witness of a true ∃, the counterexample of a false ∀, and an evaluation tree that goes through the objects one at a time. Click an empty cell of the board to add an object and click an object to select it; drag it to move it, or hold Shift and press an arrow key. Shape, colour, size and name under the board change the selected object, and Delete removes it. Type sentences beside the board or pick a lesson: each one is marked true or false in the world you see, and the marks follow every change. Select a sentence to see why it has its value: the witness of a true ∃ or the counterexample of a false ∀ is marked on the board, and the evaluation tree goes through the objects one by one. Point at a line of the tree to see the objects it is about. Find a world builds a world in which every sentence is true (or has the value its goal asks for), and Search for a difference looks for a world in which two sentences disagree.
How it works
- Click the board to add objects, drag them to move them, and set shape, colour, size and name under it; the keys insert ∀, ∃ and the predicates on a phone.
- Type one or more sentences, or pick a lesson such as ∀∃ against ∃∀, and watch each sentence turn true or false as you change the world.
- Select a sentence to see why it has its value: the object that decides it is marked on the board, and the evaluation tree opens the quantifiers object by object.
Why quantifiers need a world
A propositional formula is true or false once its letters are set true or false; a sentence with quantifiers is true or false in a structure: a set of objects together with the meaning of each predicate. ∀x Circle(x) says that every object of this world is a circle, and ∃x Circle(x) that at least one is, so the same sentence can be true in one world and false in another. That is why the explorer puts a world on the screen: up to 12 objects on a 6 × 5 board, each a circle, square or triangle, red, green or blue, small or large, with the positions giving the relations LeftOf, Above, SameRow, SameColumn and Adjacent. A sentence true in every world is logically valid, and that is what the two searches are about: Find a world looks for a world in which your sentences come out as you want them, and Search for a difference tries to tell two sentences apart.
The mistakes this makes visible
“Every circle is red” is ∀x (Circle(x) → Red(x)), not ∀x (Circle(x) ∧ Red(x)), which says that every object is a red circle. “Some square is green” is ∃x (Square(x) ∧ Green(x)), not ∃x (Square(x) → Green(x)), which any object that is not a square already makes true. With no square in the world, “every square is red” and “no square is red” are both true, because an implication whose if-part fails is true: vacuous truth. And the order of two quantifiers changes the meaning, ∀x ∃y against ∃y ∀x: every circle may have its own square next to it while no single square touches all of them. Each of these pairs is a lesson, with a world in which they differ and a search that looks for one.
Frequently asked questions
What is the difference between predicate logic and propositional logic?
Propositional logic treats a statement as a whole, true or false, and combines statements with ¬, ∧, ∨, → and ↔; a truth table decides everything. Predicate logic looks inside a statement: it has objects, predicates that say something about them (Circle(x), LeftOf(x, y)) and the quantifiers ∀ and ∃. “All circles are red, this is a circle, so this is red” cannot be shown valid with truth tables, but can with quantifiers. The price is that a sentence is now true or false only in a given world, and that no table is big enough to check them all.
How do I write a sentence here?
Quantifiers are ∀ and ∃, or forall, all, every, exists and some; the connectives are ¬ ∧ ∨ → ↔, or ~, !, &, |, ->, <-> and the words not, and, or, implies, iff; ≠ is != or <>. ¬ binds tightest, then ∧, ∨, → and ↔, and → groups to the right. A quantifier reaches only over the formula right after it, so write ∀x (Circle(x) → Red(x)) with brackets or ∀x. Circle(x) → Red(x) with a dot. Variables are single letters from g to z, and a to f are names you can give to objects on the board. The predicate names are the same in every language; what each one means is on its key.
What is a free variable?
A variable no quantifier binds, as x in Circle(x) → Red(x). Such a formula is not a sentence: it has no truth value until x is given an object, so it is a property rather than a statement. The explorer flags it and marks the place, and for a single free variable it also shows how many objects have the property. The usual cause is a missing bracket: in ∀x Circle(x) → Red(x) the quantifier stops after Circle(x), which leaves the second x free.
Why does the app call a sentence vacuously true?
Because nothing in the world satisfies the if-part of its ∀. ∀x (Square(x) → Red(x)) asks every square to be red; with no square there, no object can be a counterexample, so the sentence is true, and so is ∀x (Square(x) → ¬Red(x)). This is not a quirk of the app but how the material implication of classical logic works, and it is why a mathematician adds ∃x Square(x) when there must be something to talk about. In the empty world every sentence that begins with ∀ is true and every sentence that begins with ∃ is false.
Why do you use → with ∀ but ∧ with ∃?
“All circles are red” only makes a claim about circles, so it is ∀x (Circle(x) → Red(x)): a square makes the if-part false and the line true. ∀x (Circle(x) ∧ Red(x)) would say that everything is a red circle. “Some circle is red” needs one object that is both, ∃x (Circle(x) ∧ Red(x)); with →, any square would already make it true.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Go to Editor