[eeps] Proposal for /\ and \/ operators
Richard O'Keefe
ok@REDACTED
Fri Feb 27 01:38:55 CET 2009
On 26 Feb 2009, at 10:35 pm, Raimo Niskanen wrote:
> 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).
Because those are the only standard mathematical signs
for the job and have been for at least fifty years.
> To me it seems counterintuitive
> since /\ looks like a mountain hence max
> and \/ looks like a valley hence min.
This is covered in another message.
Basically, you are reading them upside done.
The result is at the *top*.
> And I do not want to fully understand Lattice theory∩
You don't need to. You understand < without fully
understanding lattice theory; its logical and visual
relative /\ is no harder to understand.
Lattice theory is a generalisation of (parts of)
arithmetic, (parts of) Boolean algebra, and (parts of)
set theory. Any set can be considered as a lattice,
and
X \union Y = X \/ Y
X \inter Y = X /\ Y
I should have listed that as another analogy:
union and join are the same except for round vs pointy;
intersection and meet are the same except for round vs pointy.
>
> 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?
I can't make sense of that last sentence. The question
of which operand you get when the two compare equal has
nothing to do with operator precedence or binding; it's
just as much a problem for functional syntax, as you've
shown yourself.
Over the years I must have agonised over which way to
define max and min dozens of times. The one thing I've
always insisted on is that
X \/ Y ==> Y implies that X /\ Y ==> X
and conversely, so that [X,Y] => [X/\Y,X\/y] is a
permutation.
All that agonising was wasted. If you ever find yourself
caring whether X\/Y is X or Y when X == Y, you are doing
something wrong. You cannot expect /\ or \/ to make
distinctions that < and > do not make.
Prolog distinguishes between X < Y (numeric order) and
X @< Y (term order) precisely because identifying integers
and floats gets you into endless trouble.
I provided precise definitions which I think are workable.
By the way, I first met the /\ and \/ operators _as_
programming language operators in the PDP-11 UNIX V7
C compiler. I happily started using them and found a
useful improvement in the clarity of my code. I was
deeply unhappy when the VAX C compiler didn't support
them.
As for the person who found the standard symbols
"ugly and unintuitive", I just mentioned this to a
colleague who fell about laughing at the idea.
More information about the eeps
mailing list