-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling theories that define vectors #2587
Comments
@balacij you don't need to worry about breaking the code generated for SSP, since we don't currently generate code for SSP. 😄 The reason we don't generate code is because Drasil doesn't currently understand the indexes. @JacquesCarette will have more meaningful insight that me, but my thinking is that we want to teach Drasil about sequence datatypes. I believe all of the indexed variables in SSP are sequences of reals (floats). For SSP I don't think we need to understand what vector means; I think we have the simpler case of Drasil understanding what sequence means. |
@smiths is correct that the most fundamental thing that's wrong is that Drasil has no notion of sequence, nor of indexing. We can do vectors "barely". The first phase of the fix is to figure out "indexable types" and indexing (there are some issues open about that). These are basically a special case of functions, where the index set is discrete instead of continuous. That will get rid of some of the hard-coding of "i", but only part. The second phase is to figure out "functional definitions". We have a bunch of hacks wrt that in our examples, as a bunch of definitions are actually functions (of time), but this is elided. That too should be fixed. This should finish dealing with the hard-coding of "i". The third phase will then involve models, where we will have to decide what differences we want to make. Is discrete indexing so different than continuous arguments so as to make a big difference? Personally, I don't think so. |
Hmm, ok, this sounds like a good plan. I'll leave this ticket open and look to complete tickets related to the first and second phase first. Thank you! |
Those all seem 'related', yes. But it's also likely that most will need specific fixes - though the split of |
In SSP, we have many models that describe elements of indexable things as being defined as some expression (which may depend on some other indexable things). For example,
and
Additionally, as of right now, we define related variables & unitals as:
Drasil/code/drasil-example/Drasil/SSP/Unitals.hs
Lines 269 to 281 in 88f8b44
However, I think this view of the variables is a bit problematic because it hardcodes the
i
(which becomes problematic when we embed expressions in each other), does not couple the elements to their carrier (it looks like they are different references entirely), and puts no restrictions oni
. I think we will need some sort of meta-ModelKind that takes in another ModelKind and "gives" it a variable for using internally. As a starting point, let's consider<ModelName> (<variable Expr> -> ModelKind) (<variable Expr> -> ConstraintSet)
, where theConstraintSet
is meant to constrain the input variable, and the internalModelKind
is the real model we're interested in. I think with this model, we would be able to define indexable Equational Models, Realms, and Constraints. For the Models and Realms, we would need to require that the quantity they define is an indexed variable -- this is to avoid situations such asforall i. X := S_i
(this is more like a constraint that saysforall i. X $= S_i
instead).There are models that currently conflict with this requirement, such as:
I think we can either convert them into these new meta-models as well, or we can remove them entirely and replace them with theoretical variants and create another new "StackedModel" that allows us to stack models over each other for wherever they appear in computations (similar to Haskell's
do
notation) -- "StackedModel" probably isn't the best name however.Note: this model definitely has logistical issues and will surely cause issues for code generation, but we will need some sort of model to replace the OthModels in SSP's GDs.
Is there any thoughts on what kind of a model we should build for this? I want to say that it's strictly for "universal quantification over indexable things" but it can definitely be related to many other kinds of models.
The text was updated successfully, but these errors were encountered: