| Thomas Wölfl 2005-11-19, 6:58 pm |
| Hi All,
I use assert / retract to set a value which should be accessible in the same
way as a global variable in a functional language. I know that this is not a
good programming style in PROLOG. As long as my program contains assert /
retract I can not use automatic theorem provers (like LPTP:
http://www.inf.ethz.ch/personal/staerk/lptp.html ) in order to prove
left-termination. Robert Staerk writes on this page:
"Non-logical predicates and control operators like cut (!), assert/1,
retract/1, var/1 are forbidden, since they destroy either the lifting
property or modify the program during run-time."
Is there any standard way to convert a global variable to a local one?
I could pass the "global" variable as argument between all predicates of my
program. For example let Path be such a variable. I call the predicate
-? test(x, px, Path).
and it fails. Now, Path should contain the path of the derivation, i.e. the
reason why test failed. However, since test failed, Path is unbound, e.g.
Path = _L123.
Thanks for your help,
Thomas
|