Google Answers Logo
View Question
 
Q: Logical Programming ( No Answer,   1 Comment )
Question  
Subject: Logical Programming
Category: Science > Math
Asked by: dave29-ga
List Price: $3.00
Posted: 10 Nov 2005 23:10 PST
Expires: 10 Dec 2005 23:10 PST
Question ID: 591797
How can i ensure a ceratain prolog program to be decidable? How can i
proof that? I just use pure prolog, no specialities like cut.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Logical Programming
From: mathtalk-ga on 14 Nov 2005 10:11 PST
 
If there is no recursion in the definitions of the Prolog predicates,
then your Prolog "program" is decidable as a special case of the
decision procedure for Horn clauses in logic.

Recursion can enter Prolog in two (closely related) forms.  One is
some circularity of references in the definitions of the predicates
themselves.  You are probably familiar with the repeat/0 predicate,
provided as a built-in for many Prolog implementations but which has
the logical equivalent:

  repeat.
  repeat :- repeat.

Consider the following goal:

  main :- repeat, fail.

This Prolog program will never terminate, because repeat will always
succeed on backtracking.

The second way that recursion can enter a Prolog program is through
recursively-defined data structures. Lists, to give a simple example,
are "defined" recursively, and unified Prolog data structures may
"consist" of partially-bound/partially-unbound portions, such as a
list entry "to be named later" or a tail that remains "free" after the
head is bound.  Despite this, the unification algorithm (which taken
together with backtracking forms the basic corpus of a Prolog
implementation) is a decidable one (for first-order unification,
albeit one with exponential complexity in most Prolog interpreters).

So I would say that one way to guarantee decidability is to avoid
recursion in predicates (first kind above), but of course this is a
Draconian approach.

More practically one guarantees that a Prolog predicate is decidable,
despite using recursion, by a "proper" definition, sort of a
well-founded induction with certain "base case" clauses together with
some rules that are "reducing" the goal to one or more subgoals that
are provably closer to the base cases with each application.


regards, mathtalk-ga

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy