This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(datatype Ob (ObGen String)) | |
(datatype Mor (MorGen String)) | |
(constructor dom (Mor) Ob) | |
(constructor cod (Mor) Ob) | |
(constructor id (Ob) Mor) | |
(constructor compose (Mor Mor) Mor) | |
(ruleset CatAxioms) | |
; Predicate: Is a morphism term well-typed? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Theory of monoids | |
(datatype Mon | |
(Gen String) | |
(times Mon Mon) | |
(unit)) | |
; The usual monoid axioms, but note that the associativity rewrite is bidirectional, | |
; whereas the unit rewrites are unidirectional. This ensures that the rewrites never increase | |
; the size of the expressions, so we can safely saturate the e-graph. | |
(ruleset MonAxioms) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Theory of a category: first copy, for the domain category | |
; (Associativity and unitality axioms not recorded.) | |
(datatype Ob1 (ob1 String)) | |
(datatype Mor1 (mor1 String)) | |
(constructor dom1 (Mor1) Ob1) | |
(constructor cod1 (Mor1) Ob1) | |
(constructor id1 (Ob1) Mor1) | |
(rewrite (dom1 (id1 x)) x) | |
(rewrite (cod1 (id1 x)) x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Catlab | |
import Base: +, -, ~, zero | |
import Catlab: ⋅ | |
""" Theory of the commutative algebra of quantities. | |
""" | |
@theory ThQuantityAlgebra begin | |
Quantity::TYPE | |
# Multiplicative commutative monoid. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Catlab, DataMigrations | |
# SIR | |
##### | |
@present SchSIR(FreeSchema) begin | |
Person::Ob | |
(S, I, R)::Ob | |
S_is_person::Hom(S, Person) | |
I_is_person::Hom(I, Person) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.