I tried to simulate a less naive monadic non-determinant coding (less naive than MonadPlus and general lists) in Coq, which is often used in Haskell; for example, the encoding for lists looks like
data List ma = Nil | Cons (ma) (m (List ma))
whereas the corresponding definition in Coq would be as follows:
Inductive List (M: Type -> Type) (A: Type) := Nil: List MA | Cons : MA -> M (List MA) -> List M A.
However, such a definition is not allowed in Coq because of the “strictly positive” condition for inductive data types.
I'm not sure if I intend to get an answer to Coq or an alternative implementation in Haskell that I can formalize in Coq, but I am happy to read any suggestions on how to overcome this problem.
source share