\documentclass[a4paper,12pt]{article}

\usepackage[croatian]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{lettrine}
\usepackage{fancyhdr}
\usepackage{wasysym}
\usepackage{amscd}
\usepackage{amsthm}

\pagestyle{empty}

\newcommand{\zad}[1]{\textbf{Zadatak {#1}. }}


\begin{document}
\noindent \zad{1}Da li je jezik $L=\{w\in (a+b+c)^{*}\ \mid\
3|w|_{b}=5|w|_{c}\}$ regularan?\\
\\ \textbf{Rje\v{s}enje: }
\\
Pretpostavimo da je jezik $L$ regularan. Klasa regularnih jezika je
zatvorena za presjek pa je regularan i jezik $L \cap b^{*}c^{*} = \{
b^{5k}c^{3k}\ \mid\ k\in \mathbb{N}\}$. Ozna\v{c}imo $L_{1} = L \cap
b^{*}c^{*}$.\\ \v{Z}elimo opovrgnuti regularnost jezika $L_{1}$,
odnosno da vrijedi Lema o pumpanju. Dakle, tvrdimo da $\exists p\in
\mathbb{N}$ takav da $\forall w\in L_{1},\ |w|>p,\ w = xyz$ pri
\v{c}emu vrijedi $\forall i > 0,\ xy^{i}z\in L_{1};\ |y|>0;\
|xy|<p$.\\ Uzmimo $w = b^{5p}c^{3p}\in L_{1}$, $w = \underbrace{b
... b}_{5p}\underbrace{c ... c}_{3p}$.\\ O\v{c}ito je $|w| = 5p + 3p
> p$, a jer je $|xy|<p$ to se $y$ dio koji pumpamo mo\v{z}e nalaziti na
samo jednoj poziciji u rije\v{c}i $w$:   $\underbrace{b ...
b}_{x}\underbrace{... bb}_{y}\underbrace{bc ... c}_{z}$\\  No sada
\'{c}e se pumpanjem y dijela poremetiti odnos b-ova i c-ova u
rije\v{c}i, dakle izlazimo iz jezika $L_{1}$, odnosno Lema o
pumpanju ne vrijedi i jezik nije regularan.
\\ \\ \\ \\
\zad{2}Nad abecedom $X = \{a,b,c\}$ konstruirati PDA koji prepoznaje
jezik $L = \{w\in X^{*}\ \mid\ |w|_{a}=|w|_{b}+|w|_{c}\}$.
\\
\\ \textbf{Rje\v{s}enje: } \\
\begin{minipage}[t]{.45\textwidth}
  \begin{align*}
    & \langle p,\ a,\ S,\ p,\ aS\rangle \\
    & \langle p,\ a,\ a,\ p,\ aa\rangle \\
    & \langle p,\ b,\ a,\ q,\ \varepsilon\rangle \\
    & \langle p,\ c,\ a,\ q,\ \varepsilon\rangle \\
    & \langle q,\ b,\ a,\ q,\ \varepsilon\rangle \\
    & \langle q,\ c,\ a,\ q,\ \varepsilon\rangle \\
    & \langle q,\ a,\ a,\ p,\ aa\rangle \\
    & \langle q,\ a,\ S,\ p,\ aS\rangle \\
    & \langle q,\ b,\ S,\ t,\ bS\rangle \\
    & \langle q,\ c,\ S,\ t,\ bS\rangle
  \end{align*}
\end{minipage}
\begin{minipage}[t]{.45\textwidth}
  \begin{align*}
    & \langle p,\ b,\ S,\ t,\ bS\rangle \\
    & \langle p,\ c,\ S,\ t,\ bS\rangle \\
    & \langle t,\ b,\ b,\ t,\ bb\rangle \\
    & \langle t,\ c,\ b,\ t,\ bb\rangle \\
    & \langle t,\ a,\ b,\ w,\ \varepsilon\rangle \\
    & \langle w,\ a,\ b,\ w,\ \varepsilon\rangle \\
    & \langle w,\ b,\ b,\ t,\ bb\rangle \\
    & \langle w,\ c,\ b,\ t,\ bb\rangle \\
    & \langle w,\ b,\ S,\ t,\ bS\rangle \\
    & \langle w,\ c,\ S,\ t,\ bS\rangle \\
    & \langle w,\ a,\ S,\ p,\ aS\rangle
  \end{align*}
\end{minipage}
\hfill \\
\\
\\
\zad{3}Konstruirati TS koji prepoznaje jezik\\ $L =
\{a^{n+2}b^{m+1}\ |\ n\geq 0,\ m\geq 0\}$.
\\
\\ \textbf{Rje\v{s}enje: }
\\
$(q_{0}, a, q_{1}, a, D)\\ (q_{1}, a, q_{2}, a, D)\\ (q_{2}, a,
q_{2}, a, D)\\ (q_{2}, b, q_{3}, b, D)\\ (q_{3}, b, q_{3}, b, D)\\
(q_{0}, b, q_{NE}, b, S)\\ (q_{0}, \ , q_{NE}, \ , S)\\
(q_{1}, b, q_{NE}, b, S)\\ (q_{1}, \ , q_{NE}, \ , S)\\ (q_{2}, \ ,
q_{NE}, \ , S)\\ (q_{3}, a, q_{NE}, a, S)\\ (q_{3}, \ , q_{DA}, \ ,
S)$

\end{document}

