Skip to content
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

Basic EquationalRealms #2532

Merged
merged 31 commits into from
Jun 8, 2021
Merged

Basic EquationalRealms #2532

merged 31 commits into from
Jun 8, 2021

Conversation

balacij
Copy link
Collaborator

@balacij balacij commented May 27, 2021

Contributes to #2440
Closes #2436

@balacij balacij marked this pull request as ready for review May 28, 2021 17:39
@JacquesCarette
Copy link
Owner

I'm going to review this "later", as it will need quite a bit of effort.

Copy link
Owner

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much more a "design review" than 'request changes'.

instance HasUID GenDefn where uid = lensMk uid uid uid
instance NamedIdea GenDefn where term = lensMk term term term
instance Idea GenDefn where getA = getA . (^. mk)
instance Definition GenDefn where defn = lensMk defn undefined defn
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should never be any undefined in any of the accessors. This is a symptom that something is wrong with the design.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree! The undefineds are definitely very odd.

Additionally, while working on it, I really wanted to take the lensMk, elimMk, and setMk's 3 function parameters (acting on RelationConcepts, QuantityDicts, and QDefinitions) and merge them into 1 param using typeclasses, but I couldn't get a sufficient "common denominator" between the various models.

The "definition" of an EquationalRealm is interesting. I think we want it be undefined until the EquationalRealm is observed and converted into an EquationalModel using a specific RealmVariant with the attached QuantityDict.

code/drasil-theory/Theory/Drasil/ModelKinds.hs Outdated Show resolved Hide resolved
code/drasil-theory/Theory/Drasil/ModelKinds.hs Outdated Show resolved Hide resolved
code/drasil-theory/Theory/Drasil/ModelKinds.hs Outdated Show resolved Hide resolved

-- | Retrieve internal data from QDefinitions/RelationConcepts
elimMk :: Getter QDefinition a -> Getter QuantityDict a -> Getter RelationConcept a -> ModelKinds -> a
elimMk l _ _ (EquationalModel q) = q ^. l
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what this elimMk seems to say is that a "better" representation for a ModelKind would be a product of a QDefinition and "the rest of the information", labelled with the kind of model. So EquationalModel would have no payload, only EquationalRealm would.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we be able to form a QDefinition for an EquationalRealm if we want EquationalRealms to represent "more than one way to define a quantity"? I think the "right-hand side" of the QDefinition would be ambiguous for an EquationalRealm, unless we wanted to have the Realm's QDefinition be of the form x $= y $= z $= ....

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, the 'right hand side' will not make sense. 'a' right hand side will. I think a QDefinition needs to be precise. So indeed, there would be no such Getter. I consider that to be a good thing, as it will force us to be precise about what we mean. It would be interesting to see who uses this getter. Maybe it should return an NonEmpty ?

@balacij balacij marked this pull request as draft June 4, 2021 18:21
@balacij balacij marked this pull request as ready for review June 4, 2021 20:24
@balacij balacij marked this pull request as draft June 8, 2021 00:19
@balacij balacij marked this pull request as ready for review June 8, 2021 03:08
@JacquesCarette JacquesCarette merged commit ddd205c into master Jun 8, 2021
@JacquesCarette JacquesCarette deleted the equationalRealmMK branch June 8, 2021 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Converting "Newton's law of universal gravitation" Theory Model
2 participants