Pre-Finals (PROLOG) Flashcards

Programmation en logique Programming in Logic (29 cards)

1
Q

He is widely recognized as the creator of Prolog and drove its practical implementation for natural language processing.

A

Alain Colmerauer

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

The full phrase that the abbreviation “Prolog” stands for.

A

PROgrammation en LOGique
Programming in Logic

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

What are the three basic constructs used to build programs in Prolog?

A

facts, rules, and queries

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

This specific symbol must be used at the end of every Prolog statement to terminate a clause or query

A

(.) Period

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

It is the combination of an atom and its arity used to name compound terms

A

Functor

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

Prolog is classified as an imperative programming language because the programmer specifies exactly how to compute a result

A

False
Prolog is an example of a declarative language.
Prolog describes what the problem is and how to solve it

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

Variables in Prolog must always begin with an uppercase letter or an
underscore (_).

A

True

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

Prolog uses traditional for and while loops to perform repetitive tasks.

A

False.
Prolog uses recursion

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

The “Cut” operator, which is used to prevent backtracking, is represented by the exclamation mark symbol (!).

A

True

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

What does Cut(!) operator do in Prolog?

A

It is used to freeze or stop the search for solutions.
It will also not allow backtracking

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

What is backtracking in Prolog?

A

This means when the language hits a dead end when finding a solution, it automatically goes back to the last place where it had a choice and tries a different path

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

The standard file extension for Prolog source files is typically .pl or .pro.

A

True

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

What is the file extension for Prolog

A

.pl or .pro

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

When was Prolog developed and by whom?

A

1970s. Released in 1972
Alain Colmerauer,
Phillippe Roussel
Robert Kowalski

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

What is the structure of Prolog?

A

Consist of a database of “facts” and “rules”.
User interact with the language by providing “goal statements” to query the database

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

Prolog’s Applications?

A

Artificial Intelligence,
NLP,
Intelligent database management systems

17
Q

What are the two kinds of statements that populate a Prolog database?

A

Facts Statements
Rule Statements

18
Q

Define Facts and Rule statements in Prolog

A

Facts statements - define known truths or relationships in the database

Rules statements - define logical rules that infer new facts based on existing ones

19
Q

what query can invoke the output?

% — Facts —
% These define simple truths in the database.
dog(ringgo). % ringgo is a dog
dog(georgia). % georgia is a dog

% — Rules —
% These define logical relationships (If/Then).

% Kaye owns a Pet IF that Pet is a dog.
owns(kaye, Pet) :-
dog(Pet).

% Who loves What IF Who owns What.
loves(Who, What) :-
owns(Who, What).

A

-? loves(Who, What)

20
Q

Given the facts, what is the result of the query?

friend(ace, mark).
friend(mark, jude).

Query:
?- friend(ace, X), friend (X, jude).

21
Q

Given the facts and rules, what is the result of the query?

is_compsci(ace).
is_compsci(ecie).
is_nursing(alecs).
is_business(sofia).

not_compsci(X) :- + is_compsci(X).

Query:
?- not_compsci(sofia).

22
Q

If a rule is defined as follows, what is the result of the query?

double(X, Y) :- Y is X * 2

Query:
?- double(10, Result).

23
Q

What is the latest stable version of prolog?

A

SWI-Prolog version 10.0

24
Q

Application Areas

A

Semantic Web and Knowledge Graphs

25
Characteristics
Unification. Make two terms identical Backtracking Reflexivity (Homoiconicity)
26
Classification
Declarative Logic Programming Language. Foundation rests on First-Order Predicate Logic
27
Constant variables
Atoms. Immutable
28
Data Structures
Arrays Records Lists -- can be [] or [H | T] Strings Sets Trees Graphs
29