fool2fish / dragon-book-exercise-answers

Compilers Principles, Techniques, & Tools (purple dragon book) second edition exercise answers. 编译原理(紫龙书)第2版习题答案。
6.37k stars 1.77k forks source link

Proof in ex. 3.4.4 seems to be incomplete #107

Open 0xd34df00d opened 7 years ago

0xd34df00d commented 7 years ago

The proof doesn't mention why the chosen strategy for shrinking t is correct.

Indeed, the naive approach of just scanning the string back from the longest prefix would yield the correct prefix, and indeed the approach in the presented algorithm will find some prefix, but it's not obvious why it will find the longest one.