Skip to content

Instantly share code, notes, and snippets.

@bblfish
Created November 18, 2020 08:16
Show Gist options
  • Save bblfish/b19b3150b8ce499faf067a96ea5c38cb to your computer and use it in GitHub Desktop.
Save bblfish/b19b3150b8ce499faf067a96ea5c38cb to your computer and use it in GitHub Desktop.
Calculate Sigma, Delta, Pi for a functor from 2 to 3 arrow quivers on a very simple instance
// This calculates the Sigma, Delta, Pi adjunctions for a functor F from
// the schema for 2 arrow quivers to 3 arrow quivers on a simple instance
// see https://www.categoricaldata.net/ .
// ie it shows two translations of a directed graph to a RDF like directed
// graph. Sigma just gives each arrow a type, Pi duplicates the graph as
// many times as their are nodes and for all the arrows in one of the duplicated
// graphs assigns it one of the nodes.
typeside Ty = literal {
java_types
Integer = "java.lang.Integer"
String = "java.lang.String"
java_constants
Integer = "return java.lang.Integer.parseInt(input[0])"
String = "return input[0]"
}
schema Q2 = literal : Ty {
entities
A
N
foreign_keys
s : A -> N
t : A -> N
}
schema Q3 = literal : Ty {
entities
A
N
foreign_keys
s : A -> N
r : A -> N
t : A -> N
}
instance Q2I = literal : Q2 {
generators
ab bc ca dd : A
a b c d : N
equations
s(ab) = a t(ab) = b
s(bc) = b t(bc) = c
s(ca) = c t(ca) = a
s(dd) = d t(dd) = d
}
mapping F = literal : Q2 -> Q3 {
entity
A -> A
foreign_keys
s -> s
t -> t
entity
N -> N
}
instance sigmaF = sigma F Q2I
instance piF = pi F Q2I
instance deltaSigmaF = delta F sigmaF
instance deltaPiF = delta F piF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment