Download Predicate Logic

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Intuitionistic logic wikipedia , lookup

Ambiguity wikipedia , lookup

History of the function concept wikipedia , lookup

Truth-bearer wikipedia , lookup

Boolean satisfiability problem wikipedia , lookup

Curry–Howard correspondence wikipedia , lookup

New riddle of induction wikipedia , lookup

Lambda calculus wikipedia , lookup

Structure (mathematical logic) wikipedia , lookup

Law of thought wikipedia , lookup

Sequent calculus wikipedia , lookup

Laws of Form wikipedia , lookup

First-order logic wikipedia , lookup

Propositional calculus wikipedia , lookup

Propositional formula wikipedia , lookup

Principia Mathematica wikipedia , lookup

Transcript
Predicate Logic
M.A.Galán, TDBA64, VT-03
1
Introduction
There are certain arguments that seem to be perfectly logical,
yet they cannot be specified by using propositional logic.
• All cats have tails.
• Tom is a cat.
From these two sentences, one should be able to conclude that
• Tom has a tail.
M.A.Galán, TDBA64, VT-03
2
Introduction
Generally, predicates are used to describe certain properties or
relationships between individuals or objects.
In addition to predicates one uses terms and quantifiers.
• ”Mary and Anne are sisters.”
• ”All cats have tails.”
Predicate calculus is a generalization of propositional calculus.
M.A.Galán, TDBA64, VT-03
3
Syntax: Symbols.
• constants: a, b, c, . . .
• variables: x, y, z, . . .
• function symbols: f, g, h, . . .
• predicate symbols: p, q, r, . . .
• logical connectives: ∧, ∨, ¬, →
• quantifiers: ∀ (for all), ∃ (there exists)
• parenthesis and comas
M.A.Galán, TDBA64, VT-03
4
Predicates
Generally, predicates make statements about individuals. In predicate calculus, each predicate is given a name, which is followed
by the list of arguments. The list of arguments is enclosed in
parentheses.
To express ”Jane is the mother of Mary”, one would choose an
identifier, say ”mother”, to express the predicate ”is mother of”
and one would write mother(J ane, M ary)
Note that the order of the arguments is important.
The number of elements in the predicate list is called the arity
of the predicate. The arity of a predicate is fixed.
M.A.Galán, TDBA64, VT-03
5
Predicates
A predicate name, followed by an argument list in parentheses,
is called an atomic formula.
The atomic formulas are statements, and they can be combined
by logical connectives.
For instance, to express the fact that Jane is the mother of Mary,
one can use the atomic formula mother(J ane, M ary), and this
statement can be part of some compound statement, such as
mother(J ane, M ary) → ¬mother(M ary, J ane)
M.A.Galán, TDBA64, VT-03
6
Variables
Often, one does not want to associate the arguments of an
atomic formula with a particular individual. To avoid this, variables are used.
cat(x) → hastail(x)
Syntactically, one can use variables in any place where one is
allowed to use constants. The word term is used to refer to
anything that can be used in place of an individual.
M.A.Galán, TDBA64, VT-03
7
Syntax for terms
The set T of all terms is defined as follows:
• Every constant is a term.
• Every variable is a term.
• If f is a function symbol with arity n and s1, s2, . . . , sn are
terms, then f (s1, s2, . . . , sn) is also a term.
M.A.Galán, TDBA64, VT-03
8
Well formed formulas
• Every atomic expression p(s1, . . . , sn) where p is a predicate
symbol of arity n and s1 . . . sn are terms, is a wff.
• If P and Q are wffs so are ¬P, P ∧ Q, P ∨ Q, P → Q.
• If P is a wff and x is a variable, ∀x P and ∃x P are wffs.
• No other expression is a wff.
M.A.Galán, TDBA64, VT-03
9
Quantifiers
”All cats have tails”
”Some people like going to the cinema”
These statements indicate how frequently certain things are true.
In predicate calculus, one uses quantifiers in this context.
The universal quantifier indicates that something is true for all
individuals.
The existential quantifier indicates that a statement is true for
some individuals.
M.A.Galán, TDBA64, VT-03
10
Universal quantifier
Let P be an expression, and let x represent a variable.
If we want to indicate that P is true for all possible values of x,
we write ∀x P.
Here ∀x is called the universal quantifier and P the scope of the
quantifier. The variable x is said to be bound by the quantifier.
The symbol ∀ is pronounced ”for all”
Example: ”Everyone gets a break once in a while”
∀x getsbreak(x)
M.A.Galán, TDBA64, VT-03
11
Existential quantifier
Let P be an expression, and let x represent a variable. If we
want to indicate that P is true for at least one value of x, we
write ∃x P. This statement is pronounced ”there exists an x such
that P”.
Here ∃x is called the existential quantifier, and P is called the
scope of the existential quantifier. The variable x is said to be
bound by the quantifier.
Example: ”Some objects are blue”
∃x blue(x)
M.A.Galán, TDBA64, VT-03
12
Free variables
Any variable that is not bound is said to be free.
In the formula,
∀z (p(z) ∨ q(x)) ∨ ∃y q(y)
only the variable x is free. All occurrences of z are bound, and
so are all occurrences of the variable y .
M.A.Galán, TDBA64, VT-03
13
Precedence rules
Same rules as in propositional logic but the quantifiers are given
a higher precedence than all the rest of the connectives.
Consider the predicates p(x) =”x is living” and q(x) =”x is
dead”, then
∀x (p(x) ∨ q(x)) indicates that everything is either living or dead.
∀x p(x) ∨ q(x) indicates that everything is living, or x is dead.
M.A.Galán, TDBA64, VT-03
14
Semantic
1.
2.
3.
4.
Jane is Paul’s mother.
Jane is Mary’s mother.
Any two persons having the same mother are siblings.
Paul and Mary are siblings.
There are many people named Jane and Paul, and without further information the statement ”Jane is Paul’s mother” can refer
to many different people.
To remove such ambiguities, we introduce the concept of domain
(collection of all individuals that affect the logical argument under consideration)
M.A.Galán, TDBA64, VT-03
15
Semantic: Interpretation
An interpretation t is a mapping that
• to each constant a and each variable x assigns a value
t(a), t(x) ∈ D
(The set D is called the domain of the interpretation)
• to each function symbol of arity n, assigns a function
ft : D n → D
• to each predicate symbol of arity n, assigns a function
pt : D n → {T, F }
M.A.Galán, TDBA64, VT-03
16
Interpretation
The interpretation of a formula is defined inductively by:
• t(f (s1, . . . , sn)) = ft(t(s1), . . . , t(sn)) for the term f (s1, . . . , sn).
• t(p(s1, . . . , sn)) = pt(t(s1), . . . , t(sn)) for all atomic formula
p(s1, . . . , sn).
t(P ∧ Q)
t(P ∨ Q)
• For all formula P, Q
t(¬)P
t(P → Q)
=
=
=
=
t(P )∧t(Q)
t(P )∨t(Q)
¬t(P )
t(P )→t(Q)
M.A.Galán, TDBA64, VT-03
17
Interpretation
• For all formula P
t(∀x P ) = T if tx=d(P ) = T for all d ∈ D (otherwise is F )
t(∃x P ) = T if tx=d(P ) = T for a particular d ∈ D (otherwise is F )
A formula P is valid is t(P ) = T for all interpretation t.
M.A.Galán, TDBA64, VT-03
18
Gödel’s Theorems
Gödel’s completeness theorem
There exists a sound and complete proof system for predicate
logic.
Gödel’s incompleteness theorem
For number theory (N, >, +, ·, 0, 1) is not possible to find a sound
proof system that is complete.
M.A.Galán, TDBA64, VT-03
19
Examples
Domain= {animals} How can we express ”All dog are mammals”?
One rephrases the statement as ”If x is a dog, then x is a
mammal”.
∀x (dog(x) → mammal(x))
Generally, the sentence ∀x (P (x) → Q(x)) can be translated as
”All individuals with property P also have property Q”
M.A.Galán, TDBA64, VT-03
20
Examples
How can we express ”Some dogs are brown”?
This statement means that there are some animals that are dogs
and that are brown. The statement ”x is a dog and x is brown”
can be translated as
dog(x) ∧ brown(x)
”There are some brown dogs” can now be translated as
∃x (dog(x) ∧ brown(x))
In general, the statement ∃x (P (x) ∧ Q(x)) can be interpreted
as ”Some individuals with property P also have property Q”.
M.A.Galán, TDBA64, VT-03
21
Examples
”Only dogs bark”
To convert this into predicate calculus, this must be reworded
as ”It barks only if it is a dog” or, equivalently, ”If it barks, then
it is a dog”. One has therefore
∀x (barks(x) → dog(x))
M.A.Galán, TDBA64, VT-03
22