We see that variable X was used in different argument positions in A and B, and that no variables were used in C. Unlike functional programming, there is no intrinstic notion of “input” or “output” variables.
Prolog
Prolog
Prolog is the most popular logic programming language:
Developed in early 1970s
Used in natural language processing and A.I.
Syntax - clausal fragment of classical first-order logic
Semantics - SLD-resolution with automatic backtracking
Let p, q, r, … represent predicate symbols, each with a fixed arity.
If p is a predicate of arity n and t1,…,tn are terms, then p(t1,…,tn) is an atomic formula, A, B, …. A literal is an atomic formula A, or negated atomic formula, ¬A.
You can think of a predicate symbol as expressing a relationship between elements of the domain.
For example, the predicate father_of(peter, paul) expresses Peter is Paul’s father.
If rainy and snowy are unary predicates, temperature is a binary predicate, celsius is a unary function symbol, tuesday and zero are constants, and X is a variable, then the following are possible literals: