PROLOG Basics A Prolog program consists of a database of facts and rules, and queries (questions). Fact:.... Rule:... :-.... Query: ?-.... Variables: must.

Slides:



Advertisements
Similar presentations
Lecturer: Dr. Abeer Mahmoud Logic Programming in Prolog.
Advertisements

9 x9 81 4/12/2015 Know Your Facts!. 9 x2 18 4/12/2015 Know Your Facts!
Prolog.
PROLOG SYNTAX AND MEANING Ivan Bratko University of Ljubljana Faculty of Computer and Info. Sc. Ljubljana, Slovenia.
©Silberschatz, Korth and Sudarshan5.1Database System Concepts Chapter 5: Other Relational Languages Query-by-Example (QBE) Datalog.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
1 x0 0 4/15/2015 Know Your Facts!. 9 x1 9 4/15/2015 Know Your Facts!
1 x0 0 4/16/2015 Know Your Facts!. 1 x8 8 4/16/2015 Know Your Facts!
3 x0 0 7/18/2015 Know Your Facts!. 4 x3 12 7/18/2015 Know Your Facts!
SWI Prolog Portable 1 ?- [p1]. % p1 compiled 0.00 sec, 22 clauses
1 Logic Programming. 2 A little bit of Prolog Objects and relations between objects Facts and rules. Upper case are variables. parent(pam, bob).parent(tom,bob).
Prolog or: How I Learned to Stop Worrying and Love the Search.
4. PROLOG Data Objects And PROLOG Arithmetic
LING 388: Language and Computers Sandiway Fong Lecture 2: 8/24.
Syntax and Semantics of Prolog  Syntax + Terminologies  Data Types  Search Tree (Proof Tree)  Unification  Backtracking.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
Copyright © 2012 Pearson Education, Inc. Chapter 2 Beginning Problem-Solving Concepts for the Computer Problem Solving and Programming Concepts 9 th Edition.
UNIT RATE & CONSTANT OF PROPORTIONALITY. CONSTANT A CONSTANT is a specific number. This value stays the same. VARIABLE A VARIABLE is a letter used to.
DEDUCTIVE DATABASE.
1 COMP 205 Introduction to Prolog Dr. Chunbo Chu Week 13 Slides Courtesy to: Peter LO.
Copyright © 2012 Pearson Education, Inc. Chapter 2 Beginning Problem-Solving Concepts for the Computer Problem Solving and Programming Concepts 9 th Edition.
Fundamental Theorems of Calculus 6.4. The First (second?) Fundamental Theorem of Calculus If f is continuous on, then the function has a derivative at.
Factorial Notation For any positive integer n, n! means: n (n – 1) (n – 2)... (3) (2) (1) 0! will be defined as equal to one. Examples: 4! = =
LING 388: Language and Computers Sandiway Fong Lecture 6.
computer
4 x1 4 10/18/2015 Know Your Facts!. 5 x /18/2015 Know Your Facts!
3 x0 0 10/18/2015 Know Your Facts!. 11 x /18/2015 Know Your Facts!
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
Introduction To PROLOG World view of imperative languages. World view of relational languages. A PROLOG program. Running a PROLOG program. A PROLOG.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 22 A First Course in Database Systems.
BASICS CONCEPTS OF ‘C’.  C Character Set C Character Set  Tokens in C Tokens in C  Constants Constants  Variables Variables  Global Variables Global.
CT214 – Logical Foundations of Computing Lecture 8 Introduction to Prolog.
Programming Languages. A Logic Programming Language: Prolog This lesson describes the basic structures and functions of the logic programming language:
By: Cory Canter CSC 415 Programming Languages. History  Created by Alain Colmerauer, Phillipe Roussel and Robert Kowalski in 1971  Started as a natural.
Introduction to Prolog. Outline What is Prolog? Prolog basics Prolog Demo Syntax: –Atoms and Variables –Complex Terms –Facts & Queries –Rules Examples.
Logic Programming (LP) expresses code using of a restricted form of symbolic logic. LP programs are declarative, rather than algorithmic. An LP program.
Logic Programming. Formal Logics- Recap Formulas – w/out quantifiers Free Variables Bound Variables Assignments and satisfaction Validity and satisfiability.
Logic Programming Tarik Booker. What will we cover?  Introduction  Definitions  Predicate Calculus  Prolog  Applications.
ISBN Chapter 16 Logic Programming Languages.
Functional Programming Languages Logic Programming Languages
5.4 Second Fundamental Theorem of Calculus. If you were being sent to a desert island and could take only one equation with you, might well be your choice.
Knowledge Based Information System
Artificial Intelligence CS370D
Techniques of Differentiation. We now have a shortcut to find a derivative of a simple function. You multiply the exponent by any coefficient in front.
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
For Friday No reading Prolog Handout 2. Homework.
Familiar concept Names for storage Choosing names Ruby rules Program Variables Click icon to hear comments.
Prolog Fundamentals. 2 Review Last Lecture A Prolog program consists of a database of facts and rules, and queries (questions). –Fact:.... –Rule:... :-....
Logic Programming Logic programming Candidates should be familiar with the concept of logic programming for declaring logical relationships.
Ch Variables in Algebra Objective: To recognize and evaluate variable expressions and basic formulas.
Pengenalan Prolog Disampaikan Oleh : Yusuf Nurrachman, ST, MMSI.
علمتني الثلوج أن أكون كبياض الثلج لا يحمل قلبي غير الحب والعطف والرحمة لا أسيئ الظن بالأخرين ولا أحكم عليهم من مظهرهم فإذا لم تعاشرهم فأنت تجهلهم !
For Friday No reading Prolog handout 3 Chapter 9, exercises 9-11.
For Wednesday Read “lectures” 7-10 of Learn Prolog Now:
The number of times a number or expression (called a base) is used as a factor of repeated multiplication. Also called the power. 5⁴= 5 X 5 X 5 X 5 = 625.
PROLOG.
ARTIFICIAL INTELLIGENCE LAB UCEL601 ( Second Term) Presented by Nirmala 1.
Prolog programming Introduction to Prolog (part2)
Knowledge Representation and Inference
Introduction to Matrices
PROLOG PROgramming in LOGic
Learn Your 2x Facts.
Chapter Two: Syntax and Meaning of Prolog Programs
Put the dots on the shift keys.
List Operation in ProLog EUSL/TC/IS/2013/COM/08. In here list will print..
PROLOG.
Function Notation.
Presentation transcript:

PROLOG Basics A Prolog program consists of a database of facts and rules, and queries (questions). Fact:.... Rule:... :-.... Query: ?-.... Variables: must begin with an upper case letter. Constants: numbers, begin with lowercase letter, or enclosed in single quotes.

Simple Facts john_is_cold. raining. john_Forgot_His_Raincoat. fred_lost_his_car_keys. peter_footballer. ‘peter footballer’.

Some more facts female(amy). female(johnette). male(anthony). male(bruce). male(ogden). parentof(amy,johnette). parentof(amy,anthony). parentof(amy,bruce). parentof(ogden,johnette). parentof(ogden,anthony). parentof(ogden,bruce).

Computing a factorial factorial(0,1). factorial(N,F) :- N>0, N1 is N-1, factorial(N1,F1), F is N * F1.

Fibonacci f(0,1). f(1, 1). f(N, R) :- N > 1, N1 is N-1, N2 is N-2, f(N1, R1), f(N2, R2), R is R1 + R2.