coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: "Igor Zhirkov" <igorjirkov AT gmail.com>
- To: "" <coq-club AT inria.fr>
- Subject: [Coq-Club] Mu combinator
- Date: Wed, 30 Mar 2016 16:46:57 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=igorjirkov AT gmail.com; spf=Pass smtp.mailfrom=igorjirkov AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm0-f49.google.com
- Ironport-phdr: 9a23:Wg8D6B/ByeUa/v9uRHKM819IXTAuvvDOBiVQ1KB91+kcTK2v8tzYMVDF4r011RmSDdWdsaIP1LSempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+lSsiI34/oiaibwN76XUZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwu3cYh/V0vYQIBa79ZuEzSaFSJDUgKWE8osPx40rtVwyKszE9XWIM2ihIAhLG6w+wFsPwvSzgtOtn2y6EFcLzRLEwHz+l6vE4G1fTlC4bOmthoynsgctqgfcDrQ==
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.
BR
Igor
- [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.