Coverage report: /home/runner/work/geb/geb/src/specs/package.lisp
Kind | Covered | All | % |
expression | 0 | 35 | 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
(muffle-package-variance
4
(defpackage #:geb.specs
7
(muffle-package-variance
8
(defpackage #:geb.poly.spec
9
(:shadow :+ :* :/ :- :mod)
10
(:use #:geb.utils #:cl)
11
(:export #:@poly #:@poly-constructors)))
13
(muffle-package-variance
14
(defpackage #:geb.bitc.spec
17
(:use #:geb.utils #:cl #:geb.mixins)
18
(:export #:@bitc #:@bitc-constructors)))
20
(muffle-package-variance
21
(defpackage #:geb.seqn.spec
22
(:use #:geb.utils #:cl #:geb.mixins)
23
(:export #:@seqn #:@seqn-constructors)))
25
;; please document this later.
26
(muffle-package-variance
27
(uiop:define-package #:geb.lambda.spec
28
(:documentation "Basic spec for creating lambda terms")
29
(:mix #:trivia #:serapeum #:common-lisp #:geb.mixins)
30
(:export #:@lambda-specs)))
32
(pax:define-package #:geb.spec
33
(:documentation "Gödel, Escher, Bach categorical model")
34
(:use #:common-lisp #:serapeum #:geb.mixins #:geb.utils)
35
(:shadow :left :right :prod :case)
36
(:export :prod :case :mcar :mcadr :mcaddr :mcdr :name :func :obj
37
:same-type-to-list :pair-to-list
38
#:@geb-categories #:@geb-substmu #:@geb-substmorph #:@geb-constructors #:@geb-realized))
40
(muffle-package-variance
41
(uiop:define-package #:geb.extension.spec
42
(:documentation "Extensions of the various categories")
43
(:mix #:trivia #:serapeum #:common-lisp #:geb.mixins #:geb.utils)
44
(:export #:@geb-extensions)))
46
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
47
;; Geb Package Documentation
48
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
50
(in-package :geb.specs)
52
(pax:defsection @geb-specs (:title "Spec Files, Main Files and Project Layout")
53
"The codebase is split between many files. Each folder can be seen as
54
a different idea within geb itself! Thus the `poly` has packages
55
revolving around polynomials, the `geb` folder has packages regarding
56
the main types of geb GEB.SPEC:@GEB-SUBSTMU and
57
GEB.SPEC:@GEB-SUBSTMORPH, etc etc.
59
The general layout quirk of the codebase is that packages like
60
`geb.package.spec` defines the specification for the base types for
61
any category we wish to model, and these reside in the `specs` folder
62
not in the folder that talks about the packages of those types. This
63
is due to loading order issues, we thus load the `specs` packages
64
before each of their surrounding packages, so that each package can
65
built off the last. Further, packages like `geb.package.main` define
66
out most of the functionality of the package to be used by other
67
packages in `geb.package`, then all of these are reexported out in the
70
Further to make working with each package of an idea is easy, we have
71
the main package of the folder (typically named the same as the folder
72
name) reexport most important components so if one wants to work with
73
the fully fledged versions of the package they can simply without
74
having to import too many packages at once.
76
For example, the `geb.poly.spec` defines out the types and data
77
structures of the GEB.POLY.SPEC:@POLY, this is then rexported
78
in `geb.poly`, giving the module `geb.poly` a convenient interface for
79
all functions that operate on `geb.poly`.")
81
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
82
;; Geb Poly Package Documentation
83
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
85
(in-package :geb.poly.spec)
87
(pax:defsection @poly (:title "Polynomial Types")
88
"This section covers the types of things one can find in the [POLY]
102
(pax:defsection @poly-constructors (:title "Polynomial Constructors")
103
"Every accessor for each of the CLASS's found here are from @GEB-ACCESSORS"
104
(ident pax:symbol-macro)
110
(compose pax:function)
111
(if-zero pax:function)
112
(if-lt pax:function))
114
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115
;; Geb Bits Package Documentation
116
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
118
(in-package :geb.bitc.spec)
120
(pax:defsection @bitc (:title "Bits Types")
121
"This section covers the types of things one can find in the [BITS]
135
(pax:defsection @bitc-constructors (:title "Bits (Boolean Circuit) Constructors")
136
"Every accessor for each of the CLASS's found here are from @GEB-ACCESSORS"
137
(compose pax:function)
139
(parallel pax:function)
141
(one pax:symbol-macro)
142
(zero pax:symbol-macro)
145
(branch pax:function))
147
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
148
;; Geb Seqn Package Documentation
149
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
151
(in-package :geb.seqn.spec)
153
(pax:defsection @seqn (:title "Seqn Types")
156
(composition pax:class)
158
(parallel-seq pax:class)
161
(remove-right pax:class)
162
(remove-left pax:class)
163
(drop-width pax:class)
164
(inj-length-left pax:class)
165
(inj-length-right pax:class)
167
(branch-seq pax:class)
168
(shift-front pax:class)
172
(seqn-subtract pax:class)
173
(seqn-multiply pax:class)
174
(seqn-divide pax:class)
176
(seqn-concat pax:class)
177
(seqn-decompose pax:class)
180
(seqn-mod pax:class))
182
(pax:defsection @seqn-constructors (:title "Seqn Constructors")
183
"Every accessor for each of the classes making up seqn"
184
(composition pax:function)
186
(fork-seq pax:function)
187
(parallel-seq pax:function)
188
(drop-nil pax:function)
189
(remove-right pax:function)
190
(remove-left pax:function)
191
(drop-width pax:function)
192
(inj-length-left pax:function)
193
(inj-length-right pax:function)
194
(inj-size pax:function)
195
(branch-seq pax:function)
196
(shift-front pax:function)
197
(zero-bit pax:symbol-macro)
198
(one-bit pax:symbol-macro)
199
(seqn-add pax:function)
200
(seqn-subtract pax:function)
201
(seqn-multiply pax:function)
202
(seqn-divide pax:function)
203
(seqn-nat pax:function)
204
(seqn-concat pax:function)
205
(seqn-decompose pax:function)
206
(seqn-eq pax:function)
207
(seqn-lt pax:function)
208
(seqn-mod pax:function))
210
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
211
;; Geb lambda Package Documentation
212
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
214
(in-package :geb.lambda.spec)
216
(pax:defsection @lambda-specs (:title "Lambda Specification")
217
"This covers the various the abstract data type that is the simply
218
typed lambda calculus within GEB. The class presents untyped STLC terms.
239
(bit-choice pax:class)
244
(absurd pax:function)
248
(case-on pax:function)
259
(divide pax:function)
260
(bit-choice pax:function)
261
(lamb-eq pax:function)
262
(lamb-lt pax:function)
263
(absurd pax:function)
266
"Accessors of [ABSURD][class]"
268
(tcod (pax:method () (absurd)))
269
(term (pax:method () (absurd)))
270
(ttype (pax:method () (absurd)))
272
"Accessors of [UNIT][class]"
273
(ttype (pax:method () (unit)))
275
"Accessors of [LEFT][class]"
276
(rty (pax:method () (left)))
277
(term (pax:method () (left)))
278
(ttype (pax:method () (left)))
280
"Accessors of [RIGHT][class]"
281
(lty (pax:method () (right)))
282
(term (pax:method () (right)))
283
(ttype (pax:method () (right)))
285
"Accessors of [CASE-ON][class]"
286
(on (pax:method () (case-on)))
287
(ltm (pax:method () (case-on)))
288
(rtm (pax:method () (case-on)))
289
(ttype (pax:method () (case-on)))
291
"Accessors of [PAIR][class]"
292
(ltm (pax:method () (pair)))
293
(rtm (pax:method () (pair)))
294
(ttype (pax:method () (pair)))
296
"Accessors of [FST][class]"
297
(term (pax:method () (fst)))
298
(ttype (pax:method () (fst)))
300
"Accessors of [SND][class]"
301
(term (pax:method () (snd)))
302
(ttype (pax:method () (snd)))
304
"Accessors of [LAMB][class]"
305
(tdom (pax:method () (lamb)))
306
(term (pax:method () (lamb)))
307
(ttype (pax:method () (lamb)))
309
"Accessors of [APP][class]"
310
(fun (pax:method () (app)))
311
(term (pax:method () (app)))
312
(ttype (pax:method () (app)))
314
"Accessors of [INDEX][class]"
315
(pos (pax:method () (index)))
316
(ttype (pax:method () (index)))
318
"Accessor of [ERR][class]"
319
(ttype (pax:method () (err)))
321
"Accessors of [PLUS][class]"
322
(ltm (pax:method () (plus)))
323
(rtm (pax:method () (plus)))
324
(ttype (pax:method () (plus)))
326
"Accessors of [TIMES][class]"
327
(ltm (pax:method () (times)))
328
(rtm (pax:method () (times)))
329
(ttype (pax:method () (times)))
331
"Accessors of [MINUS][class]"
332
(ltm (pax:method () (minus)))
333
(rtm (pax:method () (minus)))
334
(ttype (pax:method () (minus)))
336
"Accessors of [DIVIDE][class]"
337
(ltm (pax:method () (divide)))
338
(rtm (pax:method () (divide)))
339
(ttype (pax:method () (divide)))
341
"Accessors of [BIT-CHOICE][class]"
342
(bitv (pax:method () (bit-choice)))
343
(ttype (pax:method () (bit-choice)))
345
"Accessors of [LAMB-EQ][class]"
346
(ltm (pax:method () (lamb-eq)))
347
(rtm (pax:method () (lamb-eq)))
348
(ttype (pax:method () (lamb-eq)))
350
"Accessors of [LAMB-LT][class]"
351
(ltm (pax:method () (lamb-lt)))
352
(rtm (pax:method () (lamb-lt)))
353
(ttype (pax:method () (lamb-lt)))
355
"Accessors of [MODULO][class]"
356
(ltm (pax:method () (modulo)))
357
(rtm (pax:method () (modulo)))
358
(ttype (pax:method () (modulo)))
360
(tcod pax:generic-function)
361
(tdom pax:generic-function)
362
(term pax:generic-function)
363
(rty pax:generic-function)
364
(lty pax:generic-function)
365
(ltm pax:generic-function)
366
(rtm pax:generic-function)
367
(on pax:generic-function)
368
(fun pax:generic-function)
369
(pos pax:generic-function)
370
(ttype pax:generic-function)
371
(bitv pax:generic-function))
373
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
374
;; Geb Package Documentation
375
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
377
(in-package :geb.spec)
379
(pax:defsection @geb-categories (:title "Core Category")
380
"The underlying category of GEB. With @GEB-SUBSTMU covering the
381
shapes and forms (GEB-DOCS/DOCS:@OBJECTS) of data while @GEB-SUBSTMORPH
382
deals with concrete GEB-DOCS/DOCS:@MORPHISMS within the category.
384
From this category, most abstractions will be made, with
385
[SUBSTOBJ][type] serving as a concrete type layout, with
386
[SUBSTMORPH][type] serving as the morphisms between different
387
[SUBSTOBJ][type] types. This category is equivalent to
388
[finset](https://ncatlab.org/nlab/show/FinSet).
390
A good example of this category at work can be found within the
391
GEB-BOOL::@GEB-BOOL section."
392
(@geb-substmu pax:section)
393
(@geb-substmorph pax:section)
394
(@geb-realized pax:section))
396
(pax:defsection @geb-substmu (:title "Subst Obj")
397
"This section covers the objects of the [SUBSTMORPH][type]
398
category. Note that [SUBSTOBJ][type] refers to the
399
[GEB-DOCS/DOCS:@CLOSED-TYPE], whereas [\\<SUBSTOBJ\\>][class] refers
400
to the [GEB-DOCS/DOCS:@OPEN-TYPE] that allows for user extension."
402
(<substobj> pax:class)
403
"[SUBSTOBJ][type] type is not a constructor itself, instead it's
404
best viewed as the sum type, with the types below forming the
405
constructors for the term. In ML we would write it similarly to:
417
"The @GEB-ACCESSORS specific to @GEB-SUBSTMU"
418
(mcar (pax:method () (prod)))
419
(mcadr (pax:method () (prod)))
421
(mcar (pax:method () (coprod)))
422
(mcadr (pax:method () (coprod))))
424
(pax:defsection @geb-realized (:title "Realized Subst Objs")
425
"This section covers the [REALIZED-OBJECT][TYPE] type. This
426
represents a realized [SUBSTOBJ][type] term.
428
The [REALIZED-OBJECT][TYPE] is not a real constructor but rather a sum
429
type for the following type
432
(deftype realized-object () `(or left right list so1 so0))
435
In ML we would have written something like
438
type realized-object = so0
444
(realized-object pax:type)
448
(right pax:function))
450
(pax:defsection @geb-substmorph (:title "Subst Morph")
451
"The overarching types that categorizes the [SUBSTMORPH][type]
452
category. Note that [SUBSTMORPH][type] refers to the
453
[GEB-DOCS/DOCS:@CLOSED-TYPE], whereas [\\<SUBSTMORPH\\>][class] refers
454
to the [GEB-DOCS/DOCS:@OPEN-TYPE] that allows for user extension."
455
(substmorph pax:type)
456
(<substmorph> pax:class)
457
"[SUBSTMORPH][type] type is not a constructor itself, instead it's
458
best viewed as the sum type, with the types below forming the
459
constructors for the term. In ML we would write it similarly to:
462
type substmorph = comp
475
Note that an instance of [SUBSTOBJ][type], acts like the identity
476
morphism to the layout specified by the given [SUBSTOBJ][type]. Thus
477
we can view this as automatically lifting a [SUBSTOBJ][type] into a
484
(distribute pax:class)
485
(inject-left pax:class)
486
(inject-right pax:class)
487
(project-left pax:class)
488
(project-right pax:class)
490
"The @GEB-ACCESSORS specific to @GEB-SUBSTMORPH"
491
(mcar (pax:method () (comp)))
492
(mcadr (pax:method () (comp)))
494
(obj (pax:method () (init)))
496
(obj (pax:method () (init)))
498
(mcar (pax:method () (case)))
499
(mcadr (pax:method () (case)))
501
(mcar (pax:method () (pair)))
502
(mcdr (pax:method () (pair)))
504
(mcar (pax:method () (distribute)))
505
(mcadr (pax:method () (distribute)))
506
(mcaddr (pax:method () (distribute)))
508
(mcar (pax:method () (inject-left)))
509
(mcadr (pax:method () (inject-left)))
511
(mcar (pax:method () (inject-right)))
512
(mcadr (pax:method () (inject-right)))
514
(mcar (pax:method () (project-left)))
515
(mcadr (pax:method () (project-left)))
517
(mcar (pax:method () (project-right)))
518
(mcadr (pax:method () (project-right))))
520
(pax:defsection @geb-constructors (:title "Constructors")
521
"The API for creating GEB terms. All the functions and variables
522
here relate to instantiating a term"
525
"More Ergonomic API variants for *SO0* and *SO1*"
526
(so0 pax:symbol-macro)
527
(so1 pax:symbol-macro)
529
(make-alias pax:function)
530
(has-aliasp pax:function)
531
(<-left pax:function)
532
(<-right pax:function)
533
(->left pax:function)
534
(->right pax:function)
536
(make-functor pax:function))
538
(in-package :geb.extension.spec)
540
(pax:defsection @geb-extensions (:title "Extension Sets for Categories")
541
"This package contains many extensions one may see over the codebase.
543
Each extension adds an unique feature to the categories they are
544
extending. To learn more, read about the individual extension you are
546
"Common Sub expressions represent repeat logic that can be found
547
throughout any piece of code"
548
(common-sub-expression pax:class)
549
(make-common-sub-expression pax:function)
550
"The Opaque extension lets users write categorical objects and
551
morphisms where their implementation hide the specifics of what
552
types they are operating over"
554
(reference pax:class)
555
(opaque-morph pax:class)
556
(code (pax:method () (opaque-morph)))
557
(dom (pax:method () (opaque-morph)))
558
(codom (pax:method () (opaque-morph)))
559
(code (pax:method () (opaque)))
560
(name (pax:method () (opaque)))
561
(name (pax:method () (reference)))
562
(reference pax:function)
563
(opaque-morph pax:function)
564
(opaque pax:function)
565
"The Natural Object/Morphism extension allows to expand the core Geb category
566
with additional constructors standing in for bt-sequence representation of
567
natural numbers along with basic operation relating to those."
571
(nat-width pax:class)
573
(num (pax:method () (nat-width)))
575
(nat-width pax:function)
578
(<natmorph> pax:class)
584
(nat-const pax:class)
586
(nat-concat pax:class)
587
(one-bit-to-bool pax:class)
588
(nat-decompose pax:class)
593
(num (pax:method () (nat-add)))
594
(num (pax:method () (nat-mult)))
595
(num (pax:method () (nat-sub)))
596
(num (pax:method () (nat-div)))
597
(num (pax:method () (nat-const)))
598
(pos (pax:method () (nat-const)))
599
(num (pax:method () (nat-inj)))
600
(num-left (pax:method () (nat-concat)))
601
(num-right (pax:method () (nat-concat)))
602
(num (pax:method () (nat-decompose)))
603
(num (pax:method () (nat-eq)))
604
(num (pax:method () (nat-lt)))
605
(num (pax:method () (nat-mod)))
607
(nat-add pax:function)
608
(nat-mult pax:function)
609
(nat-sub pax:function)
610
(nat-div pax:function)
611
(nat-const pax:function)
612
(nat-inj pax:function)
613
(nat-concat pax:function)
614
(one-bit-to-bool pax:function)
615
(nat-decompose pax:function)
616
(nat-eq pax:function)
617
(nat-lt pax:function)
618
(nat-mod pax:function)
620
(num pax:generic-function)
621
(pos pax:generic-function)
622
(num-left pax:generic-function)
623
(num-right pax:generic-function)
625
(*one-bit-to-bool* pax:variable)
626
(one-bit-to-bool pax:symbol-macro))