Re: [Cbor] Bignums and the generic data models (Re: πŸ”” WGLC on draft-ietf-cbor-7049bis-09)

Carsten Bormann <cabo@tzi.org> Wed, 15 January 2020 20:52 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 8E42912089C; Wed, 15 Jan 2020 12:52:28 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Level:
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NeiT00IIcF4X; Wed, 15 Jan 2020 12:52:26 -0800 (PST)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A7CCD120288; Wed, 15 Jan 2020 12:52:25 -0800 (PST)
Received: from [192.168.217.119] (p548DC4D8.dip0.t-ipconnect.de [84.141.196.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 47yfdz6RgDz16GD; Wed, 15 Jan 2020 21:52:23 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <CANh-dXnfhoDO_Q9X+B73EtsHH89MjayeturjNOiBkKFaLL3NiQ@mail.gmail.com>
Date: Wed, 15 Jan 2020 21:52:23 +0100
Cc: "draft-ietf-cbor-7049bis@ietf.org" <draft-ietf-cbor-7049bis@ietf.org>, Francesca Palombini <francesca.palombini=40ericsson.com@dmarc.ietf.org>, "cbor-chairs@ietf.org" <cbor-chairs@ietf.org>, "cbor@ietf.org" <cbor@ietf.org>
X-Mao-Original-Outgoing-Id: 600814343.394309-e50ceaa1fa82d116aea0b3e59f6beb4f
Content-Transfer-Encoding: quoted-printable
Message-Id: <5A7E7B96-6F5D-479C-8660-D144A25AA882@tzi.org>
References: <293AFF31-D0EF-45D6-9B9D-E8136481C404@ericsson.com> <CANh-dXnPRd7w_z2LA0gYD0GHVbmych4BGA5_-vmJz+Zn1qBh_w@mail.gmail.com> <A4756143-2E47-474C-8EBD-0632DD3B659D@tzi.org> <CANh-dXnfhoDO_Q9X+B73EtsHH89MjayeturjNOiBkKFaLL3NiQ@mail.gmail.com>
To: Jeffrey Yasskin <jyasskin@chromium.org>
X-Mailer: Apple Mail (2.3608.40.2.2.4)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/C67N_HWOeiMYPWg2TcYqi-8VLxY>
Subject: Re: [Cbor] Bignums and the generic data models (Re: πŸ”” WGLC on draft-ietf-cbor-7049bis-09)
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 15 Jan 2020 20:52:29 -0000

> 
> I think either of the following situations would be plausible:
> 
> 1. 2(h'12') is a different value from major-type-0 "18", in the same
> way major-type-0 18 is a different value from floating "18.0".
> 2. 2(h'12') is the same value as major-type-0 "18", but both are
> distinct from floating "18.0".

(1) would then extend to numbers bigger than can be represented in basic integers?
I don’t think the simple fact that the range of an integer exceeds the 64-bit + sign (β€œ65-bit”) range of basic CBOR integers should catapult it into a different universe.  Once 128-bit numbers are becoming more common, that would create an ugly discontinuity.  So I strongly believe that only (2) is compatible with long-term stability of the format.

> (It would also have been plausible to declare that integral 18 is the
> same value as floating 18.0, but we discussed that a while ago and
> decided to keep them separate.)

Indeed.  We kept this somewhat open in RFC 7049, but experience seems to indicate that separating the integer world from the floating point world is the right thing at least for the generic data models (application data models can unite them).

> I don't think the wording in
> https://cbor-wg.github.io/CBORbis/draft-ietf-cbor-7049bis.html#extended-generic-data-models
> nails down whether tags can offer alternate representations for
> elements of the basic generic data model.
> 
> It's true that a tag can define a non-injective mapping into its
> domain, but I don't think that by itself requires that its domain be
> able to overlap the domain of the basic generic data model.
> 
> The extended generic data model *does* specify that particular tag
> values in the basic generic data model are equal to other values in
> the extended generic data model, but in that case the identified
> values have the same encoding, so I don't think it helps much in
> deciding whether they can be equal to a value in the basic generic
> data model.
> 
> My preference is to follow the decision we made to distinguish
> integers from floating point, and also distinguish bignums from
> primitives.

(I’d say: Yes, no β€” See above.)

> However, if we decide not to do that, we need to remove
> the sentence in
> https://cbor-wg.github.io/CBORbis/draft-ietf-cbor-7049bis.html#bignums
> saying "In the generic data model, bignum values are not equal to
> integers from the basic data model" and the sentence in
> https://cbor-wg.github.io/CBORbis/draft-ietf-cbor-7049bis.html#fractions
> saying "As with bignums, values of different types are not equal in
> the generic data model."

Yes, that is work that needs to be done.   Now #164: https://github.com/cbor-wg/CBORbis/issues/164

(Peter Occil has another interesting observation about fractions in https://github.com/cbor-wg/CBORbis/issues/160#issuecomment-574787487 β€” this probably requires more text about deterministic encoding for these, as well.)

Grüße, Carsten