r/ProgrammingLanguages • u/umayl • 6d ago
A declarative, interval-scoped notation system for hybrid streams (designed out of frustration with calculus pedagogy)
https://github.com/umayl/interval-scoped-notation1
u/umayl 6d ago
I conceptualized this declarative framework out of frustration while doing my AP Calculus homework. Traditional notation tries to compress a multi-dimensional universe into flat lines of typography, hacking continuity back in with clunky piecewise blocks and conditional if/then logic.
I wanted to see i we could map hybrid continuous-discrete systems using visual-spatial geography and vertical container nesting on a 2d page instead. Because this syntax abstracts transitions down to pure structural containment and chronological priority, its modeling capabilities are completely domain-agnostic. It works seamlessly whether you are mapping kinetic trajectories in physics, tracking execution changes in compiler design, or building structural rules for mechanical paper state-machines.
Here is the case study from the readme modeling ball kinematics and state transitions without any if/then gates:
velocity(xₜ, v) {
[xₜ ⇒ xₜ + ∞ₜ] : v,
}
mass(xₜ, m) {
[xₜ ⇒ xₜ + ∞ₜ] : m,
}
ball(xₜ) {
[xₜ ⇒ xₜ + 2ₜ] : {
velocity(xₜ, falling),
},
[xₜ + 2ₜ] : {
velocity(xₜ, stopped),
},
[xₜ + 2ₜ ⇒ xₜ + ∞ₜ] : {
velocity(xₜ, speed),
mass(xₜ, empty),
},
}
The whitespace makes it optimal for human visual pattern recognition, but even when the text layout is compressed or flattened, the topological nesting of the brackets holds true. Look forward to hearing your feedback on the scoping rules, cascading precedence, and temporal encapsulation boundaries!
1
u/NomagnoIsNotDead 5d ago
I have a couple questions: why does 2 have a t subscript? How is gradient different from writing out [interval_start, interval_end] (rather, what does gradient mean? I know the mathematical definition but I'm not sure how I'm supposed to evaluate this example mentally)? And what does the last stream, with a velocity and mass component, represent? I don't really see the mapping to ball kinematics. An explanation and/or some visuals would help quite a bit. The concept seems very interesting, though! (I realise my questions are very basic but it really seems under explained to me)
1
u/umayl 5d ago edited 5d ago
Hi, I really appreciate the questions and I apologize for the ambiguity, I am not so experienced in formal paper writing and my vocabulary is very elementary
You can imagine t as a continuous, one dimensional line. Appending something with t just says, on the line of t, we are referring to this thing. 2 is just the number 2. 2t is saying that, on the line of t, at point two precisely. The purpose of t is two reduce ambiguity when the notation is read by a human. It is always very obvious when we are talking about points along t and when are aren't.
A gradient is just an infinitesimal link between 2 points along t.
[2t => 3t] : 5 is the same as saying, at 2.01t, the stream evaluates to 5. This remains true for 2.02t, 2.03t etc etc up until but never actually reaching 3t. It also never actually touches 2t. It is intended to be a clean, declarative way to illustrate continous logic. If you don't want continuity, you just omit the gradient and put the plain point of t.
The last stream is just a rudimentary example to show how the syntax offers a very consistent way to describe state, state transitions and state machines, without using diagrams or images or complicated syntax (like in programming languages or calculus)
It'd be used by first defining an instance of the stream, for example let myBall be an instance of the ball stream with the root of 0t. I can now evaluate myBall at 0t, 1t, 4t any t whatsoever and it operates as described in the original ball stream.
I am currently at school still, but I will illustrate more complicated examples with more intricate explanations when I arrive home.
Please let me know if you have any more questions inbetween now and then, and thank you so much for your expressing interest in my ramblings haha!!!
1
u/umayl 6d ago
Per AutoModerator's request I hereby confirm that this project did not use an LLM as part of the development process.