[eeps] Proposal for /\ and \/ operators

Alceste Scalas <>
Thu Feb 26 14:59:53 CET 2009


Il giorno gio, 26/02/2009 alle 10.35 +0100, Raimo Niskanen ha scritto:
> Can you explain to a non-mathematician (me) why you have defined
> (E1 /\ E2) as min(E1, E2) and
> (E1 \/ E2) as max(E1, E2).

You could think about sets, and see the proposed operators as:

        /\ = ∩ = ∩ (HTML) = \cap (LaTeX)  (set intersection)
        \/ = ∪ = ∪ (HTML) = \cup (LaTeX)  (set union)

An thus, given two sets A and B, and assuming that one of them contains
the other:

        A /\ B is equivalent to the minimum set
        A \/ B is equivalent to the maximum set

The same concept can be extended to numbers: if you assume that each
integer represents a set with the same number of elements, and that
greater sets always contain all the smaller ones (and thus, 42 contains
41,40,39...), you obtain the meaning of /\ and \/ for integers.

The same abstraction "works" intuitively on floats [1].

The fact that /\ and \/ are also standard boolean operators is not a
mere coincidence: just take example above, and assume that A and B may
have only two possible values: {1} (set with element "1") and ∅ (emtpy
set).  If you consider {1} as boolean "true", and ∅ as boolean "false",
you've obtained the standard /\ (AND) and \/ (OR) behaviour.

I think that the proposed operators may be very useful.  The only thing
that bothers me is that they are not as powerful as the original
operators on lattices: /\ and \/ are only supposed to work on linear
orders (in fact, in the examples above, I had to use sets that contain
each other --- while ∩ and ∪ are defined for any set).  In other words,
their notation may be "too powerful" (and possibly unclear, as we've
seen) for most people in the most common use cases, and "too
restrictive" for the others (they cannot be used on "real" lattices,
like lists used as sets).  In other words: I would suggest another
notation, but I don't know which one :-)


> Since (1.0 == 1) and (1.0 >= 1) and (1 >= 1.0),
> could you also for /\ and \/ elaborate on
> 	max(A, B) when A >= B -> A;
> 	max(A, B) -> B.
> vs
> 	max(A, B) when A > B -> A;
> 	max(A, B) -> B.
> Which may be most useful in the light of operator
> precedence and binding?

Well, since 1.0 == 1, I think that both options are correct, as long as
you choose one and only one (and remain coherent with it).  In order to
avoid confusion, /\ and \/ could be documented to work as + and -: they
may cast their operands to a "larger" set (and thus, cast integers to
floats), and return a value from that set.

Regards,

alceste

Notes:

  [1] Yes, I know, real numbers are not enumerable.

-- 
Alceste Scalas <>
CRS4 - http://www.crs4.it/




More information about the eeps mailing list