I'm reading the book Introduction to the Theory of Computation by Micheal Sipser, and is confused with the proof of Theorem 2.42 that the class of Deterministic Context-free languages (DCFL) is closed under complementation.
The proof idea and the whole proof can be found here:
PROOF IDEA: https://drive.google.com/open?id=0B5UUNlljygnGUVBhYWJldXNsa3M
PROOF: https://drive.google.com/open?id=0B5UUNlljygnGSU9Rc2xEU01wZHM
For the proof, I cannot understand why they need the second paragraph. Let's say the machine yielded by paragraph one be M1, and the one yielded by paragraph two be M2. It seems by inverting accept and non-accept states of M1, we are done, because in no cases M1 could go from an accept state to a non-accept one at the end of the input string (because M1 "once enters an accept state, it remains in accept states until it reads the next input symbol"). Could anybody explain why M2 is still needed.
Moreover, as accepting states that are not reading states have all been removed why M2 is still equivalent to M1? what if M1 stops at some accept state that is not a reading state?
And why in the last, only those reading states got inverted? Then non-reading states all stay the same? what if by some input string the original machine stops at a non-accept state that is also not a reading state, then it gets rejected by both the original and the inverted machines.
Many thanks if anybody could help.