Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] A fast "eq" predicate for Gallina?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] A fast "eq" predicate for Gallina?


Chronological Thread 
  • From: "jonikelee AT gmail.com" <jonikelee AT gmail.com>
  • To: Pierre-Marie Pédrot <pierre-marie.pedrot AT inria.fr>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] A fast "eq" predicate for Gallina?
  • Date: Wed, 20 Jan 2021 16:17:43 -0500
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk1-f169.google.com
  • Ironport-phdr: 9a23:ZM0/rxEQrKA6FscgwK/5dp1GYnF86YWxBRYc798ds5kLTJ76p8u7bnLW6fgltlLVR4KTs6sC17OH9fm6EjVZuN7B6ClELMUTEUddyI0/pE8JOIa9E0r1LfrnPWQRPf9pcxtbxUy9KlVfA83kZlff8TWY5D8WHQjjZ0IufrymUoHdgN6q2O+s5pbdfxtHhCanYbN1MR66sRjdutMZjId/Lqs90AbFrmVHd+hL2G9kOE+YkxLg6sut5pJu/DlctvA7+8JcTan2erkzQKBFAjghL207/tDguwPZTQuI6HscU2EWnQRNDgPY8hz0XYr/vzXjuOZl1yaUIcP5TbYvWTS/9KhrUwPniD0GNzEi7m7ajNF7gb9BrxKgoxx/xJPUYJ2QOfFjcK7RYc8WSGxcVctKSSdPHp2zYJcOD+oZPOZXsY/9p0cVrRCjAQWgHf7jxiNUinPz26AxzuYvHhzc3AE4EdwAsGraosj2OqgQX+C7y6bHwinMYf5NxTf98ZLFfgw7rP2QX799d9fax0k1FwPCi1WdsYLpPzGS1uQLsmib7PRvVeaxhGE5sAxxrT2vyd0tionNnI4a1lfE9SB3zI0oItC4Skl7YdilEJtTqS6aM5V5Td05TmFnvSY10LwGuZqhcCcWz5QnwgfSZvqaeIeH/hztTvyeIStkhH17YrK/gQ6//FS+xuD+WcS5zlRHoytLnNfMqn0A1xje59aGR/Zj40qs2SqD2x3S5+1aP005iLTWJpE9zrMumJQerUfOEyv2lUjwkaSYdV0k9/C25+j7ZrjqvJyROo9uhg3gLKgihNazDfk5PwUKR2SX5+Wx2KH+8UD8XblHiuE5n6zWvZ3bOcgXuqu0DxJJ3oYt7huyATSr38kXkHQCLV9KYxyHj4bsNlHAPv/3Ee2wjlGtnTh32vzLPrvsCYjXIHfZirfuZ7N95lZcyAUtydBf4IpZCrQbL/LyXk/9rcXYDhwkPwCtzebrFdRw24cEVWKABa+ZN6zSsVuW6e41P+aMY4oVtC78K/gj+fHukWc0lUEBcaStx5caa3C1Eu54L0mHf3bgmMoNHGYOswYmSezlklyCUTpdZ3aoWKI84yk2CIChDYfFR4Ctg6KO3COlEZJIfW1GBVWMHm3pd4WAQfsDdCWSIsp5njweSbehU5Mh1Q2ptALi07poMPfb+jcftZL/z9V05uzTlRQp+jxuFcuRyWCNT2dunmMJXTA6xq5/oVZlwFeZzad4m+BYFcBU5/5RTgg6Mofcw/VmBND2RwLOZcyESE2mQ9WjGTE+VMg9w94IY0ZnGtWtlArP3ySwA+xdq7vePJ056LjRml34Pcdwg05H2LMmkxFyWspCL3erw6t27QneQZbEn1+ei46rc74d1WjD7jHQ43CJuRQSUgl2UKbIWX0STkTTpNX9oEjFSvXmXbYgNApCxMqPJ4NFb9ToiRNNQ/K1a4eWWH64h2rlXUXA/biLdoe/PjxFhHyBWnhBqBga+DO9DSZ7Hj2o+juMAzlnFFapaETpo7En+SGLC3QsxgTPVHVPkr+8+xobn/uZEqpB0bcNuSNnoDJxTg/kgoDmTuGYrg8kR51yJNMw5FAdizDcvg15e4WjduVs3wBPNQtwuEzq2lN8DYASycU=

It occurs to me that I don't really need "eq x y = true -> x = y", but
instead can get by with "eq x y = false -> x <> y" (another good reason
not to be classical!), because the vast majority of the comparisons I'd
be doing will end up being false. And I can get that with UIDs, or even
just mostly-unqiue IDs. I would then embed such a UID in each
structure I need to compare quickly.

That should be somewhat attainable once Ltac2 has a more complete set
of mutable structure capabilities - so that an Ltac2 function can create
such an almost-UID. That would at least allow me to generate UIDs at
type checking time, which again might be sufficient for my purposes,
although barely.

Of course, it would be even better if Gallina had an opaque type to use
for these UIDs that implemented a very fast equality check - but
integers would work for now. And even better still if Gallina could
generate such UIDs itself without violating the logic.

On Wed, 20 Jan 2021 21:22:38 +0100
Pierre-Marie Pédrot <pierre-marie.pedrot AT inria.fr> wrote:

> On 20/01/2021 21:17, jonikelee AT gmail.com wrote:
> > I am working on some Coq reflection procedures and trying to stay
> > within Gallina as much as possible.
>
> Why don't you implement your own heap inside Coq then, using some form
> of state monad? It's going to be overly cumbersome but at least you'd
> get pointer equality from first principles.
>
> PMP
>




Archive powered by MHonArc 2.6.19+.

Top of Page