Based on the recursion-schemes package for Haskell. See also: leanprover-community/mathlib4#282
Given a recursive inductive datatype,
I think that I can get quite far by asking for the following:
- Given an inductive datatype
Twith a constructor𝑐and arg𝑎 : α, deriveT.𝑐.𝑎? : T → Option αT.𝑐.𝑎! [Inhabited α] : T → αT.𝑎? : T → Option αmaps each constructor with arg𝑎to this.T.𝑎! : T → αT.PosT.children : T → List TT.traverseChildrenT.Base : Type → Typeis the base functor type such thatT = Fix T.BaseT.Free : Type → TypeT.Cofree : Type → TypeT.Zipper