coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Samuel Gruetter <gruetter AT mit.edu>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Operations on boolean vector : shift / mask
- Date: Sat, 3 Mar 2018 20:33:01 +0000
- Accept-language: en-US
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gruetter AT mit.edu; spf=Pass smtp.mailfrom=gruetter AT mit.edu; spf=None smtp.helo=postmaster AT dmz-mailsec-scanner-4.mit.edu
- Ironport-phdr: 9a23:0PrYUBbrudu6k0fAY1SheGH/LSx+4OfEezUN459isYplN5qZr86+bnLW6fgltlLVR4KTs6sC17KN9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCazbL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjA57m/Zl9BwgqxYrhKvpRN/wpLbbo6aO/dlYqPSZskXSXZdUspNVSFMBJ63YYsVD+oGOOZVt5TzqEELrRujGwasAP7kxD5Shn/rw6I6z/ghHh/c3Ac9GN8Ov27UrMjrO6cOTeC60rPIwC7Gb/NXxTfx8pbHfQ08ofyVW797bMTfyU4qFwzfj1WQr5ToPzKT1uQXsmiU9fBsVey1i2I/pAFxoySvxscxiobSnI4a1lfE9SB/zY0oJtO4UFZ2bcOnHZdKsyyWLZV6T8M4T211uCs20r8LtYOhcCQUxpkqyQTTZ+GHfoWJ+B7vSvqdLSlgiH54eb+ygwy+/Vagx+DzTMW4zUxGojdGn9TDsH0Gygbd5dKdSvRn+0eswTaP2B7X6uFDOU07iK/bKp84zr41jJUTsEDDHjTol0rqlaOWbVkr9fKu6+ThfLrmvIaQOoBuhgH7M6QuhtazDvolPQgTR2Sb+OK826P//UDhXblHjec6n63DvJzEJckXvLO1Dg9N3oYm8Rm/DjOm0NoCnXkAKVJIYB2Hj5L0O17QPPD4Eemwg063nTduxvDGIqftDYvQIXjeiLvhZ6py61ZAyAovytBS/45bCrYYIP7qRkDxsMHYAQQiPgyvw+fnDc192ZkEVWKOBK+ZKqLSvkWS6uIhOenfLLMS7Xz2LOFg7Przh1c4n0UcdO+nx9FfPHu/B7FtJ1iTSXvqmNYIV2kQ6FkQVuvv3WaLVCNeYz6dRb8x+i02EsryAp3eS5yxjaap2SanWJBaezYVWRi3DX70etDcCL83YyWIL5o5y21WZf2aU4YkkCqWmkr/wrtjIPDT/3xKsJP/ktV5+r+KzE1gxXlPF82Yllq1YSRshGpZFTo3wOZyrVEvkg7eg5g9uORREJlo390MUgo+MsWFneB/GZX3UwPFZdqCDU2tS9OgDCt0EpQ0wsNIbkpgSY2v
Hi,
The theorem
> append (n & MASK27) (n >> 27) == n
looks similar to one we have in our bitvector library [1]:
> Theorem combine_split : forall sz1 sz2 (w : word (sz1 + sz2)),
> combine (split1 sz1 sz2 w) (split2 sz1 sz2 w) = w.
"combine" is "append", and "split1"/"split2" take the lower and
upper bits of a bit vector, respectively.
But before you start using it I'd like to warn you about the dependent
types, they're not easy to use and require a lot of eq_rect stuff.
Maybe you'll be better off just using Z.
Best,
Sam
[1] https://github.com/mit-plv/bbv/blob/4dcd180f06/Word.v#L587
On Fri, 2018-03-02 at 13:18 +0100, Vincent Siles wrote:
> Hi !
>
> Yes, I remember that `rev (rev v) = v` is kind of a Kraken for dependent
> types :)
> I already had a look at the CompCert library, but I won't be able to use
> for my current project because of the license.
> Thank you for the last link, I'll have a look !
>
> Best,
> V.
>
> 2018-03-02 9:01 GMT+01:00 Pierre-Evariste Dagand
> <pedagand AT gmail.com>:
> > Hi Vincent,
> >
> > > From the library [1], I see that I can use 'trunc' to implement my
> > 'mask'
> > > operation, but I don't see anything I could use to implement 'right
> > shift'.
> > > [...]
> > > [1] https://coq.inria.fr/library/Coq.Vectors.VectorDef.html#
> >
> > AFAIK, Coq.Vectors is a proof-of-concept but it is not actually
> > "usable" in today's Coq. Emilio has this "do or dare" game where he
> > asks you to prove that "rev (rev v) = v", which often results in
> > someone badmouthing dependent types.
> >
> > For a usable model of bitvectors, there is the tried-and-trusted
> >
> > https://github.com/AbsInt/CompCert/blob/master/lib/Integers.v
> >
> > and some more experimental/unfinished business:
> >
> > https://github.com/ejgallego/ssrbit/
> >
> >
> > Hope this helps,
> >
> > --
> > Pierre
>
>
- Re: [Coq-Club] Operations on boolean vector : shift / mask, Pierre-Evariste Dagand, 03/02/2018
- Re: [Coq-Club] Operations on boolean vector : shift / mask, Vincent Siles, 03/02/2018
- Re: [Coq-Club] Operations on boolean vector : shift / mask, Frédéric Blanqui, 03/02/2018
- Re: [Coq-Club] Operations on boolean vector : shift / mask, Samuel Gruetter, 03/03/2018
- Re: [Coq-Club] Operations on boolean vector : shift / mask, Vincent Siles, 03/02/2018
Archive powered by MHonArc 2.6.18.