coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Merlin Göttlinger <megoettlinger AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Mutual Fixpoints into mutual inductive types
- Date: Mon, 08 Jan 2018 10:53:49 +0000
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=megoettlinger AT gmail.com; spf=Pass smtp.mailfrom=megoettlinger AT gmail.com; spf=None smtp.helo=postmaster AT mail-io0-f169.google.com
- Ironport-phdr: 9a23:SNJB+RV55CZbPKo0auNnmlZq7ubV8LGtZVwlr6E/grcLSJyIuqrYYxKAt8tkgFKBZ4jH8fUM07OQ7/i5HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba9vIBmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KptVRTmijoINyQh/W7YhMx/jqJVrhyiqRJi3YDbfJqYO+Bicq7HZ94WWXZNU8RXWidcAo28dYwPD+8ZMOhfsYb9vV8OrRq4BQa0Be33zCNIhmPy3a071eQhHh/J3BY9FN8JtXTbstr1NKAMXuCp0KnIyTTDb/VZ2Tjj8ojFaR8hofSWUrJxdcrd01UgFwTAjliJr4HuIj2b1uMIs2eB7upgU/qii2EmqwFtojiv29wjhpPViYISz1DJ8zhyzoUtJdCgVkJ3fdqpHIFTuiyaLYd6XN0uTm9ytCony7ALvZi2dzUQxps93R7QcfmHfpCI4h39UOaRJi91hHd/d7K+gxa+6EmgyurgWsWt3lZGsytIn93WunAC0BzT7ceHSv9j8Uu7xTmP0AXT5vlFIUAyi6XbN4YszqAsmpcXq0jOHS/7lF/ogKOIeEgo4PWk5uXjb7n+o5+TLY50igXwMqQ0ncy/BPw1Mg0QUGiU/uSzyqHj/VH9QLVLiP02nbfWsIrBKMQUo662GQ5V0oI55xmjCDem1cwUnWMbI1JdZBKHk4/pNknSL/D/FPezmkijkDN2x//dJbDhGZXMLn3bkLj7Z7p96khcyBAyzd9F/Z5UBKsBc7rPXRr6s8WdBRskOSS1xfzmAZNzzNAwQ2WKV4qUKqfTt2ineP4zJ+iKa4IP8GL4Jvci6uLyiX4/llIHVaas1JoTLnu/G6I1cA2ifXPwj4JZQi8xtQ0kQbmyhQ==
Hi,
Joachim Breitner <mail AT joachim-breitner.de> schrieb am Mo., 8. Jan. 2018 um 11:04 Uhr:
Hi,
Am Montag, den 08.01.2018, 08:23 +0000 schrieb Merlin Göttlinger:
> sure. My guess would be that I messed up the encoding of the
> hierarchy and the fmap call in the implementation of traverse is
> therefore not resolved to be be the Vector.map call.
> https://gist.github.com/mgttlinger/db35a3748f1dfe68c152678f9a714c06
ah, you are using features I have not played around with (e.g. :>, and
default definitions in a record).
I just tried implementing traverse like this:
Definition traverse `{T: Traversable} `{@Applicative G} {t u} : (t -> G u) -> F t -> G (F u) :=
let f := T _ (t_f__) in fun f ft => sequence (fmap f ft).
As to not rely on the default implementation in the record. That didn't change anything.
Implementing traverse at the instance creation also didn't help.
I suspect it could be because my implementation is defined interactively.
Definition vSequence {G} {n} `{Applicative G} : forall T, Vector.t (G T) n -> G (Vector.t T n).
intros. induction X; pose proof _f as f; pose proof _p as p. apply pure; trivial. apply (@point (fun f => Vector.t f 0) _ _). eapply ap. apply (fmap (fun a b => a :: b) h). exact IHX.
Defined.
This is the definition. The Instance is then essentially
Definition vTraversable {G} {n} : @Traversable__Dict (fun t => Vector.t t n) G := {| sequence__ _ := vSequence;
|}.
Global Instance vector_Traversable {n} {G} : @Traversable (fun t => Vector.t t n) G := fun r f => f vTraversable.
Does it work if you do not give the definition of traverse__ in the
Record definition, and instead give it during your Instance? Where is
your Instance?
> What is the "local go" pattern? A quick google lead me only to things
> related to Go-lang.
There might be a better name. It is the problem that nested recursion
through map defined like
Fixpoint map f xs := match xs with
| [] => []
| x :: ys => f x :: map f ys end.
fails but
Definition map f :=
fix go xs := match xs with
| [] => []
| x :: ys => f x :: go ys end.
works.
Good to know.
Cheers,
Merlin
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, (continued)
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Pierre Courtieu, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Pierre Courtieu, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/07/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/07/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/08/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/07/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Joachim Breitner, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Merlin Göttlinger, 01/05/2018
- Re: [Coq-Club] Mutual Fixpoints into mutual inductive types, Pierre Courtieu, 01/05/2018
Archive powered by MHonArc 2.6.18.