Questions tagged [declarative-programming]

Declarative programming is a programming paradigm where the focus is on what must be accomplished, rather than how it is to be accomplished. Hence it is more about "declaring" than about implementing algorithms. Use this tag for questions about how declarative programming is used in AI systems.

Declarative programming is a computer programming paradigm where the focus is on declaring what should be accomplished, rather than explaining how it should be accomplished.

A good example of a declarative programming language is Prolog, which is based upon predicate logic. Here is a simple Prolog program:

dog(brutus).
dog(pluto).
dog(X):-barks(X).

This program states (declares) 3 things: (1) that brutus is dog, (2) that pluto is a dog, and (3) that if something is a dog, it barks.
(Note that the names of the dogs are in small letters; Prolog uses capital letters to identify variables).

We can now ask this program to tell us who barks:

barks(X)

and it will give us the solutions:

X = brutus ;
X = pluto ;
no more solutions

Note how we did not tell our program how to arrive at this result; this is done by the Prolog system itself.

Declarative programming, by focusing on the "what" rather than the "how", is useful for building knowledge bases.

3 questions
9
votes
2 answers

What are the main advantages of using declarative programming languages for building AI?

What specific advantages of declarative languages make them more applicable to AI than imperative languages? What can declarative languages do easily that other languages styles find difficult for this kind of problem?
intcreator
  • 1,325
  • 2
  • 10
  • 15
3
votes
0 answers

Answer Set Programming - Make a Fact INVALID

I have a question regarding Answer Set Programming on how to make an existing fact invalid, when there is already (also) a default statement present in the Knowledge Base. For example, there are two persons seby and andy, one of them is able to…
0
votes
1 answer

How to transfer declarative knowledge into neural networks

Humans learn facts about the world like "most A are B" by own experience and by being told so (by other people or texts). The systems and mechanisms of storage and usage of such facts (by an "experience system" and a "declarative system") are…