Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.32-10-g1885b056f)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- assertz(tryit(alpha,beta)).
true.
?- tryit(A,B).
A = alpha,
B = beta.
I was not expecting this to work without a dynamic/1 statement.
The way that I understand this is that using any of these means that the predicate is, indeed, dynamic. In particular, for retractall/1, it says:
If Head refers to a predicate that is not defined, it is implicitly created as a dynamic predicate.
If you hover on footnote 80 in the docs for retractall/1 it also says,
The ISO standard only allows using dynamic/1 as a directive .
My understanding is that this implies that you can use dynamic/1 as a goal in a predicate body in SWI-Prolog, in contrast to what the ISO standard allows (and if you try it out you will see that you can, indeed, use dynamic/1 as a goal, not only as a directive).