anoma / geb

A Categorical View of Computation
https://anoma.github.io/geb/
GNU General Public License v3.0
28 stars 10 forks source link

Error: "not a well-defined APP in said NIL" #137

Closed lukaszcz closed 1 year ago

lukaszcz commented 1 year ago

What am I doing wrong here?

(defpackage #:test003
  (:shadowing-import-from :geb.lambda.spec #:pair #:right #:left)
  (:shadowing-import-from :geb.spec #:case)
  (:use #:common-lisp #:geb.lambda.spec #:geb))

(in-package :test003)

(defparameter *entry*
  (app
    (lamb
      (list
        (coprod
          so1
          so1))
      (case-on
        (index 0)
        (lamb
          (list
            so1)
          (index 1))
        (lamb
          (list
            so1)
          (left
            so1
            (unit)))))
    (list
      (right
        so1
        (unit)))))
agureev commented 1 year ago

This has to do with how we type things for case-on. The term index 1 in the left term will be typed in the context so1, so1, (coprod so1 so1) so that it will take on type so1 causing a mistyping. The correct way to write this term will be:

(app (lamb (list (coprod so1 so1)) (case-on (index 0) (lamb (list so1) (index 2)) (lamb (list so1) (left so1 (unit))))) (list (right so1 (unit))))

i.e. simply changing the depth of the index.