Let’s imagine the following situation: my friend gave me yesterday books. I put them into a box.
Now, I have noticed that we should name the box as
the box of books that my friend gave me
the box of the books that my friend gave me
though outside the of-phrase we have to say
the books that my friend gave me
Look! There are the books that my friend gave me.
What is the reasoning?
I think that native English speakers understand “the box of books” in “the box of books that he gave me” as a set of books which is contained in a box, books which are contained in a box, rather than a box with books. So there is no need to put “the” before “books” in “the box of books that he gave me”, because “the” before “box of books” does the job (“the” refers to the books contained in the box). Am I right? Or there is a different logic behind this?
In the phrase box of books, the prepositional phrase of books doesn’t refer to specific books but to the class or kind of item in the box.
A flock of geese flew overhead.
It’s not a flock of ducks or a flock of blackbirds but a flock of geese.
There was a pile of books on the desk.
There was a box of books on the desk.
Even though the box contains specific books in your example, when indicating what kind of items the box contains, there’s no need for the definite article; indeed the article would be wrong there, since it indicates specific items, not class of item. You can even express that idea adjectivally:
Toss this book in the book box.
Put this book on the book pile.
There, the goes with box and pile, not with book. The word book is a noun used adjectivally there, indicating the kind of pile or the kind of box, that is, one that has books in it and one that consists of books.
A box of books = a box with books in it
A box of books he gave me = a box, with books in it, ambiguous with respect to whether you were given by him a box containing books, or given books by him which were later put in a box.
A box of the books he gave me = a box containing some of the books he gave you; this is a partitive construction; the set, from which a subset is taken, consists of “the books he gave me”.