The section on integer arithmetic and constraint programming at https://www.metalevel.at/prolog/clpz explains that the list_length/2 predicate does not terminate when asked to find a list that has a specified length.
?- list_length(Ls, 3), false.
nontermination
"It takes only a single additional goal to make this query terminate. This is left as an exercise."
I have struggled to find what this single additional goal is. I have tried days of reading popular texts on prolog, googling and even asking on stackexchange.
The section on integer arithmetic and constraint programming at https://www.metalevel.at/prolog/clpz explains that the list_length/2 predicate does not terminate when asked to find a list that has a specified length.
"It takes only a single additional goal to make this query terminate. This is left as an exercise."
I have struggled to find what this single additional goal is. I have tried days of reading popular texts on prolog, googling and even asking on stackexchange.
I would love an answer or a link to an answer.