The standard built-in predicate retractall/1 can be used to remove all sentences for a dynamic predicate, but the predicate will still be known at runtime. On the other hand, the standard built-in predicate abolish/1 not only removes all predicate sentences, but also makes the predicate unknown to the runtime. If you try to call a dynamic predicate after deleting all of your sentences with retractall/1 , the call will simply fail. But if you cancel the dynamic predicate by calling it after this will lead to the error of the existence of the predicate.
source share