• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-cqtcocoa誰得pythonphprubygameguibathyscaphec翻訳計画中(planning stage)omegatframeworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

A categorical programming language


Commit MetaInfo

修订版5ce1d98b359ee6713b42fc7ae9185980024ecf9b (tree)
时间2022-03-30 09:21:26
作者Corbin <cds@corb...>
CommiterCorbin

Log Message

Implement the Yoneda combinators and other stuff.

更改概述

差异

--- /dev/null
+++ b/hive/dynamics.cammy
@@ -0,0 +1,4 @@
1+(pair/mapfst (comp (pair (fun/name @0) id) fun/int-comp))
2+
3+The dynamics of a deterministic automaton. The second component of the pair is
4+left free, but usually is a status value, like a Boolean.
--- /dev/null
+++ b/hive/extnat/about.md
@@ -0,0 +1,3 @@
1+The type $\mathbb{N} + 1$ can be interpreted as $\mathbb{\tilde{N}}$, the
2+type of extended natural numbers, via [one-point
3+compactification](https://ncatlab.org/nlab/show/one-point+compactification).
--- /dev/null
+++ b/hive/extnat/pred.cammy
@@ -0,0 +1,6 @@
1+(comp
2+ (sum/mapleft nat/pred-maybe)
3+ (comp sum/assr (comp (sum/mapright sum/swap) sum/assl)))
4+
5+The predecessor of an extended natural number. The extra point signals when
6+the input is zero.
--- /dev/null
+++ b/hive/extnat/succ.cammy
@@ -0,0 +1,4 @@
1+(sum/mapleft succ)
2+
3+The successor of an extended natural number is also an extended natural
4+number.
--- a/hive/fun/int-comp.cammy
+++ b/hive/fun/int-comp.cammy
@@ -1,3 +1,3 @@
1-(curry (comp (comp fun/assr (pair fst (comp snd fun/app))) fun/app))
1+(curry (comp (comp pair/assr (pair fst (comp snd fun/app))) fun/app))
22
33 An internalized version of composition.
--- /dev/null
+++ b/hive/fun/unname.cammy
@@ -0,0 +1,3 @@
1+(comp (pair ignore id) (uncurry @0))
2+
3+Reference an arrow by name.
--- a/hive/list/scan.cammy
+++ b/hive/list/scan.cammy
@@ -1,4 +1,3 @@
1-(comp (fold
2- (pair @0 nil)
3- (comp (comp fun/assl (pair @1 snd)) (pair fst cons)))
4-snd)
1+(comp (fold (pair @0 nil) (comp (comp pair/assl (pair @1 snd)) (pair fst cons))) snd)
2+
3+
--- a/hive/monads/maybe/int-comp.cammy
+++ b/hive/monads/maybe/int-comp.cammy
@@ -1,7 +1,4 @@
1-(curry
2- (comp
3- (comp fun/assr (pair fst (comp snd fun/app)))
4- (comp fun/distribr (case fun/app (comp ignore right)))))
1+(curry (comp (comp pair/assr (pair fst (comp snd fun/app))) (comp fun/distribr (case fun/app (comp ignore right)))))
52
63 An internalized version of composition in the Kleisli category for the maybe
74 monad.
--- /dev/null
+++ b/hive/poly/about.md
@@ -0,0 +1,2 @@
1+The type $[\mathbb{N}]$ can be interpreted as the type of polynomials with
2+coefficients in $\mathbb{N}$.
--- /dev/null
+++ b/hive/poly/const.cammy
@@ -0,0 +1,3 @@
1+(comp (pair id (fun/const nil)) cons)
2+
3+A constant polynomial which always evaluating to the given natural number.
--- /dev/null
+++ b/hive/poly/order.cammy
@@ -0,0 +1,3 @@
1+(comp list/len nat/pred)
2+
3+The largest exponent in a polynomial.
--- /dev/null
+++ b/hive/poly/zero.cammy
@@ -0,0 +1,3 @@
1+nil
2+
3+The zero polynomial.
--- /dev/null
+++ b/hive/sum/assl.cammy
@@ -0,0 +1,3 @@
1+(case (comp left left) (case (comp right left) right))
2+
3+Reassociate a triple sum to the left.
--- /dev/null
+++ b/hive/sum/assr.cammy
@@ -0,0 +1,3 @@
1+(case (case left (comp left right)) (comp right right))
2+
3+Reassociate a triple sum to the right.
--- /dev/null
+++ b/hive/yoneda/about.md
@@ -0,0 +1,2 @@
1+Given some fixed arrow $f : X \to Y$, its Yoneda embedding can be realized by
2+the type $\hat{f} : (X^Z) \to (Y^Z)$.
--- /dev/null
+++ b/hive/yoneda/embed.cammy
@@ -0,0 +1,3 @@
1+(curry (comp fun/app @0))
2+
3+The Yoneda embedding of an arrow.
--- /dev/null
+++ b/hive/yoneda/lift.cammy
@@ -0,0 +1,3 @@
1+(fun/unname (comp (fun/const (fun/name id)) @0))
2+
3+Undo the Yoneda embedding.
--- a/movelist/test.json
+++ b/movelist/test.json
@@ -3,7 +3,8 @@
33 ["first component", "(pair X Y)", "X"],
44 ["right unitor", "X", "(pair X 1)"],
55 ["name of id", "1", "(hom X X)"],
6- ["associator", "(pair (pair X Y) Z)", "(pair X (pair Y Z))"],
6+ ["product associator", "(pair (pair X Y) Z)", "(pair X (pair Y Z))"],
7+ ["sum associator", "(sum (sum X Y) Z)", "(sum X (sum Y Z))"],
78 ["application", "(pair (hom X Y) X)", "Y"],
89 ["braiding", "(pair X Y)", "(pair Y X)"],
910 ["distributivity", "(sum (pair X Y) (pair X Z))", "(pair X (sum Y Z))"],
--- a/todo.txt
+++ b/todo.txt
@@ -60,3 +60,4 @@
6060 * We need to iter-maybe but also keep track of how many steps were taken
6161 * Instead of X -> [N, Y + 1], we need X -> [N, N x (Y + 1)]
6262 * ulimit jellification?
63+* formal power series N -> Q