bbv icon indicating copy to clipboard operation
bbv copied to clipboard

bulky representation of concrete words

Open aa755 opened this issue 7 years ago • 2 comments

Because of indices (which nest), every concrete 64 bit word has 2080 S constructors, even though it has only 64 WS constructors. Should we opt for a less intrinisically dependently typed variant like Word s := {n:N | log n< s}?

Fixpoint sumFirstN (n : nat) : nat :=
match n with
| O => O
| S n => (S n) + (sumFirstN n)
end.

Eval compute in (sumFirstN 64)

aa755 avatar Sep 20 '18 15:09 aa755

I'm in favor of this. See the discussion in #21

gmalecha avatar Sep 20 '18 16:09 gmalecha

I already did this for riscv-coq, see here.

I use the following representation:

  Record word_record{sz: Z} := Build_word {
    word_val: Z;
    word_mod: word_val mod 2 ^ sz = word_val
  }.

It seems to work well in the sense that I use it everywhere in riscv-coq and in bedrock2, without any problems.

If you want to use that too, we should incorporate this into bbv, PRs welcome :wink:

samuelgruetter avatar Sep 20 '18 17:09 samuelgruetter