# complexity theory – How can I simulate nested WHILE loops in a theoretical programming language to show Turing completeness?

PRE-WORK-POST is a theoretical programming language with the following structure, where P,Q and R are LOOP program:

$$text{PRE} P text{WORK} Q text{POST} R text{END}$$

First $$P$$ is executed. Then $$Q$$ is executed until $$x_0 neq 0$$. Finally $$R$$ is executed. I have to prove that PRE-WORK-POST is Turing complete and I have chosen to prove that I can simulate any WHILE program through a PRE-WORK-POST program. I’m stuck on one of the tasks. Given that $$P1$$ and $$P2$$ are both WHILE program, then $$P1;P2$$ is also a WHILE program (by definition). How can I simulate this using PRE-WORK-POST? I’m not really sure how I can do this since LOOP programs don’t allow for nested loops.