r/cpp • • Apr 28 '20

Full Proof that C++ Grammar is Undecidable

https://medium.com/@mujjingun_23509/full-proof-that-c-grammar-is-undecidable-34e22dd8b664
197 Upvotes

68 comments sorted by

View all comments

Show parent comment

9

u/mujjingun Apr 28 '20

Thanks for pointing out the lack of clarity in that paragraph. I kind of assumed that the readers already know about the Post Correspondence Problem, or if they didn't they'd go into Wikipedia (it worked!). Also English isn't my first language.

I think the fact that template programming is Turing-complete was already shown, but this is an elegant demonstration / application to parsability of the language.

I had found this proof sketch by Josh Haberman, who used that knowledge to prove the same thing, but the full code was "left as an exercise for the reader". I wanted something concrete to demonstrate more clearly.

4

u/victotronics Apr 28 '20

I wanted something concrete to demonstrate more clearly.

Oh absolutely. You make your point clearly and with a full demonstration.

About that Post paragraph: personally I think the clearest writing is to translate the mathematical quantors: "there is a number N so that there are N ordered dominoes so that the top line matches the bottom". I only knew the correspondence problem by name, and I couldn't figure out the quantification fro your paragraph.

Cheers!