comp.lang.ada
 help / color / mirror / Atom feed
* Fun: the Ada assignment operator is an alias of the equivalence operator
@ 2011-05-28  0:48 Yannick Duchêne (Hibou57)
  2011-05-28  7:25 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 6+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-05-28  0:48 UTC (permalink / raw)


Hello,

A very light topic: I've just discovered the Ada / Pascal assignment  
operator, is one of the alias of the logical-equivalence or defined-as  
operator, that is, “ := ” is an alias of “ ≡ ”. As was trying to makeup my  
mind about some ambiguities in the use which is made of “ ≡ ” when I  
landed to this Wikipedia page :
http://en.wikipedia.org/wiki/List_of_logic_symbols

This is a rather good choice which was made… would have been a perfect  
choice is this was not used for side effects (let say this is just the  
interpretation context which slightly vary :-D ).

-- 
“Syntactic sugar causes cancer of the semi-colons.”  [Epigrams on  
Programming — Alan J. — P. Yale University]
“Structured Programming supports the law of the excluded muddle.” [Idem]
“c++; /* this makes c bigger but returns the old value */” [Anonymous]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fun: the Ada assignment operator is an alias of the equivalence operator
  2011-05-28  0:48 Fun: the Ada assignment operator is an alias of the equivalence operator Yannick Duchêne (Hibou57)
@ 2011-05-28  7:25 ` Dmitry A. Kazakov
  2011-05-28  8:02   ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry A. Kazakov @ 2011-05-28  7:25 UTC (permalink / raw)


On Sat, 28 May 2011 02:48:29 +0200, Yannick Duchêne (Hibou57) wrote:

> A very light topic: I've just discovered the Ada / Pascal assignment  
> operator, is one of the alias of the logical-equivalence or defined-as  
> operator, that is, “ := ” is an alias of “ ≡ ”.

I didn't see that usage of ":=" ("Defined-as" is not same "equivalent").

For "defined-as" I saw "=" with a small triangle or word "def" under it. In
grammar definitions "::=" or "->".

≡ is indeed used as equivalent/tautological.

> This is a rather good choice which was made… would have been a perfect  
> choice is this was not used for side effects (let say this is just the  
> interpretation context which slightly vary :-D ).

Assignment is not a logical operation, variables are not logical
predicates. Even

   A := B;
   Post (A = B); -- Not necessarily true.

(A variable is a mapping of the program state onto the domain values set.
Assignment merely denotes a state transition.)

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fun: the Ada assignment operator is an alias of the equivalence operator
  2011-05-28  7:25 ` Dmitry A. Kazakov
@ 2011-05-28  8:02   ` Yannick Duchêne (Hibou57)
  2011-05-28  9:03     ` Dmitry A. Kazakov
  0 siblings, 1 reply; 6+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-05-28  8:02 UTC (permalink / raw)


Le Sat, 28 May 2011 09:25:40 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
> I didn't see that usage of ":=" ("Defined-as" is not same "equivalent").
>
> For "defined-as" I saw "=" with a small triangle or word "def" under it.
http://www.unicode.org/charts/PDF/U2200.pdf agree with you
Says
    225C ≜ DELTA EQUAL TO = equiangular = equal to by definition
    2261 ≡ IDENTICAL TO

(a bit ambiguous)

> Assignment is not a logical operation, variables are not logical
> predicates.
Nor "defined-as" is ;)

":=" would be OK for constant, makes Ada looks a bit more functional :p

-- 
“Syntactic sugar causes cancer of the semi-colons.”  [Epigrams on  
Programming — Alan J. — P. Yale University]
“Structured Programming supports the law of the excluded muddle.” [Idem]
“c++; /* this makes c bigger but returns the old value */” [Anonymous]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fun: the Ada assignment operator is an alias of the equivalence operator
  2011-05-28  8:02   ` Yannick Duchêne (Hibou57)
@ 2011-05-28  9:03     ` Dmitry A. Kazakov
  2011-05-28  9:19       ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry A. Kazakov @ 2011-05-28  9:03 UTC (permalink / raw)


On Sat, 28 May 2011 10:02:51 +0200, Yannick Duch�ne (Hibou57) wrote:

>> Assignment is not a logical operation, variables are not logical
>> predicates.
> Nor "defined-as" is ;)
> 
> ":=" would be OK for constant, makes Ada looks a bit more functional :p

I think it is a widely shared misconception that immutability has anything
to do with that. [Functional is not an answer, whatever the question was
(:-))]

