--------------------------------------------------------------------------------
-- T_Fibonacci.tex
--
-- This is the Fibonacci example from the paper.
--
--------------------------------------------------------------------------------

\begin{circus}
    \circchannel out: \nat
\end{circus}  

\begin{circus}
    \circprocess\ Fibonacci \defs \circbegin
\end{circus}

    \begin{circus}
    \circstate
    \end{circus}

	\begin{schema}{FibState}
            x, y: \nat
	\end{schema}

        \begin{circus}
        InitFibState \defs x := 1; y := 1
        \end{circus}

        \begin{circus}
        InitFib \defs out!1 \then out!1 \then InitFibState
        \end{circus}

        \begin{circus}
        OutFibState \defs \circvar temp: \nat @ (temp := y; y := x + y; x := temp)
        \end{circus}

        \begin{circus}
        OutFib \defs \circmu X @ out!(x + y) \then OutFibState; X
        \end{circus}

\begin{circus}
    @ InitFib; OutFib
    \circend
\end{circus}
