My intention was to implement a simple example (just for myself) of transitivity in Prolog.
These are my facts:
trust_direct(p1, p2).
trust_direct(p1, p3).
trust_direct(p2, p4).
trust_direct(p2, p5).
trust_direct(p5, p6).
trust_direct(p6, p7).
trust_direct(p7, p8).
trust_direct(p100, p200).
I've written this predicate to check whether A trusts C, which is true whenever there is a B that trusts C and A trusts this B:
trusts(A, B) :-
trust_direct(A, B).
trusts(A, C) :-
trusts(A, B),
trusts(B, C).
The predicate returns true for trusts(p1, p2) or trusts(p1, p5) for example, but trusts(p5, p6) already returns ERROR: Out of local stack.
Is Prolog flooding the stack this quickly?
Or is my idea/implementation of trusts bad / wasting system memory?