You are on page 1of 56

FIRST ORDER LOGIC

Animesh Choudhary
-2015MT0870

Btech. Project
Introduction
 Consider the argument:
 1. Tommy is a dog.
 2. Every dog is an animal.
 3. Hence, Tommy is an animal.
 The argument (which seems logically
correct) cannot be proved using
propositional logic. For, propositional logic
would express this as:

 However, this is not correct, as an


interpretation can be chosen such that
 The main issue is that there are no
relationships between the propositions.
 We wish to explore deeper into the form
of a sentence.
 This can be dealt as follows:
 For every x, if x is a dog, x is an animal.
 However, we need to introduce new
objects: these are predicates and
quantifiers.
 Quantifiers are objects which indicate the
scope of a variable.
 We also, add more useful objects: functions,
predicates and a special binary predicate reserved
for identity,
 A function returns an object on inputting some

arguents. For, example Father of () is a function.


Father of (Indira Gandhi) = Jawaharlal Nehru.
 An n-ary predicate is an n-ary relation (or a subset of

)
. For example, (Ram,Shyam) may be a member
of the relation ‘Friends’.
The resulting logic is called first order logic because
we can quantify only over the objects and not over
the functions and predicates.
Notation Example

 For example: The authors of War and Peace and


Anna Karenina were the same is expressed as:
Syntax of FL

 The sets are those of variables, functions,


predicates, quantifiers, connectives, logical
constants and puntuations.
Notes
 The j-ary functions are denoted by fj.
Similarly, for the predicates.
 0- ary predicates are propositional
variables used in PL.
 0- ary functions are objects.
 Hence, the FL alphabet is :
 Any string over A is called an expression.
Formulas
 Terms are objects that are either
constants or variables or obtained by
functions which have constants or
variables as input. Formally, we define :

 Having defined terms, we define well


formed sentences/formulas as: (where
s,t are terms)
Symbolizing English
Sentences
 For example, we symbolize the
sentence:
 For every pair of primes differing by 2,
there is a pair of greater primes differing by
2.

 Here, (x,y) belongs to D iff x-y=2, x belongs


to P iff x is prime and G(x,y) is same as
(x>y).
Scope and closed formulas
 Let Y be a formula. A substring Z of Y which is
itself a formula is called a subformula of Y.
 The scope of an occurrence of a quantifier
occurring in Y is the subformula starting with
that occurrence.
 A variable x is called free if there is at least
one free occurrence of x in Y.
 A variable x is called bound variable of Y if
there is at least one bound occurrence of x in
Y.
 A formula having no free variables is called a
closed formula or a sentence
 If there is a free occurrence of a variable
x in a formula Y, we also say that x
occurs free in Y.

 Here, the first occurrence of y is free


while the other 2 are bound.
 We also note that all English sentences/
sentences occurring naturally are closed.
Substitution
 [x/t] means substitution of the variable x
by the term t. Then, X[x/t] means we
replace every x present in the formula X by
t.
 Also, we note that substitution is only
meaningful for free variables. In case of
quantified variables, substitution does not
change anything. Also, if t is a constant,
then the resulting string is not even a
formula.
 However, in the case of the quantifier ‘for
 For example, consider the statement:
Every human being has a father.

 As the first quantifier is for all, Replace x


by f(y), where f is ‘eldest brother of’:
 But, then we get:

 Which translates into “The eldest brother of


y, who is a human being is also his father”
 However, this was not the intended
meaning.
 We observe something peculiar in this
substitution:
 The occurrences of x, which were free in:

become bound after the substitution [x/f(y)].


 Such a substitution is said to ‘capture’ the variable.

Thus, we can only substitute x by variables which are


free for x.
 If t is a term that does not have any
occurrence of any variable, then it is
called a closed term.

 Once t is free for x in Y, all free


occurrences of variables in Y remain free
in Y[x/t].
Valuations
 Consider the formula:

 The predicates N and O are simply symbols before


we assign ‘meaning’ to them by using an
appropriate ‘vocabulary’.
 For example,
 Every natural number is greater than 0.
 Author of logic books are good teachers.
 Thus, we can have infinite number of
interpretations.
 Similarly, function symbols do not have a meaning
before an interpretation assigns some meaning.
 The truth of non-closed formulas depend
upon states.
 States thus assign values to the free
variables of a formula to some objects in a
model/interpretation.
 An assignment function which associates
variables to elements of the universe or
domain of an interpretation is called a
valuation. L is also extended to the terms,
such that it agrees with the mapping that
associates predicates to relations and
Valuations equivalent along a variable

 We wish to formally define the truth value of the


quantified formulas in case of multiple variables
being present.

 The notation denotes, the valuation which


equals the valuation l, except fixing x to a.
 Another convention is to define valuations l’
equivalent to l along x, which means that
l(y)=l’(y) for all .
 Then, holds in a state l, if Pxy holds in
every state l’ equivalent to l along x or
Pxy holds for every when a is allowed to
be arbitrary.
Semantics
 An interpretation is a pair I = (D,), where D is a
non-empty set, called the domain or universe
of I,  is a mapping associating function symbols
with concrete functions on D, i.e.

where R is the collection of all relations and


functions on D. Also,  preserves arity, i.e.
1. If P is any 0-ary predicate, then (P) is a
sentence about objects in D.
2. If P is an n-ary predicate, n≥1 then (P)  Dn
3. If f is a 0-ary function symbol, then (f) D.
4. If f is an n-ary function symbol, then (f):Dn->D.
 A valuation under I = (D, ) is a mapping l
that assigns each term to an element of D,
first defined for variables and then
extended to terms satisfying:
 If f is a constant, then l(f) = (f).
 If f is an n-ary function, and t1,t2,… are
terms,

 A state Il is a triplet (D, ,l)


Satisfaction of Formula
 Il is a state- model of A, if
 A is said to be satisfiable if it has a state
model for some interpretation.
 An interpretation I satisfies A, written as
, if for every valuation l. ( I is a
model of A)
 A set of formulas  is called satisfiable, if
there exist I,l such that: for every

 We say that  entails A, written as if


every state model of  is a state model of
A.

 We say that formulas A and B are


equivalent, i.e. , if every state model
of A is a state model of B and vice versa.
Relevance Lemma
 We note an interesting point that for
statements like , the truth value in a
particular valuation does not depend on
what the valuation assigns to x. This is
formalized (and proved rigorously by the
use of induction)
Environment
 In short, the theorems say that for a
sentence, the concepts of state models
and models are same.

 Il is called an environment, where I is


an interpretation and l is a valuation.

 Then, is true in environment l, if


Px is true in all environments, where
a varies over D.
 Another way to define quantifier
semantics, is that we add additional
constants in an extended language.

 For every d in the domain D, we add a


constant, d’
 Then, we say, I is a model of if I
is a model of P[x/d’]
 This semantics is also known as import
semantics.
Some Useful Consequences
 The laws valid in PL are valid in this
language too.
Closures of a formula
 Free variables separate a formula and a
sentence.
 The truth (wrt model) of a formula with
free variables present can be decided by
two approaches:
 Existential Closure of a formula X with free
variables x1,x2,…,xm :
 Universal Closure of a formula X:
Superset of PL
 The language FL is a superset of PL.
What we mean by this, is that if a wff A
is valid in PL, then (A), where every
occurrence of a proposition is replaced
by predicates, is valid too.
 For example, is a valid
sentence.
 The relevant theorems are:
Calculations
Leibniz’s rule
 As in propositional logic, Leibniz’s rule is
valid here too, allowing us to provide
proofs by replacing propositions by other
formulae (calculation):
Examples
Normal Forms
 As in PL, we look for normal forms to
simplify validity and satisfiability.
 We have to first deal with the quantifiers.
 For this, we introduce prenex forms:
Formulas in which all the quantifiers are
placed at the beginning.
 This can be done with renaming
(rectification) and using appropriate rules.
Prenex form conversion
example

 Thus by renaming variables and using


appropriate rules to ‘pull out’ quantifiers, a
formula can be converted to an equivalent
prenex form.
 Thus, it is proved (using induction on the
number of quantifiers) that:
Algorithm
PCNF and PDNF
 Once we obtain the prenex normal form, we can
convert the matrix into an equivalent cnf, or dnf
(using propositional tautologies). For this, we
redefine clauses and literals:
 Atomic formulas are propositional constants
and and formulas of the form P(t1,t2,…,tn) where P
is a predicate and ti are terms.
 A literal is again an atomic formula or its negation.
 A conjunctive clause is a conjunction of literals, a
disjunctive clause is a disjunction of literals.
 A cnf is a conjunction of disjunctive clauses and dnf
