100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
KIPA PROLOG Summary $6.72   Add to cart

Summary

KIPA PROLOG Summary

 13 views  0 purchase
  • Course
  • Institution

Summary of the PROLOG lectures of the KIPA course

Preview 2 out of 9  pages

  • January 22, 2024
  • 9
  • 2022/2023
  • Summary
avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller timb3. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $6.72. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

85443 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$6.72
  • (0)
  Add to cart