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

Double theory for diagrammatic equations with unary operations #257

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"tsx": "^4.16.5",
"typedoc": "^0.26.5"
},
"packageManager": "pnpm@9.11.0"
"packageManager": "pnpm@9.12.3"
}
4 changes: 2 additions & 2 deletions packages/frontend/src/diagram/diagram_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default function DiagramPage() {
const { doc } = liveDoc;
invariant(doc.type === "diagram", () => `Expected diagram, got type: ${doc.type}`);

const modelReactiveDoc = await getLiveDoc<ModelDocument>(rpc, repo, doc.modelRef.refId);
const liveModel = enlivenModelDocument(doc.modelRef.refId, modelReactiveDoc, theories);
const modelLiveDoc = await getLiveDoc<ModelDocument>(rpc, repo, doc.modelRef.refId);
const liveModel = enlivenModelDocument(doc.modelRef.refId, modelLiveDoc, theories);

return enlivenDiagramDocument(refId, liveDoc, liveModel);
});
Expand Down
54 changes: 54 additions & 0 deletions packages/frontend/src/stdlib/theories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,57 @@ stdTheories.add(
});
},
);

stdTheories.add(
{
id: "diagrammatic-equations",
name: "Equational theory",
description: "Systems of equations specified diagrammatically",
group: "Applied Mathematics",
},
(meta) => {
const thCategory = new catlog.ThCategory();
return new Theory({
...meta,
theory: thCategory.theory(),
modelTypes: [
{
tag: "ObType",
obType: { tag: "Basic", content: "Object" },
name: "Type",
description: "Type of quantity",
shortcut: ["Q"],
},
{
tag: "MorType",
morType: {
tag: "Hom",
content: { tag: "Basic", content: "Object" },
},
name: "Operation",
description: "Arithmetical operation or differential operator",
shortcut: ["A"],
},
],
instanceTypes: [
{
tag: "ObType",
obType: { tag: "Basic", content: "Object" },
name: "Quantity",
description: "Variables and other numerical quantities",
shortcut: ["Q"],
},
{
tag: "MorType",
morType: {
tag: "Hom",
content: { tag: "Basic", content: "Object" },
},
name: "Application",
description: "Apply an operation to quantities",
shortcut: ["A"],
},
],
});
},
);