Coverage report: /home/runner/work/geb/geb/src/lambda/package.lisp
Kind | Covered | All | % |
expression | 0 | 16 | 0.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
(in-package :geb.utils)
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
(geb.utils:muffle-package-variance
8
(uiop:define-package #:geb.lambda.main
9
(:documentation "A basic lambda calculus model")
10
(:mix #:geb.lambda.spec #:geb.common #:common-lisp)
11
(:reexport #:geb.lambda.spec)
12
(:export #:@lambda-api)))
14
(in-package #:geb.lambda.main)
16
(pax:defsection @lambda-api (:title "Main functionality")
17
"This covers the main API for the STLC module"
19
(ann-term1 pax:generic-function)
20
(index-check pax:function)
21
(fun-to-hom pax:function)
22
(ann-term2 pax:function)
23
(annotated-term pax:function)
24
(type-of-term-w-fun pax:function)
25
(type-of-term pax:function)
26
(well-defp pax:generic-function)
28
(fun-type pax:function)
30
(reducer pax:function)
32
(mcar (pax:method () (fun-type)))
33
(mcadr (pax:method () (fun-type))))
35
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39
(in-package :geb.utils)
41
(geb.utils:muffle-package-variance
42
(uiop:define-package #:geb.lambda.trans
43
(:documentation "A basic lambda translator into other parts of geb")
44
(:mix #:geb.lambda.spec #:geb.common #:common-lisp :geb.lambda.main)
45
(:export #:@utility #:@stlc-conversion)))
47
(in-package #:geb.lambda.trans)
49
(pax:defsection @utility (:title "Utility Functionality")
50
"These are utility functions relating to translating lambda terms to other types"
51
(stlc-ctx-to-mu pax:function)
52
(so-hom pax:function))
54
(pax:defsection @stlc-conversion (:title "Transition Functions")
55
"These functions deal with transforming the data structure to other
58
"One important note about the lambda conversions is that all
59
transition functions except [TO-CAT] do not take a context.
61
Thus if the [\\<STLC\\>] term contains free variables, then call
62
[TO-CAT] and give it the desired context before calling
63
any other transition functions"
64
(to-cat (pax:method () (t <stlc>)))
65
(to-poly (pax:method () (<stlc>)))
66
(to-bitc (pax:method () (<stlc>)))
67
(to-seqn (pax:method () (<stlc>)))
68
(to-circuit (pax:method () (<stlc> t)))
69
(@utility pax:section))
71
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
73
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
75
(in-package :geb.utils)
77
(geb.utils:muffle-package-variance
78
(uiop:define-package #:geb.lambda
79
(:documentation "A basic lambda calculus model")
80
(:mix #:geb.lambda.spec #:geb.lambda.trans #:geb.common #:common-lisp)
81
(:use-reexport #:geb.lambda.spec #:geb.lambda.main #:geb.lambda.trans)
84
(in-package #:geb.lambda)
86
(pax:defsection @stlc (:title "The Simply Typed Lambda Calculus model")
87
"This covers GEB's view on simply typed lambda calculus
89
This serves as a useful frontend for those wishing to write a compiler
90
to GEB and do not wish to target the categorical model.
92
If one is targeting their compiler to the frontend, then the following
93
code should be useful for you.
96
(in-package :geb.lambda.main)
100
(lamb (list (coprod so1 so1))
109
(lamb (list (coprod so1 so1))
117
(((1 - x1) * 1) + (x1 * 0), ((1 - x1) * 1) + (x1 * 0))
120
MAIN> (to-circuit (lamb (list geb-bool:bool)
121
(left so1 (right so1 (index 0)))) :foo)
127
For testing purposes, it may be useful to go to the `BITC` backend and
134
(lamb (list (coprod so1 so1))
139
(left so1 (unit))))))
144
(lamb (list (coprod so1 so1))
149
(left so1 (unit))))))
155
(@lambda-specs pax:section)
156
(@lambda-api pax:section)
157
(@stlc-conversion pax:section))