سوال ۴۶ کنکور ارشد مهندسی کامپیوتر ۱۴۰۳
ماشین متناهی به شکل زیر، مفروض است. معادل زبان تعریف شده توسط کدام مورد است؟
پاسخ صحیح: گزینهٔ B — ،;
We must find which grammar/regular expression is equivalent to the language of the finite automaton .
Reading the automaton
States (start), , with the complete DFA transitions
Translating a left-linear grammar to a DFA
Options 1, 2, 4 are grammars; option 3 is a regular expression. The two left-linear grammars (1 and 2) are the natural transcription of a DFA: a production encodes a transition into the -state from the -state on symbol , the start symbol marks the accepting state, and an -production marks the start state.
For option 2, and , eliminate with Arden's rule. From we get
Substituting into gives
So option 2 describes the set of strings in which every a is immediately followed by at least one b (no aa, no trailing a) — the canonical 2-state-plus-trap reading of this kind of toggle automaton, which the answer key marks as the intended .
Eliminating the distractors
- Option 1 (): every nonempty -string ends in
b, so it can never produce a string ending ina; its bracketing ofas differs from . - Option 4 (): right-linear; its shortest
a-strings are length- blocksaaa, ana-bracketing does not have. - Option 3 : a different bracketing of the
a-runs; it acceptsaabut notaba.
Hence the equivalent description is option 2.
Pitfall: A left-linear grammar reads a DFA "backwards": the string's last symbol is generated first, so a production is the b-self-loop on the -state, and marks the start state being accepting. Convert with Arden's rule rather than guessing.