- From: Torbjörn Lager <torbjorn.lager@gmail.com>
- Date: Fri, 20 Sep 2019 13:13:32 +0200
- To: paoladimaio10@googlemail.com
- Cc: W3C AIKR CG <public-aikr@w3.org>
On Fri, Sep 20, 2019 at 4:00 AM Paola Di Maio <paola.dimaio@gmail.com> wrote: > I do not write code, but I am familiar with Prolog and Lisp from my school days > *when I didnt use Prolog for my implementation either- but I looked into the possibility > Apparently many find Prolog indigestible to this date but its the most robust AI language > afaik As a reminder of what Prolog can do in relation to AI, consider the following very simple examples of 1) KR and reasoning, 2) problem solving, 3) expert systems, and 4) NLP: 1. KR and reasoning: Given a program such as: ancestor_descendant(X, Y) :- parent_child(X, Y). ancestor_descendant(X, Z) :- parent_child(X, Y), ancestor_descendant(Y, Z). parent_child(X, Y) :- mother_child(X, Y). parent_child(X, Y) :- father_child(X, Y). mother_child(trude, sally). father_child(tom, sally). father_child(tom, erica). father_child(mike, tom). we can ask queries and get answers on demand: ?- ancestor_descendant(mike, Who). Who = tom ; Who = sally ; Who = erica ; false. For the other three examples, just select any links below and you'll be taken to the SWISH online IDE where they can be run: 2. Problem solving: https://swish.swi-prolog.org/example/clpfd_queens.pl 3. Expert systems: https://swish.swi-prolog.org/example/expert_system.pl 4. NL parsing and generation: https://swish.swi-prolog.org/example/grammar.pl There are more examples where these came from: https://swish.swi-prolog.org/example/examples.swinb People who find Prolog indigestible often have problems with the concepts of recursion and immutable variables. Typically, they would feel the same kind of pain when they try functional programming. Also, people may rightfully wonder why this doesn't work: ancestor_descendant(X, Y) :- parent_child(X, Y). ancestor_descendant(X, Z) :- ancestor_descendant(X, Y), parent_child(Y, Z). It's because top-down depth-first search in combination with a left-recursive clause will lead to an infinite loop, and you would have to know that. Fortunately, over the years, Prolog has improved a lot, and nowadays many Prolog systems supports *tabling*, so that the above will work if you add a directive :- table ancestor_descendant/2. to you program. > and put forward one request: can Web prolog improve on Prolog pain points > in any way? ie. can Web Prolog be better (easier, leaner, lighter perhaps?) No, except where Prolog as such has improved, Web Prolog comes with the same "warts". They make the learning curve steeper than for most other languages, but once you master the cut (for pruning the search space) and various other impurities, I think you'd find that Prolog is a really nice language. Prolog also has a very friendly and helpful community these days - check out the SWI-Prolog community over at https://swi-prolog.discourse.group for example. What Web Prolog contributes is a sane model for network-transparent concurrent and distributive programming using the Erlang-style actor programming model. This is a model that allow us to create what I like to think of as the Prolog Web - an extension of the Web that can be programmed with Web Prolog. As for the relation of the Prolog Web to the Semantic Web, I think some (but not all) differences are: 1. The Prolog Web uses the *same* language (i.e. Web Prolog) for knowledge representation and querying, whereas the Semantic Web uses different languages for these tasks (i.e. RDF and OWL for KR, and SPARQL for querying). 2. Web Prolog is a *programming* language, while the Semantic Web languages are not. The SW languages can perhaps be categorised as *web logic languages*, but then Web Prolog should be classified as a web logic *programming* language. 3. The Prolog Web comes with an *architecture* while AFAIK the Semantic Web lacks this. I don't aim for the Prolog Web to *replace* the Semantic Web, or for Web Prolog to replace the current Semantic Web languages and the technologies surrounding them. On the contrary, I hope and believe that we will be able to carve out a place for the Prolog Web alongside the Semantic Web, and that the languages involved can live happily together. I also see Web Prolog as a viable *semantic web programming language*, mainly because Web Prolog is a relational language, which allow us to avoid the so called object-relational impedance mismatch problem. A nice reference here is (Wielemaker et al. 2016 -- see https://pdfs.semanticscholar.org/fd70/73744016166538edd815c298876a02a3f5ae.pdf) > > Thank you Torbjorn for coming out of the lurk zone > > Nice to know what people are working on > and for sharing the valuable resources > > Just yesterday, I was thinking in how many ways do AI and the Semantic Web interface? > > Looks to me like what you are doing is in that direction, possibly important work > > I do not write code, but I am familiar with Prolog and Lisp from my school days > *when I didnt use Prolog for my implementation either- but I looked into the possibility > Apparently many find Prolog indigestible to this date but its the most robust AI language > afaik > > I d like to understand more about how Web Prolog can relate/solve current KR challenges > (if you could write that up that could be a paper) > > and put forward one request: can Web prolog improve on Prolog pain points > in any way? ie. can Web Prolog be better (easier, leaner, lighter perhaps?) > > I would encourage to start a draft doc and link it to the group's wiki for people to > stygmerize on this topic, and perhaps from my personal research perspective > draft a paper on the KR aspects of your work > > PDM > > > On Thu, Sep 19, 2019 at 8:24 PM Torbjörn Lager <torbjorn.lager@gmail.com> wrote: >> >> Dear All, >> >> I joined this community group some months ago, but have been lurking >> up till now. With this message, and in the hope that it may lead to a >> discussion, I'd like to inform you what I'm working on. >> >> It's an approach to AI and KR on the Web which is based on a mixture >> of the Prolog programming language, the Erlang programming language, >> and various standard web technologies. A lot of it is based on Prolog >> - a programming language which I guess at least some of you are at >> least somewhat familiar with. I'd like to "webize" Prolog, and >> "rebrand" it as a web logic programming language. Here are two >> "elevator pitches" that might whet your appetite: >> >> Web Prolog - the elevator pitch: Imagine a dialect of Prolog with >> actors and mailboxes and send and receive - all the means necessary >> for powerful concurrent and distributed programming. Alternatively, >> think of it as a dialect of Erlang with logic variables, backtracking >> search and a built-in database of facts and rules - the means for >> logic programming, knowledge representation and reasoning. Also, think >> of it as a web logic programming language. This is what Web Prolog is >> all about. >> >> The Prolog Web - the elevator pitch: Imagine the Web wrapped in >> Prolog, running on top of a distributed architecture comprising a >> network of nodes supporting HTTP and WebSocket APIs, as well as web >> formats such as JSON. Think of it as a high-level Web, capable of >> serving answers to queries - answers that follow from what the Web >> "knows". Moreover, imagine it being programmable, allowing Web Prolog >> source code to flow in either direction, from the client to the node >> or from the node to the client. This is what the Prolog Web is all >> about. >> >> If you've read this far, you probably want some more flesh on these >> bones, and perhaps a proof-of-concept implementation to play with. So >> here, in the order that you should probably look at them, is a list of >> relevant material: >> >> 1. In mid August this year, I went to ICFP in Berlin and presented a >> paper in the co-located Erlang'19 workshop. Here's the title and an >> abstract: >> >> **Intro to Web Prolog for Erlangers** >> >> We describe a programming language called *Web Prolog*. We think of it >> as a *web programming language*, or, more specifically, as a web >> *logic* programming language. The language is based on Prolog, with a >> good pinch of Erlang added. We stay close to traditional Prolog, so >> close that the vast majority of programs in Prolog textbooks will run >> without modification. Towards Erlang we are less faithful, picking >> only features we regard as useful in a web programming language, e.g. >> features that support concurrency, distribution and inter-process >> communication. In particular, we borrow features that make Erlang into >> an *actor programming language*, and on top of these we define the >> concept of a *pengine* -- a programming abstraction in the form of a >> special kind of actor which closely mirrors the behaviour of a Prolog >> top-level. On top of the pengine abstraction we develop a notion of >> *non-deterministic RPC* and the concept of *the Prolog Web*. >> >> The paper is here: https://gup.ub.gu.se/file/207827 >> >> 2. A first draft of a manual covering the most interesting proposed >> additions to the ISO Prolog standard: >> https://raw.githubusercontent.com/Web-Prolog/swi-web-prolog/master/book/web-prolog-predicate-api.pdf >> >> 3. Should you want to know more, there is a github repo from which a >> proof-of-concept implementation can be downloaded and taken for a >> trail run - and there's a comprehensive tutorial too! The repo is >> here: https://github.com/Web-Prolog/swi-web-prolog >> >> 4. A longer (> 170 pages) manuscript “Web Prolog and the programmable >> Prolog Web”: https://github.com/Web-Prolog/swi-web-prolog/raw/master/book/web-prolog.pdf >> >> >> The plan is to set up a separate W3C Community Group devoted to this >> idea in a not-too-distant future. Perhaps a language such as Web >> Prolog deserves to be standardised by the W3C? >> >> What do you think? Questions, comments, etc. are most welcome! >> >> Best regards, >> Torbjörn Lager >>
Received on Friday, 20 September 2019 11:14:07 UTC