Questions tagged [non-termination]

In Prolog programs there are two kinds of non-termination: Existential and universal non-termination.

Universal termination of a query Q means that the query

?- Q, false.

terminates. Many Prolog programs can not and must not terminate universally. For example, the predicate length/2 describes lists of arbitrary length, and universal termination of the most general query in this case would mean that the predicate is incomplete.

Existential termination, on the other hand, occurs for example when a solution is found and reported.

There are ways to reason declaratively about termination properties of Prolog programs. The goal of termination analyzers for Prolog programs is to deduce more information about their termination properties. Termination analysis for subsets of Prolog is a field of active research in the logic programming community.

Non-termination is the lack of termination.

See also .

34 questions
0
votes
2 answers

Non-terminating inductive predicates

In the excellent Programming and Proving in Isabelle/HOL it says [...] in contrast to recursive functions, there is no termination requirement for inductive definitions. (pdf p. 40) Does this mean there are inductive definitions where it's…
Sebastian Graf
  • 3,602
  • 3
  • 27
  • 38
0
votes
2 answers

Prolog raises out of local stack for no good reason

I'm trying to implement Levenshtein distance in Prolog. The implementation is pretty straightforward: levenshtein(W1, W2, D) :- atom_length(W1, L1), atom_length(W2, L2), lev(W1, W2, L1, L2, D), !. lev(_, _, L1, 0, D) :- D is L1,…
s1ddok
  • 4,615
  • 1
  • 18
  • 31
0
votes
1 answer

2-Water jug in prolog

I'm trying to solve the 2-water jug problem in swi-prolog: Given 2 jugs of capacities 4 and 3 gallons respectively, I want to find the steps to obtain 2 gallons in jug of capacity 4 and 0 in the other. I wrote programs for this problem in C++ using…
0
votes
2 answers

prevent app termination when general exception happens

Is there a way to catch, in one place, all "uncaught" exceptions and let the app continue? I see I can use setUncaughtExceptionHandler to do some logging and whatever, but the app will still terminate. I want something where I can log an exception,…
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101
1 2
3