Automata and regular languages
مُقدَّم
مفردات
| English | المعنى |
|---|---|
| deterministic finite automaton | deterministic finite automaton |
| pumping lemma | pumping lemma |
English
The table machine
- A deterministic finite automaton is states plus a transition table: read a symbol, move, accept or reject at the end of input. The course DFA accepts strings over $\{a, b\}$ ending in $ab$.

{exercise:uni-cs1101-dfa}
تدريب
The course DFA on input aba ends in state —
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
q0-a-q1, q1-b-q2, q2-a-q1: ends q1, rejected (q2 accepts, not q1).
English
The pumping ceiling
- The pumping lemma: any long accepted string splits $xyz$ with $|xy| \le p$, $|y| \ge 1$, and every $xy^iz$ accepted — so $L = \{a^n b^n\}$ is NOT regular: pump $y$ (all $a$'s) and the count breaks.
- Regular languages cannot count unboundedly — memoryless is the ceiling.
{exercise:uni-cs1101-pumping}
تدريب
The pumping lemma shows a^n b^n is not regular because —
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
y lies in the a-block; pumping changes the count of a without b.
English
Traces, exactly
aababwalks q0→q1 (a), q1→q1 (a), q1→q2 (b), q2→q1 (a), q1→q2 (b) — accept.abawalks q0, q1, q2, q1 — reject (ends mid-pattern).- Regex
ab|baas an NFA guesses the branch; the subset-construction DFA tracks both possibilities at once — determinisation can square the state count.
{exercise:uni-cs1101-trace}
تدريب
The trace of aabab in the ends-in-ab DFA is —
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
a:q1, a:q1, b:q2, a:q1, b:q2 - accept.