In
mathematical logic
Mathematical logic is the study of Logic#Formal logic, formal logic within mathematics. Major subareas include model theory, proof theory, set theory, and recursion theory (also known as computability theory). Research in mathematical logic com ...
,
propositional logic
The propositional calculus is a branch of logic. It is also called propositional logic, statement logic, sentential calculus, sentential logic, or sometimes zeroth-order logic. Sometimes, it is called ''first-order'' propositional logic to contra ...
and
predicate logic
First-order logic, also called predicate logic, predicate calculus, or quantificational logic, is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables ove ...
, a well-formed formula, abbreviated WFF or wff, often simply formula, is a finite
sequence
In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters. Like a set, it contains members (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is cal ...
of
symbols
A symbol is a mark, sign, or word that indicates, signifies, or is understood as representing an idea, object, or relationship. Symbols allow people to go beyond what is known or seen by creating linkages between otherwise different concep ...
from a given
alphabet
An alphabet is a standard set of letter (alphabet), letters written to represent particular sounds in a spoken language. Specifically, letters largely correspond to phonemes as the smallest sound segments that can distinguish one word from a ...
that is part of a
formal language
In logic, mathematics, computer science, and linguistics, a formal language is a set of strings whose symbols are taken from a set called "alphabet".
The alphabet of a formal language consists of symbols that concatenate into strings (also c ...
.
The abbreviation wff is pronounced "woof", or sometimes "wiff", "weff", or "whiff".
A formal language can be identified with the set of formulas in the language. A formula is a
syntactic
In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituency ...
object that can be given a semantic
meaning by means of an
interpretation. Two key uses of formulas are in propositional logic and predicate logic.
Introduction
A key use of formulas is in
propositional logic
The propositional calculus is a branch of logic. It is also called propositional logic, statement logic, sentential calculus, sentential logic, or sometimes zeroth-order logic. Sometimes, it is called ''first-order'' propositional logic to contra ...
and
predicate logic
First-order logic, also called predicate logic, predicate calculus, or quantificational logic, is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables ove ...
such as
first-order logic
First-order logic, also called predicate logic, predicate calculus, or quantificational logic, is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables over ...
. In those contexts, a formula is a string of symbols φ for which it makes sense to ask "is φ true?", once any
free variable
In mathematics, and in other disciplines involving formal languages, including mathematical logic and computer science, a variable may be said to be either free or bound. Some older books use the terms real variable and apparent variable for f ...
s in φ have been instantiated. In formal logic,
proof
Proof most often refers to:
* Proof (truth), argument or sufficient evidence for the truth of a proposition
* Alcohol proof, a measure of an alcoholic drink's strength
Proof may also refer to:
Mathematics and formal logic
* Formal proof, a co ...
s can be represented by sequences of formulas with certain properties, and the final formula in the sequence is what is proven.
Although the term "formula" may be used for written marks (for instance, on a piece of paper or chalkboard), it is more precisely understood as the sequence of symbols being expressed, with the marks being a
token instance of formula. This distinction between the vague notion of "property" and the inductively-defined notion of well-formed formula has roots in Weyl's 1910 paper "Uber die Definitionen der mathematischen Grundbegriffe". Thus the same formula may be written more than once, and a formula might in principle be so long that it cannot be written at all within the physical universe.
Formulas themselves are syntactic objects. They are given meanings by interpretations. For example, in a propositional formula, each propositional variable may be interpreted as a concrete proposition, so that the overall formula expresses a relationship between these propositions. A formula need not be interpreted, however, to be considered solely as a formula.
Propositional calculus
The formulas of
propositional calculus
The propositional calculus is a branch of logic. It is also called propositional logic, statement logic, sentential calculus, sentential logic, or sometimes zeroth-order logic. Sometimes, it is called ''first-order'' propositional logic to contra ...
, also called
propositional formulas, are expressions such as
. Their definition begins with the arbitrary choice of a set ''V'' of
propositional variable
In mathematical logic, a propositional variable (also called a sentence letter, sentential variable, or sentential letter) is an input variable (that can either be true or false) of a truth function. Propositional variables are the basic building ...
s. The alphabet consists of the letters in ''V'' along with the symbols for the
propositional connectives and parentheses "(" and ")", all of which are assumed to not be in ''V''. The formulas will be certain expressions (that is, strings of symbols) over this alphabet.
The formulas are
inductively defined as follows:
* Each propositional variable is, on its own, a formula.
* If φ is a formula, then ¬φ is a formula.
* If φ and ψ are formulas, and • is any binary connective, then ( φ • ψ) is a formula. Here • could be (but is not limited to) the usual operators ∨, ∧, →, or ↔.
This definition can also be written as a
formal grammar
A formal grammar is a set of Terminal and nonterminal symbols, symbols and the Production (computer science), production rules for rewriting some of them into every possible string of a formal language over an Alphabet (formal languages), alphabe ...
in
Backus–Naur form
In computer science, Backus–Naur form (BNF, pronounced ), also known as Backus normal form, is a notation system for defining the Syntax (programming languages), syntax of Programming language, programming languages and other Formal language, for ...
, provided the set of variables is finite:
Using this grammar, the sequence of symbols
:(((''p'' → ''q'') ∧ (''r'' → ''s'')) ∨ (¬''q'' ∧ ¬''s''))
is a formula, because it is grammatically correct. The sequence of symbols
:((''p'' → ''q'')→(''qq''))''p''))
is not a formula, because it does not conform to the grammar.
A complex formula may be difficult to read, owing to, for example, the proliferation of parentheses. To alleviate this last phenomenon, precedence rules (akin to the
standard mathematical order of operations
In mathematics and computer programming
Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing al ...
) are assumed among the operators, making some operators more binding than others. For example, assuming the precedence (from most binding to least binding) 1. ¬ 2. → 3. ∧ 4. ∨. Then the formula
:(((''p'' → ''q'') ∧ (''r'' → ''s'')) ∨ (¬''q'' ∧ ¬''s''))
may be abbreviated as
:''p'' → ''q'' ∧ ''r'' → ''s'' ∨ ¬''q'' ∧ ¬''s''
This is, however, only a convention used to simplify the written representation of a formula. If the precedence was assumed, for example, to be left-right associative, in following order: 1. ¬ 2. ∧ 3. ∨ 4. →, then the same formula above (without parentheses) would be rewritten as
:(''p'' → (''q'' ∧ ''r'')) → (''s'' ∨ (¬''q'' ∧ ¬''s''))
Predicate logic
The definition of a formula in
first-order logic
First-order logic, also called predicate logic, predicate calculus, or quantificational logic, is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables over ...
is relative to the
signature
A signature (; from , "to sign") is a depiction of someone's name, nickname, or even a simple "X" or other mark that a person writes on documents as a proof of identity and intent. Signatures are often, but not always, Handwriting, handwritt ...
of the theory at hand. This signature specifies the constant symbols, predicate symbols, and function symbols of the theory at hand, along with the
arities of the function and predicate symbols.
The definition of a formula comes in several parts. First, the set of
terms is defined recursively. Terms, informally, are expressions that represent objects from the
domain of discourse
In the formal sciences, the domain of discourse or universe of discourse (borrowing from the mathematical concept of ''universe'') is the set of entities over which certain variables of interest in some formal treatment may range.
It is also ...
.
#Any variable is a term.
#Any constant symbol from the signature is a term
#an expression of the form ''f''(''t''
1,...,''t''
''n''), where ''f'' is an ''n''-ary function symbol, and ''t''
1,...,''t''
''n'' are terms, is again a term.
The next step is to define the
atomic formula
In mathematical logic, an atomic formula (also known as an atom or a prime formula) is a formula with no deeper propositional structure, that is, a formula that contains no logical connectives or equivalently a formula that has no strict subformu ...
s.
#If ''t''
1 and ''t''
2 are terms then ''t''
1=''t''
2 is an atomic formula
#If ''R'' is an ''n''-ary predicate symbol, and ''t''
1,...,''t''
''n'' are terms, then ''R''(''t''
1,...,''t''
''n'') is an atomic formula
Finally, the set of formulas is defined to be the smallest set containing the set of atomic formulas such that the following holds:
#
is a formula when
is a formula
#
and
are formulas when
and
are formulas;
#
is a formula when
is a variable and
is a formula;
#
is a formula when
is a variable and
is a formula (alternatively,
could be defined as an abbreviation for
).
If a formula has no occurrences of
or
, for any variable
, then it is called quantifier-free. An ''existential formula'' is a formula starting with a sequence of
existential quantification
Existentialism is a family of philosophy, philosophical views and inquiry that explore the human individual's struggle to lead an Authenticity (philosophy), authentic life despite the apparent Absurdity#The Absurd, absurdity or incomprehensibili ...
followed by a quantifier-free formula.
Atomic and open formulas
An ''atomic formula'' is a formula that contains no
logical connective
In logic, a logical connective (also called a logical operator, sentential connective, or sentential operator) is a logical constant. Connectives can be used to connect logical formulas. For instance in the syntax of propositional logic, the ...
s nor
quantifiers, or equivalently a formula that has no strict subformulas.
The precise form of atomic formulas depends on the formal system under consideration; for
propositional logic
The propositional calculus is a branch of logic. It is also called propositional logic, statement logic, sentential calculus, sentential logic, or sometimes zeroth-order logic. Sometimes, it is called ''first-order'' propositional logic to contra ...
, for example, the atomic formulas are the
propositional variable
In mathematical logic, a propositional variable (also called a sentence letter, sentential variable, or sentential letter) is an input variable (that can either be true or false) of a truth function. Propositional variables are the basic building ...
s. For
predicate logic
First-order logic, also called predicate logic, predicate calculus, or quantificational logic, is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables ove ...
, the atoms are predicate symbols together with their arguments, each argument being a
term.
According to some terminology, an ''open formula'' is formed by combining atomic formulas using only logical connectives, to the exclusion of quantifiers. This is not to be confused with a formula which is not closed.
Closed formulas
A ''closed formula'', also ''
ground formula'' or ''sentence'', is a formula in which there are no
free occurrences of any
variable. If A is a formula of a first-order language in which the variables have free occurrences, then A preceded by is a ''universal closure'' of A.
Properties applicable to formulas
* A formula A in a language
is ''
valid'' if it is true for every
interpretation of
.
* A formula A in a language
is ''
satisfiable'' if it is true for some
interpretation of
.
* A formula A of the language of
arithmetic
Arithmetic is an elementary branch of mathematics that deals with numerical operations like addition, subtraction, multiplication, and division. In a wider sense, it also includes exponentiation, extraction of roots, and taking logarithms.
...
is ''decidable'' if it represents a
decidable set
In computability theory, a set of natural numbers is computable (or decidable or recursive) if there is an algorithm that computes the membership of every natural number in a finite number of steps. A set is noncomputable (or undecidable) if it is ...
, i.e. if there is an
effective method
In metalogic, mathematical logic, and computability theory, an effective method or effective procedure is a finite-time, deterministic procedure for solving a problem from a specific class. An effective method is sometimes also called a mechani ...
which, given a
substitution of the free variables of A, says that either the resulting instance of A is provable or its negation is.
Usage of the terminology
In earlier works on mathematical logic (e.g. by
Church), formulas referred to any strings of symbols and among these strings, well-formed formulas were the strings that followed the formation rules of (correct) formulas.
Several authors simply say formula. Modern usages (especially in the context of computer science with mathematical software such as
model checkers,
automated theorem prover
Automated theorem proving (also known as ATP or automated deduction) is a subfield of automated reasoning and mathematical logic dealing with proving mathematical theorems by computer programs. Automated reasoning over mathematical proof was a ma ...
s,
interactive theorem provers) tend to retain of the notion of formula only the algebraic concept and to leave the question of
well-formedness, i.e. of the concrete string representation of formulas (using this or that symbol for connectives and quantifiers, using this or that
parenthesizing convention, using
Polish or
infix
An infix is an affix inserted inside a word stem (an existing word or the core of a family of words). It contrasts with '' adfix,'' a rare term for an affix attached to the outside of a stem, such as a prefix or suffix.
When marking text for ...
notation, etc.) as a mere notational problem.
The expression "well-formed formulas" (WFF) also crept into popular culture. ''WFF'' is part of an esoteric pun used in the name of the academic game "
WFF 'N PROOF: The Game of Modern Logic", by Layman Allen, developed while he was at
Yale Law School
Yale Law School (YLS) is the law school of Yale University, a Private university, private research university in New Haven, Connecticut. It was established in 1824. The 2020–21 acceptance rate was 4%, the lowest of any law school in the United ...
(he was later a professor at the
University of Michigan
The University of Michigan (U-M, U of M, or Michigan) is a public university, public research university in Ann Arbor, Michigan, United States. Founded in 1817, it is the oldest institution of higher education in the state. The University of Mi ...
). The suite of games is designed to teach the principles of symbolic logic to children (in
Polish notation
Polish notation (PN), also known as normal Polish notation (NPN), Łukasiewicz notation, Warsaw notation, Polish prefix notation, Eastern Notation or simply prefix notation, is a mathematical notation in which Operation (mathematics), operator ...
). Its name is an echo of ''
whiffenpoof'', a
nonsense word
In linguistics, a nonce word—also called an occasionalism—is any word (lexeme), or any sequence of sounds or letters, created for a single occasion or utterance but not otherwise understood or recognized as a word in a given languag ...
used as a
cheer at
Yale University
Yale University is a Private university, private Ivy League research university in New Haven, Connecticut, United States. Founded in 1701, Yale is the List of Colonial Colleges, third-oldest institution of higher education in the United Stat ...
made popular in ''The Whiffenpoof Song'' and
The Whiffenpoofs.
[Allen (1965) acknowledges the pun.]
See also
*
Ground expression
*
Well-defined expression
In mathematics, a well-defined expression or unambiguous expression is an expression whose definition assigns it a unique interpretation or value. Otherwise, the expression is said to be ''not well defined'', ill defined or ''ambiguous''. A func ...
*
Formal language
In logic, mathematics, computer science, and linguistics, a formal language is a set of strings whose symbols are taken from a set called "alphabet".
The alphabet of a formal language consists of symbols that concatenate into strings (also c ...
*
Glossary of logic
This is a glossary of logic. Logic is the study of the principles of valid reasoning and argumentation.
A
...
*
WFF 'N Proof
Notes
References
*
*
*
*
*
*
*
*
*
External links
Well-Formed Formula for First Order Predicate Logic- includes a short
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
quiz.
Well-Formed Formula at ProvenMath
{{DEFAULTSORT:Well-Formed Formula
Formal languages
Metalogic
Syntax (logic)
Mathematical logic