3 ms·
Probably better to use modern Prolog instead?
by xvilka 8y ago
Probably better to use modern Prolog instead?
- pvinis 8y agoWhat is a modern prolog? I'd like to try out something like it.
- xvilka 8y agoCheck Power of Prolog[1] book, and Awesome Prolog[2] list for more information. [1] https://www.metalevel.at/prolog https://www.metalevel.at/prolog [2] https://github.com/klaussinani/awesome-prolog https://github.com/klaussinani/awesome-prolog
- jimktrains2 8y agoSometimes it's much easier to state rules in a forward chaining system. Why is it inherently better to use a bakeards chaining system under all circumstances?
- muydeemer 8y agoBackward chaining is goal-driven, it's aimed at answering specific questions where you can prune your search space effectively. This is opposed to data-driven forward chaining where you basically keep looking at what things can be derived without having specific queries in mind. I wouldn't say one is better than the other, it depends on circumstances and use cases. In dynamic systems where there is a lot of data changes/data is fed in dynamically, backward chaining gives you a completeness guarantee whereas FC is eventually consistent (specific answer you are looking for might be not triggered yet). On the other hand, FC is useful when we want to use triggering behaviours - once a specific information is added to the system, a trigger can be executed/specific action can be taken.
- spinningslate 8y ago> Probably better to use modern Prolog instead? Caveat first off: it's 7+ years since I looked at this, so take "modern" in that context. I used SWI Prolog specifically [1]. At that point, CLIPS and Prolog occupied similar spaces - but not the same. Prolog is backward chaining. So it's really good at answering questions that can be derived from a base set of facts. For example. Let's say: There's a road from City A to City B, and a road from City B to City C. It's then very easy in Prolog to say "there's a route from "Start" to "Finish" if either: 1. there's a road from Start to Finish, or 2. There's a road from Start to City X, and a route from X to Finish. The beauty of prolog is that you don't need to explicitly code iteration over all the available roads; that's what the backward chaining algorithm does for you. In arriving at the answer, it'll exhaustively test all permutations. Importantly though, it won't add to the list of facts you started with (unless you specifically tell it to). Once the question is answered, the intermediate results are discarded. In that sense, Prolog - at least in purest form - is somewhat stateless. Assert some facts, then ask questions about inferences that can be drawn from them. CLIPS is different. It's a forward chaining engine, from a class of related products known as Production Systems. It's designed to be used where new facts are being asserted; when that happens, it figures out the consequences as they ripple through. As new facts are asserted - and their consequences computed - the underlying state evolves. So intermediate results are retained (in fact, that's key to operation). CLIPS (and Production Systems in general) were used, for example, in medical diagnosis applications. As new symptoms were asserted, the rules rippled through, suggesting the most likely diagnosis. The key to making this efficient is the forward chaining algorithm, known as Rete [2] (pronounced "Rait"). Again: these are examples, and the reality is likely much more nuanced now. But at least in their purest original form, CLIPS and Prolog are more complementary than overlapping. [1] http://www.swi-prolog.org/ http://www.swi-prolog.org/ [2] https://en.wikipedia.org/wiki/Rete_algorithm https://en.wikipedia.org/wiki/Rete_algorithm EDIT: minor grammar changes + clarified naming in Prolog example.