coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gregory Malecha <gmalecha AT cs.harvard.edu>
- To: Coq Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Mu combinator
- Date: Wed, 30 Mar 2016 19:12:47 -0700
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gmalecha AT cs.harvard.edu; spf=None smtp.mailfrom=gmalecha AT cs.harvard.edu; spf=None smtp.helo=postmaster AT mail.eecs.harvard.edu
- Ironport-phdr: 9a23:nMIzhhcYjau+OwZHsuo338ALlGMj4u6mDksu8pMizoh2WeGdxc69YR7h7PlgxGXEQZ/co6odzbGG4+a6CCddvd6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDivceCKFgUzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IeezAcq85Vb1VCig9eyBwvZWz9EqLcQzazXwFGk4SjxAAVwPC9VTxWor7mir8rOt0nieAa57YV7cxDBu44qhsUg6grS4DOjU5+SmDhcl5iK9QoBuJrAc5w4fOfoiPOLxzcr6LLoBSfnZIQssED38JOYi7dYZaSrNZZes=
The solutions pointed out by others are great. There is another one that that I wrote about on my blog a little while ago where you approximate Mu using fixpoints.
The basic idea is to index Mu by a natural number that unfolds F some number of times, i.e.
Variable F : Type -> Type.
Fixpoint Mu (n : nat) :=
match n with
| 0 => Empty_set
| S n => F (Mu n)
end.
The blog post shows some examples for writing eliminators and such for types like this.
On Wed, Mar 30, 2016 at 7:46 AM, Igor Zhirkov <igorjirkov AT gmail.com> wrote:
Hello,I wonder whether it is possible to define the Mu combinator in Coq in a general way.In Haskell it can be defined like that:>>>newtype Fix f = Fx (f (Fix f ) )<<<Or like that (using records syntax):>>>newtype Mu f = In {out :: f (Mu f)}<<<When translated directly into Coq it fails with "Non strictly positive occurrence of Mu":>>>Inductive Mu f := MIn {MOut: f ( Mu f) }.<<<Maybe I need to throw in some axioms to work around the termination issues?It seems, however, that for an arbitrary recursive type one can always write a definition that corresponds to the Mu application to the corresponding functor:>>>Inductive exprf a :=| add : a -> a -> exprf a| lit: nat -> exprf a.Inductive expr := In { Out: exprf expr }.<<<While doing a little research I have only stepped on the work of Arthur Chargueraud (A Practical Fixed Point Combinator for Type Theory), but it does not seem to me that it is relevant.What I am trying to achieve is the separation of the recursion schema and the computable part (algebra) for catamorphisms and anamorphisms.BRIgor
gregory malecha
- [Coq-Club] Mu combinator, Igor Zhirkov, 03/30/2016
- Re: [Coq-Club] Mu combinator, Thorsten Altenkirch, 03/30/2016
- Re: [Coq-Club] Mu combinator, John Wiegley, 03/30/2016
- Re: [Coq-Club] Mu combinator, Thorsten Altenkirch, 03/30/2016
- Re: [Coq-Club] Mu combinator, John Wiegley, 03/30/2016
- Re: [Coq-Club] Mu combinator, Thorsten Altenkirch, 03/30/2016
- Re: [Coq-Club] Mu combinator, Gregory Malecha, 03/31/2016
Archive powered by MHonArc 2.6.18.