Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[basic.type.qualifier] The ordering defined on cv-qualifiers is not a partial ordering #4908

Closed
real-guanyuming-he opened this issue Sep 15, 2021 · 5 comments

Comments

@real-guanyuming-he
Copy link

The fourth paragraph in [basic.type.qualifier] says that

There is a partial ordering on cv-qualifiers, so that a type can be
said to be \defn{more cv-qualified} than another.
\tref{basic.type.qualifier.rel} shows the relations that
constitute this ordering.

However, the ordering defined in table basic.type.qualifier.rel is not a partial ordering, since that there exists two cv-qualifiers (namely, const and volatile) for which the ordering is not defined.

I guess it intends to mean that the ordering is partially defined on the cv-qualifiers. But the term partially ordering is not defined this way. The definition of a partially ordered set requires that the ordering is defined on every two elements of the set (i.e. the ordering relation is either true or false between any two elements).

I don't know if this issue seems to be overcorrect... I noticed the phrase "partial ordering" because I recently learned concepts about ordered sets. I apologize if the issue is really overcorrect.

@tkoeppe
Copy link
Contributor

tkoeppe commented Sep 15, 2021

I don't think the problem as you stated is correct.

The definition of a partially ordered set requires that the ordering is defined on every two elements of the set (i.e. the ordering relation is either true or false between any two elements).

This is not true. A partial order need not be defined on every pair of elements. The partial order axioms only apply to those orderings that are defined. For example, "if a < b and b < c, then a < c" -- but it is not required that a and b are comparable to begin with. See also https://en.wikipedia.org/wiki/Partially_ordered_set. (Consider the canonical example of the "subset" relation on the elements of the power set of any given set.)

@tkoeppe tkoeppe closed this as completed Sep 15, 2021
@real-guanyuming-he
Copy link
Author

Hello tkoeppe,
The requirement for the ordering to be either true or false comes from that it is a relation (the Wikipedia page also mentions it).

A relation R over a set S may be defined as a subset of S × S, and therefore must be either true or false for any two elements in S, because the statement (x,y) ∈ R is either true or false.

@tkoeppe
Copy link
Contributor

tkoeppe commented Sep 16, 2021

I'm not sure if there is a contradiction here. As you say, R is a subset (and usually a strict one!) of S × S, so some elements may be related, but others may not. X is more cv-qualfied than Y if (X, Y) is a relation, otherwise it is not so. The table you quote describes precisely that set R of relations, everything not in the table is not a relation.

@real-guanyuming-he
Copy link
Author

real-guanyuming-he commented Sep 16, 2021

Hello tkoeppe,
Suppose we have <, determined by a set R ⊆ S × S as a relation over S, then

  1. (x, y) ∈ R means that x < y is true, and
  2. (x, y) ∉ R means that x < y is false

Nevertheless, you remind me of that we may treat all relations not defined on the table as if they are false (e.g. const < volatile is not defined on the table, so const < volatile is false). And this is a valid interpretation.

Anyway, thank you for your review. :)

@tkoeppe
Copy link
Contributor

tkoeppe commented Sep 16, 2021

Yes, and again I don't think there's any problem or contradiction here. For example, you may say "const < volatile is false", if you like, that's accurate, and consistent with what we say in the standard (where "<" means "more cv-qualified"), or in other words, "it is not the case that const is more cv-qualified than volatile".

Your original complaint that an ordering is not defined for all pairs is merely a restatement of the observation that there exist x, y such that (x, y) ∉ R. Or in yet other words, in order to state a partial order, it suffices to state R, and it is not necessary to also state the complement of R.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants