How to create a fact in SWI-Prolog?

I’m assuming you are using swi interactively and trying to enter the fact gives you an error like so: 1 ?- like(x, y). ERROR: toplevel: Undefined procedure: like/2 (DWIM could not correct goal) Since the fact does not exist in the database. If this is the case, try asserting the fact first: 2 ?- assert(like(x,y)). … Read more

What are the best uses of Logic Programming?

Prototyping. Prolog is dynamic and has been for 50 years. The compiler is liberal, the syntax minimalist, and “doing stuff” is easy, fun and efficient. SWI-Prolog has a built-in tracer (debugger!), and even a graphical tracer. You can change the code on the fly, using make/0, you can dynamically load modules, add a few lines … Read more

Lisp and Prolog for Artificial Intelligence? [closed]

The question has already been answered for Lisp, so I’ll just comment on Prolog. Prolog was designed for two things: natural language processing and logical reasoning. In the GOFAI paradigm of the early 1970s, when Prolog was invented, this meant: constructing symbolic grammars for natural language that would be used to construct logical representations of … Read more

A graph DB vs a Prolog (or miniKanren)

No, logic programming as embodied by those things and neo4j are quite different. On one level, you’re right that they conceptually both amount to graph storage and graph query. But for logic programming, it’s only conceptually graph query, there’s no guarantee that it’s actually stored that way (where with neo4j, it is). Second, with logic … Read more

What use does if_/3 have?

In old-fashioned Prolog code, the following pattern arises rather frequently: predicate([], …). predicate([L|Ls], …) :- condition(L), then(Ls, …). predicate([L|Ls], …) :- \+ condition(L), else(Ls, …). I am using lists here as an example where this occurs (see for example include/3, exclude/3 etc.), although the pattern of course also occurs elsewhere. The tragic is the following: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)