Ethereal-dev: Re: [Ethereal-dev] ip.addr != 1.2.3.4 should work as expected

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Mon, 09 May 2005 22:48:11 -0700
Gilbert Ramirez wrote:
So, maybe we need a different "==". One that means "there exists an x
that is equal to y", and one that means "all x's equal y". Trying to
borrow from logic, we could use "A" and "E":

A(ip.addr) == 1.2.3.4
E(ip.addr) == 1.2.3.4

Yup.

For *all* of the comparison operators, "F <op> V" is shorthand for

there exists, in the protocol tree, at least one field F for whose value F.v the proposition "F.v <op> V" is true.

This means that, for example "!(F <op> V)" means

there does not exist, in the protocol tree, any field F for whose value F.v the proposition "F.v <op> V" is true

which maps to

for all fields F in the protocol tree the proposition "F.v <not-op> V" is true

where

	op		not-op
	==		!=
	>		<=
	>=		<
	<		>=
	<=		<

(There aren't, as far as I know, not-ops for the "contains" or "matches" ops, so that last mapping doesn't exist.)

A consequence of this is that "!(F == V)" is not the same as "F != V", as the former is

	for all F, F.v != V

and the latter is

	there exists an F such that F.v != V

Some might wish "F != V" to mean "for all F, F.v != V" - but if we treat the "!=" operator specially, what do we do with ">", ">=", "<", and "<="? Or do we treat != as a special case?