No, even an initialized constant is not necessarily equivalent to its
initializing expression. Obvious examples:

   I : constant Integer := Get (File);
   X : constant Float := Random (Dice);
   T : constant Time := Clock;

Another point is that equivalence itself is an abstract operation with the
semantics undefined in general.

Mathematical equivalence = is not analogous to "=" operation defined on
objects. Rather it is:

1. Values equivalence (values do not belong to the program). I.e. you can
say that the value of the variable A is equivalent to the value of the
variable B. Which is unrelated [not required] to whether A=B yields True or
False.

2. Program equivalence. You can say that two programs are equivalent in
some [limited] sense, e.g. when the compiler optimizes the code, or when
you modify the program.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fun: the Ada assignment operator is an alias of the equivalence operator
  2011-05-28  9:03     ` Dmitry A. Kazakov
@ 2011-05-28  9:19       ` Yannick Duchêne (Hibou57)
  2011-05-28  9:58         ` Dmitry A. Kazakov
  0 siblings, 1 reply; 6+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-05-28  9:19 UTC (permalink / raw)


Le Sat, 28 May 2011 11:03:25 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
> I think it is a widely shared misconception that immutability has  
> anything
> to do with that. [Functional is not an answer, whatever the question was
> (:-))]
>
> No, even an initialized constant is not necessarily equivalent to its
> initializing expression. Obvious examples:
>
>    I : constant Integer := Get (File);
>    X : constant Float := Random (Dice);
>    T : constant Time := Clock;

Right Er Professor, sure ":=" does not introduce a macro :p So, what about  
“defined-as the realization-of” ?

> 2. Program equivalence. You can say that two programs are equivalent in
> some [limited] sense, e.g. when the compiler optimizes the code, or when
> you modify the program.
Equivalent by realization (modulus some canonicalization of the output) ?


-- 
“Syntactic sugar causes cancer of the semi-colons.”  [Epigrams on  
Programming — Alan J. — P. Yale University]
“Structured Programming supports the law of the excluded muddle.” [Idem]
“c++; /* this makes c bigger but returns the old value */” [Anonymous]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fun: the Ada assignment operator is an alias of the equivalence operator
  2011-05-28  9:19       ` Yannick Duchêne (Hibou57)
@ 2011-05-28  9:58         ` Dmitry A. Kazakov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry A. Kazakov @ 2011-05-28  9:58 UTC (permalink / raw)


On Sat, 28 May 2011 11:19:09 +0200, Yannick Duchêne (Hibou57) wrote:

> Le Sat, 28 May 2011 11:03:25 +0200, Dmitry A. Kazakov  
> <mailbox@dmitry-kazakov.de> a écrit:
>> I think it is a widely shared misconception that immutability has  
>> anything
>> to do with that. [Functional is not an answer, whatever the question was
>> (:-))]
>>
>> No, even an initialized constant is not necessarily equivalent to its
>> initializing expression. Obvious examples:
>>
>>    I : constant Integer := Get (File);
>>    X : constant Float := Random (Dice);
>>    T : constant Time := Clock;
> 
> Right Er Professor, sure ":=" does not introduce a macro :p

"Lazy" would be a better word than "macro".

> So, what about  
> “defined-as the realization-of” ?

Well, declaration of an immutable variable defines it in a scope. The point
is that realization, which looks like just another word for "value", cannot
define [immutable] variable. A variable can be defined *to have* some
value, but variable is not a value. Value is a "meaning" of a variable in
some context. In mathematics both sides of "defined-as" are same sort of
beasts.

BTW, just for fun:

   Huh : constant Boolean := Halt (P); -- Is Huh defined? (:-))

>> 2. Program equivalence. You can say that two programs are equivalent in
>> some [limited] sense, e.g. when the compiler optimizes the code, or when
>> you modify the program.
> Equivalent by realization (modulus some canonicalization of the output) ?

Indistinguishable by certain means, e.g. within some formal model, like
black box etc.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-05-28  9:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-28  0:48 Fun: the Ada assignment operator is an alias of the equivalence operator Yannick Duchêne (Hibou57)
2011-05-28  7:25 ` Dmitry A. Kazakov
2011-05-28  8:02   ` Yannick Duchêne (Hibou57)
2011-05-28  9:03     ` Dmitry A. Kazakov
2011-05-28  9:19       ` Yannick Duchêne (Hibou57)
2011-05-28  9:58         ` Dmitry A. Kazakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox