Unformatted text preview: plement and concatenation. 4. The set BALANCED is context free but not regular. It is context free because there is PDA for it (We want to check whether k − l = n − m . This can be done as follows. Push all a s, pop an a for every input b , push remaining b s (if any). At this stage stack contains either k − l a s or l − k b s. There are two cases. (1) If stack contains a s then pop an a for every input c , when stack becomes empty push all remaining c s, pop a c for every input d , accept if stack is empty after last input d . (2) If stack contained b s then push all c on a stack, pop a symbol ( c or b ) for every d , accept if stack is empty after last input d . The set BALANCED is not regular because BALANCED ∩ a * b * = a n b n is not a regular language, and set of regular languages is closed under intersection. 1...
View
Full
Document
 Spring '08
 Staff

Click to edit the document details