Topic

Syllogisms

For two thousand years logic meant the syllogism: two premises and a conclusion, each saying how two classes are related. Here validity is not looked up in a list. It is decided, by checking every way of filling in a Venn diagram, and the traditional names and rules are reported beside the answer.

Four forms of statement

FormStatementOn the Venn diagram
AAll S are PS outside P is empty
ENo S are PS inside P is empty
ISome S are PS inside P has something in it
OSome S are not PS outside P has something in it
import { categorical, categoricalText } from "@ratmath/logic";

categorical("No reptiles are mammals");     // { form: "E", subject: "reptiles", predicate: "mammals" }
categoricalText({ form: "O", subject: "birds", predicate: "fliers" });   // "Some birds are not fliers"

Mood and figure

A syllogism has three terms: the minor term S (the subject of the conclusion), the major term P (its predicate), and the middle term M, which appears in both premises and not in the conclusion. The major premise, written first, contains P. The mood is the three forms in order, and the figure (1 to 4) says where M stands:

FigureMajor premiseMinor premise
1M – PS – M
2P – MS – M
3M – PM – S
4P – MM – S

So there are 43×4=2564^3 \times 4 = 256 syllogisms. Give one in words, or by mood and figure:

import { syllogism } from "@ratmath/logic";

const s = syllogism("All men are mortal", "All Greeks are men", "All Greeks are mortal");
s.valid, s.form, s.name;    // true, "AAA-1", "Barbara"
s.terms;                    // { S: "Greeks", M: "men", P: "mortal" }
s.venn.shaded;              // ["¬SM¬P", "S¬M¬P", "S¬MP", "SM¬P"]: the regions forced empty

syllogism("EIO-2", { S: "poets", M: "rich", P: "happy" }).statements;
// ["No happy are rich", "Some poets are rich", "Some poets are not happy"]

Deciding validity

The three circles of a Venn diagram make eight regions. A statement says some regions are empty, or that some region among a few has something in it. Each of the 28=2562^8 = 256 choices of which regions have something in them either makes the premises true or not; the syllogism is valid when every choice that makes the premises true makes the conclusion true. If one does not, it is a counterexample, and the fewest occupied regions are reported.

const bad = syllogism("All dogs are animals", "All cats are animals", "All cats are dogs");
bad.valid;               // false
bad.counterexample;      // ["SM¬P"]: a cat that is an animal and not a dog
bad.rules.filter((r) => r.broken).map((r) => r.rule);
// ["the middle term is distributed at least once"]

The tests build actual sets from each counterexample, one element per occupied region, and check that the premises come out true and the conclusion false, for every invalid syllogism.

Existential import

Aristotle took every term to have members, so "All S are P" carried "Some S are P" with it. Modern logic does not: "All unicorns have horns" is true because there are no unicorns. The modern reading has 15 valid syllogisms; with existential import, nine more become valid, each with its own name.

syllogism("AAI-3").valid;              // false: "All M are P, All M are S, so Some S are P"
syllogism("AAI-3").counterexample;     // []: everything empty
syllogism("AAI-3", { existentialImport: true }).name;   // "Darapti"

validSyllogisms().map((x) => x.name).join(", ");
// "Barbara, Camestres, Calemes, Darii, Datisi, Baroco, Celarent, Cesare,
//  Ferio, Festino, Ferison, Fresison, Disamis, Dimatis, Bocardo"

The traditional rules

Medieval logicians gave rules that a valid syllogism keeps. A term is distributed when the statement says something about all of it: the subject of A and E, the predicate of E and O.

  • The middle term is distributed at least once.
  • A term distributed in the conclusion is distributed in its premise (otherwise "illicit major" or "illicit minor").
  • Not both premises are negative.
  • A negative premise needs a negative conclusion, and a negative conclusion needs a negative premise.
  • On the modern reading, two universal premises do not give a particular conclusion.

Each result lists the rules and which are broken. A syllogism is valid exactly when it breaks none, which the tests check against the Venn decision on all 256.

Reference

ExportWhat it does
categorical(text | { form, subject, predicate })A statement in one of the four forms.
categoricalText(statement)The statement in words.
syllogism(major, minor, conclusion, { existentialImport })Decide a syllogism given in words or as objects.
syllogism("AAA-1", { existentialImport, S, M, P })Decide by mood and figure, with names for the terms if you like.
resultvalid, mood, figure, form, name, terms, statements, counterexample (occupied regions), venn (shaded, marked), rules.
validSyllogisms({ existentialImport })Every valid mood and figure with its name: 15, or 24 with existential import.
Try itEdit the code and run it with @ratmath/logic and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.
Ctrl/⌘ + Enter runs