download

Matakuliah
Tahun
Versi
: T0264/Inteligensia Semu
: Juli 2006
: 2/1
Pertemuan 6
Using Predicate logic
1
Learning Outcomes
Pada akhir pertemuan ini, diharapkan mahasiswa
akan mampu :
• << TIK-99 >>
• << TIK-99>>
2
Outline Materi
•
•
•
•
•
Materi 1
Materi 2
Materi 3
Materi 4
Materi 5
3
5. USING PRDICATE LOGIC
Logika merupaka bentuk representasi
Input :
Premis atau
Fakta
PROSES LOGIKA
Output :
(LOGIC PROCESS)
Konklusi
Inferensi atau
Terdapat 2 jenis penalaran :
1.
2.
Penalaran Deduktif : Penalaran dimulai dari rpinsip
umum untuk mendapatkan kesimpulan yang lebih
khusus.
Penalaran Induktif : Penalaran dimulai dari fakta-fakta
khsusus untuk mendapatkan kesimpulan umum.
4
Operator
Operator AND
symbol 
Operator OR
symbol 
Operator NOT
symbol 
Operator For All symbol 
Operator There Exists symbol 
Operator Implication (jika-maka)
symbol 
• Operator Equivalent (jika dan hanya jika)
symbol 
•
•
•
•
•
•
5
5.1 Representing Simple Facts in Logic
Representing Simple Facts in Logic
It is raining.
RAINING
It is sunny.
SUNNY
It is windy.
WINDY
If it is rainning, then it is not sunny.
RAINING   SUNNY
6
A Predicate Logic Example
1. Marcus was a man.
man(Marcus)
2. Marcus was a Pompeian.
Pompeian(Marcus)
3. All Pompeian were Romans.
x : Pompeian (x) 
Roman(x)
4. Caesar was a ruler.
ruler(Caesar)
5. All Romans were either loyal to Caesar or hated him
x : Roman(x)  loyalto(x,Caesar)  hate(x,Caesar)
6. Everyone is loyal to someone.
x : y : loyalto (x,y)
7
A Predicate Logic Example
7. People only try to assassinate rulers they
aren’t loyal to
x : y : person(x)  ruler(y)
tryassassinate(x,y)  loyalto(x,y)
• Marcus tried to assassinate Caesar.
tryassassinate (Marcus, Caesar)
9. All men are people.
x : man(x)person(x)
8
An Attempt to Prove loyalto(Marcus,Caesar)
9
Contoh lain Predicate Logic
1.
2.
3.
4.
5.
6.
7.
8.
Chandra adalah seorang mahasiswa
Chandra masuk jurusan Informatika
Setiap mahasiswa Informatika pasti mahasiswa
Fasilkom
Algoritma adalah matakuliah yang sulit
Setiap mahasiswa Fasilkom pasti akan suka Algoritma
atau membencinya
Setiap mahasiswa pasti menyukai suatu matakuliah
Mahasiswa yang tidak pernah hadir kuliah pada
matakuliah slit, maka mereka pasti tidak suka terhadap
matakuliah tersebut
Chandra tidak pernah hadir paka matakuliah Algoritma
10
Bentuk Predicate Logic
1.
2.
3.
4.
5.
mahasiswa (Chandra)
Informatika (Chandra)
x : informatika(x)  Fasilkom(x)
sulit(Algoritma)
x : Fasilkaom(x)  suka(x,Algoritma) 
benci(x,Algoritma)
6.
x :x : suka(x,y)
7.
x : y : mahasiswa(x)  sulit(y)  hadir(x,y) 
8.
suka(x,y)
hadir(Chandra,Algoritma)
11
Apakah Chandra suka mtakuliah Algoritma
suka(Chandra,Algoritma)
(7)
mahasiswa(Chandra)  sulit(Algoritma)
 hadir(Chandra,Algoritma)
(1)
sulit(algoritma)  hadir(Chandra,Algoritma)
(4)
hadir(Chandra,Algoritma)
(8)
12
5.2 Representing Instance and Isa Relationships
Class membership is represented with unary
predicates (such as Roman), each of which
correspond to a class. Asserting that P(x) is true is
equivalent to asserting that x is an instance (or
element) of P.
• Three Ways of Representing Class Membership
1. man(Marcus)
2. Pompeian(Marcus)
3. x : Pompeian(x) Roman(x)
4. ruler(Caesar)
5. x:Roman(x) 
loyalto(x,Caesar) hate(x,Caesar)
13
Representing Instance and Isa Relationships
1.
2.
3.
4.
5.
instance(Marcus,man)
instance(Marcus,Pompeian)
x : instance(x,Pompeian) instance(x,Roman)
instance(Caesar,ruler)
x : instance(x, Roman)  loyalto(x,Caesar)
hate(x,Caesar)
1.
2.
3.
4.
5.
instance(Marcus,man)
instance(Marcus,Pompeian)
isa(Pompeian,Roman)
instance(Caesar,ruler)
x : instance(x,Roman) loyalto(x,Caesar)
hate(x,Caesar)
x:y:z: instance(x,y)  isa(y,z)
instance(x,z)
6.
14
5.3 Computable Functions and Predicates
A Set of Facts about Marcus
1.
2.
3.
4.
5.
man (Marcus)
Pompeian(Marcus)
born(Marcus,40)
x :man(x) mortal(x)
erupted(volcano,79)   x : [Pompeian(x)
died(x,79)]
6. x: t1: t2: mortal(x)  born(x,t1)  gt(t2- t1,150)
dead(x,t2)
8. now = 1991
9.  x: t:[alive(x,t) dead(x,t)]  [dead(x,t)
alive(x,t)]
10.  x: t1:t2: died(x,t1)  gt(t2,t1) dead(x,t2)
15
One Way of Proving That Marcus Is Dead
16
<< CLOSING>>
End of Pertemuan 6
Good Luck
17