Quote:
Original post by Steadtler
Well any proof for an algorithm will assume that the algorithm is correctly executed. If the open list is empty, then you explored all possible paths and thus the algorithm must have returned the optimal path by brute force.
Your sentence contains two arguments: the fact that the algorithm is correctly executed and the fact that all nodes have been explored. Both these arguments apply to any search algorithm, not only A*. Therefore, if they were sufficient to prove that A* is correct, then they are sufficient to prove that, say, breadth-first search also finds the shortest path in a weighted graph. Consider this graph:
B - C - D / \ start - A F - G - end \___ E ___/
Let's assume that the lengths guarantee AE + EF > AB + BC + CD + DF (as such, the shortest path is ABCDFG). A breadth-first search will explore node F before node D, and thus the path found by it will be AEFG, which is suboptimal. This happens even if breadth-first has explored all nodes, and even if it has executed correctly.
This is akin to saying, "Fish have eyes, therefore they can breathe underwater". Fish can breathe underwater, but this isn't because they have eyes—humans have eyes too, but I don't really enjoy lungfuls of water.
In essence,
there is a specific property of the A* algorithm which lets it find the shortest path, and this is what you need to mention in any correctness proof.
Quote:
Such a node will have g(x) = L(x) (by definition, else it would be another, "earlier" node)
Nonsense. Also, the presence of quotes around "earlier" hints at overzealous hand-waving. You're trying to shorten the proof as much as you can, but you're dropping out fundamental arguments.
You're trying to show that g(x) = L(x) for a given node in the open list. Given the way g(x) is computed, this implies that you expect the closest explored neighbor of x, which we'll call y, to verify g(y) = L(y), so that g(x) = g(y) + d(x,y) = L(y) + d(x,y), which you hope is equal to L(x) but haven't formally proven either (and you won't be able to prove it, since you haven't really defined 'x' yet beyond its being in the open list, and that you hope g(x) = L(x) is true). And if you wish to prove g(y) = L(y), then you need a lot more words than "by definition", since it has nothing to do about definitions and everything to do about proving an algorithm invariant.
To prove the correctness of A*, you need to argue the fact that at any point during execution, for any explored node y so far, g(y) = L(y). This is your algorithm's invariant, and without it you cannot assume that the value of g(x) makes sense—because if g(y) wasn't the intended value for the explored nodes, then A* will compute an unintended value of g(x) for open list nodes as well, which makes g(x) = L(x) an awfully difficult assumption to make.
To prove that g(x) = L(x) for any explored node, you need to reason on the
shortest path from start to x, since this is what L(x) represents. However, since your entire reasoning works around the
shortest path from start to destination, you simply cannot prove that g(x) = L(x), which is why I consider your proof insufficient.