• Re: retract problem in SWI-Prolog

    From Hoang Nguyen Duy@21:1/5 to All on Thu Nov 18 00:21:24 2021
    Vào lúc 12:33:10 UTC+7 ngày Thứ Sáu, 1 tháng 6, 2001, Qiong Cai đã viết:
    Hi all,
    Some codes from the book "First-Order logic
    and Automated Theorem proving"(2nd) are as follows:
    funcount(1).
    newfuncount(N) :-
    funcount(N),
    retract(funcount(N)),
    M is N + 1,
    assert(funcount(M)).
    reset :-
    retract(funcount(_)),
    assert(funcount(1)),
    !.
    But, when I actually call reset or newfuncount,
    SWI-Prolog has a ERROR message:
    ERROR: No permission to modify static procedure "funcount/1".
    Could anyone tell me how to avoid this problem? Thanks

    Yours
    Qiong
    I'm have to prove the equality of left and right neutral element of a semi group using PROLOG
    here is my code:
    m(m(x,y),z):- m(x,m(y,z)).
    m(el,x)=x.
    m(x,er)=x.
    and the error is No permission to modify static procedure `(=)/2'
    can some one please help me
    Thanks so much

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to All on Thu Nov 18 10:43:31 2021
    On Thursday, 18 November 2021 at 09:21:26 UTC+1, Hoang Nguyen Duy wrote:

    You should have opened a new thread, not reply to one that is from 2001:
    next time, if you think the old discussion is relevant, please just put a link.

    I'm have to prove the equality of left and right neutral element of a semi group using PROLOG
    here is my code:
    m(m(x,y),z):- m(x,m(y,z)).
    m(el,x)=x.
    m(x,er)=x.
    and the error is No permission to modify static procedure `(=)/2'
    can some one please help me
    Thanks so much

    That code makes no sense: looks like some kind of Python... Have you
    gone through at least one tutorial before attempting to write any Prolog?

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)