Prolog programming Introduction to Prolog

Slides:



Advertisements
Similar presentations
Software Development Languages and Environments. Programming languages High level languages are problem orientated contain many English words are easier.
Advertisements

4. Using Structures: Example Programs. Contents l Retrieving structured information from a database l Doing data abstraction l Simulating a non-deterministic.
1. An Overview of Prolog.
Prolog.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
Prolog The language of logic. History Kowalski: late 60’s Logician who showed logical proof can support computation. Colmerauer: early 70’s Developed.
Prolog Programming for Artificial Intelligence Three edition 2001
Prolog programming Introduction to Prolog (part4) CS 370 – CS461.
Prolog programming Introduction to Prolog
About prolog  History  Symbolic Programming Language  Logic Programming Language  Declarative Programming Language.
MB: 2 March 2001CS360 Lecture 31 Programming in Logic: Prolog Prolog’s Declarative & Procedural Semantics Readings: Sections
Introduction to Prolog Proof Procedures. Exercise parent(mark, alex). parent(di, alex). brother(brian, mark). sister(cathy, di). wife(susan, brian). husband(brad,
For Friday Read “lectures” 1-5 of Learn Prolog Now: prolog-now/
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Introduction to Prolog Notes for Ch.1 of Bratko For CSCE 580 Sp03 Marco Valtorta.
Copyright © 2003 Bolton Institute Logical Analysis and Problem Solving, (LAPS) Programming in Prolog.
Amazing Call to Action Templates. Personalising the Call to Action Templates Images are grouped in the Powerpoint slide so to edit an element, simply.
An ide for teaching and learning prolog
Prolog programming Introduction to Prolog CS370d - CS 461.
1 Software Development Topic 2 Software Development Languages and Environments.
Introduction Purpose This course describes the process of installing the KPIT GNU toolchain on your PC. Objective Learn how easy it is to get information.
COSC 2P93 Logic Programming Instructor: Brian Ross Instructor: Brian Ross Texts: Texts: Prolog Programming for Artificial Intelligence,4e, Ivan Bratko,
 We are going to learn about programming in general…How to think logically and problem solve. The programming language we will use is Python. This is.
1 Lecture 6 Logic Programming introduction to Prolog, facts, rules Ras Bodik Shaon Barman Thibaud Hottelier Hack Your Language! CS164: Introduction to.
Artificial Intelligence LECTURE 2 ARTIFICIAL INTELLIGENCE LECTURES BY ENGR. QAZI ZIA 1.
Help With Constructing a Family Tree (Pedigree). Here you will learn how to take a family history and construct a family tree using the symbols and relationship.
For Wednesday No new reading Prolog handout 2 Chapter 9, exercise 4.
For Wednesday Read “lectures” 7-10 of Learn Prolog Now Chapter 9, exs 4 and 6. –6 must be in Horn clause form Prolog Handout 2.
Setting Up Eclipse. What is Eclipse? Eclipse is a free, downloadable software that allows us to create, compile, and run JAVA programs.
CISB434: VisiRule 1.
I Power Higher Computing Software Development Development Languages and Environments.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
For Monday Read “lectures” 1-5 of Learn Prolog Now: prolog-now/
Review for test! Alice Chapter 1&2 Test is tomorrow! - March 26 th March 25th.
MB: 26 Feb 2001CS Lecture 11 Introduction Reading: Read Chapter 1 of Bratko Programming in Logic: Prolog.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
Use SPSS for solving the problems Lecture#21. Opening SPSS The default window will have the data editor There are two sheets in the window: 1. Data view2.
For Friday No reading Prolog Handout 2. Homework.
Logic Programming Logic programming Candidates should be familiar with the concept of logic programming for declaring logical relationships.
IENG-385 Statistical Methods for Engineers SPSS (Statistical package for social science) LAB # 1 (An Introduction to SPSS)
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
1 TP #1: What is a Prolog program? n The SWI Prolog interpreter; n How to load a Prolog program in the interpreter; n Asking questions to the program (execution).
Computer Languages [Computing] Computing.
CST 1101 Problem Solving Using Computers
S519: Evaluation of Information Systems
PROLOG – PROgamming in LOGic Early 1970s- programming language.
For Friday No reading Prolog handout 3 Chapter 9, exercises 9-11.
For Wednesday Read “lectures” 7-10 of Learn Prolog Now:
An introduction to programming Created by Dr. Randy Pausch
Prolog programming Introduction to Prolog
Click here for the answer. Click here for the answer.
By: Your Name Your Teacher’s Name
Click here for the answer. Click here for the answer.
Excel in M.E. –Using add-ins
Click here for the answer. Click here for the answer.
Prolog programming Introduction to Prolog (part2)
HOW TO INSTALL DRIVERS ON WINDOWS 10. Select the Start button and Go to the device manager.
HOW TO INSTALL DRIVERS ON WINDOWS 10. Select the Start button and Go to the device manager.
How to Install an old version of Adobe Reader on Mac OS.
Prolog Primarily for Symbolic (nonnumeric) Computation
Objective: Be able to add and subtract directed numbers.
Egyptian Language School
Prolog programming Introduction to Prolog (part3)
Click the problem to show the answers.
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Prolog programming Introduction to Prolog (part4)
How To Think Like a Prolog ?
YOUR text YOUR text YOUR text YOUR text
BlueJ: a very quick introduction
Objective: Be able to add and subtract directed numbers.
Presentation transcript:

Prolog programming Introduction to Prolog CS370d

What is Prolog programming? Prolog is a programming language for symbolic , non-numeric commutation. It solves problems that involve objects and relations between objects.

Defining relations by facts The fact that Tom is a parent of Bob can be written in prolog as: parent(tom, bob). tom and bob are objects, parent(tom, bob) is a relation between these objects.

Defining relations by facts The whole family tree can be described by the following facts: pam tom bob liz ann pat jim

Defining relations by facts The whole family tree can be described by the following facts: parent(pam,bob). parent(tom,bob). parent(tom,liz). parent(bob,ann). parent(bob,pat). parent(pat,jim). pam tom bob liz ann pat jim

Defining relations by facts We can also add information about the gender of the people by the following facts: female(pam). male(tom). male(bob). female(liz). female(pat). female(ann). male(jim).

Defining relations by facts female(pam) is a Unary relation parent(bob,pat) is a Binary relation. Think about this relation: sex(pam, feminist).

SWI-Prolog SWI-Prolog editor is an open source implementation of the programming language . Prolog is a free software and you can download it from here: http://www.swi-prolog.org/Download.html

SWI-Prolog Getting started: Any Prolog program in SWI-Prolog is written in a file with extension .pl. You can write your own one by following these steps:

SWI-Prolog After opening SWI Prolog environment, choose file -> new to create a new.pl file.

SWI-Prolog This will open a new window to create the new file, choose any name for your programs (here we name it tree) then choose to save it.

SWI-Prolog Now the .pl file we have just created will be opened, and we can write our own program. Let's write the following facts about parent , male and female relationships: parent(pam,bob). parent(tom,bob). parent(tom,liz). parent(bob,ann). parent(bob,pat). parent(pat,jim). female(pam). female(liz). female(pat). female(ann). male(tom). male(bob). male(jim).

SWI-Prolog

SWI-Prolog Compile your program. Compile - > Make

SWI-Prolog Then click “ OK ” to save the changes on your file.

SWI-Prolog In SWI Prolog environment, load your program by file -> consult. Then choose your program .

Questions in prolog. Prolog can posed questions about any relation. So, we can ask a question about Parent relation, For example : Is bob a parent of Pat? ?- parent(bob,pat). The answer will be true.

Exercise 1: Write prolog program of your own family tree .