Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Vector in Coq [Was: Re: Trouble with dependent induction]

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Vector in Coq [Was: Re: Trouble with dependent induction]


Chronological Thread 
  • From: Xavier Leroy <Xavier.Leroy AT inria.fr>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Vector in Coq [Was: Re: Trouble with dependent induction]
  • Date: Sun, 17 Dec 2017 18:21:33 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=xavier.leroy AT gmail.com; spf=Pass smtp.mailfrom=xavier.leroy AT gmail.com; spf=None smtp.helo=postmaster AT mail-wr0-f171.google.com
  • Ironport-phdr: 9a23:NtLPwRFcIMEMaFb1gCCA3J1GYnF86YWxBRYc798ds5kLTJ78o8ywAkXT6L1XgUPTWs2DsrQY07OQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmCexbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KNyUk/m/JhMx+jKFVrhyvqBNwwYHbfI6bOeFifq7eZ94WWXZNU8hTWiFHH4iyb5EPD+0EPetArobyvUUOrRqgCgm2GejhzCFHhmXx3aw6zu8sFgDJ0xY+H9IPrnvUts/5OqEMXuCvy6nJzS7Ob/JQ2Tfn6YjHaAotof+WXb9pd8fa1EohFxvdg1mOtYDoOymZ2+cNvmSB8uZsS+Gih3Q6pwxzvzSj3sQhhpfTio4LxF3J9z91zYQoKdGiVUJ2ZcOoHZ1NvC+ALYR2WNktQ2RwtSY61LIGvZm7cTAPyJs9xh7fb+WLcoaS4h7/TeqRLyp0iXB4dL6liBay9k+gyuL4VsaqylpFsi1FktzUunAM0Rzc9NSHR+Nj8ku93TuDzQPe5+FeLUwpi6bWKIQtzqMym5YOqUjDGzX5mETyjK+YbEUk/e2o5vzoY7r8uJ+cNpF7ihvkPqQqhMO/G+M4MwgVUmiU/OSzzrzj/UnjTLpWif02l7HVsIrGKsQDuq65HwhV354/5Ba4FjeqycgXnX0aLF1eYx+HlIjoO1TWIP/iF/u/glKskC1qx//cJLHhDI/NfTD/l+Lqeq844EpBwiIyy8pe7tRaEOIvOvX2D3/4qt3VFFcdPhaz0q6zONxj144EH0aCGKiIGKLUq16BoOw1dbrfLLQJsSrwfqB2r8XlimU0zAcQ

On 12/17/2017 05:21 PM, Emilio Jesús Gallego Arias wrote:
>> What should then the proper alternative recommended alternative for
>> sized lists in the standard library?
> I meant:
> What should then the proper recommended alternative be?
> [In particular in the context of Coq's standard library]

I find the following definition of vectors a lot easier to work with than the
one that is currently in the standard library:

Fixpoint vec (A: Type) (n: nat) : Type :=
match n with
| O => unit
| S m => (A * vec A m)%type
end.

With this definition and the "convoy pattern" from CPDT you're in control!

Rooby Findler asks:

> Isn't that the first example in (essentially) every paper? Won't
> newcomers assume it is a good starting point to just play around?

"call/cc" is the first example in many papers about control operators, yet it
is not a good starting point for Scheme newcomers to just play around with
the language...

If you just want to get things done in Coq, I agree with Adam that the "vec"
type is best avoided, and if you really need to use it you should use the
definition above and not the one from the standard library. This points to a
problem with the standard library that should be fixed like Emilio proposes.

If you want to study GADTs, of course the inductive definition of "vec A n"
will be one of your first examples. But let's not put that in the face of
newcomers.

- Xavier Leroy



Archive powered by MHonArc 2.6.18.

Top of Page