I have recently been solving advent of code 2023 puzzles in Prolog and found myself heavily reliant on tabling/SLG for tractability. I note that gprolog and SICStus do not seem to support SLG. It made me wonder, how Prolog would even handle these problems without SLG resolution.
Lets take the example from the manual featured here:
fib(0, 1) :- !.
fib(1, 1) :- !.
fib(N, F) :-
N > 1,
N1 is N-1,
N2 is N-2,
fib(N1, F1),
fib(N2, F2),
F is F1+F2.
One could just add :- table fib/2.
and be done with it in SWI Prolog, but how would you handle this in a performant way using only portable Prolog code? Would you have to resort to assert or similar or is there some other pattern?