Question

Community Wiki

I don't care about the reputation points, I just want good answers. Feel free to remark this question as community wiki.

Context

I'm been working through The Reasoned Schemer, and have found the following observations:

  • Logic programming is very interesting.
  • Logic programming is sometimes counter-intuitive
  • Logic programming is often "inefficient" (or at least the code I write).

    It seems like in going from

  • Assembly -> C++, I "give up" control of writing my own machine code
  • C++ -> Clojure, I give up control of memory management
  • Clojure -> core.logic/prolog/minikanren, I lose partial control of how computations are done

Question:

Besides (1) solving logic puzzles and (2) type inference, what are the domains of problems that logic programming dominates?

Thanks!

Was it helpful?

Solution

Constraint logic programming can be really useful for solving various scheduling, resource allocation, and other nontrivial constraint satisfaction / combinatorial optimization problems. All you have is declarative: the constraints (e.g. only one aircraft can be on the runway at a time), and maybe something you want to minimize/maximize (throughput/waiting).

There are various well-known flavors of that in Prolog, including CLP(FD), which works in finite integer domain, and CLP(R), which works in real domain. At least CLP(FD) seems to be in core.logic's immediate roadmap.

I believe such Prolog-derived solutions are actively being used in air traffic control and other logistics tasks, although it's hard to get precise info what technologies exactly such mission- and life-critical companies are using under the hood.

OTHER TIPS

Research in artificial intelligence, and in particular cognitive robotics and other application of logic-based knowledge representation, are areas where Prolog is used a lot for its close relation to logic theory. This relation is very useful because it basically brings theory to life. Theorems can be proven on paper, and then implemented almost trivially in prolog and executed, and the executing programs have the proven properties. This allows for programs that are "correct by construction", which is the opposite of first writing programs and then trying to prove properties about them (as is done in formal methods, using, e.g., model checking).

The semantic web is another place where logic programming plays a growing role.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top