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

--ADAPTADO AO LATEX DO NOVO PARSER (1.5.0)!!!

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

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

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

	\begin{circusaction}
    \circstate\ FibState ~~==~~ [~ x, y: \nat ~]
    \end{circusaction}

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

        \begin{circusaction}
        InitFibState \circdef x := 1 \circseq y := 1
        \end{circusaction}

        \begin{circusaction}
        InitFib \circdef out!1 \then out!1 \then InitFibState
        \end{circusaction}

        \begin{circusaction}
        OutFibState \circdef \circvar temp: \nat \circspot (temp := y \circseq
        y := x + y \circseq x := temp)
        \end{circusaction}

        \begin{circusaction}
        OutFib \circdef \circmu X \circspot out!(x + y) \then OutFibState \circseq X
        \end{circusaction}

\begin{circusaction}
    \circspot InitFib \circseq OutFib
\end{circusaction}

\begin{circus}
    \circend
\end{circus}