is a disjunction of conjunctive clauses.
 Thus, it can be easily proven that:

 We now wish to convert a FL formula into a


formula free of all quantifiers.
 The motivation for this is that formulas such as
can be written as Pc while preserving satisfiability
(where c is a new introduced constant)
 The sentences such as can be written
as , but equivalence is not preserved, though
satisfiability is. The function f is called indical
function.
Skolemization
 Thus, every formula can be converted
into a Skolem form (which ignores ‘for
all’ quantifiers and eliminates ‘there
exist’ quantifiers)
 Skolem formula preserves satisfiability
i.e. A is satisfiable iff Skolem(A) is
satisfiability.
 This is because a particular
interpretation can be chosen so that the
function symbol satisfies the formula. For
example, as is true, Px is true for
Algorithm for Skolemization
Notes

 We note that Skolemization treats free


variable as universally quantified, because
 Also, we can get a validity invariant as
satisfiability and validity are dual concepts
as:
 For validity, the new formula is called the
functional form of A.
 The existential quantifiers are ignored and
universal quantifiers are replaced with the
indical functions.
 The corresponding cnf and dnf forms are
known as fcnf and fdnf.
Herbrand Interpretation
 Utility of the Functional and Skolem forms are
that the satisfiability of formulae is transferred
to the problem of finding an appropriate
universe/domain such that the checking of
satisfiability is easy.
 Herbrand’s idea involves looking at syntactic
entities as concrete. I.e., the definition of an
appropriate universe is developed using the
symbols present in the formula.
 For example if the formula is Pab, then we limit
the domain to {a’,b’} and let P be the
predicate such that P(a,b) is true.
Development and
Motivation
 Given a function f of arity 1in a formula, it
potentially generates D = {a, f(a),f(f(a)),…}. Then
we set the domain as D and regard f as a function:

 The equality predicate cannot be regarded as


algebraic equality as it poses problems. (For
example if is present in the formula, then we
cannot assume f(a) = a, since we assumed they
are distinct elements in D)
 The equality predicate is replaced with an
equivalence relation and the domain changes as it
now becomes the equivalence classes of D.
 If holds, then (a,f(a)) belong to the
equivalence relation.
 Another property of ‘=’ that we would like
to capture is that we can substitute equals
for equals keeping meaning intact.
 I.e, if s=t, then f(…,s,…) = f(…,t,…).
 Motivated by these ideas, the Herbrand
universe is defined.
Herbrand Universe
 The elements of the universe, called
ground terms are simply the closed
terms obtained using function symbols
occurring in the formula.
 Also, if no constants occur in it, then we
introduce a symbol  in D.
 Also, a function  is introduced that is
compatible with our outline/motivation of
the Herbrand Interpretation.
 Then, H = (D,) is called the Herbrand interpretation.
By assigning 0 or 1 to the atomic formulas P(t1,t2,…,tn)
we decide whether H is a model of the formula or not.
Application
 For example let
 Then, the universe is D = {c} as there
are no function symbols. Then, the
formula is equivalent to satisfiability of :

 Then, a Herbrand model of X can be


chosen as i(Qcc)=0, i(Pc)=i(Rc)=1.
 Also, can be written as:
 Atomic formulas such as Qcc, Pc and Rc are called
the ground atomic formulas.
 Literals such as Qcc,Qcc,  Pc,Pc are termed as
ground literals.
 A Herbrand interpretation is then a set of
ground literals such that both Y and Y are not its
members.
 Also, corresponding to each ground atomic
formula A, exactly one of A or A is the member
of a Herbrand interpretation.
 We transfer the satisfiability problem in FL to
satisfiability problem of PL. This is done as follows:
 The Herbrand Expansion HE is defined as:

 Then, existence of a Herbrand Model is


equivalent to the satisfiability of
Herbrand expansion.
Examples
Example with identity
predicate
 The following observation is important for
the next theorem: If X is a formula, then
the Herbrand Expansion of X is countable.
 Hence, as countable union of countable
sets is countable, the Herbrand expansion
of a countable set of formulas is countable.
Skolem Paradox
 R, the set of real numbers is defined
through a finite set of axioms; The axioms
include order, completeness and satisfies
the Archimedean axioms.
 However, Cantor’s theorem states that the
set R is uncountable. According to the
statement, whatever set satisfies all the
axioms of R has to be uncountable.
 A possible explanation is that the mapping
that makes the model countable cannot be
constructed inside the model.

You might also like