Prolog programming Introduction to Prolog CS370d - CS 461.

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.
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.
PIIT Computer Science Summer Camp - Alice July 10, 2012 Brenda Parker Computer Science Department MTSU.
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
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.
CS Tutorial 1 Getting Started with Visual Studio 2012 (Visual Studio 2010 are no longer available on MSDNAA, please choose Visual Studio 2012 which.
COSC 2P93 Logic Programming Instructor: Brian Ross Instructor: Brian Ross Texts: Texts: Prolog Programming for Artificial Intelligence,4e, Ivan Bratko,
LING 388: Language and Computers Sandiway Fong Lecture 3.
 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.
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.
Basics of Biostatistics for Health Research Session 1 – February 7 th, 2013 Dr. Scott Patten, Professor of Epidemiology Department of Community Health.
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.
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.
For Wednesday No reading Prolog handout 2 Chapter 9, exercise 4.
1 TP #2: How does Prolog answer questions? n Miscellaneous info; n Last TP exercises solved; n How does Prolog answer questions? n Recursive Prolog programs;
Logic Programming Logic programming Candidates should be familiar with the concept of logic programming for declaring logical relationships.
Insert your name and class period here. 1. What is the goal of every equation you solve? 2. How do we accomplish this goal? Type your answer here.
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).
Prolog CSC 481 Team Project Winter 2009 ES-Tools Team.
Computer Languages [Computing] Computing.
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.
Quick Start Guide for Visual Studio 2010
Prolog Primarily for Symbolic (nonnumeric) Computation
Objective: Be able to add and subtract directed numbers.
Prolog programming Introduction to Prolog
Prolog programming Introduction to Prolog (part3)
Click the problem to show the answers.
CS 1111 Introduction to Programming Spring 2019
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 - CS 461

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 sex 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:

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

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.