Skip to content

Equations between morphisms in notebook types#1060

Merged
epatters merged 5 commits intomainfrom
equations_in_notebook_types
Mar 16, 2026
Merged

Equations between morphisms in notebook types#1060
epatters merged 5 commits intomainfrom
equations_in_notebook_types

Conversation

@KevinDCarlson
Copy link
Copy Markdown
Collaborator

@KevinDCarlson KevinDCarlson commented Feb 18, 2026

Ahead of notebook elaboration of equations, this PR introduces equations into the notebook_types modules model, model_judgment, diagram_judgment, thus necessitating an upgrade of notebook types to v2. Other than the modules already listed, the main change of interest is in document, which includes code for migrating v1 to v2 documents. The only actual modification this migration requires is changing the version number, but there's some slightly wordy unpacking and repacking seemingly necessary since we have to reconstruct ModelJudgment and DiagramJudgment types for the new version.

It's probably possible to argue for not bothering with upgrading DiagramJudgment at this time, since we have no type theoretic treatment of diagrams yet, but I figured it's a minor enough change which we may want before long and versioning notebook_types is a bit fiddly. Some more specific comments are attached in the diff.

Comment thread packages/catlog/src/tt/notebook_elab.rs Outdated
Comment thread packages/notebook-types/src/bin/migrate_examples.rs Outdated
Comment thread packages/notebook-types/src/v1/mod.rs
Comment thread packages/notebook-types/src/v2/mod.rs Outdated
Comment thread packages/notebook-types/src/v2/model.rs Outdated
@KevinDCarlson KevinDCarlson force-pushed the equations_in_notebook_types branch from 252404e to df2a925 Compare February 18, 2026 22:55
@KevinDCarlson KevinDCarlson force-pushed the equations_in_notebook_types branch from 57ae14a to c2ef971 Compare February 19, 2026 18:06
@KevinDCarlson
Copy link
Copy Markdown
Collaborator Author

I found it was necessary to remove TSIFY annotations from some old types to make the versioning work here. This didn't cause problems on the v0 -> v1 upgrade because the redefined types were structurally identical, but we actually had duplicated type definitions in the WASM output.

Copy link
Copy Markdown
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.

Knowing when to bump the notebook types version can be confusing. The main principle is this: we only bump the version and write a migration for changes that would break existing user data. Changes or additions to the notebook types for which existing data would remain valid do not trigger a version bump.

The most common example of such a safe change is adding new variants to an enum. And fortunately that's exactly what we have here.

So this PR can be much simplified by just adding the Equation variant to the existing v1 type ModelJudgment. We did the same thing when adding instantiations:

@epatters epatters merged commit 17b22eb into main Mar 16, 2026
15 checks passed
@epatters epatters deleted the equations_in_notebook_types branch March 16, 2026 22:08
@epatters epatters changed the title Equations in notebook types Equations between morphisms in notebook types Mar 16, 2026
@epatters epatters added enhancement New feature or request frontend TypeScript frontend and Rust-wasm integrations labels Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants