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

Upgrade so-eval to a Generic #149

Merged
merged 1 commit into from
Aug 29, 2023
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
12 changes: 5 additions & 7 deletions src/geb/geb.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,18 @@ u
(geb:so0 1)
(geb:so1 1)))


(-> so-eval (substobj substobj) substmorph)
(defun so-eval (x y)
(defmethod so-eval ((x <substobj>) y)
(match-of substobj x
(so0 (comp (init y) (<-right so1 so0)))
(so1 (<-left y so1))
((coprod a b) (comp (mcase (comp (so-eval a y)
(so-forget-middle (!-> a y) (!-> b y) a))
(so-forget-middle (so-hom-obj a y) (so-hom-obj b y) a))
(comp (so-eval b y)
(so-forget-first (!-> a y) (!-> b y) b)))
(distribute (prod (!-> a y) (!-> b y)) a b)))
(so-forget-first (so-hom-obj a y) (so-hom-obj b y) b)))
(distribute (prod (so-hom-obj a y) (so-hom-obj b y)) a b)))
((prod a b) (let ((eyz (so-eval b y))
(exhyz (so-eval a (so-hom-obj b y)))
(hom (!-> a (so-hom-obj b y))))
(hom (so-hom-obj a (so-hom-obj b y))))
(comp eyz
(pair (comp exhyz (so-forget-right hom a b))
(comp (<-right a b)
Expand Down
2 changes: 1 addition & 1 deletion src/geb/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(commutes pax:function)
(commutes-left pax:function)
(!-> pax:function)
(so-eval pax:function)
(so-eval (pax:method () (<substobj> t)))
(so-hom-obj pax:function)
(so-card-alg pax:generic-function)
(so-card-alg (pax:method () (<substobj>)))
Expand Down
5 changes: 5 additions & 0 deletions src/generics/generics.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ x
(COPROD SO1 X)
```"))

(defgeneric so-eval (object1 object2)
(:documentation
"Takes in X and Y Geb objects and provides an evaluation morphism
(prod (so-hom-obj X Y) X) -> Y"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Conversion functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down
1 change: 1 addition & 0 deletions src/generics/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The main documentation for the functionality is given here, with
examples often given in the specific methods"
(gapply pax:generic-function)
(maybe pax:generic-function)
(so-eval pax:generic-function)
(to-circuit pax:generic-function)
(to-bitc pax:generic-function)
(to-poly pax:generic-function)
Expand Down