Logic
- Logic
- Proof Systems
- Elementary General Concepts in Logic
- Logical Calculi
- Propositional Logic
- Predicate Logic (First-order Logic)
Logic
Proof Systems
Definition
In a formal treatment of mathematics, all objects of study must be described in a well-defined syntax. Typically, syntactic objects are finite strings over some alphabet , for example the symbols allowed by the syntax of a logic or simply the alphabet , in which case syntactic objects are bit-strings. Recall that denotes the set of finite strings of symbols from .
In this section, the two types of mathematical objects we study are
- mathematical statements of a certain type and
- proofs for this type of statements.
By a statement type we mean for example the class of statements of the form that a given number is prime, or the class of statements of the form that a given graph has a Hamiltonian cycle, or the class of statements of the form that a given formula in propositional logic is satisfiable.
Consider a fixed type of statements. Let be the set of (syntactic representations of) mathematical statements of this type, and let be the set of (syntactic representations of) proof strings.
Every statement is either true or false. The truth function
assigns to each its truth value . This function defines the meaning, called the semantics, of objects in .
An element is either a (valid) proof for a statement , or it is not. This can be defined via a verification function
where means that is a valid proof for statement .
Without strong loss of generality we can in this section consider
with the understanding that any string in can be interpreted as a statement by defining syntactically wrong statements as being false statements.
💡 A proof system is a quadruple , as above.
💡 A proof system is sound if no false statement has a proof, i.e., if for all for which there exists with , we have .
💡 A proof system is complete if every true statement has a proof, i.e., if for all with , there exists with .
Elementary General Concepts in Logic
💡 A goal of logic is to provide a specific proof system for which a very large class of mathematical statements can be expressed as an element of .
However, such a proof system can never capture all possible mathematical statements. For example, it usually does not allow to capture (self-referential) statements about , such as “ is complete”, as an element of . The use of common language is therefore unavoidable in mathematics and logic.
In logic, an element consist of one or more formulas (e.g. a formula, or a set of fomrulas, or a set of fomulas and a formula), and a proof consist of applying a certain sequence of syntactic steps, called a derivation or a deduction. Each step consists of applying one of a set of allowed syntactic rules, and the set of allowed rules is called a calculus. A rule generally has some place-holders that must be instantiated by concrete values.
In standard treatments of logic, the syntax of and the semantics (the function ) are carefully defined. In contrast, the function , which consists of verifying the correctness of each rule application step, is not completely explicitely defined. One only defines rules, but for example one generally does not define a syntax for expressing how the place-holders of the rules are instantiated.
💡 The syntax of a logic defines an alphabet (of allowed symbols) and specifies which strings in are formulas (i.e., are syntactically correct).
💡 The semantics of a logic defines (among other things) a function which assigns to each formula a subset of the indices. If , then the symbol is said to occur free in .
💡 An interpretation consists of a set of symbols of , a domain (a set of possible values) for each symbol in , and a function that assigns to each symbol in a value in its associated domain.
💡 An interpretation is suitable for a formula if it assigns a value to all symbols occurring free in .
💡 The semantics of a logic also defines a function assigning to each formula , and each interpretation suitable for , a truth value in . In treatments of logic one often writes instead of and calls the truth value of under interpretation .
💡 A (suitable) interpretation for which a formula is true, (i.e., ) is called a model for , and one also writes
More generally, for a set of formulas, a (suitable) interpretation for which all formulas in are true is called a model for , denoted as
If is not a model for one writes .
💡 A formula (or a set of formulas) is called satisfiable if there exists a model for (or ), and unsatisfiable otherwise. The symbol is used for an unsatisfiable formula.
💡 A formula is called a tautology or valid if it is true for every suitable interpretation. The symbol is used for a tautology.
💡 A formula is a logical consequence of a formula (or a set of formulas), denoted
if every interpretation suitable for both (or ) and , which is a model for (for ), is also a model for .
💡 Two formulas and are equivalent, denoted , if every interpretation suitable for both and yields the same truth value for and , i.e., if each one is a logical consequence of the other:
💡 If is a tautology, one also writes .
💡 If and are formulas, then also and are formulas.
💡 if and only if and . if and only if or . if and only if
📌 For any formulas , and we have
- and (idempotence)*
- and (commutativity)*
- and (associativity)*
- and (absorption)*
- (distributive law)*
- (distributive law)*
- (double negation)
- and (de Morgan’s rules)*
- and (tautology rules)*
- and (unsatisfiability rules)*
- and .
📌 A formula is a tautology if and only if is unsatisfiable.
📌 The following three statements are equivalent:
- is a tautology*
- is unsatisfiable*
Logical Calculi
💡 A derivation rule is a rule for deriving a formula from a set of formulas (called the precondition). We write
if G can be derived from the set by rule .
💡 (Informal.) The application of a derivation rule to a set of formulas means
- Select a subset of .
- For the place-holders in : specify formulas that appear in such that for a formula .
- Add to the set (i.e., replace by ).
💡 A (logical) calculus is a finite set of derivation rules: .
💡 A derivation of a formula from a set of formulas in a calculus is a finite sequence (of some length ) of applications of rules in , leading to . More precisely, we have
- for , where for some and for some , and where
We write
if there is a derivation of from in the calculus .
💡 A derivation rule is correct if for every set of formulas and every formula , implies :
💡 A calculus is sound or correct if for every set of formulas and every formula , if can be derived from then is also a logical consequence of :
and is complete if for every and , if is a logical consequence of , then can also be derived from :
A calculus is hence sound and complete if
i.e., if logical consequence and derivability are identical. Clearly, a calculus is sound if and only if every derivation rule is correct. One writes if can be derived in from the empty set of formulas. Note that if for a sound calculus, then , i.e., is a tautology.
📌 If holds for a sound calculus, then
Propositional Logic
💡 (Syntax.) An atomic formula is of the form with . A formula is defined as follows:
- An atomic fomula is a formula.
- If and are formulas, then also and are formulas.
💡 (Semantics.) For a set of atomic formulas, an interpretation , called truth assignment, is a function . A truth assignment is suitable for a formula if contains all atomic formulas appearing in . The semantics (i.e., the truth value of a formula under interpretation ) is defined by for any atomic formula ,
💡 A literal is an atomic formula or the negation of an atomic formula.
💡 A formula is in conjunctive normal form (CNF) if it is a conjunction of disjunctions of literals, i.e., if it is of the form
for some literals .
💡 A formula is in disjunctive normal form (DNF) if it is a disjunction of conjunctions of literals, i.e., if it is of the form
for some literals .
📖 Every formula is equivalent to a formula in CNF and also to a formula in DNF.
💡 A clause is a set of literals.
💡 The set of clauses associated to a formula
in CNF, denoted as , is the set
The set of clauses associated with a set of formulas is the union of their clause sets:
💡 A clause is a resolvent of clauses and if there is a literal such that , , and
📌 The resolution calculus is sound, i.e., if then .
📖 A set of formulas is unsatisfiable if and only if .
Predicate Logic (First-order Logic)
💡 (Syntax of predicate logic.)
- A variable symbol is of the form with .
- A function symbol is of the form with , where denotes the number of arguments of the function. Function symbols for are called constants.
- A predicate symbol is of the form with , where denotes the number of arguments of the predicate.
- A term is defined inductively: A variable is a term, and if are terms, then is a term. For one writes no parentheses.
- A formula is defined inductively:
- For any and , if are terms, then is a formula, called an atomic formula
- If and are formulas, then , , and are formulas.
- If is a formula, then, for any , and are formulas.
💡 Every occurrence of a variable in a formula is either bound or free. If a variable occurs in a (sub-) formula of the form or , then it is bound, otherwise it is free. A formula is closed if it contains no free variables.
💡 For a formula , a variable and a term , denotes the formula obtained from by substituting every free occurrence of by .
💡 An interpretation or structure is a tuple where
- is a non-empty set, the so-called universe
- is a function assigning to each function symbol (in a certain subset of all function symbols) a function, where for -ary function symbol . is a function
- is a function assigning to each predicate symbol (in a certain subset of all predicate symbols) a function, where for a -ary predicate symbol , is a function
- is a function assigning to each variable symbol (in a certain subset of all variable symbols) a value in .
💡 An interpretation (structure) is suitable for a formula if it defines all function symbols, predicate symbols, and freely occurring variables of .
💡 (Semantics.) For an interpretation (structure) , we define the value (in ) of terms and the truth value of formulas under that structure.
- The value of a term is defined recursively as follows:
- If is a variable, i.e., , then .
- If is of the form for terms and a -ary function symbol , then .
- The truth value of a formula is defined recursively by
and
- If is of the form for terms and a -ary predicate symbol , then .
- If is of the form or , then let for be the same structure as except that is overwritten by (i.e., ):
📌 For any formulas , and , where does not occur free in , we have
📌 If one replaces a sub-formula of a formula by an equivalent (to ) formula , then the resulting formula is equivalent to .
📌 For a formula in which does not occur, we have
💡 A formula in which no variable occurs both as a bound and as a free variable and in which all variables appearing after the quantifiers are distinct is said to be in rectified form.
📌 For any formula and any term we have
💡 A formula of the form
where the are arbitrary quantifiers ( or ) and is a formula free of quantifiers, is said to be in prenex form.
💡 In order to transform a formula into prenex form one first transforms the formula into an equivalent formula in rectified from and then applies the following equivalences
to move up all quantifiers in the formula tree, resulting in a prenex form of the formula.
📖 For every formula there is an equivalent formula in prenex form.
📖
📎 There exists no set that contains all sets that do not contain themselves, i.e., is not a set.
📎 The set is uncountable.
📎 There are uncomputable functions
📎 The function assigning to each the complement of what program outputs on input , is uncomputable.