First-Order Logic
C.1 First-Order Logic
As we mentioned in Chap. 6 , First-Order Logic (FOL) is the main formal model used for constructing intelligent systems based on mathematical logic. Notions concerning the syntax of FOL that are necessary for introducing a resolution method and basic notions concerning the semantics of FOL are presented in this section.
A set of symbols of a FOL language consists of the following elements: • constant symbols,
• variable symbols, • predicate (relation) symbols, • function symbols, • logical symbols: ¬, ∧, ∨, ⇒, ⇔, • quantifiers: ∀, ∃, • the equality symbol: =, • auxiliary symbols (e.g., parentheses).
Examples of the use of these symbols for describing the real world were presented in Sect. 6.1 . First of all, let us introduce the syntax of FOL, beginning with the notions of signature and a set of terms.
Definition C.1
FP n
n ,n≥1a
n ) © Springer International Publishing Switzerland 2016
257 M. Flasi´nski, Introduction to Artificial Intelligence, DOI 10.1007/978-3-319-40022-8
258 Appendix C: Formal Models for Artificial Intelligence Methods … Sometimes we differentiate constant symbols in a definition of signature, be-
SF n is defined for n ≥ 1.
Definition C.2 Let X be an infinite countable set of variable symbols. A set of terms T ( X)
• If x ∈ X, then x ∈ T ( X) .
n , if t 1 ,..., t n ∈T ( X) , then f (t 1 ,..., t n ) ∈ T ( X) .
Now, we introduce notions of: atomic formula and formula (well-formed formula). Definition C.3 • A false symbol ⊥ is an atomic formula.
• If t 1 , t 2 ∈T ( X) , then an expression t 1 =t 2 is an atomic formula.
n , if t 1 ,..., t n ∈T ( X) , then an expression p(t 1 ,..., t n ) is an atomic formula.
Definition C.4 ductively in the following way.
• Any atomic formula is a formula. • If ϕ, ψ are formulas, then ¬ϕ, ϕ ∧ ψ, ϕ ∨ ψ, ϕ ⇒ ψ, ϕ ⇔ ψ are formulas. • If ϕ is a formula and x ∈ X, then (∀x)(ϕ), (∃x)(ϕ) are formulas. A formula ϕ in
a formula of the form (∀x)(ϕ) or in the formula of the form (∃x)(ϕ) is called a scope of the quantifier .
Examples of the use of formulas for representing laws concerning the real world
were presented in Sect. 6.1 .
Let us introduce notions that allow us to define sentences and propositional func- tions of FOL.
Definition C.5
A variable x is bound in its occurrence in a formula ϕ iff x occurs directly after a quantifier or x is inside the scope of some quantifier that x occurs directly after.
For example, variables that are bound in their occurrences are underlined in the following formulas: ( ∃x∀z(r(x, z) ⇒ s(x, z))) ( ∃x(r(x, z) ⇒ ∀z s(x, z)))
Definition C.6 If a variable x is not bound in its occurrence in a formula ϕ, then x is free in this occurrence in ϕ.
In the example above, a variable which is not underlined is a free variable in its occurrence in the formula.
Appendix C: Formal Models for Artificial Intelligence Methods … 259 Definition C.7
A variable x in a formula ϕ is free in ϕ iff x is free in ϕ in at least one occurrence. A variable x in a formula ϕ is bound in ϕ iff x is bound in every occurrence in ϕ.
Definition C.8
A formula with no free variables is called a sentence. Formulas that are not sentences are called propositional functions.
At the end of this section, we introduce notions concerning the semantics of FOL. Definition C.9
a pair (U, I), where U is nonempty set called a universe, I is a function, called
A :U F −→ U to each function n , and it assigns a relation p
an interpretation function that assigns a function f A n
⊆U P n . Definition C.10
X −→ U. Additionally, for an assignment ̺, a variable x ∈ X and an element a ∈ U let us define an assignment ̺ a
x : X −→ U in A that maps x to a in such a way that ̺ x is equal to ̺ for all the variables that are different from x:
̺ a x ̺(y), ( y) =
a,
otherwise.
Definition C.11 An interpretation (value) of a term t ∈ T ( X) under an assignment ̺, denoted [[t]] A
̺ , is defined inductively in the following way: • [[x]] A
̺ = ̺(x), x ∈ X. A A A A
n , t 1 ,..., t n ∈T ( X), n ≥ 1. Definition C.12
• [[f (t 1 ,..., t n ) ]] ̺ =f ( [[t 1 ]] ̺ ,..., [[t n ]] ̺ )
signature, and an assignment ̺. We define what it means for a formula ϕ to be satisfied in the structure A under the assignment ̺, denoted
(A, ̺) |= ϕ,
in the following way. • (A, ̺) |= ⊥ never holds.
n and for any t 1 ,..., t n ∈T ( X) , we assume that: (A, ̺) |= p(t 1 ,..., t
A A n A ) iff ([[t 1 ]]
̺ ,..., [[t n ]] ̺ ) ∈p . A A
• (A, ̺) |= t 1 =t 2 iff [[t 1 ]] ̺ = [[t 2 ]] ̺ .
• (A, ̺) |= ϕ ∧ ψ iff (A, ̺) |= ϕ and (A, ̺) |= ψ. • (A, ̺) |= ϕ ∨ ψ iff (A, ̺) |= ϕ or (A, ̺) |= ψ or both. • (A, ̺) |= ϕ ⇒ ψ iff either not (A, ̺) |= ϕ or else (A, ̺) |= ψ. • (A, ̺) |= ϕ ⇔ ψ iff (A, ̺) |= ϕ and (A, ̺) |= ψ if and only if (A, ̺) |= ϕ and
(A, ̺) |= ψ.
260 Appendix C: Formal Models for Artificial Intelligence Methods … • (A, ̺) |= (∀x)(ϕ) iff for each a ∈ U, (A, ̺ a
x ) |= ϕ.
• (A, ̺) |= (∃x)(ϕ) iff there exists an a ∈ U such that (A, ̺ a x ) |= ϕ. Definition C.13
exists an assignment ̺ in A such that (A, ̺) |= ϕ. Definition C.14
A , in which ϕ is satisfiable. Definition C.15
in A (A, ̺) |= ϕ. We say that A is a model for the formula ϕ, denoted
A |= ϕ.
Definition C.16
Definition C.17
A formula ϕ is valid, or it is a tautology, denoted |= ϕ, iff ϕ is