assertz", or maybe remove facts/rules using
retractall. To do this, you must declare the procedure to be dynamic.
You can declare a procedure to be dynamic by including
in your code (normally adjacent to the facts/rules for that
procedure) a suitable
Example - suppose you have a procedure called
with arity 2, and you have a "starter set"
of facts/rules in your Prolog program, but you want to infer extra
likes during execution, and add them
to the data base so that they don't need to be recomputed each
time they are used. [You would normally only do this - add the
new facts to the database - if the extra facts were slow to
compute.] You need to declare
likes (with arity 2)
to be dynamic. You do this as follows:
:- dynamic likes/2.
[By the way, notice that this leaves open the possibility that a
different version of
likes (with arity 3, say) might
not be dynamic.]
See also memoisation.