Prolog Flashcards

1
Q

The aim of prolog is to

A
  • represent knowledge efficiently through facts and rules
  • retrieve and infer knowledge from this representation,
    given a query
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Logical principles are needed to enable such inference

A

Truth conditions, connectives, variables, predicates,
formula’s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Prolog: general framework

A

1: Knowledge base
* Facts
* Rules
* Stored in .pl files
* 2: Queries
* Posted from shell / script
* ?-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Prolog - not

A
  • not(:Goal) - True if Goal cannot be proven
  • not is deprecated due to its strong link to logical negation but still
    provided
  • Use + instead
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

implication

A

:- defines an implication (A → B corresponds to B :- A).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

conjunction

A

, defines a conjunction (in right-hand side of rule)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

disjunction

A

; defines a disjunction (but can also be multiple rules)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

atom

A
  1. A sequence of letters, digits, or underscores that starts with a lower-case letter, e.g. car, hOUSE_2, father
    1. A sequence of letters, digits or underscores that are enclosed in single quotes, e.g. ‘car’, ‘House’, ‘HOUSE 2’
  2. A string of special characters, e.g. :- or ,
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

number

A

A number is any sequence of numbers, possibly containing a dot.
Both atoms and numbers are called constants.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

variable

A

A variable is a sequence of letters, digits or underscores that starts with an uppercase letter or an underscore, e.g. X, Car, HOUSE_2, _father, House.
o The variable _ is called the anonymous variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

term

A
  1. Each constant and variable is a term.
  2. f(t1,…,tk) is a term if each ti is a term and f is an atom.
    * This is called a compound term with functor f and arity k, which is often referred to in
    the notation f/k (signature), e.g. has_wheels/1 or has_embodiment/2.
    * A term is ground when it contains no variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

predicate

A

Any constant or compound term is known as a predicate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

fact

A

predicate If immediately followed by a dot (.), it is called a fact (knowledge).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

clause

A

A clause is any fact or rule.
* p(X) :- f(X),r(X) (Prolog)
* f(X)∧ r(X) → p(X) (FOL)
Clauses are always universal, i.e. here p(X) holds for all X

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly