Re: golog in minipicolisp
Hi Alex, If I had taken yours and Yiorgos advice and read these two articles *before* doing the swi-prolog to pilog translation it might have cleared some things up I was guessing about. http://en.wikipedia.org/wiki/Situation_calculus http://drops.dagstuhl.de/opus/volltexte/2010/2631/pdf/10081.Ferrein.2631.pdf Sill some issues there, but I am very optimistic. Starting at 120kb or so, people can embed golog with minipicolisp/pilog into systems. And I have an application that will be fun, I think, to use this approach in. :-) Cheers, Doug --- On Sun, 6/26/11, Alexander Burger wrote: > From: Alexander Burger > Subject: Re: golog in minipicolisp > To: picolisp@software-lab.de > Date: Sunday, June 26, 2011, 11:50 AM > On Sun, Jun 26, 2011 at 01:44:33AM > -0700, Doug Snead wrote: > > (It looks not so bad, once I studied golog_swi.pl a > bit more. Some loose ends still, but promising. - > Doug) > > Cool. Bravo! > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe > -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: golog in minipicolisp
On Sun, Jun 26, 2011 at 01:44:33AM -0700, Doug Snead wrote: > (It looks not so bad, once I studied golog_swi.pl a bit more. Some loose ends > still, but promising. - Doug) Cool. Bravo! -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: golog in minipicolisp
--- On Sun, 6/26/11, Doug Snead wrote: > (be isAtom (@A) (not (equal @A (Neg @W))) > (or (equal @A (And @W1 @W2))) > (or (equal @A (If @W1 @W2))) > (or (equal @A > (Is @W1 @W2))) > (or (equal @A (Or @W1 @W2))) > (or (equal @A (some @X @W))) > (or (equal @A (all @X @W I mean: (be isAtom (@A) (not (or (equal @A (Neg @W)) (equal @A (And @W1 @W2)) (equal @A (If @W1 @W2)) (equal @A (Is @W1 @W2)) (equal @A (Or @W1 @W2)) (equal @A (some @X @W)) (equal @A (all @X @W) :-) -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
golog in minipicolisp
(It looks not so bad, once I studied golog_swi.pl a bit more. Some loose ends still, but promising. - Doug) # a golog interpreter in pilog # translated from: http://www.cs.toronto.edu/cogrobo/Systems/golog_swi.pl # do(E1 : E2,S,S1) :- do(E1,S,S2), do(E2,S2,S1). (be do ((@E1 @E2) @S @S1) (do @E1 @S1 @S2) (do @E2 @S2 @S1)) # do(?(P),S,S) :- holds(P,S). (be do ((? @P) @S @S) (holds @P @S)) # ?? # do(E1 # E2,S,S1) :- do(E1,S,S1) ; do(E2,S,S1). (be do ((Amb @E1 @E2) @S @S1) (or (do @E1 @S @S1) (do @E2 @S2 @S1))) # do(if(P,E1,E2),S,S1) :- #do( (?(P) : E1) ## (?(-P) : E2), # S,S1). (be do ((if @P @E1 @E2) @S @S1) (do (Amb (Seq (? @P) @E1) (Seq (? (Neg @P)) @E2)) @S @S1)) # do(star(E),S,S1) :- S1 = S ; do(E : star(E),S,S1). (be do ((star @E) @S @S1) (or (equal @S1 @S) (do (@E (star @E)) @S @S1))) # do(while(P,E),S,S1):- do(star(?(P) : E) : ?(-P),S,S1). (be do ((while @P @E) @S @S1) (do (Seq (star (Seq (? @P) @E)) (? (Neg @P))) @S @S1)) # do(pi(V,E),S,S1) :- sub(V,_,E,E1), do(E1,S,S1). (be do ((pi @V @E) @S @S1) (sub @V @ @E @E1) (do @E1 @S @S1)) # do(E,S,S1) :- proc(E,E1), do(E1,S,S1). (be do (@E @S @S1) (proc @E @E1) (do @E1 @S @S1)) # do(E,S,do(E,S)) :- primitive_action(E), poss(E,S). (be do (@E @S (do @E @S)) (primitive_action @E) (poss @E @S)) # sub(_,_,T1,T2) :- var(T1), T2 = T1. (be sub (@ @ @T1 @T2) (var @T1) (equal @T2 @T1)) # sub(X1,X2,T1,T2) :- \+ var(T1), T1 = X1, T2 = X2. (be sub (@X1 @X2 @T1 @T2) (not (var @T1)) (equal @T1 @X1) (equal @T2 @X1)) # sub(X1,X2,T1,T2) :- \+ T1 = X1, T1 =..[F|L1], sub_list(X1,X2,L1,L2), # T2 =..[F|L2]. (be sub (@X1 @X2 @T1 @T2) (not (equal @T1 @X1)) (append @F @L1 @T1) (sub_list @X1 @X2 @L1 @L2) (append @F @L2 @T2)) # sub_list(_,_,[],[]) (be sub_list (@ @ () ())) # sub_list(X1,X2,[T1|L1],[T2|L2]) :- sub(X1,X2,T1,T2), sub_list(X1,X2,L1,L2). (be sub_list (X1 @X2 (@T1 @L1) (@T2 @L2)) (sub @X1 @X2 @T1 @T2) (sub_list @X1 @X2 @L1 @L2)) # holds(P & Q,S) :- holds(P,S), holds(Q,S). (be holds ((And @P @Q) @S) (holds @P @S) (holds @Q @S)) # holds(P v Q,S) :- holds(P,S); holds(Q,S). (be holds ((Or @P @Q) @S) (or (holds @P @S) (holds @Q @S))) # holds(P => Q,S) :- holds(-P v Q,S) (be holds ((If @P @Q) @S) (holds (Or (Neg @P) @Q) @S)) # holds(P <=> Q,S) :- holds((P => Q) & (Q => P),S). (be holds ((Is @P @Q) @S) (holds (And (If @P @Q) (If @Q @P) @S))) # holds(-(-P),S) :- holds(P,S). (be holds ((Neg (Neg @P)) @S) (holds @P @S)) # holds(-(P & Q),S) :- holds(-P v -Q,S). (be holds ((Neg (And @P @Q)) @S) (holds (Or (Neg @P) (Neg @Q)) @S)) # holds(-(P v Q),S) :- holds(-P & -Q,S). (be holds ((Neg (Or @P @Q)) @S) (holds (And (Neg @P) (Neg @Q)) @S)) # holds(-(P => Q),S) :- holds(-(-P v Q),S). (be holds ((Neg (If @P @Q)) @S) (holds (Neg (Or (Neg @P) @Q)) @S)) # holds(-(P <=> Q),S) :- holds(-((P => Q) & (Q => P)),S). (be holds ((Neg (Is @P @Q)) @S) (holds (Neg (And (If @P @Q) (If @Q @P))) @S)) # holds(-all(V,P),S) :- holds(some(V,-P),S). (be holds ((Neg (all @V @P)) @S) (holds (some @V (Neg @P)) @S)) # holds(-some(V,P),S) :- \+ holds(some(V,P),S). (be holds ((Neg (some @V @P)) @S) (not (holds (some @V @P) @S))) # holds(-P,S) :- isAtom(P), \+ holds(P,S). (be holds ((Neg @P) @S) (isAtom @P) (not (holds @P @S))) # holds(all(V,P),S) :- holds(-some(V,-P),S) (be holds ((all @V @P) @S) (holds (Neg (some @V (Neg @P)) @S))) # holds(some(V,P),S) :- sub(V,_,P,P1), holds(P1,S). (be holds ((some @V @P) @S) (sub @V @ @P @P1) (holds @P1 @S)) # holds(A,S) :- restoreSitArg(A,S,F), F ; # \+ restoreSitArg(A,S,F), isAtom(A), A. (be holds (@A @S) (restoreSitArg @A @S @F) @F # is naked var ok as pilog clause? (not (restoreSitArg @A @S @F)) (isAtom @A) @A) # isAtom(A) :- \+ (A = -W ; A = (W1 & W2) ; A = (W1 => W2) ; # A = (W1 <=> W2) ; A = (W1 v W2) ; A = some(X,W) ; A = all(X,W)). (be isAtom (@A) (not (equal @A (Neg @W))) (or (equal @A (And @W1 @W2))) (or (equal @A (If @W1 @W2))) (or (equal @A (Is @W1 @W2))) (or (equal @A (Or @W1 @W2))) (or (equal @A (some @X @W))) (or (equal @A (all @X @W # %restoreSitArg(poss(A),S,poss(A,S)). (prove (goal '(restoreSitArg (poss @A) @S (poss @A @S # ? --- On Fri, 6/17/11, Doug Snead wrote: > From: Doug Snead > Subject: Re: golog in minipicolisp ? > To: picolisp@software-lab.de > Date: Friday, June 17, 2011, 8:43 PM > > Yiorgos, Alexander: > > Thanks for the info. Unfortunately, not so straightforward > as I had hoped. > > Doug > > > > --- On Fri, 6/17/11, Yiorgos Adamopoulos > wrote: > > > From: Yiorgos Adamopoulos > > Subject: Re: gol
Re: golog in minipicolisp ?
Yiorgos, Alexander: Thanks for the info. Unfortunately, not so straightforward as I had hoped. Doug --- On Fri, 6/17/11, Yiorgos Adamopoulos wrote: > From: Yiorgos Adamopoulos > Subject: Re: golog in minipicolisp ? > To: picolisp@software-lab.de > Date: Friday, June 17, 2011, 3:07 AM > On Fri, Jun 17, 2011 at 10:37 AM, > Alexander Burger > wrote: > >> Levesque, H. J., Reiter, R., Lespérance, Y., Lin, > F., & Scherl, R. B. > >> (1997). GOLOG: A Logic Programming Language for > Dynamic Domains. > >> Journal of Logic Programming, 31(1-3), 59-83 > > > > Can this be found online somewhere? > > http://www.cs.toronto.edu/kr/publications/GOLOGlang.pdf > > > -- > http://gr.linkedin.com/in/yiorgos > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe > -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: golog in minipicolisp ?
On Fri, Jun 17, 2011 at 10:37 AM, Alexander Burger wrote: >> Levesque, H. J., Reiter, R., Lespérance, Y., Lin, F., & Scherl, R. B. >> (1997). GOLOG: A Logic Programming Language for Dynamic Domains. >> Journal of Logic Programming, 31(1-3), 59-83 > > Can this be found online somewhere? http://www.cs.toronto.edu/kr/publications/GOLOGlang.pdf -- http://gr.linkedin.com/in/yiorgos -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: golog in minipicolisp ?
Hi Doug, Yiorgos, > Levesque, H. J., Reiter, R., Lespérance, Y., Lin, F., & Scherl, R. B. > (1997). GOLOG: A Logic Programming Language for Dynamic Domains. > Journal of Logic Programming, 31(1-3), 59-83 Can this be found online somewhere? > It is based on the Situation Calculus. Since Lisp and the Situation > Calculus are closely related, it might be better to work directly in > picolisp rather than trying to adapt a Prolog implementation into > pilog. I would second that. Concerning the implementations in "gologinterpreter.pl" and "golog_swi.pl": The operator definitions with 'op' are not available in Pilog, though I could imagine they can be emulated. I must say that for me personally it is difficult to understand what that code does, especially without knowing Golog. I have problems to read "real" Prolog, as I never used it. What does the '-' syntax mean? Negation? But there is also 'not' ... There are many predicates I don't know, e.g. '?', 'proc', 'star', 'while', 'pi', 'primitive_action' etc. Are they built-in? Perhaps someone with a better knowledge of Prolog (Clemens?) can help? Cheers, - Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: golog in minipicolisp ?
GOLOG is described in: Levesque, H. J., Reiter, R., Lespérance, Y., Lin, F., & Scherl, R. B. (1997). GOLOG: A Logic Programming Language for Dynamic Domains. Journal of Logic Programming, 31(1-3), 59-83 It is based on the Situation Calculus. Since Lisp and the Situation Calculus are closely related, it might be better to work directly in picolisp rather than trying to adapt a Prolog implementation into pilog. Just my $0.02 -- http://gr.linkedin.com/in/yiorgos -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
golog in minipicolisp ?
Alexander (or anyone!), I'm looking at something called golog http://www.cs.toronto.edu/cogrobo/main/systems/index.html it is a "A high-level agent programming language... based on Prolog (usually Eclipse, SWI, LPA, and Quintus.)" "An interpreter in SWI Prolog can be found here. http://www.cs.toronto.edu/cogrobo/Systems/golog_swi.pl An interpreter in ECLIPSE Prolog can be found here. http://www.cs.toronto.edu/cogrobo/Systems/gologinterpreter.pl " The .pl prolog gologs above look (deceptively) simple. I don't know pilog well enough to be able to tell if there is something about gologinterpreter.pl (or golog_swi.pl, same thing) that I will NOT be able to do in minipicolisp's pilog. I'd like to try to converting gologinterpreter.pl into pilog (especially for minipicolisp). I am hoping that this will be both possible and straightforward. Any thoughts? Cheers, Doug -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe