sodium icon indicating copy to clipboard operation
sodium copied to clipboard

Clarification of Continuous Time

Open dakom opened this issue 6 years ago • 6 comments

I was chatting with @paldepind, who's also developing a Typescript FRP framework (https://github.com/funkia/hareactive) and he had some questions about the Semantics

I hope I get this right (if not feel free to correct), but I believe his concern was that a Cell does not allow continuous time since C a = (a, [(T, a)]) is discrete.

Might be helpful for everyone researching this space to have some clarification of this - how do we see from the semantics that a Cell is indeed continuous?

dakom avatar May 28 '18 14:05 dakom

The cell for current time (called sys.time) is C T = (T0, [(T, T)]) where T is an element of the infinite set [T0...]. Its value is continuous in that for any T >= T0, it has a value T. The continuousness is simulated on a discrete machine by means of making it so you can sample it at any time and get a value. It's akin to describing something using vector graphics. In order to actually see the image, it has to be rasterized, and that's how a finite machine can simulate an infinite variance over space. We do the same thing, except with time instead of space.

Using map, lift and snapshot, you can easily construct a new cell that is a function of time and it will have the same conceptual continuousness.

To make it a true behavior in the FRP sense, Operational.updates() and Operational.value() have to be illegal.

the-real-blackh avatar May 29 '18 00:05 the-real-blackh

The C# 2.0 implementation (which I believe has been ported to some other languages now) has both the Behavior and Cell types. Behavior can be continuous as it does not have the Updates or Values methods. Cell is by definition a discrete Behavior.

jam40jeff avatar May 29 '18 00:05 jam40jeff

Thanks!

@the-real-blackh - it seems to me that your point about C T is made in the doc itself, is that right? e.g.

We can derive Conal's B a from C a with an at function...

I'm also wondering if the implementation choice of splitting Behavior and Cell should be mentioned in the semantics itself? E.g. there's more than only Cell, and Stream- there's also Behavior?

dakom avatar May 29 '18 04:05 dakom

Yes, it should be mentioned in the semantics. I'll do it all when I can find the time.

the-real-blackh avatar May 29 '18 05:05 the-real-blackh

@the-real-blackh

Its value is continuous in that for any T >= T0, it has a value T.

That is not what I understand as being continuous. From Wikipedia:

In mathematics, a continuous function is a function for which sufficiently small changes in the input result in arbitrarily small changes in the output.

In other words, a continuous function changes infinitely often. Consider the following two functions.

Both of these have a value for any T, but only the function on the right is continuous.

To make it a true behavior in the FRP sense, Operational.updates() and Operational.value() have to be illegal.

Not necessarily. Hareactive supports updates (with the name changes) on its behaviors even though they can be continuous. The only caveat is that calling changes on a behavior that changes infinitely often will give a run-time error.

paldepind avatar May 29 '18 07:05 paldepind

Both of these have a value for any T, but only the function on the right is continuous.

As my teenage daughter would say, OH MY GOD!!!! You're right. I didn't state my assumption that T was continuous.

Hareactive supports updates (with the name changes) on its behaviors even though they can be continuous.

That's possibly reasonable, although isn't one of the reasons for having a Behaviour type so that these things come up as compile-time errors?

the-real-blackh avatar May 29 '18 08:05 the-real-blackh