by roenxi · 8y ago · 0 comments
The abstraction isn't perfect, but it is decent enough for a first approximation. I'm guessing Fortran is similar. Imperitive languages of that era were used because they worked very closely with the actual actions of the CPU and gave a fine grained control over execution, allowing efficiencies. Since then, popular languages have all been improvements that take advantage of increased computing power to do interesting things.
Sometimes new paradigms rear up - eg, Clojure with its set-and-forget approach to values. That paradigm is sold on the basis that it is easier to reason about, debug and as a practical bonus faster in many cases than the alternative. This is a great reason to learn a new paradigm.
Prolog is an experiment, but has anyone found a domain for the paradigm of logic programming? I've used it, and I couldn't see any domain where it seemed to have an advantage. For AI in particular - the way the world is developing, it seems logic is a weak foundation for intelligence. At this point, given that we know humans do not use logic for their intelligence, it would be a little surprising if logic is the best way to approach that particular problem. In most domains, the error in your sensor overwhelms the existence of fact and the 'rules' are more what you'd call guidelines.
If I rule out AI, what field is Prolog especially suited for? It doesn't read like it has a natural advantage in debugability (quite the reverse imo), GUIs, stream processing, efficiency, etc. With a lack of a killer domain, why not implement it as an afterthought library in C or lisp, and keep the imperative languages we have so much research in?
Basically, the default state of Prolog is dead. It doesn't represent how humans want to think about programming, it doesn't represent how the computer implements programming and so if it doesn't have a domain where its paradigm is spot on perfect it isn't going to take hold. It is an interesting idea and might yet be useful, but someone will need to find a reason to justify it.
One example of a proof that Prolog is good at is solving games, such as solving a particular instance of tic tac toe, or 4-in-a-row. Beyond these toy examples, you can see a good fit in any application which needs to follow a procession of rules. These rules may be in a feeding/bleeding relationship — this is essentially constraint logic programming. The problem goes: given these constraints, does this statement fulfil the constraints? How can I make the statement fit the constraints? Which is the set of statements that fit these constraints?
I know of an industry application in German luxury cars, where the customer can order a car with a lot (a lot a lot) of different features, but some are mutually exclusive. If you have this particular leather seat, you can't have that particular heating unit or whatever. Now tell me if the customer selected a valid configuration, and if not, tell me what the valid configurations "next to" the desired one are.
Another application are DCGs (Definite Clause Grammar), which have the expressive power of regular expressions (EDIT: see below for a correction, it appears they're at least context-sensitive.) If you've done Monadic parsing, DCGs feel kinda similar. They're super-close to Phrase Structure Grammar rules, and used to be part of my linguistics curriculum (I hear it's all ML nowadays. Pity.)
Yes, Prolog fits niche domains. But if you find a domain, such as regular languages or a problem that can be solved by CLP, the elegance of logic programming can hardly be beat. It's really a joy to work with in the right domain. It's absolutely awful as a general purpose programming language, though — mostly because the debugging is so complex, it almost feels nondeterministic (it isn't, but there were many moments at 2 in the morning where I could've sworn it is.)
In principle, Prolog is great for searching for solutions of a formally posed problem. Think of it as a logic search engine. If your problem can be stated in logic, and the logic problem can be evaluated in a finite time, Prolog's your friend.
If not, you'll blow the stack.
DCGs have a lot more expressive power than regular expressions. They are at least context-sensitive (i.e., stronger than context-free grammars as well). But off the top of my head I don't see why they wouldn't be able to capture recursively enumerable languages (i.e., the languages of completely unrestricted grammars) as well.
> Think of it as a logic search engine.
Think of it as a logic search engine embedded in a general-purpose programming language, because that's what it is.
I think this is the whole problem. The Prolog language is not great as a general-purpose language, and the "logic search engine" doesn't need be so closely identified with a particular language. Prolog should be a library, not a language, and not the almost sole representative of a programming paradigm.
The trouble is that your program can become non-terminating in all but the regular case IIRC. Man it's been 10 years since I've done Prolog, so take what I say with a grain of salt.
as --> as, [a].
as --> [].
Prolog will recurse infinitely on the first rule.Whoa, "humans do not use logic for their intelligence"? Hold on there. How do we know that?
I suspect the line of reasoning is something like: if machine learning is massively successfully without a great deal of logic or deductive rules, then the human mind works similarly.
Which stems in turn from thinking the brain is just like a computer, and vice-versa, which is arguable (let alone lamentable).
This never went upstream for a couple of practical reasons:
(1) It wasn't much simpler than the C code. In fact once you've gone and explained to people how Prolog works they might as well have digested the C code.
(2) There wasn't a good, embeddable, widely-available Prolog "engine" we could use. As a result I wrote my own engine which only did the simplest sort of forward inference and so wasn't at all efficient.
Not at all on topic, but this is the first time I've seen double repetition like that in the wild. Makes me wonder about examples of non-contrived buffalo sentences.
Graphs?
SWI-Prolog even comes with an RDF triple store: http://www.swi-prolog.org/pldoc/man?section=semweb-rdfapi
Why aren't people using Prologs instead of graph databases like neo4j?
It seems more like something I would want to embed as a DSL than something I would want to use for writing an entire program front to back.
What an offensive statement.
Over two thousand years of fighting intuition-based judgements, and now that DL can merely tell a gorilla from a mouse (with 712 hours of training on 91 GPUs), it is best form of "intelligence" but Logic - a fundamental part of mathematics that helped us u.n.d.e.r.s.t.a.n.d the universe better - is a "weak foundation for intelligence?
Still, logic systems are a lot closer to reasoning and understanding (if not for the machine itself, at least for its operators), in other words closer to intelligence than other systems.
DL are plain incapable of reflection/showing its workings.
I'm just asserting that the GP was probably considering a small subset of logic based systems and was incorrect in their assumptions.
is a baby able to tell a gorilla from a mouse after ~2 months of being awake ?
For instance, people will never accept that the AI of a car kills by accident, even thought human drivers kill a lot more etc. A system that makes life-or-death decisions but has no liability nor ethics is difficult to accept.
The article talks about expectations - unrealistic expectations even. People expect from AI that it makes clever decisions like humans and "no mistakes" like machines (scare quotes for bugs, failures etc.).
Now, I don't suggest that DL is useless. It is good at what it does, but contrary to what OP suggests, I don't see it as the sole or even main component of an AI system.
why is that "new" paradigm associated with clojure?