Discussion of Homotopy Type Theory and Univalent Foundations
 help / color / mirror / Atom feed
From: Jason Gross <jasongross9@gmail.com>
To: Michael Shulman <shulman@sandiego.edu>
Cc: Nicolai Kraus <nicolai.kraus@gmail.com>,
	 "HomotopyTypeTheory@googlegroups.com"
	<homotopytypetheory@googlegroups.com>
Subject: Re: [HoTT] two's complement integers
Date: Thu, 4 Mar 2021 22:02:18 -0500
Message-ID: <CAKObCaqiyUcB+FrbvPmR-eS5ZMsb2CTVCtVbAYZeMUcOzCpmbA@mail.gmail.com> (raw)
In-Reply-To: <CAOvivQwtAMVnOG7D_A_s1EMAum4fv_x945MLB+01Y_pMdEKC2w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2429 bytes --]

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 <shulman@sandiego.edu> wrote:

> On Thu, Mar 4, 2021 at 3:16 PM Nicolai Kraus <nicolai.kraus@gmail.com>
> 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.

[-- Attachment #2: Type: text/html, Size: 3413 bytes --]

  reply	other threads:[~2021-03-05  3:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 20:43 Michael Shulman
2021-03-04 21:11 ` Martin Escardo
2021-03-04 22:05   ` Michael Shulman
2021-03-04 22:42     ` Martin Escardo
2021-03-04 23:16     ` Nicolai Kraus
2021-03-05  2:27       ` Michael Shulman
2021-03-05  3:02         ` Jason Gross [this message]
2021-03-05  4:41           ` Michael Shulman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKObCaqiyUcB+FrbvPmR-eS5ZMsb2CTVCtVbAYZeMUcOzCpmbA@mail.gmail.com \
    --to=jasongross9@gmail.com \
    --cc=homotopytypetheory@googlegroups.com \
    --cc=nicolai.kraus@gmail.com \
    --cc=shulman@sandiego.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Discussion of Homotopy Type Theory and Univalent Foundations

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/hott

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 hott hott/ https://inbox.vuxu.org/hott \
		homotopytypetheory@googlegroups.com
	public-inbox-index hott

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.hott


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git