I posted this question on the SWI Prolog Discourse forum and got some useful comments, but maybe people here might also have some ideas about this topic.
I am somewhat confused about how to use the word “atom” in a paper we are writing.
(1) In Prolog an atom is said to be a “Textual constant. Used as name for compound terms, to represent constants or text.”. See here. Accordingly these are atoms: john
, grandparent
, etc.
(2) In texts about logic programming, e.g. Riguzzi (2018) and Baral and Gelfond (1994), “atoms” are said to be terms with the form p(t1, t2, ..., tn)
, where the t
s are terms and p
is a predicate symbol. This corresponds to the use of “atom” in classical first order logic.
Am I correct in assuming that (1) is the proper definition for “atom” when talking about Prolog, and that (2) is the proper definition for “atom” when talking about logic programming? I think that a reason for my confusion is that I think of Prolog as an instance of logic programming.
Cheers/JC
EDIT 2020-08-18**********************************************
It was somewhat challenging to explain unification when using LP terminology; i made an attempt.
Unification with typical Prolog terminology:
- Atoms, numbers, variables and compounds are terms
- Atom = string that starts with a lower case letter
- Number = a number
- Variable = string that starts with a capital letter
- Compound = p(t1, t2, ..., tn) where p is a predicate symbol and ts are terms.
Unification:
- Two atoms unify if they are the same
- Two numbers unify if they are the same
- A variable unifies with any kind of term
- Two compounds unify if (1) they have the same name, (2) the same number of arguments, (3) all of their arguments unify, (4) their variables can be instantiated consistently
Unification with typical LP terminology:
- Constants, variables and functions are terms
- Constant = a string that starts with a lower case letter or a number
- Variable = a string that starts with an upper case letter
- Function = f(t1, t3, ..., tn) where f is a function symbol and the ts are terms
- Atomic formula = p(t1, t2, ..., tn) where p is a predicate symbol and the ts are terms
Unification:
- Two constants unify if they are the same
- A variable unifies with any kind of term
- Two atomic formulas, or two functions, unify if (1) they have the same name, (2) the same number of arguments, (3) all of their arguments unify, (4) their variables can be instantiated consistently