2

Defining a new type foo gives me a recursion principle foo_rect, which elegantly abstracts over fix. Could a coinductive equivalent (abstracting over cofix) be defined by "flipping the arrows" somehow?

Anton Trunov
  • 15,074
  • 2
  • 23
  • 43
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
  • Giménez and Castéran [implement](http://www.labri.fr/perso/casteran/RecTutorial.pdf) "Park's Principle" in Coq, essentially a mirror image of the usual induction schema. It is also [discussed](http://adam.chlipala.net/cpdt/html/Coinductive.html) in Adam Chlipala's *Certified Programming with Dependent Types*, and Catalin Hritcu [published](https://hritcu.wordpress.com/2012/12/23/learning-teaching-coinduction-with-coq/) problem sets on the subject ([1](http://www.cis.upenn.edu/~bcpierce/courses/670Fall12/HW6.v), [2](http://www.cis.upenn.edu/~bcpierce/courses/670Fall12/HW67.v)). – Carl Patenaude Poulin Jul 09 '17 at 00:52

1 Answers1

2

This isn't possible due to the non-modular way that Coq checks the guardedness condition for cofixpoints. Fortunately, the Paco library solves this problem by doing exactly what you want as long as you phrase your definitions in a particular way.

There is a good tutorial for the Paco library here: http://plv.mpi-sws.org/paco/tutorial.html

Gregory
  • 1,205
  • 10
  • 17