Fermat's principle is the "path of least time principle" or we can say that "he path a light ray takes is a local minimum". Quantum physics also says that the light take (test) all possible paths and only the minimal remains. Is it working in special cases like this too? Let's examine the fig. 1-3 below. Fig1. is the normal case, the light goes from A to B and finds the "least time" path through the object. Question 1: What if we cut the object (Fig. 2), resulting a possible better path with less time? Will the light go unchanged, and arrives to the B as the dotted line shows, or will it find the less-time-path, even if this means that it must go through the object in a different angle? Question 2: What happens if we cut the object even shorter (Fig. 3), crossing the path of the ray goes normally through the object? Let's assume that in this case the "least time" path is if the light does not enter the object, but goes on the surface. Is this possible, and the path will be the orange one? Or in this case the light will do something else, like the reflecion inside, and will reach the B' ? My question in general: Is the "least time between two points" principle is an always working principle (rule 1), or the light is "not so smart" and can decide only locally on the entering points and can't "think further" (rule 2). If the "rule 2" is the real one, why QP says that the light take all the possible paths? Thank you!