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

Trivial migrations in the frontend and core #391

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kris-brown
Copy link
Collaborator

@kris-brown kris-brown commented Feb 7, 2025

This PR partially addresses #375 for the special case of literal inclusions (rather than monomorphisms) generally. There are two (noninteracting) components: in the core, there is a method which swaps the theory pointer for a model. In the frontend, there is an attribute inclusions for each Theory which is a list of string ids for which one is licensed to change the theory to (even if formal content has been added). These are hardcoded in theories.tsx.

A future PR will add to this hardcoded data to allow special privileged monomorphisms (for example: the names change from Olog to Schema so we cannot handle this trivial migration yet).

Right now, the theory "group" (e.g. "Knowledge and Data") is still present even if there are no available theories within that group. Unsure if that is a problem.

Changing the theory is in general an irreversible and mutating operation. Some sugar could be added in the future to combine the theory change with a duplication of the model.

Copy link

github-actions bot commented Feb 7, 2025

@epatters epatters added enhancement New feature or request frontend TypeScript frontend and Rust-wasm integrations core Rust core for categorical logic and general computation labels Feb 7, 2025
Copy link
Member

@epatters epatters left a comment

Choose a reason for hiding this comment

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

Thanks Kris! I was going to make a few line-level comments, but then I realized there is a design issue that we haven't fully discussed but I think should be addressed before proceeding further.

Currently, the situation is that you can't push forward models except in the most trivial case, namely from the initial theory to another theory. However, provided you don't have any formal cells in the notebook, you're free to keep the changing the theory, even after choosing a non-initial theory. A mathematical gloss on this intuitively correct behavior is that as long as you have no formal content, starting from any theory, you can pull back to the initial theory then pushforward to any other theory without loss of data.

With this PR, once you change to a theory, you can never undo that. You can only keep changing to bigger theories. As you say in your description, "changing the theory is in general an irreversible and mutating operation." This is quite punishing to the user: if they make a wrong click, they can never get back to the previous state. The aim, I think, should be make these migrations as fluid as possible.

I can imagine some possible strategies to address this problem and I'm sure you can too. Let's discuss more in person.

@kris-brown
Copy link
Collaborator Author

This PR does recover the old behavior (as long as there are only informal cells, then you can switch between any theories reversibly). It's only when you have formal content that changing theory is irreversible. Still, I agree that if one is only using formal cells from a simpler theory that it should be possible to move from more complex to the simpler theory, so happy to talk about ways of doing that!

@epatters
Copy link
Member

epatters commented Feb 7, 2025

Oh good, I missed that. Thanks for clarifying. But yes, still worth talking more.

@KevinDCarlson
Copy link
Collaborator

I suppose we should just ask for both deltas and sigmas along inclusions, yes? That’ll make the menu design a bit trickier as you need both ancestors and descendants available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Rust core for categorical logic and general computation enhancement New feature or request frontend TypeScript frontend and Rust-wasm integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants