Logic Programming is Underrated
swannodette.github.io
Logic Programming is Underrated
1–10 of 28 posts
Re: Logic Programming is Underrated
#2The idea of specifying directly what is computed, and not how it is computed, is very useful, and not limited to abuse mathematical problems.
Re: Logic Programming is Underrated
#3Logic programming is a wonderful tool to know about, and armed with that knowledge you can adapt your programming style to the problem in question. http://norvig.com/sudoku.html
Re: Logic Programming is Underrated
#4I can't understand how you can be happy using ~84,000,000 clock cycles to solve that. Logic programming is a wonderful tool to know about, and armed with that knowledge you can adapt your programming style to the problem in question. http://norvig.com/sudoku.html
Re: Logic Programming is Underrated
#5However some parts of say Prolog are a little unusual. The typical way of writing OR as multiple clauses directly violates DRY and I usually use the alternative IF-THEN-ELSE notation (->). I also use logical loops (basically foreach)...at the end of the day it's kind of a paradigm mix (arithmetic and write sideffects, too).
Grammars and constraints are pretty fun though. It's a very good tool to have in your toolbox. Prolog is certainly the language that expanded my mind the most after having worked with JAVA/Python before.
Re: Logic Programming is Underrated
#6I believe logicians of philosophical inclination are prone to be enamored with what they have and lose sight of what they don't have. For a good part of two millennia, they kept debating Aristotilean syllogisms, without realizing that classical logic was yet to be discovered. Finally, it was left to the mathematicians to formulate classical logic. The logicians of today are similarly enamored with classical logic without much of an understanding of what it lacks. We would be ill-advised to listen to them. Or, we would be stuck for another two millennia, God forbid. [By the way, the Wikipedia page on Classical Logic is in a pitiful state. I hope somebody will pay attention to it.]
Brilliant new things are happening in Logic. - Mathematicians have formulated Toposes (a generalization of Kripke models), which give us a great new variety of models for intuitionistic logic. There are deep mathematical facts buried in them and continue to be discovered. Toposes and intuitionistic logic are appropriate for modeling computer programs, which live in a growing dynamic world rather than a static one. - Girard has formulated Linear Logic, which broadens our idea of what kind of "things" a logic can talk about. David Pym and Peter O'Hearn invented Bunched Implication Logic, extending Linear Logic with a beautiful model-theoretic basis. These logics applied to imperative programming (which go by the name of "Separation Logic") are revolutionizing the development of technology for imperative programs. It is time to leave behind the classical logic. In fact, we should have done it a long time ago."
- Prof Uday Reddy on the types mailing list.
http://lists.seas.upenn.edu/pipermail/types-list/2013/001684...
Re: Logic Programming is Underrated
#7Even programming languages like Prolog needs an expression of the problem that is not exactly how we think in logical expressions. You can't directly translate a first order logic expression to Prolog, you need to add extra thinking before doing that.
On the other hand generic combinatorics libraries don't work with large sets.
Welcome to SMT (satisfiability modulo theories) where there are state of the art optimizations for specific fields. If you want to see something impressive look at how to solve Sudoku with Z3 (http://z3.codeplex.com/) , it's just expressing the problem in logic terms: http://rise4fun.com/Z3Py/tutorialcontent/guide#h210
Re: Logic Programming is Underrated
#8I can't understand how you can be happy using ~84,000,000 clock cycles to solve that. Logic programming is a wonderful tool to know about, and armed with that knowledge you can adapt your programming style to the problem in question. http://norvig.com/sudoku.html
Re: Logic Programming is Underrated
#9If we are discussing the benefits of logic programming, I think it's important to include other declarative languages like SQL. The idea of specifying directly what is computed, and not how it is computed, is very useful, and not limited to abuse mathematical problems.
I wrote a bit about that here: http://www.kmjn.org/notes/prolog_lost_steam.html
Re: Logic Programming is Underrated
#10"The attractiveness of logic programming, when it was first launched, was that it had a ready-made declarative reading, which was expected to make a big difference for programming. Unfortunately, Prolog also had a bad procedural reading that people struggled with. So, in practice, Prolog programmers spent almost all of their effort on the procedural meaning, and the declarative meaning went out of the window. In the…
Fwiw, answer-set programming is a logic-programming language with a Prolog-derived syntax that has only a declarative reading, and no procedural reading.