0% found this document useful (0 votes)
48 views22 pages

IntSys Lec 04 Predicate Calculus DR - Mina

This document provides an outline for a lecture on logic-based knowledge representation using predicate calculus. It begins with an introduction to predicate calculus and its syntax. It then discusses the propositional calculus in more detail, covering its syntax, rules for forming sentences, semantics using truth tables, and concepts of satisfiability and validity. The document concludes by introducing predicates as parameterized propositions in predicate calculus that allow for representing general statements using variables.

Uploaded by

Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views22 pages

IntSys Lec 04 Predicate Calculus DR - Mina

This document provides an outline for a lecture on logic-based knowledge representation using predicate calculus. It begins with an introduction to predicate calculus and its syntax. It then discusses the propositional calculus in more detail, covering its syntax, rules for forming sentences, semantics using truth tables, and concepts of satisfiability and validity. The document concludes by introducing predicates as parameterized propositions in predicate calculus that allow for representing general statements using variables.

Uploaded by

Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPSX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Intelligent Systems

Lecture 04: Logic based-Knowledge Representation


(Predicate Calculus)

Collected and Edited by:


Dr. Mina Younan
Lecturer of Computer Science,
Faculty of Computers and Information, Minia University

20
21
Dr. Mina Younan
Lecture Outline
// this lecture collected and edited from Prof. Moheb Girgis Lectures in AI
Part One (cont.):
• The Propositional Calculus
• Rules of forming legal propositional calculus sentences
• The semantics of the propositional calculus
• Satisfiability and Validity Concepts
• The predicate calculus
o The syntax of the predicate calculus
o Predicate calculus sentences
o Verify Function
o Relationships between quantifiers
o Representing English sentences in predicate calculus

20
21
Dr. Mina Younan
Intelligent Systems 2
The Propositional Calculus

The syntax of the propositional calculus:


The first step in describing a language is to introduce its set of
symbols.
Propositional calculus symbols are:
• the propositional symbols: P, Q, R, S, … (uppercase letters near
the end of the English alphabet)
• truth symbols: true, false
• connectives: , , ‫ר‬, , 
Propositional symbols denote propositions, or statements about
the world that may be either true or false, such as "the car is red".

20
21
Dr. Mina Younan
Intelligent Systems 3
Rules of forming legal propositional calculus
sentences
1. Every propositional symbol and truth symbol is a sentence.
e.g. true, P, Q, and R are sentences.
2. The negation of a sentence is a sentence.
e.g. ‫ר‬P and ‫ר‬false are sentences.
3. The conjunction, i.e. and, of two sentences is a sentence.
e.g. P  Q is a sentence.
4. The disjunction, i.e. or, of two sentences is a sentence.
e.g. P  Q is a sentence.
5. The implication of one sentence from another is a sentence.
e.g. P  Q is a sentence.
6. The equivalence of two sentences is a sentence.
e.g. P  Q  R is a sentence.
Legal sentences are also called well-formed formulas or WFFs.

20
21
Dr. Mina Younan
Intelligent Systems 4
Rules of forming legal propositional calculus
sentences
• In P  Q, P and Q are called conjuncts.
• In P  Q, P and Q are called disjuncts.
• In P  Q, P is the premise and Q is the conclusion.
• It means P implies Q. If the implication is true when the
premise is true, the conclusion must also be true.

20
21
Dr. Mina Younan
Intelligent Systems 5
The semantics of the propositional calculus
• A propositional symbol corresponds to a statement about the world.
For example, P may denote the statement "it is raining".
• A proposition may be either true or false, given some state of the world.
• The truth value assignment to propositional sentences is called an
interpretation, an assertion about their truth in some possible world.
• Formally, an interpretation is a mapping from the propositional symbols
into the set {T, F}.
• Each possible mapping of truth value onto propositions corresponds to a
possible world of interpretation.
• Note that, the symbols true and false are part of the set of well-formed
sentences of the propositional calculus; i.e. they are distinct from the truth
value, T/F, assigned to a sentence.

20
21
Dr. Mina Younan
Intelligent Systems 6
The semantics of propositional calculus
The semantics of propositional calculus is defined as follows:
1. An interpretation of a set of propositions is the assignment of a truth value,
either T or F, to each propositional symbol.
For example, if P denotes the proposition "it is raining" and Q denotes
"I am at work", then the set of propositions {P, Q} has different functional
mapping into the truth values {T, F}. These mappings correspond to 4
different interpretations.
2. The interpretation or truth value assignment for sentences is determined as
follows:

Condition Truth value assignment Sentence


T true
F false
If P has truth value F. T ‫ר‬P
If P has truth value T. F

20
21
Dr. Mina Younan
Intelligent Systems 7
The semantics of propositional calculus
2. The interpretation or truth value assignment for sentences is determined as
follows:

Condition Truth value assignment Sentence


