Skip to content

Commit

Permalink
ENH: Add double theory for diagrammatic equations (unary ops only).
Browse files Browse the repository at this point in the history
  • Loading branch information
epatters committed Nov 13, 2024
1 parent 8fa3120 commit 4adf813
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
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"],
},
],
});
},
);

0 comments on commit 4adf813

Please sign in to comment.