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

AI Lecture 2

father(x,y)

Uploaded by

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

AI Lecture 2

father(x,y)

Uploaded by

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

Knowledge Representation

REPRESENTING FACTS
The two most fundamental concerns of A.I. are knowledge representation and search
If we need to build intelligent computers we must tell to them all the common sense
(knowledge) we have that they don’t.

KNOWLEDGE+ COMPUTER INTELLIGENTE


COMPUTER

Facts: things true about


the world

KNOWLEDGE

Procedures: ways to
follow chains between
facts
• Two main types of knowledge :
-Declarative Knowledge : it means what do you know (Fact) , things true about
the world summation 2 and 2 is 4.
sum(2, 2, 4).
sum (2, 5, 7).
eg. : computer (cpu).
computer (memory).
computer (input).
computer(output).
- Procedural knowledge : how to do things (rules). Rules are a good way of representi
procedural knowledge
- eg. how to multiply 2 numbers or ahmed is grand father of mohamad
grandfather (ahmed , mohamad):- male(ahmed),male (hardi),
father(ahmed, hardi),
father(hardi, mohamad)
- A representational scheme should

1- be adequate to express all of the necessary information.


2- Support efficient execution of the resulting code.
3- Provide a natural scheme for expressing the required knowledge.
 AI representation languages
to talk about facts , rules we need a “language”,
A.I. using many languages for the purpose of
representation. we will use predicate calculus as
a representational language.
 The languages in A.I. must :-
a) Handle qualitative knowledge.
b) Allow new knowledge to be inferred from a
basic set of facts.

5
c) Allow representation of general principles
as well as specific situations.
d)Capture complex semantic meaning.
e)Allow for meta – level reasoning.
a) Handle qualitative knowledge:-
C

A B

Using predicate calculus , the world could be described by


the logical assertions
Clear ( c )
Clear (a)
On table (a)
On table (b)
On (c,b)
Cube (a)
Pyramid ( c )
.
.
.
Color
Left
Right
. 7
.
.
b) Allow new knowledge to be inferred from a basic set of
facts:
To determine whether a block is clear
V X Y on ( Y , X ) Clear (X)
“For all X , X is clear if there does not exist a Y such
that Y is on x”
c) Allow representation of general principles as well as
specific situations:
 Using variables
 Free from type & scope

8
d) Capture complex semantic meaning:
Required large amounts of highly structured interrelated knowledge.
Describing the relationship between events occurring over time.
“ a blue bird is a small blue – colored bird and a bird is a feathered
flying animal”

Size ( bluebird , small ) //bluebird size small


Has covering ( bird , feather ) //bird has covering feather
Has color ( blue bird , blue ) //blue bird has color blue
Has property ( bird , flies ) //bird has property flies
Is a ( blue bird , bird ) //blue bird is a bird
Is a ( bird , animal ) //bird is a animal

9
e) Allow for meta – level reasoning
1) An intelligent system not only should know things but also
know what it knows.
2) It should be able not only to solve problems but also to explain
how it should the problem and why it made certain decisions.
3) It should be able to describe its knowledge in both specific and
general terms.
4) It should be able to recognize the limitations of its knowledge
and learn from its interactions with the world

Knowledge about what you know

Meta – knowledge
( higher level of knowledge )
10
The Propositional Calculus
• The propositional and predicate calculus are first of all
languages , using their words, phrases and sentences
we can represent and reason about properties and
relationships in the world.

• Propositional calculus symbols


P, Q, R , S, T (propositions) (statements)
• Truth Symbols
true , false
• Connectives
• ^ = AND =Conjunction. //A and B ==A^B
• ⱽ = OR = disjunction. //A or B ==AvB
• ‫ = ﬢ‬NOT //not A== ‫ﬢ‬A
• ==> = Implication. //if A happen then B happen : A==>B
• = = equivalence //A equal B == A=B
• Propositional symbols denote propositions or statements
about the world that may be either true or false.

• Propositions are denoted by upper case letters near the end


of the English alphabet.

• Sentences in the propositional calculus are formed from those


atomic symbols according to the following propositional
calculus sentences.

Ex. True , P , Q and R senteces

Negation: ‫ﬢ‬P , ‫ﬢ‬False is a sentences


