PIB Pertemuan 12 Resolution & Refutation (review) Short Quiz

Slides:



Advertisements
Presentasi serupa
Developing Knowledge Management dalam perusahaan Week 10 – Pert 19 & 20 (Off Class Session)
Advertisements

Pengujian Hipotesis untuk Satu dan Dua Varians Populasi
Mata Kuliah : ALGORITMA dan STRUKTUR DATA 1.
PEMOGRAMAN BERBASIS JARINGAN
SOCIAL MEDIA Widianto Nugroho, S.Sn. |
PERUBAHAN VS PERBAIKAN Center for Continuous Improvement, Today is better than yesterday, tomorrow is better than today
Program Keahlian I – SI By Antonius Rachmat C, S.Kom
Materi Analisa Perancangan System.
PERULANGANPERULANGAN. 2 Flow of Control Flow of Control refers to the order that the computer processes the statements in a program. –Sequentially; baris.
Ra Dewa Matahari.
Tugas-Tugas.
REVIEW.
Slide 3-1 Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Revised by IB & SAM, Fasilkom UI, 2005 Exercises Apa saja komponen utama.
Prinsip Pembuatan Study Guide
Prof. Busch - LSU1 Mathematical Preliminaries. Prof. Busch - LSU2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Review IS & Software System Concept Diah Priharsari PTIIK – Universitas Brawijaya Source: 1.Obrien & Marakas, Management Information.
Introduction to The Design & Analysis of Algorithms
IF-ITB/SAS/25Aug2003 IF7074 – Bagian Pertama Page 1 IF 7047 Kewirausahaan Teknologi Informasi Bagian Pertama: 1.1. Entrepreneurship, entrepreneur, dan.
PROSES PADA WINDOWS Pratikum SO. Introduksi Proses 1.Program yang sedang dalam keadaan dieksekusi. 2.Unit kerja terkecil yang secara individu memiliki.
1. Objek dalam kalimat aktif menjadi subjek dalam kalimat pasif
Review Operasi Matriks
Jeff Howbert Introduction to Machine Learning Winter Classification Nearest Neighbor.
Mr. Ari Nurrohmat, S.Pd Present PROCEDURE for Grade IX.
Pengantar/pengenalan (Introduction)
1-Sep-14 Analisis dan Perancangan Algoritma Kuliah 3 : Proof by induction E. Haodudin Nurkifli Teknik Informatika Universitas Ahmad Dahlan.
Oracle Developer/2000. Developer/2000 Products FormsReportsGraphics.
Functions (Fungsi) Segaf, SE.MSc. Definition “suatu hubungan dimana setiap elemen dari wilayah saling berhubungan dengan satu dan hanya satu elemen dari.
Bilqis1 Pertemuan bilqis2 Sequences and Summations Deret (urutan) dan Penjumlahan.
INTEGRITY CONSTRAINTS Database System Concepts, Second Edition, Chapter 5, page 149.
2-Metode Penelitian Dalam Psikologi Klinis
Implementing an REA Model in a Relational Database
MEMORY Bhakti Yudho Suprapto,MT. berfungsi untuk memuat program dan juga sebagai tempat untuk menampung hasil proses bersifat volatile yang berarti bahwa.
3 nd Meeting Chemical Analysis Steps and issues STEPS IN CHEMICAL ANALYSIS 1. Sampling 2. Preparation 3. Testing/Measurement 4. Data analysis 2. Error.
Basisdata Pertanian. After completing this lesson, you should be able to do the following Identify the available group functions Describe the use of group.
2nd MEETING Assignment 4A “Exploring Grids” Assignment 4 B “Redesign Grids” Create several alternatives grid sysytem using the provided elements: (min.
Slide 1 QUIS Langkah pertama caranya Buat di slide pertama judul Slide kedua soal Slide ketiga waktu habis Slide keempat jawaban yang benar Slide kelima.
LESSON 10: LET’S COOK LEARNING FOCUS USING “a little” USING “a few”
LOGO Manajemen Data Berdasarkan Komputer dengan Sistem Database.
Linked List dan Double Linked List
BASH – Shell Programming Guide Erick, Joan © Sekolah Tinggi Teknik Surabaya 1.
Contentment Philippians 4: Contentment What does it mean to be content? What does it mean to be content? Are you a content person? Are you a content.
SMPN 2 DEMAK GRADE 7 SEMESTER 2
STRUCTURAL CONTROL continuation STATEMENT  SWITCH  WHILE  DO..WHILE.
Introduction to Softcomputing Son Kuswadi Robotic and Automation Based on Biologically- inspired Technology (RABBIT) Electronic Engineering Polytechnic.
1. 2 Work is defined to be the product of the magnitude of the displacement times the component of the force parallel to the displacement W = F ║ d F.
Lecture 8 Set and Dictionary Sandy Ardianto & Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
MAINTENANCE AND REPAIR OF RADIO RECEIVER Competency : Repairing of Radio Receiver.
© 2009 Fakultas Teknologi Informasi Universitas Budi Luhur Jl. Ciledug Raya Petukangan Utara Jakarta Selatan Website:
PERSAMAAN DAN PERTIDAKSAMAAN
PENJUMLAHAN GAYA TUJUAN PEMBELAJARAN:
Red -BlackTrees Evaliata Br Sembiring.
The Members: 1. Masayu martika sari 2. Dhea riski 3. Meri puspita sari
TCP, THREE-WAY HANDSHAKE, WINDOW
Menu Standard Competence Based Competence.
Web Teknologi I (MKB511C) Minggu 12 Page 1 MINGGU 12 Web Teknologi I (MKB511C) Pokok Bahasan: – Text processing perl-compatible regular expression/PCRE.
Lecture 2 Introduction to C# - Object Oriented Sandy Ardianto & Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Pengantar Intelijensia Buatan
2. Introduction to Algorithm and Programming
Ruang Contoh dan Peluang Pertemuan 05
1 Pertemuan 6 Using Predicate logic Matakuliah: T0264/Inteligensia Semu Tahun: Juli 2006 Versi: 2/1.
9.3 Geometric Sequences and Series. Objective To find specified terms and the common ratio in a geometric sequence. To find the partial sum of a geometric.
Algorithms and Programming Searching
Lesson 2-1 Conditional Statements 1 Lesson 2-1 Conditional Statements.
Exploring C-Chem with numeric MM and Ab-Initio methods Masood Malekghassemi – Systems Lab Abstract Computational chemistry is no new subject.
Conditional Move and Arrays
What is Kerberos? Network Security.
Xuan Huo and Ming Li and Zhi-Hua Zhou
CMP 131 Introduction to Computer Programming
Lecture 8 Normal model.
2. Discussion TASK 1. WORK IN PAIRS Ask your partner. Then, in turn your friend asks you A. what kinds of product are there? B. why do people want to.
Transcript presentasi:

PIB Pertemuan 12 Resolution & Refutation (review) Short Quiz Prolog Introduction & Exercise PIB Pertemuan 12

Resolution & Refutation

General Steps Translate facts and rules into predicate logic Tranform sentence into CNF (conjunctive normal form) / horn clause / well formed formula

Specific Steps To Produce CNF Eliminate implications & bi-conditionals Move  inwards Standardize variables: each quantifier has different ones Skolemize: choose a “fact” to eliminate  Eliminate  Distribute ^ over v

Short Quiz (1) Buktikan bahwa “Marcus membenci Caesar” Facts Rules Marcus adalah seorang manusia Marcus orang Pompei Marcus mencoba membunuh Caesar Caesar adalah seorang penguasa Rules Semua orang Pompei adalah orang Romawi Semua orang Romawi setia pada Caesar atau membenci Caesar Setiap orang setia pada minimal 1 orang Orang hanya mencoba membunuh penguasa yang kepadanya mereka tidak setia

Translation into Predicate Logic Facts: man(marcus) pompeian(marcus) tryassassinate(marcus,caesar) ruler(caesar) Rules: x pompeian(x)  roman(x) x roman(x)  loyalto(x, caesar) v hate(x,caesar) x y loyalto(x, y) x y man(x) ^ ruler(y) ^ tryassassinate(x,y)  loyalto(x,y) Prove that: hate(marcus, caesar), use refutation.

Inference on “Marcus’s Case” Make CNF from rules pompeian(x) v roman(x) roman(x) v loyalto(x,caesar) v hate(x,caesar) loyalto(x,y) (man(x) ^ ruler(y) ^ tryassassinate(x,y)) v loyalto(x,y) man(x) v ruler(y) v tryassassinate(x,y) v loyalto(x,y) Apply substitutions into variable, and try to change rules into facts.

Introduction to prolog PROLOG = “Programmation en logique” (Marseille, 1972) Declarative programming language with procedural elements Used for problems of AI / knowledge-based (expert) systems Motivation: reconcile use of logic as declarative knowledge representation with procedural representation of knowledge Strengths: Logical descriptions of problems, instead of HOW to solve them  let computer work out the solution Well-suited for problems involving search Simple programs can be understood by reading the code Limitations Flow of control / procedural semantics

Facts <predicate_name>(arg1, arg2…). Prolog-program = collection of clauses = meta programming Facts Rules Goals (queries), shaped liked facts Facts describe properties of objects and relations between objects; comparable to tables in a relational database student Name interest Name Subject Hans Hans Math Tina Tina Datalogi Lars Lars Physics Frida Frida Math Prolog notation: student(hans). student(tina). student(lars). student(frida). Prolog notation: interest(hans,math). interest(tina,datalogi). interest(lars,physics). interest(frida,math). Prolog notation (facts): <predicate_name>(arg1, arg2…).

Rules Simple IF-THEN statements “Every reasonable student is interested in math.” interest(X,math) :- student(X). head body All specified conditions in the body (all clauses) must be true to make the predicate in the head true. Conjunctions (AND connected): mother(X,Person) :- parent(X,Person),sex(X,female). Disjunctions (OR connected): interest(X,prolog) :- interest(X,artificial_intelligence). interest(X,prolog) :- interest(X,logic).

Goals Goals are queries One ore more subgoals ?- student(thomas). => no Pattern matching: a fact matches a goal if Same predicate Same corresponding arguments. Goals can contain variables: ?- student(X). => X = hans ; => X = tina ; => X = lars ; => X = frida ; => no. Variables are instantiated( included in rules),but cannot be declared!

Prolog’s Inference mechanism Leftmost-depth-first search for solutions Matching: either two terms are identical, or they become identical by variable substitution (resolution based on pred.logic) Processing of subgoals from left to right Backtracking (from goal try to substitute variables into facts or rules) 1: s(a). 2: s(b). 3: q(a). 4: p(X) :- s(X). 5: p(Y) :- q(Y). ?- p(Z). p(Z) 4 5 s(Z) q(Z) 1 2 3 Z=a Z=b Z=a

Backward Chaining The Prolog interpreter uses backward chaining: starting from a goal (theorem) prove the goal by searching for rules whose ”head” (action part) matches the goal Given are the following rules: 1 X 2 H 3 4 OR 5 F&C B&E facts prove AND AND F C B E AND B A C B

SWI Prolog http://www.swi-prolog.org (ver. 5.6.62) Graphical User Interface (XPCE) Interface with Java, C++ Steps: Consult / Compile Goal search / Execute Debug > Graphical Debugger Trace: show you how the unification & substitution occurs

Exercise 1 Use prolog to prove the “Marcus’s Case” man(marcus). pompeian(marcus). ruler(caesar). tryassassinate(marcus, caesar). roman(X) :- pompeian(X). hate(X, Y) :- man(X), ruler(Y), tryassassinate(X, Y). loyalto(X, Y) :- man(X), ruler(Y).

Exercise 2: Family Relation (Kinship) George x Mum Spencer x Kydd Elizabeth x Philip Margaret Diana x Charles Anne x Mark Andrew x Sarah Edward William Harry Peter Zara Beatrice Eugenie

Exercise 2 (cont’d) Buat fakta berdasarkan pohon keluarga di atas Buat aturan untuk aturan: saudaraLaki(X,Y)  X berjenis kelamin laki-laki, X dan Y adalah anak dari seseorang, X dan Y bukan orang yang sama saudaraPerempuan(X,Y)  X berjenis kelamin perempuan, X dan Y adalah anak dari seseorang, X dan Y bukan orang yang sama bersaudaraKandung(X,Y)  X dan Y memiliki ayah dan ibu yang sama, X dan Y bukan orang yang sama kakek(X,Y,Z)  X adalah ayah dari Y, Y adalah ayah dari Z nenek(X,Y,Z)  X adalah ibu dari Y, Y adalah ibu dari Z

Prolog’s List Simple data structure to process non-numeric relation A list is a set of ordered sequential elements [2,2,1,1,4,4,5,6] [b,u,d,i] [budi, iwan, wati] How to use a list? Simple case: empty [] Ordered element: [head|tail] [2,2,1,1,4,4,5,6]  [ 2 | [2,1,1,4,4,5,6] ]

Rules on Prolog’s List [a,b,c] unifies with [Head|Tail] resulting in Head=a and Tail=[b,c] [a] unifies with [H|T] resulting in H=a and T=[] [a,b,c] unifies with [a|T] resulting in T=[b,c] [a,b,c] doesn't unify with [b|T] [] doesn't unify with [H|T] [] unifies with []. Two empty lists always can be unified.

Example “Member List” Predicate: member(X,List). X is a member of List, in case of: 1. X is a head, or 2. X is a member of the tail member(X,[X|Tail]). member(X,[Head|Tail]):- member(X,Tail).

Example “Reverse” reverse([],X,X). reverse([X|Y],Z,W) :- reverse(Y,[X|Z],W). reverse([1,2,3],[],A)                    reverse([2,3],[1],A)         reverse([3],[2,1],A)         reverse([],[3,2,1],A)               true  A = [3,2,1]

Please try this (1) [a,b,c,d]=[a,[b,c,d]]. [a,b,c,d]=[a|[b,c,d]]. []=_. []=[_]. []=[_|[]]. What should Prolog give as result?

Please try this (2) Develop a dictionary to translate number 1..10 from Indonesian to English and vice versa, example: Translate([satu, sembilan],Y).  Y = [one,nine] Translate(Z,[one]).  Z = [satu] Translate([],[]).