|
|
|
|
|
by 6Typos
2707 days ago
|
|
Why are you using DCGs for turing_//2? Genuine question, because I implemented a TM interpreter in Prolog, using "normal" predicates, and I can't see where they help you in this case PS: I learnt how to use DCGs thanks to your website, thank you! |
|
In this concrete case, using them explicitly is certainly not bad and may even be preferable. However, suppose I now introduce a new argument in order to implement iterative deepening:
Then this notation, in my opinion, already makes it a bit easier to think about the rule, since it only uses 3 arguments instead of 5 or more, and the tape is simply passed along implicitly.An iterative deepening version of the machine provides the important benefit that infinite branches of the computation cannot block others that lead to (nondeterministic) succcess. For example, suppose I add the indefinitely looping machine:
and then define: then we now get solutions via iterative deepening, whereas the original machine loops without reporting any solution: Iterative deepening is an asymptotically optimal search strategy under very general assumptions. Thank you for the kind words!