coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gregory Malecha <gmalecha AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Subject: [Coq-Club] New Co-inductive Restrictions
- Date: Mon, 12 Nov 2018 14:45:02 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gmalecha AT gmail.com; spf=Pass smtp.mailfrom=gmalecha AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm1-f48.google.com
- Ironport-phdr: 9a23:Rg81jRAWxbvzBZNlIuVlUyQJP3N1i/DPJgcQr6AfoPdwSPv8r8bcNUDSrc9gkEXOFd2Cra4c1KyO6+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglUhjexe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfOpWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnMVhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Qiqp4bt1RxD0iScHLz85/3/Risxsl6JQvRatqwViz4LIfI2ZMfxzdb7fc9wHX2pMRsleWSxPDI2/coUBEfYOMP1CoIXhvVYDtweyCRWuCe7p1zRGhmX23ao/0+k5EA/GxhIvH90JsHTOrNT+KaAcXvqxzKbW0TrDb+lZ0ir65YjHdxAuu/WMUqxsfsrR00YiDAzFjlCKpozkOzOZzPgCs2+e7+d5U++klmApqwZ0oje1x8csjJHEho0UylDY9SV53Z06KcekR058ZN6pFoZbuSKCN4ZuXM8uX2VltDw5x7AGo5K3YTYGxZc9yxPQaPGKdZWD7Aj5W+aLOzh4gWpoeLKhiBa29kit0uj8WdO10FZOtyZEnNzMum0U2xzd5cWKSeFx/kim2TaI2ADT7v9LLVoomqrcLp4t2r8wlpwNvkTfBiL6hln6gauMekgn+uWk8fnrbqvlq5OGOIJ5iRnyMqE0lcy+BeQ4PBIOX2+e+emk273j+Ff2QLFUgfIqkqnWqovXJcsepqGjAg9V1pwv5Aq4DzejyNgYh2UILEpZeBKbiIjkI03BIPfhDfumn1uslCpryOvdM736ApTNK2DDn637cbZ87U5c0gszwspF65JaELFSaM70D2T2rZTzCgIze1i/xP+iA9Fg3KsfX3iOC+mXKvWBn0WP47cAOeSDY5UE8BP0L/Uu5/em2XA8kFsQdqmg9ZQSYXG8WP9hJhPKMjLXnt4dHDJS7UIFR+vwhQjHCGYLPifgb+cH/jg+TbmeI8LGT4GpjqaG2X7iTJJTb2FCTFuLFCWxLtnWa7I3cCuXZ/RZvHkcT7H4Et0u0BivsEnxzL81drOJqB1djorq0Z1O38OWlRw28mYpXcGU0mXIUGQt221UF3k526dwpUE7wVCGg/B1
Hello --
I wanted to ask about the new restrictions on co-inductives. I am trying to update the interaction trees repository to work with the new restrictions and I think I've done it correctly, but it seemed a little bit more verbose than I was anticipating and so I'm wondering if there is a better way to do it.
The full pull request is here: https://github.com/DeepSpec/InteractionTrees/pull/26
Essentially the type that was
CoInductive itree (e : Type -> Type) (t : Type) : Type :=
| Ret (_ : t)
| Vis {u} (_ : e t) (_ : u -> itree e t)
| Tau (_ : itree e t).
Has become
Inductive itreeF (itree : Type) (e : Type -> Type) (t : Type) : Type :=
| RetF (_ : t)
| VisF {u} (_ : e t) (_ : u -> itree)
| Tau (_ : itree).
CoInductive itree (e : Type -> Type) (t : Type) : Type :=
{ observe : itreeF (itree e t) e t }.
This makes a lot of sense, the relations work similarly, but the tend to be a bit more verbose. Essentially, they all get wrapped in something that looks like:
Inductive EqF (r : relation (itree e t)) : itreeF (itree e t) e t -> itreeF (itree e t) -> Prop :=
| eq_ret {x} : EqF r (RetF x) (RetF x)
| eq_vis {u} {y : e u} k1 k2}
(_ : forall x : u, r (k1 x) (k2 x))
: EqF r (VisF y k1) (VisF y k2)
| eq_tau {it1 it2}
(_ : r it1 it2)
: EqF r (TauF it1) (TauF it2)
CoInductive Eq (a b : itree e t) : Prop :=
{ observe_eq : EqF a.(observe) b.(observe) }.
Originally, I tried to write this without the observe in the type of Eq (i.e. eq_ret would have type "forall x, EqF r {| observe := RetF x |} {| observe := RetF x |}"), but this doesn't seem to work because the constructors of this form are not helpful unless you can destruct a co-inductive which is the problem being addressed by the new restriction.
So, back to the original question, is there a better (more convenient) way to represent this type?
Thanks for any feedback.
- [Coq-Club] New Co-inductive Restrictions, Gregory Malecha, 11/12/2018
Archive powered by MHonArc 2.6.18.