I'm trying to re-implement some Agda code of mine in Coq. My problem is that one of my Agda functions is defined by recursion on the structure of an inductive predicate.
In my Coq code, I'm trying to follow the same style but there's a pattern matching restriction that does not allow to analyse the structure of a value with type in Prop to produce a result in Set. My question is: Is there a way to define functions by recursion on proofs while producing results in Set (like sumbool)?
The code that contains all definitions to reproduce the error is at the following gist.