## How to Compute Fibonacci Numbers?

Some inductive proofs and some light program derivation about Fibonacci numbers. If you think the fastest way to compute Fibonacci numbers is by a closed-form formula, you should read on!

Skip to content
## How to Compute Fibonacci Numbers?

## Adjoint Functors Induce Monads and Comonads

## Deriving Monadic Programs

## Handling local state with global state

## Calculating a backtracking algorithm: an exercise in monadic program derivation

## Equational reasoning for non-determinism monad: the case of Spark aggregation

## Functional pearl: folding polynomials of polynomials

## Type safe Redis queries — a case study of type-level programming in Haskell

## An executable sequential specification for Spark aggregation

Some inductive proofs and some light program derivation about Fibonacci numbers. If you think the fastest way to compute Fibonacci numbers is by a closed-form formula, you should read on!

It is folklore knowledge that a pair of adjoint functors induces a monad and a comonad. Due to my recent work, I had to load relevant information into my brain cache. However, it turned out to be hard for me to find all the pieces of information I need in one place. Therefore, I am going to summarise here what I know and need, hoping it will be helpful for someone like me.

I started to take an interest in reasoning and derivation of monadic programs around 2016-17. Several years having passed, I collaborated with many nice people, managed to get some results published, failed to publish some stuffs I personally like, and am still working on some interesting tiny problems. This post summaries what was done, and what remains to be done.

Koen Pauwels, Tom Schrijvers and Shin-Cheng Mu. In *Mathematics of Program Construction (MPC)*, Graham Hutton, editor, pp. 18-44. Springer, October 2019.

[PDF]

Shin-Cheng Mu. Tech. Report TR-IIS-19-003, Institute of Information Science, Academia Sinica, June 2019.

[PDF]

Shin-Cheng Mu. Tech. Report TR-IIS-19-002, Institute of Information Science, Academia Sinica, June 2019.

[PDF]

Chen-Mou Cheng, Ruey-Lin Hsu and Shin-Cheng Mu. In *Functional and Logic Programming (FLOPS)*, John Gallagher and Martin Sulzmann, editors, pp 68-83, 2018.

Ting-Yan Lai, Tyng-Ruey Chuang, and Shin-Cheng Mu. In *2nd Workshop on Type-Driven Development (TyDe)*, 2017.

[PDF]

Yu-Fang Chen, Chih-Duo Hong, Ondřej Lengál, Shin-Cheng Mu, Nishant Sinha, and Bow-Yaw Wang. *Networked Systems (NETYS)*, pp. 421-438. 2017.

[PDF|Code|Supplementary Proofs]