## Examples of first-order languages and sentences

### Example 1: People and Songs

Let U be a universe containing people and songs. Let L be a language with the following primitives.
c(P,S) --- Person P composed song S.
l(P,S) --- Person P likes song S.
s(P,S) --- Person P sings song S.
m(S) --- Song S is in a major key.
Constants: a --- Amy; b --- Barry; d --- David; y -- Yankee Doodle.
Express the following statements in L:

Amy has composed a song.
exists(S) c(a,S).

Barry only sings songs that he himself wrote.
forall (S) s(b,S) => c(b,S).

David likes some of the songs that Amy has written (i.e. at least one song).
exists(S) c(a,S) ^ l(d,S).

David does not like any of the songs that Amy has written in a major key.
not exists (S) l(d,S) ^ c(a,S) ^ m(S)

Anyone who likes any songs at all likes Yankee Doodle.
forall(P) [exists(S) l(P,S)] => l(P,y).

There is someone who likes all the songs that Barry sings.
exists(P) forall(S) s(b,S) => l(P,S).

Everyone likes all the songs that they themselves composed.
forall(P,S) c(P,S) => l(P,S).

None of the songs that Amy likes were composed by either David or Barry.
not exists(S) l(a,S) ^ [c(d,S) V c(b,S)].

### Example 2: Authors, articles, and citations

Let U be a universe containing people, articles, and journals. Let L be the first-order language containing the following primitives

• author(P,A) --- Predicate. Person P is an author of article A.
• in(A,J) --- Article A appeared in journal J.
• cites(A1,A2) --- Article A1 cites article A2.
• a, b, c-- Constants denoting Alfred, Bonnie, and Carol (people).
• m, t--- Constants denoting the articles "Feeding Muskrats" and "Tulips of Ellesmere Island".
• r,g --- Constants denoting the journals Rodents and Arctic Gardening
Express the following statements in L:

Alfred and Bonnie wrote "Feeding Muskrats".
author(a,m) ^ author(b,m).

Alfred has written an article that was published in Rodents
exists(X) author(a,X) ^ in(X,r).

There are no articles that have been published both in Rodents and in Arctic Gardening.
~(exists(X) in(X,r) ^ in(X,g))

All the articles Carol has written were published either in Rodents or in Arctic Gardening.
forall(X) author(c,X) => [in(X,r) V in(X,g)]

Bonnie has written an article that has never been published anywhere.
exists(X) author(b,X) ^ ~(exists(J) in(X,J)).

No article in Rodents has ever cited "Tulips of Ellesmere Island".
~(exists(X) in(X,r) ^ cites(X,t)).

All of the citations in "Feeding Muskrats" are to articles in Rodents
forall(X) cites(m,X) => in(X,r).

Carol wrote one article that has been cited in every article that has ever been published in Rodents
exists(X) author(c,X) ^ [forall(Y) in(Y,r) => cites(Y,X)].

None of the authors of "Tulips of Ellesmere Island" has ever written an article published in Rodents.
~[exists(X) author(X,t) ^ exists(Y) author(X,Y) ^ in(Y,r)].