If both P and Q has truth value T. T PQ
Otherwise. F
If both P and Q has truth value F. F PQ
Otherwise. T
If P is T and Q is F. F PQ
Otherwise. T
If P and Q have the same truth value T PQ
assignments for all possible
interpretations.
Otherwise. F

20
21
Dr. Mina Younan
Intelligent Systems 8
The semantics of propositional calculus
The truth assignments of compound propositions are often described by truth
tables.
Example: The truth table for P  Q: PQ Q P
T T T
 The truth tables for , , ‫ר‬, and  can be F F T
defined in a similar fashion.
 The equivalence of two expressions may be T T F
demonstrated using truth tables. T F F

Example: A proof of the equivalence of P  Q and ‫ר‬P  Q:

P  Q  ‫ר‬P  Q PQ ‫ר‬P  Q ‫ר‬P Q P


T T T F T T
T F F F F T
T T T T T F
T T T T F F

20
21
Dr. Mina Younan
Intelligent Systems 9
Satisfiability and Validity
• A sentence is valid/ tautology if it holds under every interpretation.
• A sentence is satisfiable if it holds under some interpretation.
• A sentence is unsatisfiable/ contradiction if it holds under no interpretation.
Examples:
1. The sentence P  (Q  P) is valid.
2. The sentence (Q  P)  P is satisfiable.
3. The sentence P  ‫ ר‬P is unsatisfiable.
These examples can be proved using truth tables.

P ‫ר‬P (QP) P P (QP) QP Q P


F T T T T T
F T T T F T
F T T F T F
F F T T F F
20
21
Dr. Mina Younan
Intelligent Systems 10
The Predicate Calculus
• In propositional calculus, each atomic symbol (P, Q, etc.) denotes a
proposition of some complexity.
o A predicate is a parameterized proposition, that is a proposition with
parameters/variables.
 For example, instead of letting a single propositional symbol, P,
denote the entire sentence "It rained on Tuesday", we can create a
predicate weather that describes a relationship between a date and the
weather: weather (tuesday, rain).
• Through inference rules we can manipulate predicate calculus
expressions, accessing their individual components and inferring new
sentences.
o Predicate calculus also allows expressions to contain variables. 
Variables let us create general assertions about classes of entities.
 For example we could state that for all values of X, where X is a day
of the week, the statement weather (X, rain) is true, i.e., it rains every
day.

20
21
Dr. Mina Younan
Intelligent Systems 11
The syntax of the predicate calculus
Predicate calculus character set:
• The set of letters: a – z, and A – Z.
• The set of digits: 0, 1, …, 9.
• The underscore, _.

Predicate calculus symbols:


• Symbols in the predicate calculus begin with a letter and are followed by
any sequence of the legal characters mentioned above.
• Examples of legitimate predicate calculus symbols:
george fire3 bill XXX friends_of tom_and_jerry
• Examples of strings that are not legal symbols:
3jakab%cd **71 duck!! "no blanks allowed"

• Symbols are used to denote objects, properties, or relations in a world


of discourse.
• Predicate calculus symbols may represent variables, constants,
functions, or predicates.
20
21
Dr. Mina Younan
Intelligent Systems 12
The syntax of the predicate calculus
(1) Constants:
• They name specific objects or properties in the world.
• Constant symbols must begin with a lowercase letter.
• Examples of legal constant symbols:
george, tree, tall, and blue.
• The constants true and false are reserved as truth symbols.

(2) Variables:
• They are used to designate general classes of objects or
properties in the world.
• Variables are represented by symbols beginning with an
uppercase letter.
• Examples of legal variables: X, Man, Bird, and DAY.

20
21
Dr. Mina Younan
Intelligent Systems 13
The syntax of the predicate calculus
(3) Functions:
• They denote a mapping of one or more elements in the domain of the
function into a unique element of the range of the function.
• Elements of the domain and range are objects in the world of
discourse.
• Function symbols begin with a lowercase letter.
• A function expression is a function symbol followed by its arguments
enclosed in parentheses and separated by commas.
• The number of arguments is called the arity of the function.
• Examples of well-formed function expressions:
Function expression f(X, Y) father(david) plus(2, 3)
Arity 2 1 2

• Each function expression denotes the mapping of the arguments onto


a single object in the range, called the value of the function.
• The act of replacing a function with its value is called evaluation.

20
21
Dr. Mina Younan
Intelligent Systems 14
The syntax of the predicate calculus
(4) Predicates:
• A predicate names a relationship between zero or more objects
or between objects and their properties in the world.
• Predicate symbols are symbols beginning with a lowercase
letter.
• Examples of predicates are:
likes, equals, on, near, part_of, clear.
• Predicates have an associated positive integer referred to as the
arity or the number of its arguments.

20
21
Dr. Mina Younan
Intelligent Systems 15
The syntax of the predicate calculus
An atomic sentence: is a predicate constant of arity n, followed
by n terms, t1, t2, …, tn, enclosed in parentheses and separated
by commas.
• A predicate calculus term is either a constant, variable, or
function expression. It may be used to denote objects and
properties in the problem domain.
• The truth values, true and false, are also atomic sentences.
• Examples of atomic sentences are:
likes (george, kate) likes (X, george)
likes (george, sarah, tuesday) likes (X, Y)
friends (bill, george) helps (richard, bill)
friends (father_of(david), father_of(andrew))
• Atomic sentences can be combined using logical connectives
(, , ‫ר‬, , and ) to form sentences in the predicate calculus.

20
21
Dr. Mina Younan
Intelligent Systems 16
Variable quantifiers
• Variable quantifiers are symbols that constrain the meaning of a
sentence containing a variable. Quantifiers determine when predicate
calculus expressions are true.
• A quantifier Q is followed by a variable X and a sentence s: QXs.
• In the first order predicate calculus, there are two variable quantifiers:
o The universal quantifier, , indicates that the sentence is true for
all values of the variable.
For example, X likes (X, ice_cream) is true for all values in the
domain of the definition of X.
o The existential quantifier, , indicates that the sentence is true
for at least one value in the domain.
For example, Y friends (Y, peter) is true if there is at least one
person, indicated by Y, that is a friend of peter.

20
21
Dr. Mina Younan
Intelligent Systems 17
Predicate calculus sentences
Every atomic sentence is a sentence.
If s is a sentence, then so is its negation, ‫ר‬s.
If s1 and s2 are sentences, then so are their:
conjunction, s1  s2, disjunction, s1  s2,
implication, s1  s2, and equivalence, s1  s2.
If X is a variable and s is a sentence, then Xs is a sentence, and Xs is a
sentence.
Examples:
Let plus be a function symbol of arity 2 and let equal and foo be
predicate symbols with arity 2 and 3, respectively:
• plus (two, three) is a function and thus not an atomic sentence.
• equal (plus (two, three), five) is an atomic sentence.
• equal (plus (two, three), seven) is an atomic sentence. Note that this sentence
is false.
•  X foo (X, two, plus (two, three))  equal (plus (two, three), five)
is a sentence, because both conjuncts are sentences.
20
21
Dr. Mina Younan
Intelligent Systems 18
Example:
• This is an example of the use of predicate calculus to describe a simple
world. The domain of discourse is a set of known family relationships:
mother (eve, abel)
mother (eve, cain)
father (adam, able)
father (adam, cain)
X Y (father (X, Y)  mother (X, Y)  parent (X, Y))
X Y Z (parent (X, Y)  parent (X, Z)  sibling (Y, Z))

• These implications can be used to infer facts such as


sibling (abel, cain).

• The predicates mother and father are used to define a set of parent-
child relationships. The implications give general definitions of other
relationships, such as parent and sibling, in terms of these predicates.
20
21
Dr. Mina Younan
Intelligent Systems 19
The function verify_sentence:
It is a recursive function for verifying that an expression is a sentence. It
takes as argument a candidate expression (E) and returns success if the
expression is a sentence.
function verify_sentence (E)
begin
case
E is an atomic sentence: return success;
E is of the form QXs, where Q is either  or , and X is a variable:
if verify_sentence (s) returns success
then return success
else return fail;
E is of the form ‫ר‬s:
if verify_sentence (s) returns success
then return success
else return fail;
E is of the form s1 op s2, where op is a binary logical operator:
if verify_sentence (s1) returns success and
verify_sentence (s2) returns success
then return success
else return fail;
otherwise: return fail
end case
20
end.
21
Dr. Mina Younan
Intelligent Systems 20
Relationships between quantifiers (‫ ר‬, and )

Several relationships between negation and the universal and the


existential quantifiers are given below. Also, the notion of a variable
name as a dummy symbol that stands for a set of constants is noted.

For predicates p and q and variables X and Y:


• ‫ר‬X p(X)  X ‫ר‬p(X)
• ‫ר‬X p(X)  X ‫ר‬p(X)
• X p(X)  Y p(Y)
• X q(X)  Y q(Y)
• X (p(X)  q(X))  X p(X)  Y q(Y)
• X (p(X)  q(X))  X p(X)  Y q(Y)

20
21
Dr. Mina Younan
Intelligent Systems 21
Representing English sentences in predicate calculus
Examples:
• If it doesn't rain on Monday, Tom will go to the mountains.
‫ ר‬weather (rain, monday)  go (tom, mountains)
• A bluebird is a blue-colored bird.
is_a (bluebird, bird)  has_color (bluebird, blue)
• All basketball players are tall.
X (basketball_player (X)  tall (X))
• Some people like anchovies.
X (person (X)  likes (X, anchovies))
• If wishes were horses, beggars would ride.
equal (wishes, horses)  ride (beggars)
• No body likes taxes.
‫ר‬X likes (X, taxes)

20
21
Dr. Mina Younan
Intelligent Systems 22

You might also like