group-telegram.com/doujinshi_ss/243
Last Update:
Okay, but what if there is actually no way to tell 1 and 2 apart? Then we would actually say that are observationally equivalent! Observational equivalence captures the idea of what it means for two things to be indistinguishable inside a programming language.
Now how does all of this relate to expressiveness? I'll return to the question: Is it possible to distinguish between 2 * 3 and 3 + 3?
My answer: It depends on the features of the language! It certainly is not possible in the language which only has basic arithmetic, functions and recursion.
Can you think of a feature we could add where it is possible to distinguish them?
Operator overloading! Say we have operator overloading and the ability to redefine existing function. If we overload * to do something weird, like return the first argument but we don't overload +. We can now distinguish between those two expressions!
By adding that feature, we broke an observational equivalence. The expressions 2 * 3 and 3 + 3 used to be observationally equivalent. Then we added operator overloading and now they are observationally distinct.
Now we need to address how to tell if a feature requires a "local" transformation vs "global" transformation :
If feature X can be implemented for language L as a local transformation to obtain the language L+X, then for any two expressions e1 and e2 that are observationally equivalent in L, it is also the case that they are observationally equivalent in L+X
This is saying that if feature X only required a local transformation to implement, then it did not "break" any observational equivalences. All of the observational equivalences from L are still true in L+X.
Note that this was not the case for operator overloading. Adding operator overloading did break some observational equivalences. On the other hand, when we added unary negation we did not break any observational equivalences.
Now we can say that when we add expressiveness to a language, we break some observational equivalences.
BY 同人誌 „state surfing“
Warning: Undefined variable $i in /var/www/group-telegram/post.php on line 260
Share with your friend now:
group-telegram.com/doujinshi_ss/243