factorize some general theory here
redoing cleanly with prelude ... though need coq for some lemma ...