Code and proofs adapted for Idris 0.9.15.1