From: "Adam Beneschan" <adam@irvine.com>
Subject: Re: Equivalent keys/elements in Ada.Containers Maps and Sets
Date: 24 Jan 2007 12:56:03 -0800
Date: 2007-01-24T12:56:03-08:00 [thread overview]
Message-ID: <1169672163.617949.214430@13g2000cwe.googlegroups.com> (raw)
In-Reply-To: <z4ednRU4OZTJNivYnZ2dnUVZ_uOmnZ2d@megapath.net>
On Jan 23, 4:43 pm, "Randy Brukardt" <r...@rrsoftware.com> wrote:
> > This function "<" is a strict ordering relation for T, as required for
> > Ada.Containers.Ordered_Maps/Sets. But the "equivalence" relation induced
> > by this "<" is not transitive: X and Y are "equivalent" (both X < Y and
> > Y < X are False) and Y and Z are "equivalent" (both Y < Z and Z < Y are
> > False) but X and Z are not "equivalent" (because X < Z is True).
> I don't believe this function meets the requirements. It has to be the case
> that the function is reversible (we can't know the order of the operands)
> and it can't be the case that
> neither (X < Z) nor (Z < X) nor (X = Z) (where "=" means equivalent).
>
> One of these three things has to hold, or the function is not acceptable.
This doesn't make sense to me. "Equivalent" is defined in terms of "<"
(A.18.9(78/2)), and it's defined in such a way that
neither (X < Z) nor (Z < X) nor (X === Z)
[using === for "equivalent"] will tautologically be true. Thus, it's
logically impossible to come up with a function "<" that is
"unacceptable" according to the last criterion you state.
As far as I can tell from the wording of the RM (A.18.9(79/2)), the
function "<" that Niklas wrote does indeed meet the requirements: it's
irreflexive (A < A is false for all A), asymmetric (A < B and B < A are
not both true, for all A and B), and transitive (A < B and B < C
implies A < C, for all A, B, and C---because, in this case, there are
no such A, B, and C for which the first two relations hold). If there
is some other requirement that "<" should meet but doesn't, then that
requirement is missing from the RM.
-- Adam
next prev parent reply other threads:[~2007-01-24 20:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-23 12:56 Equivalent keys/elements in Ada.Containers Maps and Sets Niklas Holsti
2007-01-23 15:45 ` Matthew Heaney
2007-01-23 16:47 ` Matthew Heaney
2007-01-23 23:04 ` Niklas Holsti
2007-01-24 0:43 ` Randy Brukardt
2007-01-24 7:52 ` Niklas Holsti
2007-01-24 21:06 ` Randy Brukardt
2007-01-24 16:50 ` Matthew Heaney
2007-01-24 21:18 ` Randy Brukardt
2007-01-24 21:27 ` Adam Beneschan
2007-01-24 22:50 ` Matthew Heaney
2007-01-25 2:22 ` Adam Beneschan
2007-01-26 0:08 ` Georg Bauhaus
2007-01-24 20:56 ` Adam Beneschan [this message]
2007-01-24 20:57 ` Adam Beneschan
2007-01-24 22:56 ` Matthew Heaney
2007-01-25 0:44 ` Randy Brukardt
2007-01-24 16:11 ` Matthew Heaney
2007-01-24 18:12 ` Niklas Holsti
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox