Quick Answer
In a formal system, syntax is the set of rules for which strings of symbols count as legitimate expressions of the language. Semantics is the rule for assigning meaning (typically truth-values, denotations, or structures) to those expressions.
A few illustrations.
- The string
(p ∧ q)is syntactically well-formed in propositional logic. The stringp ∧ ∧ qis not. - Once we fix an interpretation that assigns truth-values to atomic letters, the well-formed string
(p ∧ q)means "the conjunction of and is true under the assignment iff both and are." - Syntax tells you which derivations are legal proofs. Semantics tells you which sentences are true in which models.
This page is the philosophical and formal-systems version of the syntax-vs-semantics distinction. The linguistic version, sentence structure (syntax) versus sentence meaning (semantics) in natural languages, is a different topic with overlapping vocabulary. For the linguistic treatment, see LinguisticsPath. For the philosophy of language treatment of meaning and reference, that lives separately under philosophy-of-language and is not the same distinction.
Side by Side
| Syntax | Semantics | |
|---|---|---|
| What it studies | Strings, grammars, derivation rules | Truth, models, denotation, satisfaction |
| Primary objects | Symbols, formulas, proofs | Structures, valuations, interpretations |
| Mode of evaluation | Mechanical: does this string follow the rules? | Truth-conditional: in this structure, does this formula hold? |
| Standard relation | ( is derivable from ) | ( is true in every model of ) |
| Failure mode | Syntactic ill-formedness, ungrammaticality | Semantic falsehood, lack of model |
| Example legality | "Is ∀x (P(x) → Q(x)) a well-formed formula?" | "Does ∀x (P(x) → Q(x)) hold in the structure ?" |
The two sides answer different questions. They are connected by the soundness-completeness bridge below, but they are not the same.
Why the Distinction Exists
Before Tarski, " is true" was treated as primitive, the property truth applied to the sentence directly. This led to the well-known semantic paradoxes (the Liar being the canonical case: "this sentence is false"). Tarski's 1933 The Concept of Truth in Formalized Languages showed that for formalized languages the paradox dissolves once truth is defined relative to a structure (an interpretation specifying what the symbols denote) and stratified across an object language and a metalanguage containing it.
The pivotal insight: truth is not a property of strings considered alone; it is a relation between strings and structures. Syntactic properties live at the level of the strings. Semantic properties live at the level of the relation. Conflating them is what produced the paradox.
This split made formal logic possible as a precise mathematical discipline, and it is the conceptual foundation of model theory, formal semantics, and substantial parts of theoretical computer science.
A Worked Example: Propositional Logic
Take a tiny formal system: propositional logic with atomic letters and connectives .
Syntax
The alphabet is the set .
The formation rules (the grammar):
- Any atomic letter is a well-formed formula (wff).
- If is a wff, so is .
- If and are wffs, so are , , .
- Nothing else is a wff.
By these rules, is a wff. The string is not.
The proof rules (one possible system, natural deduction):
- ∧-introduction: from and , derive .
- ∧-elimination: from , derive (or ).
- →-elimination (modus ponens): from and , derive .
- And several more.
A derivation of from a set is a finite sequence of wffs ending in , where each wff is either in or follows from earlier wffs by a proof rule. We write when such a derivation exists. Note: this is a purely syntactic notion. No mention of truth.
Semantics
A valuation is a function assigning each atomic letter a truth-value in .
Given a valuation, we extend to all wffs by the standard truth-functional rules:
- iff .
- iff .
- iff or .
- iff or .
A formula is semantically valid (a tautology) iff for every valuation . We write .
We write to mean: every valuation that makes every member of true also makes true. This is semantic consequence.
Note again: this is a purely semantic notion. No mention of proofs.
The Bridge
The two notions agree.
Soundness theorem (propositional logic): implies . If you can prove it, it is true in every model of the premises.
Completeness theorem (propositional logic, Post 1921; first-order logic, Gödel 1929): implies . If it is true in every model of the premises, you can prove it.
The two together: . The syntactic and semantic notions of consequence coincide.
This is not trivial. Soundness is straightforward (the proof rules were designed to preserve truth). Completeness is hard: it says the proof rules are enough, every semantically valid argument has a syntactic proof. That this holds for first-order logic is one of the central results of modern mathematical logic.
For higher-order logic and certain stronger systems, completeness fails (Lindström's theorems characterize this). The bridge is robust for first-order logic but does not extend automatically.
A Worked Example: Arithmetic and Gödel
The cleanest place to see the syntax-semantics gap matter is Gödel's incompleteness theorems.
Consider Peano arithmetic (PA), the standard formal axiomatization of the natural numbers with addition and multiplication.
- Syntactic statement: a sentence is provable in PA, written , iff there is a finite derivation of from the PA axioms using the proof rules of first-order logic.
- Semantic statement: a sentence is true in the standard model of arithmetic iff it holds when interpreted on the natural numbers with the standard addition and multiplication.
For propositional logic and pure first-order logic, completeness gives us iff . For PA, the picture is sharper.
Gödel's first incompleteness theorem (1931). There is a sentence in the language of PA such that is true in the standard model of arithmetic but not provable in PA. Symbolically, but .
The two notions of consequence, syntactic provability in PA, semantic truth on , come apart for any sufficiently strong formal system that includes arithmetic. The Gödel sentence is true; the system cannot prove it.
This is why the syntax-semantics distinction is not a curiosity. It is the framework that lets us say what Gödel's theorem says.
Where the Distinction Bites
Three live applications.
Soundness vs completeness in proof assistants. A proof assistant like Lean or Coq is sound by design: any proof it accepts is a valid derivation in the underlying type theory. Whether it is complete, whether every true statement of mathematics is derivable in its system, depends on the system. Most foundational systems are deliberately incomplete (Gödel) for known reasons.
Tarski-style truth-conditional semantics. When linguists or philosophers use "truth-conditional semantics" they are using Tarski's framework: assign a model, define truth in the model recursively, and identify the meaning of a sentence with its truth-conditions across models. The distinction between formal syntactic structure and semantic interpretation is what makes this enterprise rigorous.
Reasoning under inconsistency. A classical-logic system in which one inconsistency is provable can derive anything (the principle of explosion: ). Paraconsistent logics are designed so that this syntactic explosion does not happen, useful when reasoning over inconsistent legal codes, databases, or historical sources.
Common Confusions
Confusion 1: well-formed = true. A string can be syntactically well-formed and semantically false. "All transformers are reptiles" is grammatical English and a well-formed first-order sentence; it is also obviously false. Well-formedness is necessary for evaluation; it is not sufficient for truth.
Confusion 2: provable = true. Provability is relative to a formal system. A statement provable in classical logic may not be provable in intuitionistic logic; a statement provable in PA + a strong axiom may not be provable in PA alone. Truth (in the semantic sense) is relative to a model. The two are connected by soundness and completeness for systems where the bridge holds; they remain distinct concepts.
Confusion 3: syntactic vs linguistic syntax. The syntax studied in formal logic and the syntax studied in theoretical linguistics share a vocabulary but are different objects. Linguistic syntax studies the structure of natural-language sentences (constituency, dependency, transformations). Formal-system syntax studies the rules for legal strings in a designed language. Both live under "syntax" in the broad sense. This page is on the formal-system version. The linguistic-syntax page lives on LinguisticsPath, and the boundary between the two domains is documented in the path-network ownership registry.
Confusion 4: model = semantics, valuation = syntax. A common slip in introductory texts. The valuation is part of the semantics: it specifies which atoms are true. The syntax is the formula's structure independent of any valuation.
Exercises
For each pair, decide whether the two strings are (a) the same well-formed formula, (b) two different well-formed formulas, or (c) at least one is not a well-formed formula at all.
- versus (the same up to outer parentheses).
- versus .
- versus .
For each formula, decide whether it is a propositional tautology (true under every valuation), a contradiction (false under every valuation), or contingent (true under some, false under others).
- .
- .
- .
For each pair , decide whether .
- , .
- , .
- , .
Answers
- (a) Same up to convention on outer parentheses. The two strings are typically treated as notational variants; whether the outer parentheses are required is a convention of the specific syntax.
- (b) Different. associates to the right by convention, so the second is the standard reading of . The first is its left-bracketed variant. They differ on the valuation , try it and see which evaluates to and which to .
- (c) The second string is not well-formed. Connectives in standard infix notation appear between operands; violates the formation rule.
- Tautology. Often called the "weakening" tautology: anything implies that anything implies it. Verify by truth table.
- Contradiction. A statement and its negation cannot both be true under any valuation.
- Contingent. Take : the antecedent is T, the consequent is T, the whole conditional is T. Take : the antecedent is T, the consequent is F, the whole is F. Therefore contingent.
- Yes (). Modus ponens is semantically valid.
- No. This is denying the antecedent. From , neither nor follows. Counterexample valuation: makes the premises true and false.
- Yes. Disjunctive syllogism. From and , must hold.
Prerequisites and Next Pages
- Prerequisite: What Is Logic?, the broader frame.
- Prerequisite: Validity vs Soundness, the argument-level distinction this page extends to the system level.
- Next: What Is a Symbolic System?, the foundational notion behind formal-system syntax.
- Next: The Chinese Room Argument, Searle's argument that syntactic symbol manipulation alone does not suffice for semantic understanding.
References
Primary texts:
- Tarski, Alfred. "The Concept of Truth in Formalized Languages." 1933. Polish original; English in Logic, Semantics, Metamathematics, Oxford, 1956.
- Tarski, Alfred. "On the Concept of Logical Consequence." 1936. The model-theoretic definition of .
- Gödel, Kurt. "Über die Vollständigkeit des Logikkalküls" (Completeness of first-order logic). 1929 dissertation; "Über formal unentscheidbare Sätze..." (incompleteness for arithmetic). 1931.
Modern reference:
- Mendelson, Elliott. Introduction to Mathematical Logic. CRC Press, 6th ed. 2015. Standard graduate-level treatment of syntax, semantics, soundness, and completeness for first-order logic.
- Enderton, Herbert. A Mathematical Introduction to Logic. Academic Press, 2nd ed. 2001. Cleaner notation; equivalent depth.
- Boolos, George, John Burgess, and Richard Jeffrey. Computability and Logic. Cambridge, 5th ed. 2007. Covers the syntax-semantics-computability triangle including Gödel.
Stanford Encyclopedia entries (link, not paraphrase):
- "Tarski's Truth Definitions."
- "Classical Logic", covers the syntax-semantics-bridge for propositional and first-order logic.
- "Model Theory."
- "Gödel's Incompleteness Theorems", where the syntactic-semantic gap genuinely cannot be closed.