ontolog-forum
[Top] [All Lists]

Re: [ontolog-forum] new logic

To: "[ontolog-forum]" <ontolog-forum@xxxxxxxxxxxxxxxx>
From: "John F. Sowa" <sowa@xxxxxxxxxxx>
Date: Wed, 20 Jan 2010 03:36:38 -0500
Message-id: <4B56C096.5000407@xxxxxxxxxxx>
Pat and Jakub,    (01)

PC> I would be quite satisfied to see an actual demonstration of
 > an FOL specification that showed how a "plus" function could be
 > described in a general way so that any arbitrary number can be
 > added to any other.    (02)

As you note, the hard part is handling numerals in some systematic
way.  Prolog is an excellent language for writing parsers that can
translate character strings to some internal form.  But you must
have some built-in convert predicate that will translate a list
of bits in Prolog form, such as [1,0,1,1,0,0], to the internal form.
All that is normally done in Prolog.  There are also versions of
Prolog that handle infinite precision arithmetic (similar to the
Bignum datatype in LISP).    (03)

PC> I would be quite satisfied to see an actual demonstration of
 > an FOL specification that showed how a "plus" function could
 > be described in a general way so that any arbitrary number can
 > be added to any other.    (04)

You can avoid all the messy details by using the representation
that Jakub adopted in his previous note:    (05)

    0 = 0,
    1 = s(0),
    2 = s(s(0)),
    3 = s(s(s(0))), ...    (06)

Following is Jakub's solution in CLIF notation:    (07)

    (forall (A) (plus A 0 A))    (08)

    (forall (A B C) (if (plus A B C) (plus A (s B) (s C))))    (09)

And following is a version in Prolog notation:    (010)

    plus(A,0,A).    (011)

    plus(A,s(B),s(C)) :- plus(A,B,C).    (012)

You can try running this in any version of Prolog.    (013)

John    (014)



_________________________________________________________________
Message Archives: http://ontolog.cim3.net/forum/ontolog-forum/  
Config Subscr: http://ontolog.cim3.net/mailman/listinfo/ontolog-forum/  
Unsubscribe: mailto:ontolog-forum-leave@xxxxxxxxxxxxxxxx
Shared Files: http://ontolog.cim3.net/file/
Community Wiki: http://ontolog.cim3.net/wiki/ 
To join: http://ontolog.cim3.net/cgi-bin/wiki.pl?WikiHomePage#nid1J
To Post: mailto:ontolog-forum@xxxxxxxxxxxxxxxx    (015)

<Prev in Thread] Current Thread [Next in Thread>