Note that the Coq standard library Z is a binary representation of integers and Z.testbit gives access to the infinite twos-compliment representation. Of course, it makes use of case-distinctions on sign to define it, but you go bit-by-bit; if the number is negative, you just invert the bit before returning it. Is there something you're after by having the representation not encode sign bits separately? On Thu, Mar 4, 2021, 21:27 Michael Shulman wrote: > On Thu, Mar 4, 2021 at 3:16 PM Nicolai Kraus > wrote: > > I'm not sure what the precise thing is that you're looking for because, > without further specification, any standard definition of Z would qualify > :-) > > Yes, that seems to be what Martin suggested too with ℕ + ℕ. It seemed > to me as though the distance between ℕ + ℕ and my ℤ is greater than > the distance between his 𝔹 and 𝔹', but maybe not in any important > way. > > > The HIT is neat, but wouldn't it in practice behave pretty similar to a > standard representation via binary lists? E.g. something like Unit + Bool * > List(Bool), where inl(*) is zero, the first Bool is the sign, and you add a > 1 in front of the list in order to get a positive integer. What's the > advantage of the HIT - maybe one can avoid case distinctions? > > Is there a non-HIT binary representation that can be interpreted as > two's-complement (thereby avoiding case distinctions on sign)? I > haven't been able to figure out a way to do that with mere lists of > booleans. > > -- > You received this message because you are subscribed to the Google Groups > "Homotopy Type Theory" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to HomotopyTypeTheory+unsubscribe@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/HomotopyTypeTheory/CAOvivQwtAMVnOG7D_A_s1EMAum4fv_x945MLB%2B01Y_pMdEKC2w%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "Homotopy Type Theory" group. To unsubscribe from this group and stop receiving emails from it, send an email to HomotopyTypeTheory+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/HomotopyTypeTheory/CAKObCaqiyUcB%2BFrbvPmR-eS5ZMsb2CTVCtVbAYZeMUcOzCpmbA%40mail.gmail.com.