I read somewhere about Prolog’s Introspection.
But I just found functor, arg, ?Term =… ?List etc.
Then I have to test every phrase in the file.
I hope there is a better solution?
I doubt it is the right answer, but possibly you are looking for source_file/2. No sane Prolog program should need this directly though. It is mainly there for writing tools that reason about programs.