[06:16] *** MS- has parted #kamaelia
[06:53] *** Chong- has joined #kamaelia
[07:56] *** vmlemon_ has joined #kamaelia
[08:07] *** Uraeus has joined #kamaelia
[11:41] *** Davbo has joined #kamaelia
[12:57] *** acrimo has joined #kamaelia
[13:22] *** Uraeus has joined #kamaelia
[13:22] *** vmlemon_ has joined #kamaelia
[13:32] *** MS- has joined #kamaelia
[13:32] < MS-> afternoon
[13:32] < vmlemon_> Hi
[13:45] < Chong-> hi MS- and vmlemon_
[14:01] < acrimo> afternoon
[14:30] *** Davbo has joined #kamaelia
[14:32] < Davbo> Afternoon folks
[14:34] < MS-> afternoon
[14:43] < MS-> Davbo: Oh, since you mentioned prolog last night : http://yieldprolog.sourceforge.net/
[14:47] < Davbo> Hah, cool MS-
[14:49] < Davbo> the embedded prolog in Python is pretty slow
[15:37] *** mhrd has joined #kamaelia
[15:52] *** vmlemon_ has joined #kamaelia
[15:56] < Chong-> the Yield Prolog seems interesting, but wondering why it yield False not True :/
[15:59] < MS-> That I'm a little unclear on because I haven't gone through it in detail, but I think it's to differentiate between:
[15:59] < MS-> fail, complete, & answer
[15:59] < MS-> fail == StopIteration
[15:59] < MS-> complete == False
[15:59] < MS-> answer == Not False
[16:09] *** vmlemon_ has joined #kamaelia
[16:11] < Chong-> I see. It's just 3 status of generator/iterator. Very clever.
[16:11] < mhrd> in prolog the typical response for evaluating a statement is either a possible answer, or "no". Presumably the latter equates to False.
[16:12] < mhrd> so any sub evalulation (as part of the recursive evaluation process) will have the same kings of possible outputs
[16:13] < Chong-> mhrd: thanks. Is there uncertain or cannot be decided?
[16:14] < mhrd> nope.
[16:14] < mhrd> iirc
[16:14] < MS-> mhrd: StopIteration equates to false
[16:15] < MS-> ie StopIteration == No rather :)
[16:15] < mhrd> :)
[16:15] < mhrd> prolog basically methodically tries all possiblities by searching through the tree of the searchspace. In the context of prolog a problem is only undecidable if the search space is infinite - which simply means that the prolog interpreter will never complete its evalulation
[16:16] *** MS- nods
[16:16] < mhrd> so I suppose there can be "uncertain" or "undecided" if you ctrl-c the process before it completes :)
[16:16] < MS-> The mechanism they use uses side effects on the Variable()'s passed in to return answers
[16:17] < MS-> So for this:
[16:17] < MS-> def uncle(Person, Uncle):
[16:17] < MS-> Parent = Variable()
[16:17] < MS-> for l1 in parent(Person, Parent):
[16:17] < MS-> for l2 in brother(Parent, Uncle):
[16:17] < MS-> yield False
[16:17] < Chong-> I see. with enough time, it would decide eventually :-)
[16:17] < MS-> the actual values get "returned" as side effects.
[16:17] < MS-> It's about as twisted as prolog AFAICT
[16:17] < MS-> :)
[16:18] < mhrd> if it interests you: http://en.wikipedia.org/wiki/Resolution_(logic)
[16:18] < mhrd> oops - wrong one: http://en.wikipedia.org/wiki/Prolog
[16:18] < Chong-> got it
[16:18] < mhrd> """Given a query, the Prolog engine attempts to find a resolution refutation of the negated query. If the negated query can be refuted, i.e., an instantiation for all free variables is found that makes the union of clauses and the singleton set consisting of the negated query false, it follows that the original query, with the found instantiation applied, is a logical consequence of the program"""
[16:19] < MS-> heh
[16:19] < Chong-> I see.
[16:19] < MS-> Prolog is great - it breaks almost everyone
[16:20] < MS-> One of the ultimate levellers language wise :)
[16:20] < mhrd> ie. it tries to show that its not true :)
[16:20] < mhrd> so it basically explores the search space in its attempt to do that; accidentally finding answers on the way :)
[16:21] < MS-> There's an X Windows manager that uses prolog IIRC
[16:21] < Chong-> hehe. Like experements, always try to disprove assumption
[16:21] < mhrd> heh, how unnecessarily freaky :)
[16:22] < MS-> mhrd: I'm tempted to embed something similar in what I'm doing at the moment for work since it's ending up similar in places.
[16:22] < MS-> Not sure if that's good or bad :)
[16:22] < mhrd> heh, cool :)
[16:22] < mhrd> no harm in trying :)
[16:23] < mhrd> you can see how it maps nicely to python with yield:
[16:23] < mhrd> def findSolutions(problems):
[16:23] < mhrd> . for subproblems in problems:
[16:23] < mhrd> yield findSolutions(subproblems)
[16:23] < mhrd> # now raises StopIteration
[16:23] < vmlemon_> Hmm, any idea about integrating the FileAppender I hacked up a while ago?
[16:24] < Chong-> nice. since it can be enbeded in python
[16:24] < mhrd> def executeQuery(problem):
[16:24] < mhrd> . for solution in findSolutions(problem):
[16:24] < mhrd> . print solution
[16:24] < mhrd> print "No!"
[16:25] *** mhrd sees the time (gah!)
[16:27] < Chong-> the example on http://yieldprolog.sourceforge.net/ seems different: yield False is within the for statement
[16:27] < vmlemon_> Out of interest, does Kamaelia's DVB tuning code "block" the device so that other processes (e.g. rb-download or dvbtime) can't use it?
[16:27] < mhrd> I'm typing as I think it and my memory might be rusty - so I'm possibly wrong :-)
[16:28] < mhrd> Chong- : remember prolog tries to disprove the negative of the problem ... so it returns False for every valid solution found :-)
[16:29] < mhrd> (internally)
[16:29] < mhrd> (I think)
[16:30] < Chong-> But when can it return True?
[16:30] < mhrd> when it proves the negative :)
[16:30] < mhrd> oh, I see
[16:31] *** vmlemon_ has a one-liner for setting the CMOS and OS clocks using the time from a DVB-T multiplex, but requires having something to tune to a multiplex, so was thinking of hacking something up in Kamaelia...
[16:31] < mhrd> Chong- : why should it have to sometimes return True?
[16:32] < Chong-> When the anser is true :-)
[16:33] < mhrd> and wqhen will that be? :-)
[16:33] < mhrd> s/q//
[16:33] < Chong-> For example, uncle(Person, Uncle): should return true
[16:34] < Chong-> because Uncle is Person's uncle
[16:34] < mhrd> prolog tries, internally, to disprove the negative of the query
[16:34] < mhrd> so in that situation it *should* return False
[16:34] < Chong-> if parent(Person, Parent) and brother(Parent, Uncle) is true
[16:35] < mhrd> prolog tries, internally, to disprove the negative of the query
[16:37] < Chong-> It seems reasonable, but I not quite understand, probably needs more background reading about prolog;)
[16:37] < mhrd> or put it another way: prolog (and this python implementation) is trying to work out whether your query is NOT 'true'
[16:37] < mhrd> I've *really* got to go - cya
[16:37] < mhrd> (sorry - would love to talk longer, but no choice!)
[16:38] < Chong-> np. thanks a lot.
[16:38] *** mhrd is now known as mhrd-afk
[16:38] < Chong-> Have a nice weekend.
[16:39] < Chong-> Sorry for probably asking a silly question :P
[16:54] *** Davbo has joined #kamaelia
[18:44] < MS-> Chong-: It's trying to /disprove/ parent(Person, Parent) and brother(Parent, Uncle)
[18:45] < MS-> Chong-: I wouldn't worry too much - prolog really does break alot of people
[18:45] < MS-> The way to think about it is "proof by contraction"
[18:45] < MS-> gah
[18:45] < MS-> "proof by contradiction"
[18:45] < MS-> (typo)
[18:46] < MS-> Actually, looking at the wikipedia page that matt pointed at
[18:47] < Chong-> Probably I belong to the people broken by prolog :-)
[18:47] < MS-> I think I'm right
[18:47] < MS-> stopiteration == failed (ie prolog "No")
[18:47] < MS-> false == "success"
[18:47] < MS-> & other value == something else
[18:47] < MS-> given the example in http://en.wikipedia.org/wiki/Prolog#Evaluation
[18:48] < MS-> ?- sibling(sally, erica).
[18:48] < MS-> Yes
[18:48] < Chong-> MS-: Thanks for your explanation :-)
[18:48] < MS-> The problem with prolog is that I *ALWAYS* have to end up going back to a book
[18:48] < MS-> Best book on prolog I ever saw was called "microPROLOG", which used a custom syntax
[18:48] < MS-> and was actually understandable
[18:48] < MS-> Not seen that book in ages
[18:49] < MS-> The postulation is this:
[18:49] < MS-> Execution of a Prolog program is initiated by the user's posting of a single goal, called the query.
[18:49] < MS-> So the query here is this:
[18:49] < MS-> ?- sibling(sally, erica).
[18:49] < MS-> Yes
[18:49] < MS-> Prolog howeever tries to deal with this by doing this:
[18:49] < MS-> Logically, the Prolog engine tries to find a resolution refutation of the negated query.
[18:50] < Chong-> Probably can find it in school libary because they keep old book very well but update new book very slow :-)
[18:50] < MS-> ie it trues to prove that NOT ( sibling(sally, erica) ) is true
[18:50] < MS-> Chong-: Yes. It was in a school library when I saw it IIRC. That or the county library
[18:52] < Chong-> So, if it cannot reach NOT, the answer is yes?
[18:54] < Chong-> cool. worth having a look at the online catelog
[18:54] < MS-> yes
[18:56] < MS-> One of these days I'll sit down and make a readable version of it
[18:56] < Chong-> so, if Parent is parent of Person, "for l1 in parent(Person, Parent):", l1 will get a false value?
[18:58] < MS-> ERRNOBRAIN
[18:59] < Chong-> The book was published in 1984, avalaible in both main and Joule library
[19:00] < MS-> The answer to your question is "yes" I think btw
[19:00] < MS-> Oh that's a thought
[19:00] < MS-> I can go to the uni library
[19:00] < MS-> (I was checking amazon :) )
[19:01] < MS-> (I can use the Uni library because I went to manchester & you can still use it after graduating, even many years later)
[19:01] < Chong-> yes. I think you can get alumni library card
[19:02] < MS-> have one :)
[19:02] < Chong-> yes. we input the same information at the same time :-)
[19:02] < MS-> I have the clocksin and mellish book, but that's very theortical in approach and hence inpenetrable
[19:03] < Chong-> cool. That's the benefit of working in the same city with your study :-)
[19:03] < MS-> Indeed
[19:03] < MS-> I wonder if "Beginning micro-PROLOG / J.R. Ennals." is the book I'm thinking of
[19:03] < MS-> could go and look at it I suppose
[19:03] < MS-> (If it is I'll probably buy a copy)
[19:04] < Chong-> I can only see Micro-PROLOG : programming in logic and
[19:04] < Chong-> Micro-PROLOG and artificial intelligence.
[19:04] < MS-> Ah - i typed "prolog" as the search term
[19:05] < MS-> Or it could be: Learning micro-prolog : a problem-solving approach / Tom Conlon.
[19:06] < MS-> Ah, now I've found your two :)
[19:06] < Chong-> but I have not found yours :-)
[19:06] < MS-> I make a point of studying old languages
[19:07] < MS-> on the basis of "those who forget the past are condemned to repeat it" or the basis of "makes life more fun/easier"
[19:07] < Chong-> True. history repeats
[19:09] < Chong-> One question, when/ what cases will you use prolog rather than other languages?
[19:09] < MS-> I've got a number of old books on things like forth, occam and simular for example
[19:09] < MS-> it's used in proof systems and API
[19:09] < MS-> AI rather
[19:09] < MS-> For example, you could declare at it all the bills you get
[19:09] < MS-> what your income is
[19:10] < MS-> when you get red letters
[19:10] < MS-> and minimum payments
[19:10] < MS-> and say to it "what's the best order for doing these
[19:10] < MS-> "
[19:10] < MS-> and if you get the question right, it will tell you
[19:10] < MS-> if you get the question wrong, it will say "no"
[19:10] < MS-> that or use up all the resources on your machine
[19:11] < Chong-> yes. I can see it fits logic reasoning.
[19:11] < MS-> People think concurrency is hard, whereas in fact it's just the tools are hard. Prolog *IS* hard.
[19:11] < MS-> You can also use it for things like machine translation etc
[19:11] < MS-> Since it works on symbols
[19:12] < Chong-> yes, like the famous exmple, Socrate is a man, all man will die, so Socrate will die
[19:15] < Chong-> cool. you and other mentors are so versatile, knowing so many languages, frameworks ...
[19:19] < MS-> You know, I think it's the tom conlon book
[19:22] *** Chong- wondering what tom conlon means :/
[19:23] < MS-> it's his name :)
[19:23] < MS-> sorry
[19:23] < MS-> (based on searches)
[19:23] < MS-> described here
[19:23] < MS-> http://www.davidharrison.org/microbib.html
[19:24] *** MS- goes afk
[19:24] *** MS- is now known as ms-afk
[19:24] < Chong-> I see. Thanks and see you later.