Conjunction : P ^ ‫ﬢ‬Q is a sentence
Disjunction : P v ‫ﬢ‬P is a sentence
implicant : P ==> Q is a sentence
Equavalence : P v Q = R is a sentence.
Legal sentence is called well- formed formulas or WFFs.
P ===> Q
Premise conclusion(consequent)
antecedent

Semantics of propositional calculus

• Ex:- P=“It is raining” Q= “I am at work “

P ==> ‫ﬢ‬Q sentences


P ^Q

• Note: propositions in this logic are only true or false


Propositional logic Assumes that the world consists of facts
this is quite limited.
• An interpretation of a set of propositions is the assignment
of truth value either T or F, to each propositional symbol.

P ‫ﬢ‬P P Q PvQ P Q P^Q


T F ---------------------- ----------------------
F T F F F F F F
F T T F T F
T F T T F F
T T T T T T

P Q P==>Q P Q P=Q
---------------------- ----------------------
F F T F F T
F T T F T F
T F F T F F
T T T T T T
Ex : (‫ﬢ‬P v Q) = ( P ==> Q)

P Q ‫ﬢ‬P ‫ﬢ‬P v Q P==>Q (‫ﬢ‬P v Q) = ( P ==> Q)


--------------------------------------------------------------------
F F T T T T
F T T T T T
T F F F F T
T T F T T T

• We can also prove the following propositional calculus


equivalences
• ‫ﬢ(ﬢ‬P) =P
• (P v Q) = (‫ﬢ‬P ==> Q)
• Demorgan’s Law :‫(ﬢ‬P ^Q) = ‫ﬢ‬P v ‫ﬢ‬Q
• Demorgan’s Law :‫(ﬢ‬P v Q) = ‫ﬢ‬P ^ ‫ﬢ‬Q
• Distributive Law: P v (Q ^ R) = (P V Q) ^ (P v R)
P ^ (Q v R) = (P ^ Q) v (P ^ R)

• Commutative Law: (Q ^ R) = ( R ^ Q)
(Q v R) = (R v Q)

• Associative Law: P v (Q v R) = (P v Q) v R
P ^ (Q ^ R) = (P ^ Q) ^ R

• Contrapositive Law: P ==>Q = ‫ﬢ‬Q ==> ‫ﬢ‬P


The Predicate Calculus
• Propositional calculus assumes that the world consists of facts
this is quite limited.

• Predicate logic (First order predicate logic) is more flexible


because the world consists of objects , with properties among
Objects relations hold.

Ex: weather (tuesday , rain).

The same sentence is much harder in propositional logic.


e .g. in propositional logic

P=“Ahmed is father of Ali”


Q=“Ali is father of kamal”

• If we need Grand father of kamal , because there is no


functions and because there are no relations, both of which
are awkward and don’t allow for generalizations rel(X).

• Predicates are actions or states that relate terms.


e.g. father ( ).
Be clear that they are not the same as functions like.

• Literals are predicates applied to any term e.g.


female ( ….), isage(….)

• Clauses are conjoined literals that imply another literal


• (Well Sort of) e.g. A ^ B ^ C ^D ==> H.
Connective and Quantifiers
• Not (‫ )ﬢ‬, AND (^) conjunction , OR (v) disjunction

• If ==> implication : which is true if the antecedents are true


P ==> Q means if P is true then Q is true.
• Iff <==> equality: the two terms are equivalent.

• Quantifiers

• ƎX :means there exists at least one X such that


• ⱯX : means for all X

• There is connection between Ɐ and Ǝ via negation


• ⱯX ‫ﬢ‬likes( X, computers)
is equivalent to ‫ﬢ‬ƎX likes(X,computers)
• ⱯX likes( X, icecream)
is equivalent to ‫ ﬢ‬ƎX ‫ ﬢ‬likes(X,icecream).

//all x likes icecream


Predicates Calculus Symbols
• Predicate Calculus consists of
1- A ..Z, a .. Z
2- set of digits 0,1,…9
3- the underscore _

• Predicate calculus symbols may represent either variables,


Constants, functions or predicates.

• Variables are represented by symbols beginning with an


uppercase letter e.g. Gorge.

• Constant symbols must begin with lowercase letter


e.g. ahmed , age
• Functions symbols begins with lowercase , functions
denote a mapping of one or more elements in a set called
The domain of the function , into a unique element of
another set ( the range of the function).

e.g. f(x,y)

You might also like