100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

KIPA PROLOG Summary

Rating
-
Sold
-
Pages
9
Uploaded on
22-01-2024
Written in
2022/2023

Summary of the PROLOG lectures of the KIPA course

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
January 22, 2024
Number of pages
9
Written in
2022/2023
Type
Summary

Subjects

Content preview

KIPA PROLOG samenvatting
PROLOG 1
Facts and rules

- A Prolog program consists of facts and rules
o color(chardonnay, white). % fact
o tannines(X, low) :- color(X, white). % rule
- Arguments can be complex
o date(day(15), month(march, num(3)), year(2023))




Variables

- Arguments can be a variable
- Variable is assigned a value through unification
o If the variable is used again after unification then the value is fixed
- Special variable _ matches always, no value assigned




Transform knowledge to prolog code

- Domain rule with or: two rules in Prolog
o If it rains or if you swim then you get wet
 wet(_) :- rains.
 wet(X) :- swim(X).
- Domain rule with and: one rule with two conditions
o If it rains and you are outside then you get wet
 wet(X) :- rains, outside(X).

Query algorithm

, - Find the first fact or rule with the same name and arity as the query
- Check if arguments unify
- If yes:
o Assign values to variables
o For rules: create new query for each condition
- If no: try the next fact or rule

Unification

- A query and a fact or rule unify
o if Name is the same
o Number of arguments is the same
o Value of arguments is the same
o or: arguments are uninstantiated (free) variables




Mathematical operators

- Prolog uses standard operators + - * /
- Test for equality: =/2
o Note: same syntax and same value
- Assignment: is/2
o Math expression only on the right




Syntax of arguments and variables

- Constants: lower case, no spaces or punctuation
$7.24
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
timb3 Universiteit Utrecht
Follow You need to be logged in order to follow users or courses
Sold
15
Member since
2 year
Number of followers
7
Documents
10
Last sold
2 months ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions