This may not be directly clear from the description:
Perhaps surprisingly, the term denoting the predicate is not given in functor/arity style:
?- predicate_property(format_paragraph/2,imported_from(M)). M = yall.
(the answer is meaningless)
...but in the form of a "callable term":
?- predicate_property(format_paragraph(_,_),imported_from(M)). M = text_format.
You can find out where the predicate comes from:
?- predicate_property(format_paragraph(_,_),file(F)). F = '/usr/local/logic/swipl/lib/swipl/library/lynx/format.pl'.
(Are there any requirements regarding the returned filename? Is it a canonical path?
predicate_property/2 should probably throw if the predicate is unknown - that would be reasonable. However:
?- predicate_property(unknown(_,_),dynamic). false.
To count all asserted item/1 facts, do: