├── .gitignore ├── README.md ├── imperishable ├── Makefile ├── README.md ├── book.md └── macros.tex └── perishable ├── confused-wills-big-list-of-things-hed-like-to-know-about-relational-programming ├── Makefile ├── README.md └── book.md ├── cool-relational-programming-project-ideas ├── Makefile ├── README.md └── book.md ├── how-I-think-about-relational-programming ├── Makefile ├── README.md └── book.md ├── images ├── contents.txt └── playing_with_titles_old.jpg ├── topics.txt ├── what-I-have-in-mind.txt ├── wills-big-bad-boring-braindump-on-relational-programming ├── Makefile ├── README.md └── book.md ├── wills-dubious-and-opinionated-collection-of-minikanren-and-relational-programming-resources ├── Makefile ├── README.md └── book.md └── writing-log.txt /.gitignore: -------------------------------------------------------------------------------- 1 | book.pdf 2 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # imperishable-wonderland 2 | 3 | An Imperishable Wonderland of Infinite Fun: 4 | A Relational View of Computation 5 | 6 | by 7 | William E. Byrd 8 | -------------------------------------------------------------------------------- /imperishable/Makefile: -------------------------------------------------------------------------------- 1 | BOOK=book 2 | 3 | all: 4 | pandoc -f markdown -t pdf ${BOOK}.md -o ${BOOK}.pdf 5 | 6 | squeaky: clean 7 | rm -f ${BOOK}.pdf 8 | -------------------------------------------------------------------------------- /imperishable/README.md: -------------------------------------------------------------------------------- 1 | # An Imperishable Wonderland of Infinite Fun: A Relational View of Computation 2 | 3 | This book is released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license (http://creativecommons.org/licenses/by/4.0/). The code accompanying this book is covered under the MIT license---please see the code for details. 4 | 5 | Creative Commons License
An Imperishable Wonderland of Infinite Fun: A Relational View of Computation by William E. Byrd is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/webyrd/imperishable-wonderland. 6 | 7 | Book file: `book.md` 8 | 9 | To typeset a PDF version of the book, just type `make` (assuming you have Pandoc installed). 10 | -------------------------------------------------------------------------------- /imperishable/book.md: -------------------------------------------------------------------------------- 1 | % An Imperishable Wonderland of Infinite Fun: A Relational View of Computation 2 | % William E. Byrd 3 | % March 13, 2024 4 | 5 | Copyright 2024 by William E. Byrd 6 | 7 | This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). (CC BY 4.0) 8 | 9 | # Introduction 10 | 11 | Welcome to the Wonderland! 12 | 13 | ## Imperishable! 14 | 15 | ### Such Wonderland! 16 | 17 | Yesss! 18 | 19 | [relational Scheme interpreter] 20 | 21 | [quines, twines, thrines] 22 | 23 | [generating twines using absento rather than =/=] 24 | 25 | [synthesizing quasiquote quines in micro-Scheme in Scheme in mk from ICFP 2017 pearl] 26 | 27 | [these interpreter examples but with a staged evaluator] 28 | 29 | [self-reps and viruses] 30 | 31 | [synthesizing omega as a small-step quine] 32 | 33 | [synthesizing combinatory logic terms, including for fixed point combinators] 34 | 35 | [synthesizing append from input/output examples, with and without eigens, etc.] 36 | 37 | [synthesizing append from associativity property + eigens] 38 | 39 | [dynamic scope vs. static/lexical scope and program synthesis, from ICFP 2017 pearl example --- synthesize a program that evaluates to different values under dynamic scope vs. lexical scope] 40 | 41 | [explicit handling of errors in relational interpreter and angelic execution via relational interpreter -- see Polyconf 2015] 42 | 43 | [incorrectness logic and the new two-sided sequent calculus type system stuff from POPL'24 --- implement relationally] 44 | 45 | [relational type inference and type inhabitation] 46 | 47 | [Matt Might's proof checker turned into a theorem prover via relational interpreter from ICFP 2017 pearl] 48 | 49 | [encoding negation via relational Scheme interpreter] 50 | 51 | [mini-in-mini for synthesis of mk relations and run expressions] 52 | 53 | [conjunction of deep + shallow embeddings of mk-in-mk to get improved performance from the shallow embedding but the improved expressiveness (`run*` instead of `run 1`) from the deep embedding] 54 | 55 | [relational exploration of the Chomsky Hierarchy] -------------------------------------------------------------------------------- /imperishable/macros.tex: -------------------------------------------------------------------------------- 1 | \def\wspace{\vspace{0.2cm}} 2 | -------------------------------------------------------------------------------- /perishable/confused-wills-big-list-of-things-hed-like-to-know-about-relational-programming/Makefile: -------------------------------------------------------------------------------- 1 | BOOK=book 2 | 3 | all: 4 | pandoc -f markdown -t pdf ${BOOK}.md -o ${BOOK}.pdf 5 | 6 | squeaky: clean 7 | rm -f ${BOOK}.pdf 8 | -------------------------------------------------------------------------------- /perishable/confused-wills-big-list-of-things-hed-like-to-know-about-relational-programming/README.md: -------------------------------------------------------------------------------- 1 | # Confused Will’s Big List of Things He’d Like to Know about Relational Programming 2 | 3 | This book is released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license (http://creativecommons.org/licenses/by/4.0/). The code accompanying this book is covered under the MIT license---please see the code for details. 4 | 5 | Creative Commons License
Confused Will’s Big List of Things He’d Like to Know about Relational Programming by William E. Byrd is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/webyrd/imperishable-wonderland. 6 | 7 | Book file: `book.md` 8 | 9 | To typeset a PDF version of the book, just type `make` (assuming you have Pandoc installed). 10 | -------------------------------------------------------------------------------- /perishable/confused-wills-big-list-of-things-hed-like-to-know-about-relational-programming/book.md: -------------------------------------------------------------------------------- 1 | % Confused Will’s Big List of Things He’d Like to Know about Relational Programming 2 | % William E. Byrd 3 | % March 22, 2024 4 | 5 | Copyright 2024 by William E. Byrd 6 | 7 | This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). (CC BY 4.0) 8 | 9 | # What is this book? 10 | 11 | This book describes questions related to relational programming and/or miniKanren that I am deeply curious about. I provide a high-level description of each question, explain why I think the problem is interesting, give examples and code when I can, point to related resources, and discuss possible approaches to making progress. 12 | 13 | # Why this book? 14 | 15 | I want to clearly describe the problems I consider most interesting and most pressing in relational programming, in the hope that a clear problem description and examples may help me and my collaborators make progress. Also, I hope these problems will inspire others, which will advance the state of relational programming further and faster than my colleagues and I could on our own. 16 | 17 | # The writing philosophy behind this book 18 | 19 | I want to record these problems quickly and simply, and provide enough details and resouces for someone familiar with miniKanren to easily get up to speed on the problems. 20 | 21 | # Who is the audience for this book? 22 | 23 | Anyone interested in understanding or pushing the state of the art in relational programming. I assume that the reader is familiar with the basics of miniKanren and relational programming, and is unafraid of experimentation. 24 | 25 | # Things I'd Like to Know about Relational Programming 26 | 27 | ## What are the connections between relational programming, reversible computing, program inversion, and bidirectional programming? 28 | 29 | ### Reversible computing and relational programming 30 | 31 | #### Robert's 'Reversible computing from a programming language perspective' paper in TCS 32 | 33 | * Reference [66] is to W. Kluge, 'A Reversible SE(M)CD machine', from 2000. Would a reversible machine like this, or reversible or hybrid reversible-relational techniques, allow us to handle small-step reduction, etc., without "disconnecting the wires"? 34 | 35 | * Implement RFUN, which is reference [118]. Also, look at Roshan and Amr's reversible language. What happens if these languages are implemented in miniKanren? What happens if miniKanren is implemented in these languages? Is it possible to do synthesis, do computation with partially-ground terms, etc.? 36 | 37 | * What would happen if you: 1) implemented a pure reversible language as a pure relation in miniKanren; 2) implemented pure miniKanren in a pure reversible language? Which properties, if any, would be "inherited" by such embeddings? What about relational-in-reversible-in-relational and reversible-in-relational-in-reversible, etc.? Could you collapse such towers? Stage the interpreters? 38 | 39 | * The paper mentions hybrid reversible-irreversible langauges. What would a hybrid reversible-relational language look like? Which sorts of programs could you write in such a language? 40 | 41 | * Implement a reversible pushdown automata -- something interesting must come out of this experiment! What are the connections and differences between a reversible pushdown automata and a relational reversible pushdown automata? 42 | 43 | * Has anyone implemented a full classical reversible gate or other reversible hardware, and actually measured the entropy/heat/etc.? What about for quantum computing? (I assume so for quantum, since Shor's algorithm has been implemented.) What is the relationship between D-Wave and quantum adiabatic computers and reversible computing? 44 | 45 | * What are good ways to think of procedure `uncalls` in reversible computing? This seems like a very unusual idea. Can we think of `call` and `uncall` in the Mercury sense, in which a relation has deterministic "forward" and "backward" modes, which are compiled into separate functions? Or is there a conceptual difference? 46 | 47 | * Is the restriction of not "overwriting" data automatically met in a pure functional program? Or does ignoring an input value in a recursive call (for example) violate this property just as well as mutation? 48 | 49 | * Can program inversion and reversible computing be used for synthesis in the miniKanren + relational interpreter manner? 50 | 51 | * What are the connections between `uncall` in reversible computing and `uneval` in NBE? 52 | 53 | * What exactly is `inverse interpretation` in reversible computing? 54 | 55 | * Footnote 4 on page 2: `(N, D)` languages seem very under-represented. Work exploring, including from a miniKanren/relational programming perspective. 56 | 57 | * The references contain many interesting sounding papers that involve Turing machines, Lisp, autoata, garbage collection, ALUs, etc. How many of these can be implemented in miniKanren? How many can be implemented on FPGA? 58 | 59 | ## Can techniques like those used in Alpha Go and Alpha Zero, such as Monte Carlo simulation and reinforcement learning, provide radical speedups for program synthesis and other relational queries? 60 | 61 | CPP'24 talk: claim of finding proof in 10^300 search space using Monte Carlo simulation + reinforcement learning [add link to video] 62 | 63 | [add link to neural-guided search paper from Neurips 2018] 64 | 65 | [add link to n-grams repo] 66 | 67 | ## How hard would it be to take relations expressed in Twelf/Coq/LambdaProlog, etc., and either extract miniKanren relations, or run the relations directly in those tools with more sophisticated search, etc.? 68 | 69 | These tools seem to *almost* go the entire way to relational programming; you write programs as relations, and the tools are based on some form of logic. However, these tools seem to miss the ability to run the resulting relations in a way that is useful for synthesis in the same way that the relational interpreter in miniKanren can be used for synthesis. 70 | 71 | It is possible to extract an executable OCaml program from Coq. Why not an executable relational program, perhaps in OCanren? 72 | 73 | Nada Amin has shown that it is possible to port the quine-generating relational interpreter from miniKanren to Twelf. And, apparently, the interpreter is nicer to write in Twelf, in at least some ways. However, apparently Twelf doesn't support a complete, interleaving search. Would it be possible to use the equivalent of a Prolog-style meta-interpreter in Twelf to change the default search? Or just implement the search monad? 74 | 75 | The CUP book describing LambdaProlog even gives a relational interpreter. I was fully expecting to see the interpreter synthesizing programs. Yet they only seem to run the program forward. They seem mostly concerned with the mechanized meta-theory uses of LambdaProlog (HOAS, implication, etc.), just like in Twelf. Fair enough. But, since they are already going to the trouble of writing their programs as relations in an expressive logic programming language, why not also support the ability to run these relations using a complete, interleaving search, or some other search strategy that permits program synthesis? 76 | 77 | ## Term subsumption, subsumption lattices, unification, anti-unification, and semi-unification. 78 | 79 | The notion of term subsumption comes up over and over again in logic programming. 80 | 81 | For terms `t` and `u`, `t` subsumes `u` iff there exists a substitution `s` such that: 82 | 83 | ``` 84 | s(t) = u 85 | ``` 86 | 87 | For example, `f(X,Y)` subsumes each of the terms `f(Z,Z)`, `f(a,Y)`, `f(X,b)`, and `f(a,b)`. 88 | 89 | If terms `t` and `u` subsume each other then `t` and `u` are the same, up to consistent renaming of logic variables. 90 | 91 | Subsumption can be viewed as a generalization of pattern matching, in which both sides can contain variables. 92 | 93 | In 1970 Plotkin pointed out that Robinson's 1965 unification algorithm can be seen as operating over terms in a lattice defined by term subsumption, augmented with `top` and `bottom` terms---'top' is a special 'variable' term that is more general than any other term in the lattice, and `bottom` is a special 'inconsistent' term. This "subsumption lattice" (as named by Plotkin) is a complete, non-modular lattice, where unification is the `meet` operation, and anti-unification is the `join` operation. 94 | 95 | [TODO create figure with examples, and make sure I have meet vs. join correct. Cite Plotkin and Reynolds papers from 1970/1971] 96 | 97 | For terms `t` and `u`, the unification problem asks if there exists a substitution `s` such that: 98 | ``` 99 | s(t) = s(u) 100 | ``` 101 | 102 | For terms `t` and `u`, the semi-unification problem asks if there exists substitutions `s` and `s'` such that: 103 | 104 | ``` 105 | s'(s(t)) = s(u) 106 | ``` 107 | 108 | (How to picture semi-unification in terms of lattice operations?) 109 | 110 | Unlike first-order syntactic unification, the general version of first-order syntactic semi-unification is undecidable, although there are interesting decidable fragments, such as ASUP and R-ASUP, which restruct the problem to acyclic variants. 111 | 112 | The notion of semi-unification comes up naturally in polymorphic type systems. For example, see Fritz Henglein's PhD dissertation. 113 | 114 | SWI-Prolog has a predicate called something like `subsumes_term/2`, which uses +/- modes on its arguments. Many times I've wanted a relational version of this operation. It seems like semi-unification might provide a relational variant of this constraint, but it seems too powerful. Can term subsumption be implemented directly as a relation/constraint? Why isn't this a standard relational constraint? Or is it a standard relational constraint in some systems, and I just haven't noticed? What are the decidability and computational complexity results for term subsumption as a relation/lazy constraint? Maybe I just need to implement `subsumeso` as a constraint, and see if I run into trouble. What is the relationship, if any, between terms subsumption and anti-unification? Between term subsumption and Prolog's `copy_term/2`? Between subsumption and the `templateo` constraint I played around with years ago? 115 | 116 | ## Sequent calculus confusion 117 | 118 | Is sequent calculus a better match for miniKanren implementation than natural deduction? 119 | 120 | What precisely is the relationship between sequent calculus and LambdaProlog? What is a Heriditary Harrop Formula, and how is it related to LambdaProlog and to the sequent calculus? 121 | 122 | ## Would implementing miniKanren constraints using constraint handling rules (CHR) make it easier to implement constraints? 123 | 124 | [TODO] 125 | 126 | ## Is there a nice way to compose constraints in a way that is sound? In particular, to allow multiple constraints to interact with each other for the same logic variable? Would types remove this issue entirely? 127 | 128 | [TODO] 129 | 130 | ## What would the equivalent of Chris Okasaki's 'Purely Functional Data Structures' book look like for relational programming? 131 | 132 | [TODO] 133 | 134 | ## Can we create purely relational meta interpreters? 135 | 136 | [TODO] 137 | 138 | ## Can we create purely relational abstract interpretation (perhaps involving tabling), and combine an abstract interpreter with a concrete interpreter in order to perform more interesting program synthesis? 139 | 140 | [TODO] 141 | 142 | ## What are the best ways to encode implication and universal quantification in miniKanren? 143 | 144 | [TODO] 145 | 146 | ## Can heterogenous towers of interpreters be collapsed? 147 | 148 | [TODO] 149 | 150 | ## Would integrating a SAT or SMT solver into miniKanren allow for more efficient solving than when calling out to an external solver? 151 | 152 | [TODO] 153 | 154 | ## Would implenting the Extended Andorra Model help us with conjunction in miniKanren? (from Michael Ballantyne) 155 | 156 | [TODO] 157 | 158 | ## Is there a relational, general version of `copy_term` from Prolog? 159 | 160 | [TODO] 161 | 162 | ## What is the best way to implement relational aggregate operations? 163 | 164 | [TODO] 165 | 166 | ## What are the tradeoffs inherent in encoding negation, aggregate operations, etc., via relational interpreter(s)? At what level of nesting of interpreters (if any) does the "useful" expressive power "level off"? 167 | 168 | [TODO] 169 | 170 | ## What is the semantic relationship between `append` in Scheme, `appendo` in miniKanren, and `append` in a relational Scheme interpreter in miniKanren? 171 | 172 | [TODO] 173 | 174 | ## Is it possible to combine a relational parser, a relational type inferencer or type checker, and a relational interpreter into a single program that can perform program synthesis without entering "generate and test"? 175 | 176 | [TODO] 177 | 178 | ## What exactly is going on in my experiment combining shallow and deep embeddings of miniKanren in miniKanren, where sharing fresh variables in the expression to be synthesized seems to combine the run* expressiveness with the efficienciency of a shallow embedding? How far can this be pushed? Is this behavior new, or has it been noticed before? Does this behavior occur in other contexts? 179 | 180 | [TODO] 181 | 182 | ## Is it possible to combine interpreters implementing operational semantics, axiomatic semantics, denotional semantics, etc., into a single program that can perform semantics-based synthesis and reasoning without entering "generate-and-test"? 183 | 184 | [TODO] 185 | 186 | ## Is it possible to efficiently generate fixpoint combinators in a manner similar to how we can generate quines? 187 | 188 | [TODO] 189 | 190 | ## Barliman interpreter -- properties (associativity) and eigen variables for synthesis specification, instead of just concrete input/output examples (PBE)? 191 | 192 | [TODO] 193 | 194 | ## Is it possible to make inherently small-step relations "fail fast"? 195 | 196 | CESK 197 | 198 | SKI -------------------------------------------------------------------------------- /perishable/cool-relational-programming-project-ideas/Makefile: -------------------------------------------------------------------------------- 1 | BOOK=book 2 | 3 | all: 4 | pandoc -f markdown -t pdf ${BOOK}.md -o ${BOOK}.pdf 5 | 6 | squeaky: clean 7 | rm -f ${BOOK}.pdf 8 | -------------------------------------------------------------------------------- /perishable/cool-relational-programming-project-ideas/README.md: -------------------------------------------------------------------------------- 1 | # Cool Relational Programming Project Ideas 2 | 3 | This book is released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license (http://creativecommons.org/licenses/by/4.0/). The code accompanying this book is covered under the MIT license---please see the code for details. 4 | 5 | Creative Commons License
Cool Relational Programming Project Ideas by William E. Byrd is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/webyrd/imperishable-wonderland. 6 | 7 | Book file: `book.md` 8 | 9 | To typeset a PDF version of the book, just type `make` (assuming you have Pandoc installed). 10 | -------------------------------------------------------------------------------- /perishable/cool-relational-programming-project-ideas/book.md: -------------------------------------------------------------------------------- 1 | % Cool Relational Programming Project Ideas 2 | % William E. Byrd 3 | % April 1, 2024 4 | 5 | Copyright 2024 by William E. Byrd 6 | 7 | This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). (CC BY 4.0) 8 | 9 | # What is this book? 10 | 11 | This book is a collection of projects related to miniKanren and/or relational programming that I think would be fun to hack on. 12 | 13 | # Why this book? 14 | 15 | I figure it would be helpful to me, and to others, to describe in some detail projects related to relational programming that I think are worth exploring. 16 | 17 | # The writing philosophy behind this book 18 | 19 | Whenever I have an idea for a juicy project, write it down! 20 | 21 | # Who is the audience for this book? 22 | 23 | Me! And anyone else who is interested in relational programming and/or miniKanren. 24 | 25 | # Cool Relational Programming Project Ideas 26 | 27 | ## Play with Gentzen systems, Hilbert systems, etc., in miniKanren. 28 | 29 | ### Implement sequent calculus, natural deduction, Hilbert-style system, and computability logic in miniKanren. 30 | 31 | I suspect CLP(Set) will be needed for sequent calculus, at least. 32 | 33 | If I recall correctly, either Hilbert-systems and/or natural deduction uses lists instead of sets. 34 | 35 | I think I'd learn a lot about automated theorem proving and logic by playing around with these systems. 36 | 37 | ### Implement 'Ill-Typed Programs Don't Evaluate' paper by Steven Ramsey and Charlie Walpole (POPL'24 London) 38 | 39 | Implement fully relationally in miniKanren the ill-typedness type system from this POPL'24 paper, which is expressed in the sequent calculus. The paper describes a "two-sided" type system: an expression that typechecks under the "normal" typing rules "will not go wrong"; an expression that typechecks under the "ill-typing system" "will not evaluate" (that is, when evaluated the expression will either signal an error or diverge/loop forever). 40 | 41 | Then, use this type system for a relational interpreter, to improve the ability to cut off parts of the search tree that are guaranteed to never be reachable according to the ill-typeness rules. 42 | 43 | ## Relational implementations of the systems in 'First-Order Logic and Automated Theorem Proving' 44 | 45 | Melvin Fitting's book, 'First-Order Logic and Automated Theorem Proving', is full of interesting logical systems, and techniques for automated theorem proving over those systems (for example, tableaux-based methods). The book includes Prolog code for at least a few of the ATP systems. The Prolog code looks pretty clean, although it doesn't appear to be completely relational at first glance. 46 | 47 | Implement these logics and ATP systems in miniKanren, purely relationally. This might include porting Prolog code, or skipping the Prolog code and just doing what makes the most sense in miniKanren (or alphaKanren, or whatever). 48 | 49 | ## Relational Prolog interpreter 50 | 51 | It is a pain to translate Prolog programs to miniKanren, especially since Prolog programs tend to contain a mixture of pure and impure logical operations. Sidestep the issue by just implementing an interpreter for Prolog, cuts and all, as a miniKanren relation. Ideally would support `copy_term`, `!` (cut), `call`, etc. Stage the interpreter for improved performance in some cases. 52 | 53 | This interpreter would, in some ways, be similar in spirit to mk-in-mk. You'd be able to do many of the same types of synthesis problems. 54 | 55 | This interpreter would also explore how the "relational interpreter" encoding can be used to deal with impure operations, or operations that are tricky or awkware or error-prone to encode relationally in pure miniKanren. For example, one way to translate Scheme's `cond` or Scheme's `not` or pattern matching to the miniKanren setting is to just write a relational Scheme interpreter that includes those operations. Similarly, one way to deal with the impure operators in Prolog would be to just run the impure Prolog program in a pure implementation of a Prolog interpreter in miniKanren. 56 | 57 | ## Prolog -> miniKanren compiler 58 | 59 | Write a compiler for Prolog, including impure operations, to miniKanren, using only pure relational miniKanren operations. 60 | 61 | Could also write a compiler that compiles to mk with impure operations like `conda`, `condu`, `project`, etc. A person could then hand-massage the resulting impure mk program to make it as relational as desired. 62 | 63 | Both compilers could be useful and interesting, although of course I strongly prefer the first version! 64 | 65 | ## Create a catalog of Prolog-to-miniKanren transformations, including for impure Prolog operations/idioms to pure miniKanren operations/idioms. 66 | 67 | Similar to correctness-preserving transformations that Dan Friedman teaches in C311, but for turning nasty impure Prolog code into beautiful relations mk code! :P 68 | -------------------------------------------------------------------------------- /perishable/how-I-think-about-relational-programming/Makefile: -------------------------------------------------------------------------------- 1 | BOOK=book 2 | 3 | all: 4 | pandoc -f markdown -t pdf ${BOOK}.md -o ${BOOK}.pdf 5 | 6 | squeaky: clean 7 | rm -f ${BOOK}.pdf 8 | -------------------------------------------------------------------------------- /perishable/how-I-think-about-relational-programming/README.md: -------------------------------------------------------------------------------- 1 | # How I Think About Relational Programming 2 | 3 | This book is released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license (http://creativecommons.org/licenses/by/4.0/). The code accompanying this book is covered under the MIT license---please see the code for details. 4 | 5 | Creative Commons License
How I Think About Relational Programming by William E. Byrd is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/webyrd/imperishable-wonderland. 6 | 7 | Book file: `book.md` 8 | 9 | To typeset a PDF version of the book, just type `make` (assuming you have Pandoc installed). 10 | -------------------------------------------------------------------------------- /perishable/how-I-think-about-relational-programming/book.md: -------------------------------------------------------------------------------- 1 | % How I Think About Relational Programming 2 | % William E. Byrd 3 | % March 27, 2024 4 | 5 | Copyright 2024 by William E. Byrd 6 | 7 | This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). (CC BY 4.0) 8 | 9 | # What is this book? 10 | 11 | An attempt to describe some of my mental models for thinking about relational programming, especially in the context of miniKanren and its variants. 12 | 13 | # Why this book? 14 | 15 | The topic of how an experienced relational programmer/miniKanren programmer and researcher thinks about the relational paradigm seems to me to be worthy of its own short book, especially since discussion of the mental models I have developed over time, or that I have learned from others, feels different in character than a book or paper on the techniques of relational programming, or the features of miniKanren, or what-have-you. 16 | 17 | # The writing philosophy behind this book 18 | 19 | I'd like to keep the book short, and focused on mental models. 20 | 21 | # Who is the audience for this book? 22 | 23 | Anyone interested in a higher-level conceptual understanding of miniKanren and relational programming. 24 | 25 | # Introduction --- How I think about relational programming 26 | 27 | [TODO] 28 | 29 | # Table metaphor for mk/relational programming. 30 | 31 | A common way to represent data is as a *table*. For example, we can represent addition of two integers `x` and `y`, each of which is an integer between 0 and 3 inclusive, and whose sum is the integer `z`, as the table: 32 | 33 | +---+---+---+ 34 | | x | y | z | 35 | +===+===+===+ 36 | | 0 | 0 | 0 | 37 | +---+---+---+ 38 | | 0 | 1 | 1 | 39 | +---+---+---+ 40 | | 0 | 2 | 2 | 41 | +---+---+---+ 42 | | 0 | 3 | 3 | 43 | +---+---+---+ 44 | | 1 | 0 | 1 | 45 | +---+---+---+ 46 | | 1 | 1 | 2 | 47 | +---+---+---+ 48 | | 1 | 2 | 3 | 49 | +---+---+---+ 50 | | 1 | 3 | 4 | 51 | +---+---+---+ 52 | | 2 | 0 | 2 | 53 | +---+---+---+ 54 | | 2 | 1 | 3 | 55 | +---+---+---+ 56 | | 2 | 2 | 4 | 57 | +---+---+---+ 58 | | 2 | 3 | 5 | 59 | +---+---+---+ 60 | | 3 | 0 | 3 | 61 | +---+---+---+ 62 | | 3 | 1 | 4 | 63 | +---+---+---+ 64 | | 3 | 2 | 5 | 65 | +---+---+---+ 66 | | 3 | 3 | 6 | 67 | +---+---+---+ 68 | 69 | [TODO figure out how tables work in the Pandoc Markdown extension] 70 | 71 | [lookup table --- can perform addition by finding the table entry with the desired values of `x` and `y`.] 72 | 73 | [can perform subtraction in the same manner! don't need to construct a new table --- just need to use the existing table slightly differently] 74 | 75 | [more generally, can use the table to find solutions to the equation/relation `x + y = z`] 76 | [like algebra --- solve for `x`, etc.] 77 | [for a given `z`, can solve for unknown `x` and `y`, which will have multiple solutions] 78 | 79 | [the table need not be finite! Can allow `x`, `y`, and `z` to be natural numbers, for example] 80 | We can represent addition of two natural numbers (non-negative integers) `x` and `y`, whose sum is the natural number `z`, as the table: 81 | 82 | +---+---+---+ 83 | | x | y | z | 84 | +===+===+===+ 85 | | 0 | 0 | 0 | 86 | +---+---+---+ 87 | | 0 | 1 | 1 | 88 | +---+---+---+ 89 | | 0 | 2 | 2 | 90 | +---+---+---+ 91 | | 0 | 3 | 3 | 92 | +---+---+---+ 93 | |... | 94 | +---+---+---+ 95 | | 1 | 0 | 1 | 96 | +---+---+---+ 97 | | 1 | 1 | 2 | 98 | +---+---+---+ 99 | | 1 | 2 | 3 | 100 | +---+---+---+ 101 | | 1 | 3 | 4 | 102 | +---+---+---+ 103 | |... | 104 | +---+---+---+ 105 | | 2 | 0 | 2 | 106 | +---+---+---+ 107 | | 2 | 1 | 3 | 108 | +---+---+---+ 109 | | 2 | 2 | 4 | 110 | +---+---+---+ 111 | | 2 | 3 | 5 | 112 | +---+---+---+ 113 | |... | 114 | +---+---+---+ 115 | | 3 | 0 | 3 | 116 | +---+---+---+ 117 | | 3 | 1 | 4 | 118 | +---+---+---+ 119 | | 3 | 2 | 5 | 120 | +---+---+---+ 121 | | 3 | 3 | 6 | 122 | +---+---+---+ 123 | |... | 124 | +---+---+---+ 125 | 126 | [infinite table --- can't write it down completely, since we'd never finish; we need to be *lazy*, and avoid generating the entire table before producing a result] 127 | 128 | [not only can have multiple solutions, but can have *infinitely many* solutions; we need to avoid asking for all the solutions when there are infinitely many, unless we can also be lazy in handling the potentially infinite *stream* of solutions] 129 | 130 | [DFS won't find all solutions] 131 | 132 | [need for complete search] 133 | 134 | # Invariants 135 | 136 | An *invariant* is a property that always holds (it never varies, hence the name). A famous invariant from physics is the speed of light in a vacuum, *c*, which is always 299,792,458 meters per second. Invariants allow for powerful forms of reasoning---for example, the consequences of special relativity are intimately connected to the invariance of the speed of light (or more generally, the speed of causality). 137 | 138 | Invariants also allow for powerful forms of reasoning in logic, and in logic programming. miniKanren programmers encounter invariants in at least three forms: (1) invariants guaranteed by the miniKanren implementation; (2) invariants guaranteed by a relation written in miniKanren; and (3) invariants that the programmer must be careful to maintain, at the risk of the resulting computation exhibiting unsound behavior (such as returning incorrect answers, or a `run*` query terminating without producing every correct answer). 139 | 140 | ## Invariants guaranteed by the miniKanren implementation 141 | 142 | [reification of answers 143 | 144 | faster-miniKanren: `(=/= (_.0 _.1))` vs. `(=/= (_.1 _.0))`] 145 | 146 | ## Invariants guaranteed by a relation written in miniKanren 147 | 148 | ## Invariants that the programmer must maintain 149 | 150 | ["Oleg numerals" used in the purely relational arithmetic system described in chapters 7 and 8 of (both editions) of *The Reasoned Schemer*, and in a FLOPS paper [cite] --- every non-negative integer has a unique representation as an Oleg numeral (a little-endian binary list). For example, the unique representation for zero is the empty list `()`, the unique representation of one is `(1)`, and the unique representation of two is `(0 1)`. When using the relational arithmetic system, the programmer must maintain the invariant that no list representing an Oleg numeral may contain a `0` as its most significant digit. For example, this `run 1` expression maintains the invariant on Oleg numerals: 151 | 152 | ``` 153 | (run 1 (n-squared) 154 | (fresh (x) 155 | (== `(0 . ,x) n) 156 | (*o n n n-squared))) 157 | ``` 158 | 159 | However, this `run 1` expression violates the invariant, since `n` is `(0 . ())`---equivalent to `(0)`---which is a list representing an Oleg numeral in which `0` is the most significant digit. 160 | 161 | ``` 162 | (run 1 (n-squared) 163 | (fresh (x) 164 | (== `(0 . ,x) n) 165 | (== '() x) 166 | (*o n n n-squared))) 167 | ``` 168 | 169 | The `*o` relation---along the other relations in the purely relational arithmetic system---was carefully designed to take advantage of the invariant that each non-negative number has a unique representation as an Oleg numeral. If the `*o` relation is called with terms that invariant this constraint, `*o` may produce incorrect results. The `*o` relation maintains the invariant with respect to legal Oleg numerals; however, it does not check that the arguments passed to it are legal Oleg numerals. It is your responsibility as a user of the relational arithmetic system to ensure you maintain the invariant. 170 | 171 | ] 172 | 173 | [alphaKanren --- the first argument to `tie` or to `hash` must be a nom/atom] 174 | 175 | # Logic programming vs. constraint programming vs. constraint logic programming vs. functional programming vs. functional logic programming vs. relational programming. 176 | 177 | # How to think about what a `run` means, how to interpret the answers produced, etc. 178 | 179 | [TODO] 180 | 181 | # A modern view of unification in logic programming. 182 | 183 | [TODO] 184 | 185 | # Is relational programming better done in Prolog? 186 | 187 | [TODO] 188 | 189 | # Types and relational programming? 190 | 191 | [TODO] 192 | 193 | # How to think about `==` and `=/=`. 194 | 195 | [TODO] 196 | 197 | # Confusion people have with `=/=`. 198 | 199 | [TODO] 200 | 201 | # How to think about `absento`. 202 | 203 | [TODO] 204 | 205 | # Confusion people have about `absento`. 206 | 207 | # Why program relationally? 208 | 209 | [TODO] 210 | 211 | # Purity --- friend or foe? 212 | 213 | [TODO] 214 | 215 | # Constraints and consistency/inconsistency + many worlds interpretation---OS process metaphor. 216 | 217 | [TODO] 218 | 219 | # Dan Friedman -- search strategy as an OS scheduling independent processes; complete search means that processes that don't diverge will run to completion, given enough time and memory. 220 | 221 | [TODO] 222 | 223 | # properties/desiderata of `run`, mk goals, etc. 224 | 225 | [program slicing in that online Prolog book] 226 | 227 | # When to design and implement a new constraint 228 | 229 | [TODO] 230 | 231 | # Performance 232 | 233 | [TODO] 234 | 235 | # Data representation 236 | 237 | [TODO] 238 | 239 | # Laziness 240 | 241 | [TODO] 242 | 243 | # Motivation for mk constraints. 244 | 245 | [TODO] 246 | 247 | # Connection with SQL, etc. 248 | 249 | [`Simply Logical` -- very nice and readable book on logic programming with the SQL analogies in the last few chapter] 250 | -------------------------------------------------------------------------------- /perishable/images/contents.txt: -------------------------------------------------------------------------------- 1 | Description of the contents of the images in this directory. 2 | 3 | `playing_with_titles_old.jpg`: JPEG image of a 3 inch by 5 inch index card, creased and with a coffee stain in the middle, containing one of the many titles I considered for this project months ago, in purple ink that has been slightly smeared in one spot from water. The text on the card says: 'Imperishable Wonderland of Infinite Fun: Voyages in the Relational Universe'. 4 | -------------------------------------------------------------------------------- /perishable/images/playing_with_titles_old.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webyrd/imperishable-wonderland/e12923f681da453f0d72d72ddbf4430596f51448/perishable/images/playing_with_titles_old.jpg -------------------------------------------------------------------------------- /perishable/topics.txt: -------------------------------------------------------------------------------- 1 | # Major 'Arcs' (in the manga/anime sense) 2 | 3 | The Most Beautiful Program Ever Written (extensions, including errors and angelic execution, delimited control/effect handlers, store-passing style, mutation, call-by-value vs. call-by-name vs. call-by-need vs. call-by-push-value, etc.) 4 | cool-relational-interpreter-examples 5 | Fun, interesting, and thought-provoking examples of relational Scheme interpreters at work. 6 | https://github.com/webyrd/cool-relational-interpreter-examples 7 | Grab examples from Barliman repo, and from Clojure.conj talk with Greg in Austin 8 | relational-interpreter-with-set-bang 9 | Relational Scheme interpreter, written in miniKanren, with set!, and supporting different evaluation orders. 10 | https://github.com/webyrd/relational-interpreter-with-set-bang 11 | Error-handling relational interpreter: 12 | https://github.com/webyrd/error-handling-relational-interpreter 13 | ICFP 2017 and SW 2012 papers 14 | PolyConf 2015 talk and workshop 15 | Look at staged-mk examples 16 | * Explore 3D code and quoted procedures in the relational interpreter 17 | 18 | Explore the strange-looking behavior of shallow and deep embedding of the same language for mk-in-mk, and how combining both interpreters in one query sharing logic variables representing the same program can result in increased expressive power (deep embedding giving run* semantics rather than run 1 semantics), but with efficiency closer to that of the shallow embedding. (see my mk-in-mk experiments with these two interps--which repo is that in, again?) 19 | What other behaviors in which we perform a conjunction of multiple interpreters for the same or similar languages, sharing fresh logic variables, seem interesting in a similar way, or which might shine light on this behavior? 20 | * Dynamic vs. lexical scope interpreters in 2017 ICFP Pearl 21 | * Generation of simple multi-language quines using relational interpreters for two Scheme-like languages. (https://github.com/webyrd/multi-quine) 22 | Is this (or similar) behavior(s) seen in other contexts? 23 | 24 | describe challenges, such as relational set_of, relational copy_term, small-step with fail-fast behavior, commutative conjunction, dealing with errors/exceptions, dealing with negative information, etc., -- descibe common themese, challenges, approaches, tradeoffs in relational programming/miniKanren 25 | 26 | The challenges of conjunction 27 | revisit cartesian-evalo: Cartesian product of multiple evalos 28 | https://github.com/webyrd/cartesian-evalo 29 | 30 | 300 Orders of Magnitude or Bust! (Based on a CPP'24 talk showing Monte Carlo simulation + reinforcement learning applied to automated theorem proving finding a proof in a search tree with a branching factor of 10, at a depth of 300, equivalent to finding a solution in a search space of 10^300 (or so it is claimed). I want the equivalent, or better, for search in miniKanren, for the relational Scheme interpreter and other relational programs.) 31 | 32 | Build Your Own Barliman 33 | 34 | A Course of Instruction in Programming Languages, Relational Style (interpreters, type checkers/inferencers, semantics, computability theory, proof checkers, automated theorem provers, compilers, etc., all explored from a relational point of view; think of ideas found in EoPL, TAPL, SICP, TLS, Sipser, Nilson and Nilson semantics book, , relational style) 35 | 36 | mk meets modern machine learning, neural nets, LLMs, etc. 37 | 38 | AM, Eurisko, BAT, Doyle, Advice Taker, etc., in mk 39 | 40 | virtual Scheme student in mk 41 | 42 | # Assorted topics (some of these may be promoted to Arcs, and moved above) 43 | 44 | TODO go through Untitled Relational Interpreter Book outlines and LaTeX and readme 45 | https://github.com/webyrd/untitled-relational-interpreter-book 46 | 47 | TODO go through my 2014 Lambda Lounge Utah talk repo -- cKanren, finite automata and state machines, etc. https://github.com/webyrd/lambda-lounge-utah-mk-talk 48 | 49 | TODO go through 2014 miniKanren-uncourse repo 50 | https://github.com/webyrd/miniKanren-uncourse 51 | 52 | TODO go through 2014 SL talk, inclusing `mathy-stuff.pdf` (https://github.com/webyrd/Strange-Loop-2014/blob/master/mathy-stuff.pdf) https://github.com/webyrd/Strange-Loop-2014. I have more expansive equivalents to mathy stuff. mathy stuff is also a good way to explain how to read judgements, how one might think about judgements, how to implement them in mk, etc. 53 | 54 | TODO watch Clojure/conj talk with Nada Amin: From Greek to Clojure 55 | 56 | TODO go through all my repos, as well 57 | 58 | TODO look at mk Workshop papers 59 | 60 | TODO look at draft papers, my private repos, TiddlyWiki, etc. Some of this will have to be off-camera. 61 | 62 | TODO create annotated bibliography of mk-related and relational books and papers and talks or whatever 63 | 64 | How I think about mk 65 | how to think about what a `run` means, how to interpret the answers produced, etc. 66 | how to think about `==` and `=/=` 67 | Confusion people have with `=/=`. 68 | constraints and consistency/inconsistency + many worlds interpretation---OS process metaphor 69 | Dan Friedman -- search strategy as an OS scheduling independent processes; complete search means that processes that don't diverge will run to completion, given enough time and memory 70 | properties/desiderata of `run`, mk goals, etc. 71 | Motivation for mk constraints. 72 | Table metaphor for mk. 73 | Debugging 74 | Connection with SQL, etc. 75 | 76 | what can mk learn from core.logic and OCanren? 77 | 78 | ** MarkovJunior looks super cool. I suspect there is a way to combine this with mk ** 79 | MarkovJunior is a probabilistic programming language where programs are combinations of rewrite rules and inference is performed via constraint propagation. MarkovJunior is named after mathematician Andrey Andreyevich Markov, who defined and studied what is now called Markov algorithms. https://github.com/mxgmn/MarkovJunior 80 | 81 | relational LL parsing, LALR parsing, etc. 82 | Post tag systems 83 | 84 | sokuza-kanren in miniKanren 85 | http://okmij.org/ftp/Scheme/sokuza-kanren.scm 86 | 87 | explore Recursive miniKanren by Hirotaka Niitsuma, which produces answers for some queries that would otherwise fail or diverge (I'm not sure which) due to their recursive nature. (Is this similar to rational infinite trees in Prolog II?) 88 | https://github.com/niitsuma/Racket-miniKanren/tree/recursive 89 | https://niitsuma.hatenadiary.org/entry/20081113/1372410009 90 | 91 | explore sKanren: A multi-threaded cKanren with fair conj 92 | https://github.com/mio-19/sKanren 93 | 94 | explore 'Datalog in minikanren' 95 | https://github.com/rntz/minikanren-datalog 96 | 97 | explore DataFun from a relational perspective 98 | https://github.com/rntz/datafun 99 | and fixflow 100 | https://github.com/rntz/fixflow 101 | Investigating recursive dataflow for computing fixed points 102 | 103 | explore roxanren: An experimental fusion of miniKanren and Rosette. 104 | https://github.com/femtomc/roxanren 105 | 106 | explore async-mu-kanren: Proof-of-concept implementation of muKanren using CSP (core.async) 107 | https://github.com/halgari/async-mu-kanren 108 | 109 | explore HaskellKanren 110 | HaskellKanren is an implementation of the Kanren language described in Daniel P. Friedman, William Byrd, and Oleg Kiselyov's The Reasoned Schemer (MIT Press, 2005). This project was created as the final project for Amr Sabry's CSCI-B490 Advanced Functional Programming course by Carlo Angiuli, Adam Foltzer, and Jaimie Murdock. 111 | https://github.com/JaimieMurdock/HK 112 | 113 | explore 114 | HOuKanren 115 | A twist to uKanren to support Higher-Order Relational Programming. 116 | https://github.com/kyagrd/houkanren 117 | 118 | explore lambdaKanren 119 | https://icfp20.sigplan.org/details/minikanren-2020-papers/7/-Kanren-Higher-order-Logic-Programming-with-Shallow-Embedding 120 | 121 | explore kanrenLight (in HOL Light), which looks very fancy indeed 122 | https://github.com/massimo-nocentini/kanren-light 123 | 124 | explore mk in Idris: 125 | idris-microKanren 126 | Simple microKanren implementation in Idris. Translated from Michael Sullivan's Haskell implementation. 127 | https://github.com/joom/idris-microKanren 128 | 129 | explore mk in J 130 | https://github.com/Rscho314/mk 131 | 132 | explore mk in Javascript with visualization 133 | JavaScript 134 | veneer http://tca.github.io/veneer/editor.html 135 | Browser based miniKanren editor and REPL, with constraints. 136 | GitHub repo https://github.com/tca/veneer 137 | microScopeKanren https://github.com/asolove/microScopeKanren 138 | A JavaScript implementation of microKanren with a focus on inspecting programs as they run. 139 | Example, vizualizing appendo https://www.adamsolove.com/microScopeKanren/ 140 | mu-kanren http://functorial.com/mu-kanren/ 141 | A step-by-step MicroKanren evaluator. 142 | GitHub repo https://github.com/paf31/mu-kanren 143 | 144 | explore LilKanren in Julia 145 | Welcome to lilinjn's[1] Institute for Search Research! 146 | https://github.com/habemus-papadum/LilKanren.jl 147 | 148 | explore the very interesting looking LogikalDB Foundational reactive logical database in Kotlin 149 | https://github.com/MechaRex/logikaldb 150 | 151 | explore Mímir 152 | https://github.com/hraberg/mimir/blob/master/README.md 153 | 154 | explore latticeKanren: Demo of lattice-based constraint logic programming (ML) 155 | https://github.com/eupp/LatticeKanren 156 | 157 | explore Moxy (Moxie?) kanren 158 | https://github.com/rntz/moxy/blob/master/kanren.mox 159 | 160 | explore MiniKanren in Lisp in Prolog. Accompanies the Technical Interview 161 | https://aphyr.com/posts/354-unifying-the-technical-interview 162 | https://gist.github.com/aphyr/4d41e7655b10a68e753f729bdc1c5a6d 163 | 164 | revisit Scalagno 165 | https://github.com/namin/scalogno 166 | 167 | explore Shen miniKanren: 168 | shen-minikanren 169 | https://github.com/mthom/shen-minikanren 170 | 171 | explore SmallKanren: Logic Programming in Pharo Smalltalk 172 | https://github.com/emdonahue/SmallKanren 173 | 174 | LINCOS universal language for communication, which can describe itself, relational style 175 | (similarly for Jake Beal's work under GJS) 176 | 177 | interesting looking mk variants on miniKanren.org website: 178 | * microKanren with temporal logic programming (https://github.com/nathanielrb/ftmicroKanren) 179 | Related to an earlier, similar implementation (https://github.com/nathanielrb/tmicroKanren) 180 | * microKanren implementation using Martelli-Montanari unification algorithm 181 | (404) 182 | * semiKanren 183 | Logic programming using semiunification for R-ASUP instances (404 error) 184 | * rKanren 185 | Cameron Swords and Daniel P. Friedman. 186 | rKanren: Guided Search in miniKanren. 187 | https://github.com/cgswords/rkanren 188 | * rank-Kanren 189 | Why rank is important? 190 | The parametrization is beneficial if we want to take advantage of differentiable programming to guide the search strategies. Think of Deep Neural Networks that are trained to generate appropriate ranks based on a fixed given puzzle. You can play with sudoku example using the included jar file. 191 | https://github.com/azarafrooz/rank-Kanren 192 | * CLP(SMT) Kanren 193 | https://github.com/namin/clpsmt-miniKanren 194 | * staged miniKanren 195 | explorations of multi-stage logic programming in miniKanren 196 | https://github.com/namin/staged-miniKanren 197 | * staticKanren 198 | A variant of miniKanren which returns better answers. The documentation is here: https://github.com/lackhoa/Thesis/blob/master/Thesis.pdf 199 | Khoa Vo 200 | Relational conditionals with pseudo-functions \else Firewall analysis assistant in miniKanren: Techniques in miniKanren 201 | https://github.com/lackhoa/staticKanren 202 | 203 | projects using mk or whatever to revisit: 204 | * minimips 205 | minikanren mips assembler/disassembler 206 | https://github.com/orchid-hybrid/minimips 207 | * mk rewrite completion 208 | This project contains source for reports and code researching the use of term rewriting algorithms and considerations (e.g. Knuth-Bendix) in miniKanren. 209 | https://github.com/brandonwillard/mk-rewrite-completion 210 | * Relational Lsplines: Relational logic programming and form parameter design (Relational Ship Hull Geometric Design Generation) 211 | https://github.com/LukeMcCulloch/feasible-form-parameter-design 212 | * Mkanren automata in mk 213 | https://github.com/bboskin/Mkanren 214 | * A Relational SKI Combinator Calculus Interpreter 215 | (compare with my efforts) 216 | https://github.com/jpt4/skio 217 | * kibit: There's a function for that! 218 | kibit is a static code analyzer for Clojure, ClojureScript, cljx and other Clojure variants. It uses core.logic to search for patterns of code that could be rewritten with a more idiomatic function or macro. For example if kibit finds the code 219 | https://github.com/clj-commons/kibit 220 | * expresso: A clojure library for symbolic manipulation of Algebraic Expressions. 221 | https://github.com/clojure-numerics/expresso?tab=readme-ov-file 222 | 223 | Papers to revisit 224 | * Molly Q Feldman, Yiting Wang, William E. Byrd, François Guimbretière, and Erik Andersen. 225 | Towards Answering "Am I On the Right Track?" Automatically using Program Synthesis. 226 | In SPLASH-E 2019. 227 | https://www.feldmanmolly.com/splashe2019.html 228 | https://www.feldmanmolly.com/splashe2019.pdf 229 | * Lisa Zhang, Gregory Rosenblatt, Ethan Fetaya, Renjie Liao, William E. Byrd, Matthew Might, Raquel Urtasun, and Richard Zemel. 230 | Neural Guided Constraint Logic Programming for Program Synthesis. 231 | In Advances in Neural Information Processing Systems 31 (NeurIPS 2018), 2018. 232 | Paper and poster 233 | Full proceedings 234 | https://neurips.cc/Conferences/2018/Schedule?showEvent=11187 235 | * Peter Kourzanov 236 | Bidirectional parsing: a functional/logic perspective 237 | In 2014 International Symposium on Implementation and Application of Functional Language (IFL 2014), Boston, MA, October, 2014. 238 | https://ifl2014.github.io/submissions/ifl2014_submission_18.pdf 239 | * Daniel Brady, Jason Hemann and Daniel P. Friedman 240 | Little Languages for Relational Programming. 241 | In Proceedings of the 2014 Workshop on Scheme and Functional Programming (Scheme '14), Washington, DC, 2014. 242 | Complete source code (Scheme) 243 | https://github.com/dabrady/LittleLogicLangs 244 | https://www.schemeworkshop.org/2014/papers/Brady2014.pdf 245 | * Erik Wennstrom 246 | Tableau-Based Model Generation for Relational Syllogistic Logics. 247 | In Proceedings of the 2014 International Symposium on Artificial Intelligence and Mathematics (ISAIM 2014), Fort Lauderdale, FL, January, 2014. 248 | * Cameron Swords and Daniel P. Friedman. 249 | rKanren: Guided Search in miniKanren. 250 | In Proceedings of the 2013 Workshop on Scheme and Functional Programming (Scheme '13), Alexandria, VA, 2013. 251 | Complete source code (Scheme) 252 | http://webyrd.net/scheme-2013/papers/Swords2013.pdf 253 | https://github.com/cgswords/rkanren 254 | * Claire E. Alvis, Jeremiah J. Willcock, Kyle M. Carter, William E. Byrd, and Daniel P. Friedman. 255 | cKanren: miniKanren with Constraints. 256 | In Proceedings of the 2011 Workshop on Scheme and Functional Programming (Scheme '11), Portland, OR, 2011. 257 | Complete source code (R6RS Scheme) 258 | https://www.schemeworkshop.org/2011/papers/Alvis2011.pdf 259 | https://github.com/calvis/cKanren 260 | Complete source code (R6RS Scheme) 261 | * Ramana Kumar and Michael Norrish 262 | (Nominal) unification by recursive descent with triangular substitutions 263 | In Proceedings of the First international conference on Interactive Theorem Proving (ITP'10), 264 | Springer-Verlag Berlin, pp. 51-66, 2010. 265 | https://trustworthy.systems/publications/nicta_full_text/3724.pdf 266 | * Joseph P. Near, William E. Byrd and Daniel P. Friedman. 267 | alphaleanTAP: A Declarative Theorem Prover for First-Order Classical Logic. 268 | In Proceedings of the 24th International Conference on Logic Programming (ICLP 2008), 269 | LNCS vol. 5366, Springer-Verlag, Heidelberg, pp. 238-252, 2008. 270 | Complete source code--R6RS Scheme and Prolog (.zip file) 271 | http://webyrd.net/alphaleantap/alphatap.pdf 272 | http://webyrd.net/alphaleantap/alphaleanTAP.zip 273 | * Oleg Kiselyov, William E. Byrd, Daniel P. Friedman and Chung-chieh Shan 274 | Pure, declarative, and constructive arithmetic relations (declarative pearl). 275 | In Proceedings of the 9th International Symposium on Functional and Logic Programming, 276 | ed. Jacques Garrigue and Manuel Hermenegildo, pp. 64-80. 277 | LNCS vol. 4989, Springer, 2008. 278 | http://webyrd.net/arithm/arithm.pdf 279 | * William E. Byrd and Daniel P. Friedman 280 | alphaKanren: A Fresh Name in Nominal Logic Programming. 281 | In Proceedings of the 2007 Workshop on Scheme and Functional Programming, 282 | Universite Laval Technical Report DIUL-RT-0701, pp. 79-90. 283 | Authors' revised version (recommended) 284 | Revised source code (R5RS Scheme) 285 | http://webyrd.net/alphamk/alphamk_workshop.pdf 286 | http://webyrd.net/alphamk/alphamk.pdf 287 | https://github.com/webyrd/alphaKanren 288 | * 289 | 290 | Logic programming approaches of different expressive power, and with different semantics (especially regarding negation), termination guarantees, and complexity classes. Explore the mk equivalents as well. 291 | * Prolog 292 | * Datalog 293 | * Answer Set Programming 294 | 295 | negation and all that 296 | * negation as failure 297 | * the Clark completion (spelling?) 298 | * conda and condu 299 | * the g-rule 300 | * the problems 301 | * stratified negation 302 | * ASP notion of negation and stable model semantics 303 | * explicit encoding of constructive negation by writing a `not-` relation as a counterpoint to your "positive" `fooo` relation 304 | * encoding negative information through the relational Scheme interpreter: failure to pattern match, `not` as a Scheme predicate, etc. What is the power, expressiveness, complexity, etc.? To what extent can staging the interpreter and other techniques reduce the overhead? 305 | 306 | different ways to go from Scheme to miniKanren: 307 | * hand-transformation 308 | * compile 309 | * Scheme interpeter in mk 310 | 311 | different ways to implement miniKanren: 312 | * abstract machine 313 | * deep embedding 314 | * shallow embedding 315 | * interpreter 316 | * compiler 317 | * FPGA 318 | * ASIC 319 | 320 | macros and miniKanren: 321 | * a basic intro to Scheme macros 322 | * macros in context, including how to use macros effectively: 323 | ** how the macros in miniKanren work 324 | ** alternative interfaces to miniKanren 325 | *** `defrel` 326 | *** alternative `run` interfaces 327 | ** writing various test macros 328 | 329 | how to debug miniKanren programs 330 | * causes of divergence 331 | * causes of failure 332 | * causes of unexpected behavior 333 | * standard 'gotchas' 334 | * `run 1` vs. `run *` 335 | * running a relation with all variables fresh 336 | 337 | program transformations, from a relational perspective: 338 | * transformations of relational programs 339 | * transformations implemented relationally 340 | 341 | What makes a program relational? What does that mean? How can you tell if a program is relational? 342 | 343 | set_of, bag_of, and relationality/non-relationality of 344 | stratified queries 345 | mk-in-mk as an approach to stratified queries (for how many levels deep do you keep getting expressive power? **) ** 346 | 347 | can we do relational copy_term through mk-in-mk, of through Scheme in mk?!?! ** 348 | 349 | How to translate a Prolog program to miniKanren. How to deal with the nasty bits of Prolog that aren't relational 350 | 351 | How to deal with the nasty bits of a Scheme program you want to translate to miniKanren 352 | 353 | How to take an academic CS/PL paper and translate the rules to miniKanren, and play with those rules 354 | 355 | how to deal with scope and binding: environments, De Bruijn, locally nameless, combinatory logic, nominal unification/equivariant unification, HOAS, nominal sets, etc. 356 | 357 | How to get mk to not just generate similar "boring" answers when performing synthesis (lots of ways to attempt this) 358 | 359 | standard synthesis techniques + trying to apply them to mk synthesis (for example, canonical versions of expressions, per-hole type or grammar restrictions, etc. 360 | 361 | explore miniKanren-coq: A certified semantics for relational programming workout. 362 | https://github.com/dboulytchev/miniKanren-coq 363 | 364 | explore crystal-kanren 365 | https://github.com/jemc/crystal-kanren 366 | 367 | explore gologic, which seems to have some interesting extensions to mk 368 | https://github.com/hiredman/gologic 369 | 370 | trace how Kanren and miniKanren have changed over time, along with other miniKanren-like languages, such as core.logic and OCanren. Document the languages. Look at the implementations. 371 | 372 | look at the paper: Combining Unification and Disunification Algorithms -- Tractable and Intractable Instances 373 | Klaus U. Schulz 374 | Publication Date: 1996 375 | Type of Publication: Veröffentlichungen in der Reihe CIS-Berichte 376 | https://www.cis.uni-muenchen.de/otherpublications/cis_berichte/cis-96-099.html 377 | 378 | revisit https://github.com/webyrd/declarative-semantics 379 | miniKanren prototype of version v2 of 'Declarative semantics for functional languages: compositional, extensional, and elementary' by Jeremy Siek. 380 | 381 | revisit meta-circular-interp-in-mk: Simple Scheme interpreter, running inside a relational Scheme interpreter written in miniKanren, running inside of Scheme. It's...a little slow. 382 | https://github.com/webyrd/meta-circular-interp-in-mk 383 | Good candidate (and test case) for staged evaluation! 384 | 385 | look closely at utah-minikanren-summer-school, especially Jason's (and Dan's?) mk-convert.pdf (https://github.com/webyrd/utah-minikanren-summer-school/blob/master/mk-convert.pdf) 386 | https://github.com/webyrd/utah-minikanren-summer-school 387 | 388 | relational macro expander: 389 | * fexprs 390 | * hygienic Scheme macros 391 | 392 | revisit mk-interpreter-with-term-size: miniKanren relational interpreter with term size argument 393 | https://github.com/webyrd/mk-interpreter-with-term-size 394 | also look closely at Petr Lozov's work, which is much more sophisticated 395 | 396 | revisit Igor Wiedler's relational Turing Machine, ported from core.logic to miniKanren. 397 | https://github.com/webyrd/igors-turing-machine 398 | 399 | revisit mad-at-x miniKanren/cKanren take on adatx (Automatic Design of Algorithms Through X) main example (at https://github.com/LudoTheHUN/adatx) 400 | https://github.com/webyrd/mad-at-x 401 | CLP(SMT) candidate 402 | 403 | environment trimming; memory management for logic programming 404 | 405 | McCarthy's `amb` 406 | 407 | Take a look at ElephantKanren again. Anything here of interest? 408 | https://github.com/webyrd/elephantKanren 409 | 410 | even vs. odd streams 411 | streams vs. 2-continuation (sk & fk) model of backtracking 412 | old skool mk based on sk & fk 413 | 414 | AM & Eurisko 415 | Programmer's Apprentice 416 | BAT 417 | 418 | mediKanren and dbKanren 419 | 420 | reading and implementing judgements 421 | 422 | propositional calculus 423 | predicate calculus 424 | monadic second-order logic 425 | higher-order logic 426 | higher-order unification 427 | HH Formula, and in Lambda Prolog 428 | implication and negation in Lambda Prolog 429 | 430 | eigen variables 431 | universal vs. existential quantification 432 | nominal logic and quantification 433 | 434 | parsing 435 | * with derivatives 436 | * PEG 437 | * packrat 438 | * DCG + tabling (and equivalence to packrat parsing) 439 | * LALR 440 | * parser combinators 441 | 442 | fixed point semantics 443 | stable model semantics 444 | 445 | denotational semantics 446 | operational semantics 447 | axiomatic semantics 448 | 449 | equational reasoning 450 | 451 | laziness 452 | 453 | function-logic programming 454 | 455 | generators 456 | Icon 457 | 458 | constructive logic 459 | intuitionistic logic 460 | classical logic 461 | 462 | mechanized meta-theory 463 | 464 | heap/stack/registers 465 | 466 | probKanren -- trace evolution of versions 1, 2, and 3 467 | current approach and goals and challenges 468 | 469 | wreckto-verseo Verse Calculus in miniKanren 470 | 471 | Icon in miniKanren 472 | 473 | revisit relational sorting 474 | https://github.com/webyrd/relational-sorting 475 | 476 | look at Jetisu (Jetisu is a toolset for modelling with sigma complete relations; Doing for computation and business rules what the relational model did for data https://github.com/DavidPratten/jetisu) 477 | 478 | backjumping 479 | CDCL 480 | two-watched literal scheme 481 | unit propagation 482 | underconstraints 483 | SAT -- look at MB's mkcdcl (miniKanren with conflict-driven clause learning using a SAT solver) https://github.com/michaelballantyne/mkcdcl 484 | SMT 485 | solver-oriented programming 486 | 487 | presento vs. absento 488 | tree automata 489 | 490 | Robinson and unification 491 | the resolution method 492 | 493 | unification and lattices; Plotkin and Reynolds papers 494 | finding fixpoints over lattices 495 | lattice-oriented programming 496 | LVars and LVish 497 | abstract interpretation, datalog, etc. 498 | 499 | segment variables and pattern matching/unification 500 | 501 | matche 502 | 503 | duals of unification 504 | 505 | anti-unification 506 | https://github.com/webyrd/anti-unification 507 | 508 | CLP(Tree) 509 | =/= 510 | absento 511 | type constraints 512 | 513 | typed miniKanren 514 | 515 | look at Clever Algorithms: Nature-Inspired Programming Recipes, from the viewpoint of mk and relational programming https://github.com/clever-algorithms/CleverAlgorithms 516 | 517 | raytracing/raycasting/etc, viewed relationally 518 | https://github.com/webyrd/simple-raytracer/blob/master/raytracer.rkt 519 | I know there are some interesting new algorithms that can do inference 520 | 521 | look at Holmes (Holmes is a library for computing constraint-solving problems. Under the hood, it uses propagator networks and conflict-directed clause learning to optimise the search over the parameter space. 522 | https://github.com/i-am-tom/holmes) 523 | 524 | look at diff-SAT: Probabilistic Answer Set Programming and Probabilistic SAT Solving (https://github.com/MatthiasNickles/diff-SAT) 525 | 526 | look at https://github.com/ImparaAI/monte-carlo-tree-search 527 | 528 | look at Differential Dataflow (An implementation of differential dataflow over timely dataflow on Rust. https://github.com/TimelyDataflow/differential-dataflow) 529 | 530 | look at Guanxi again: https://github.com/ekmett/guanxi 531 | 532 | look at https://github.com/bboskin/syllogistic-provers 533 | syllogistic-provers: 534 | These are some syllogistic provers I made over the summer of 2017. 535 | Inspired by Larry Moss's M482 course in Mathematical Logic, and Dan Friedman's C311 course in Programming Language Principles, I used miniKanren to make provers for some basic logical systems covered in Moss's class. 536 | The miniKanren language is used courtesy of Dan Friedman, William E. Byrd, and Oleg Kiselyov http://minikanren.org/ 537 | 538 | correctness-preserving program transformations 539 | (see https://github.com/namin/lambdajam) 540 | representation independence 541 | defunctionalization 542 | CPS 543 | trampolining 544 | registerization 545 | 546 | meta interpreters in mk 547 | Playing with meta-interpreters in miniKanren. Inspired by Nada Amin's miniKanren confo talk at Clojure/West: 548 | https://github.com/webyrd/meta-interp 549 | also, the paper with Nada and Tiark -- Scalagno, etc. 550 | revisit Prolog-style meta-interpreters and relationality 551 | 552 | CPS 553 | Explorations of Continuation-Passing Style in miniKanren. 554 | https://github.com/webyrd/mk-cps 555 | MB approach to reconnecting the wires, and the limits of that approach 556 | delimited continuations and effect handlers -- do they provide more structure that prevents "breaking the wires" problems? 557 | 558 | Relational implementation of the CESK machine 559 | https://github.com/webyrd/relational-cesk 560 | 561 | WiljaEdit relational transformation-based structured editor 562 | 563 | first-order miniKanren 564 | 565 | Fizzbuzz, relational style 566 | 567 | Metamagical Themas: Lisp, self-reps, quines, and viruses -- miniKanren style 568 | self-rep explorations with Nada Amin -- try to push further 569 | self-modifying relational interpeter? 570 | 571 | reflective tower of relational interpreters, in which one level can reach up and modify a level interpreting it 572 | 573 | miniKanren quines -- mk `run` expressions that generate themselves -- try to generate using mk-in-mk (Michael Ballantyne has constructed these by hand) 574 | 575 | 2012 Scheme Workshop quines code (and paper) 576 | https://github.com/webyrd/2012-scheme-workshop-quines-paper-code 577 | 578 | relational-parsing-with-derivatives 579 | https://github.com/webyrd/relational-parsing-with-derivatives 580 | 581 | relational-progress-sensitive-security 582 | https://github.com/webyrd/relational-progress-sensitive-security 583 | Relational implementation of type system and semantics from "Precise Enforcement of Progress-Sensitive Security" by Moore, Askarov, and Chong, CCS'12: 584 | 585 | meta-miniKanren 586 | https://github.com/michaelballantyne/meta-minikanren 587 | https://github.com/webyrd/mk-metacircular-interp 588 | meta-circular miniKanren interpreter. 589 | https://github.com/webyrd/relational-unifier 590 | Relational unifier, implemented in miniKanren 591 | micro-in-mini: an implementation of a microKanren(-like language) in miniKanren 592 | https://github.com/jasonhemann/micro-in-mini 593 | muko: microKanren in miniKanren 594 | https://github.com/jpt4/muko 595 | metaKanren with Bharath 596 | 597 | Martelli-Montanari unification algorithm 598 | composable, monotonic, functional representation of substitutions 599 | (vs. triangular substitutions, for example) 600 | union-find algorithm and data structure 601 | Ramana Kumar's mechanized proof that mk unification using walk and triangular substitutions converges -- difficult, since the algorithm isn't primitive recursive/doesn't have a monotonically decreasing measure on an argument 602 | 603 | mk pretty printer 604 | A super simple pretty printer for miniKanren, designed for live coding. See the bottom of the file for example usage. Don't forget to load miniKanren before using! 605 | https://github.com/webyrd/miniKanren-pretty-printer 606 | 607 | cKanren 608 | https://github.com/webyrd/cKanren 609 | https://github.com/calvis/cKanren 610 | also, Kraken 611 | 612 | slpKanren 613 | Stochastic Logic Programs (SLP) style probabilistic logic programming in miniKanren, based on Stephen Muggleton's paper, 'Stochastic Logic Programs': http://www.doc.ic.ac.uk/~shm/Papers/slp.pdf 614 | Code by Rebecca Swords and William E. Byrd, based on core miniKanren. 615 | https://github.com/webyrd/slpKanren 616 | 617 | Lattice-based miniKanren, inspired by the lambda-LVars work of Lindsey Kuper and Ryan Newton (https://www.cs.indiana.edu/~lkuper/papers/2012-lambdaLVar-draft.pdf). 618 | https://github.com/webyrd/latticeKanren 619 | 620 | visualizing the search space 621 | 622 | revisit CDG repos and experiments 623 | https://github.com/orgs/cdglabs/repositories 624 | 625 | revisit miniKanren Playground 626 | https://github.com/webyrd/minikanren-playground 627 | 628 | revisit relational-reactive-programming 629 | https://github.com/webyrd/relational-reactive-programming 630 | 631 | revisit Polyconf 2015 code, especially wrt angelic execution 632 | https://github.com/webyrd/polyconf-2015 633 | 634 | dependent types in miniKanren 635 | Idris/miniKanren Love Child 636 | https://github.com/webyrd/curnelo 637 | 638 | modes 639 | impure mk: project, conda, condu, copy_term, etc. 640 | 641 | purity in Prolog -- more than just avoiding cut 642 | 643 | various flavors of cut in Prolog: all the colors and mixes of colors; "soft-cut"; committed-choice non-determinism; Mercury; Oleg's explanation of what inspired `conda` vs `condu` in framenotes of TRS 644 | 645 | true meta-circular Scheme interp 646 | true meta-circular mk interp 647 | 648 | mixing Scheme and mk code *relationally* through implementing Scheme and mk interpreters relationally in miniKanren: should be able to handle relationally (for example, perform synthesis) over mixtures of Scheme and mk as seen in TRS1, for example 649 | 650 | handling fully relationally higher-order miniKanren relations such as `mapo`, through mk-in-mk 651 | 652 | microKanren in Scheme in mk in Scheme to get relational behavior -- collapse/stage that! 653 | 654 | can we synthesize a radiation-hardened quine? 655 | 656 | combinatory logic in mk 657 | synthesizing fixed point combinators 658 | * the different approaches I've tried 659 | 660 | Quines, twines, thrines 661 | absento trick for twines 662 | Quine relay 663 | self-reps 664 | Kleene's Recursion theorems 665 | Omega and Y and U combinators 666 | Omega as small-step Quine 667 | 668 | vicious circles 669 | non-well-founded set theory 670 | coinductive logic programming, tabling, streams, etc. 671 | rational infinite trees, Prolog II, etc. 672 | 673 | tabled logic programming and abstract interpretation 674 | 675 | top-down vs. bottom-up evaluation 676 | 677 | bi-directional search 678 | 679 | magic sets 680 | 681 | focused proof search 682 | 683 | mk as theorem prover 684 | reifying the proof tree 685 | LeanTAP 686 | LeanCOP 687 | Matt's simple proof checker and the 2017 ICFP pearl 688 | 689 | Fun with GEB 690 | GEB MIU interpreter -- I think I have a GitHub repo on this, with a U of Utah student -- undecidability 691 | 692 | relational automata -- tabling, e-graphs, VSA, etc. -- try to recapture decidability and the ideal complexity classes, when the problems are deciadable (or in a mode in which everything should be decidable) 693 | 694 | mutally recursive relations to represent automta 695 | https://github.com/webyrd/automata-and-mutual-recursion 696 | add tabling, etc. 697 | separate representation of the language from the automata themselves 698 | staging 699 | etc. 700 | 701 | relational-dfa 702 | Relational deterministic finite automaton interpreter, written in miniKanren. 703 | https://github.com/webyrd/relational-dfa 704 | (also play with NFA versions) 705 | 706 | revisit Oleg's proofs in the purely relational arithmetic FLOPS paper; alternative representation of these numerals; tree constraints, e-graphs, etc. sharing, tabling, etc.? Hilbert's 10th problem 707 | 708 | Hindley-Milner type inference; `let` polymorphism -- how best to represent? complexity classes; principal typing; have we ever solved these issues satisfactorily? 709 | https://github.com/webyrd/hindley-milner-type-inferencer 710 | 711 | Oleg's higher-order relation fixed point trick for relational type inferencer 712 | 713 | revisit mult-quines 714 | https://github.com/webyrd/multi-quine 715 | 716 | non-monotonic logics 717 | 718 | temporal logics 719 | 720 | Ivan Bratko book 721 | 722 | abductive reasoning 723 | 724 | inductive logic programming 725 | 726 | synthesis using relational interpreter and the complexity of program traces (vs. length of the code); a short Scheme program might require more computation than a longer program, if the shorter program has a longer trace to reach success (due to the use of a recursive helper, for example); `reverse` using `append` is hard for Barliman to find, if I remember correctly 727 | 728 | Barliman optimizations 729 | 730 | look at the screenshots of Barliman examples; also, the Clojure/conj talk I gave with Greg in Austin 731 | 732 | n-grams for synthesis 733 | 734 | termination analysis of mk relations, based on decreasing measure on argument terms -- Petr Lozov's dissertation work 735 | 736 | interesting SW and mk Workshop papers 737 | 738 | type systems and termination 739 | occurs check and self-application and termination 740 | 741 | the issue with small-step, multi-pass compilers, etc. -- "breaking the wires" 742 | fail fast 743 | 744 | N ways to perform arithemetic relationally 745 | * Oleg arithmetic 746 | * Peano 747 | * CLP(FD) 748 | * CLP(Z) 749 | * CLP(SMT) 750 | * delayed goals 751 | 752 | revisit A Relational Exploration of the Chomsky Hierarchy (SL 2013 with Dan) 753 | https://www.infoq.com/presentations/chomsky-hierarchy/ 754 | https://github.com/webyrd/strange-loop-2013 755 | Some cool code here! Like HO PDA 756 | 757 | revisit TAPL in mk/core.logic/etc 758 | https://github.com/webyrd/TAPL-in-miniKanren-cKanren-core.logic 759 | 760 | revisit MU-problem: Hofstadter's MU problem (http://en.wikipedia.org/wiki/MU_puzzle) in miniKanren. Straight-forward implementation based on the appendo relation. 761 | https://github.com/webyrd/MU-puzzle 762 | would CLP(Set) help? staging? 763 | 764 | revisit set-constraints: Stolzenburg-style set constraints for miniKanren 765 | https://github.com/webyrd/set-constraints 766 | how does this compare with Nada's and Claire's work on set constraints in mk? 767 | 768 | revisit pcpo 769 | Post Correspondence Problem (PCP) in miniKanren 770 | Written with Tony Tuttle. 771 | https://github.com/webyrd/pcpo 772 | 773 | relational interpretation of copy_term 774 | why is it tricky? does it even make sense? 775 | https://github.com/webyrd/copyo 776 | https://github.com/webyrd/templateo 777 | https://github.com/webyrd/typeo (Simple DSL for writing even simpler type inferencers. Uses cKanren's new templateo constraint, which is essentially a lazy, declarative version of Prolog's copy_term/2.) 778 | Joe Near's encoding in alphaLeanTAP 779 | 780 | tree automata 781 | e-graphs 782 | version space algebras 783 | 784 | fix up alphaKanren 785 | equivariant unification 786 | lambda Prolog/lambda Kanren/HOAS 787 | De Bruijn 788 | combinatory logic 789 | 790 | revisit https://github.com/webyrd/peano-challenge 791 | A simple relational Scheme integer to peano translator, demonstrating finite domain constraints. 792 | Inspired by a Twitter challenge from @mrb_bk: 793 | Who can show me a relational version of a (peano n) function that returns peano numbers like (peano 3) -> (:s (:s (:s 0))) 794 | 795 | program synthesis -- try implementing various synthesis algorithms 796 | 797 | search 798 | * Oleg search 799 | * DFS/BFS/IDDFS 800 | * A* 801 | * neural-guided search 802 | * MCTS 803 | * MC simulation + RL 804 | * minimize KL-divergence 805 | 806 | bidirectional computing 807 | 808 | reversible computing 809 | RFun: A reversible functional programming language 810 | https://github.com/webyrd/rfun-interp 811 | 812 | deep encoding + shallow encoding of mk-in-mk: combine to get run* expressiveness with performance closer to that of shallow embeddings 813 | 814 | abstracting abstract machines 815 | 816 | tabling 817 | https://github.com/webyrd/tabling 818 | 819 | miniKanren interpreter in Scheme 820 | https://github.com/webyrd/mk-interp 821 | 822 | revisit techniques and programs in Advanced miniKanren Hangouts 823 | https://github.com/webyrd/miniKanren-hangout-summaries 824 | 825 | implementing different logics 826 | defeasible logic 827 | linear logic 828 | linear logic multiset rewriting 829 | modal logic 830 | 831 | interactive fiction and storytelling 832 | 833 | combining parser, type checker/inferencer, and interpeter -- deal with the conjunction problem 834 | 835 | the problems in miniKanren and general-purpose relational programming 836 | * conjunction 837 | * negation 838 | * general-purpose vs. specialized constraints 839 | * composing constraints 840 | 841 | LeanTAP and other ATPsx 842 | 843 | case studies in making programs relational, and exploring the resulting relations 844 | 845 | case studies in making miniKanren programs fast 846 | 847 | porting miniKanren to other languages and runtimes 848 | 849 | understanding and hacking the implementation of `faster-miniKanren` 850 | 851 | a taxonomy of miniKanren-related languages 852 | 853 | revisiting Kanren 854 | 855 | revisiting `mirror` and the old skool Kanren examples 856 | 857 | annotated bibliography of miniKanren-related literature 858 | 859 | Fifth Generation Computing Project 860 | 861 | Archaelogy into old logic and relational languages 862 | 863 | alternate tech for building mk: 864 | * ferns 865 | * propagators 866 | * Warren Abstract Machine 867 | 868 | Prolog/Datalog/ASP 869 | Lambda Prolog 870 | Godel 871 | Escher 872 | Verse 873 | Mercury 874 | etc. 875 | 876 | concatenative programming 877 | cato 878 | Concatenative relational interpreter in miniKanren 879 | https://github.com/webyrd/cato 880 | 881 | constraint logic programming 882 | 883 | Constraint Handling Rules 884 | 885 | concurrent prolog 886 | 887 | Larry Moss's 1# register language, relational style 888 | 889 | normalization-by-evaluation, relational style 890 | 891 | relational implementation of FORTH 892 | 893 | mutually-recursive relational languages 894 | 895 | the equivalent of Chris Okasaki's 'Purely Functional Data Structures', but for relational programming 896 | 897 | difference lists 898 | set constraints 899 | unification over records 900 | 901 | Chomsky hierarchy 902 | 903 | angelic execution 904 | 905 | exceptions 906 | control effects 907 | effect handlers 908 | delimited continuations 909 | 910 | fuzzing 911 | 912 | program synthesis 913 | property-based program synthesis 914 | 915 | towers of interpreters 916 | mk in mk 917 | quasiquote quines in Scheme in Scheme in mk in Scheme, and staging to remove overhead 918 | heterogenous towers 919 | collapsing towers 920 | 921 | staged evaluation 922 | partial deduction 923 | super compilation (and the relational equivalent: conjunctive partial deduction (is this correct?)) 924 | 925 | extended Andorra model and conjunction 926 | 927 | should `run*` use DFS? 928 | -------------------------------------------------------------------------------- /perishable/what-I-have-in-mind.txt: -------------------------------------------------------------------------------- 1 | I want this project to be long-term and ongoing, and to reflect on what I find fascinating about relational programming, and about computation. I also want to maintain a sort of Douglas Adams "Hitchiker's Guide"-like perspective, in which the story can always be rewritten---there is no canonical version of the story. 2 | 3 | I want to stick to my original plan, which was to record all the writing on the project. I will not attempt to record all my thinking on the project, which would be impossible anyway. I will try to keep my record of the writing process as authentic as possible, which includes both my terribly slow typing and many silent work sessions (which my current working environment requires anyway). Along with pauses as I think... 4 | 5 | What I have in mind is closer in spirit to Bronowski's 'The Ascent of Man' or Sagan's 'Cosmos' or Burke's 'Connections' than to an encyclopedic treatment of relational programming. More like a tour of grant and weird and exciting and baffling and promising and dissappointing parts of relational programming. 6 | 7 | I don't think of this as a book, or even a series of books, just like "Hitchhiker's Guide" isn't a book or series---actually, Hitchhiker's started as a BBC radio play, and was also a TV series, and a movie, and additional radio plays, all with different stories! I want to avoid becoming overly rigid. Also, Hitchhiker's kept going and evolving and playing. I want to capture something similar here. Similar to Touhou Project, as well. As see this as an evolving, growing project, rather than as a book or website or video series or paper or any other fixed set of static artifacts. 8 | 9 | This is also my response to Neil Gaiman's advice of 'finish it' for writers, which I'm sure really is sound advice, and I have finished (under protest and often after the deadline) quite a few things in my life. I don't intend to finish this one, though. However, I do intend to have readable or understandable snapshots or artifacts, just like Douglas Adams did indeed have radio plays and books and TV series and a movie and all that. I just reserve the right to riff on the story of relational programming, and to change my mind about things as I learn more (or forget more!). 10 | 11 | Another key aspect about not finishing this project is that I want to tie in both my research (and the research of my collaborators and colleagues) and also the fun, experimental aspect of playing around in the Relational Playground/Wonderland, where we don't really know what's going to happen. Playing around with miniKanren is great fun, and I haven't been doing much of it. If I feel like I have to Finish The Big Thing before I can play around, then I don't think either the Big Thing or me (Will-Bill) will be very happy. 12 | 13 | Hopefully this project will result in lots of interesting things to explore and play around with and puzzle over and laugh at, which means that it might eventually become a big thing, but I hope it becomes a big thing in being an aggregate of small things, rather than becoming a Big Serious Intimidating Thing, which I never had much use for, and certainly not much use for in exploring relational programming. 14 | 15 | Avoiding being Stuck 16 | -------------------- 17 | (a) One possible source of being stuck is waiting until I can record a nice video of my writing. I let that get me stuck for a while, over the past few weeks, largely since recording audio is tricky for me right now, due to working in an environment that is noisy at unpredictable times, and which I can't always make noise (also, at unpredictable times). However, these types of constraints can be a boon to creativity, and even to productivity. When I decided to write this year, I quickly found that my wrists started hurting when I typed a lot. This led to getting a fancy keyboard, switching to Dvorak, having to learn how to type again, etc., which was super slow. As a result of my slow typing, along with my discomfort writing "in the open" and my uncertainty about my choice of topic, I spent most of my videos talking about writing rather than writing, or complaining about how slow I was typing(!). 18 | 19 | Talking about everything I was thinking while working on a book might have served a purpose in the beginning. However, it's not how I actually write---certainly not while I'm writing alone, at least. Recording silent writing sessions is a much closer approximation of reality. In fact, it is the normal reality for when I'm writing alone, except for times I might read a sentence aloud to hear how it sounds. So, I like that these silent writing videos: (1) allow me to write (and record the writing) whenever I want; (2) lessen the distraction of trying to explain everything I'm thinking, when I should be thinking about what I'm doing; and (3) more authentically represent what it's like for me to write alone. 20 | 21 | (b) Another way I got stuck early on was to try to save every part of the writing process for a video. Whatever I type at a keyboard is only a portion of my full writing process, which largely involves curling up into a ball on the couch or on the bed, staring at the ceiling, or closing my ideas, and letting thoughts drift around in my head, followed by frantically writing a few words on a notepad next to me. Or writing notes to myself on my phone. Or thinking about the ideas in the shower. Or talking with friends. Etc. So, I will record my writing sessions, and the things I do on the computer, to the extent I can. (I checked in a file I created during my last recorded writing session after I ended the recording so I wouldn't lose the file---stuff like that doesn't count!) I will also try to share the *product* of my thinking and conversations---for example, in the form of the `topics.txt` file, which contains a few of the possible topics for the Wonderland, based on my various notes to myself. 22 | 23 | (c) Another way I got stuck early on was to start writing about a "warmup" topic, rather than going straight at the thing I *really* wanted to write about. This, perhaps, was a natural process of getting *me* warmed up, and getting up my courage, to tackle this far more expansive topic of my personal view of computation, told from a relational standpoint. But after a few changes of topics and books, I'm back at what I thought about in July of 2023 but was too intimidated to try to bite off, because I knew it could be a huge undertaking, and I was afraid I'd quit yet again. I think I'm over that now---after all, this is the topic I've been dreaming about for a year or more, and named the Discord server after! 24 | 25 | (d) Another way I've gotten stuck in the past, and a big hurdle for this Imperishable Wonderland project, is chasing after a notion of the Platonic ideal whatever (a doujinshi version of relational programming exploration, in this case). One type of perfectionism is waiting until I have just the right infrastructure for everything. The perfect typesetting system, or the perfect executable computational medium, or whatever it is. I have fallen into a bit of a rabbit hole with fancy LaTeX typesetting in the past, and in the future I probably want to avoid needing a dozen Perl scripts to typeset a book. Still, I know LaTeX well, and don't really get stuck on the LaTeX itself, only on some Platonic ideal of what the Perfect Book would look like. Since I'm going Hitchhiker Style, and I reserve the right to create a different yet kinda similar version of whatever I've created in the past, in whichever medium makes the most sense (or the least sense), I don't want to become overly concerned with whether I'm using LaTeX, Markdown, HTML, some weird format supported by Pandoc, Racket's Scribble, SGML, plaintext, Emacs org mode, an iPython notebook, a Livecode, etc. As I work, I'm sure I'll have plenty of ideas as to what I can do. For example, I have this vision of using my own drawings and paintings within a book. Plenty of opportunity for that. I shouldn't wait until I'm Picasso until I start writing the book, though! I can be a just-in-time Picasso. Similarly, maybe at some point I'll build some Scheme or Racket or miniKanren infrastructure to abstract over any concrete representation of the Wonderland. For now, though, LaTeX will do, since that's what I know inside out. (Well, I know how to do lots of horrible hacks, at least, although I hope it won't come to that.) 26 | 27 | So, with that in mind, I'm going to kick off my expression of the Winderland in LaTeX, trying to keep it on the simpler side if I can. However, I'll do what the Wonderland requires, so I reserve the right to write complicated LaTeX if needed. And at some point I will probably revisit the format. However, the important thing is to *write*! The Wonderland awaits us. 28 | -------------------------------------------------------------------------------- /perishable/wills-big-bad-boring-braindump-on-relational-programming/Makefile: -------------------------------------------------------------------------------- 1 | BOOK=book 2 | 3 | all: 4 | pandoc -f markdown -t pdf ${BOOK}.md -o ${BOOK}.pdf 5 | 6 | squeaky: clean 7 | rm -f ${BOOK}.pdf 8 | -------------------------------------------------------------------------------- /perishable/wills-big-bad-boring-braindump-on-relational-programming/README.md: -------------------------------------------------------------------------------- 1 | # Will's Big Bad Boring Braindump on Relational Programming 2 | 3 | This book is released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license (http://creativecommons.org/licenses/by/4.0/). The code accompanying this book is covered under the MIT license---please see the code for details. 4 | 5 | Creative Commons License
Will's Big Bad Boring Braindump on Relational Programming by William E. Byrd is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/webyrd/imperishable-wonderland. 6 | 7 | Book file: `book.md` 8 | 9 | To typeset a PDF version of the book, just type `make` (assuming you have Pandoc installed). 10 | -------------------------------------------------------------------------------- /perishable/wills-big-bad-boring-braindump-on-relational-programming/book.md: -------------------------------------------------------------------------------- 1 | % Will's Big Bad Boring Braindump on Relational Programming 2 | % William E. Byrd 3 | % March 22, 2024 4 | 5 | Copyright 2024 by William E. Byrd 6 | 7 | This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). (CC BY 4.0) 8 | 9 | # What is this book? 10 | 11 | This book is intended to be a semi-structured brain dump of what I know about relational programming, constraint logic programming, miniKanren and its variants, and related topics. 12 | 13 | # Why this book? 14 | 15 | I started the book on Friday, March 22, 2024. I have started working on another book, 'An Imperishable Wonderland of Infinite Fun', which is intended to be a highly-curated and highly-polished collection of interesting, unusual, and weird relational programs that I hope will inspire people to explore relational programming. I have also been talking recently with students and researchers and hobbyists who are interested in learning about miniKanren and relational programming, from the implementation, application, theory, and fun perspectives. Since I'm curating miniKanren resouces for 'An Imperishable Wonderland of Infinite Fun', and talking regularly with people interested in miniKanren, this seems like the perfect time to make a Big Bad Boring Braindump book. 16 | 17 | # The writing philosophy behind this book 18 | 19 | Get it done! 20 | 21 | "Write badly, with pride" -- Eric Edson, [Film Courage interview](https://www.youtube.com/watch?v=V6Yql0jrjow at 19:00) 22 | 23 | I remembered this as "Write poorly, proudly!", which I prefer slightly.) 24 | 25 | Get all the ideas in my head down on paper as quickly as possible. "The worst finished book is better than the best unfinished book" [something like that --- find exact quote in the Film Courage video I linked to in a recent video; add reference] 26 | 27 | Dean Wesley Smith's notion of working at "pulp speed" also inspires me to write a book "into the dark" [something like that --- find exact phrase in DWS book; add reference] Just sit down and start typing! 28 | 29 | # Who is the audience for this book? 30 | 31 | People who are trying to learn about miniKanren and/or relational programming and/or constraint logic programming, etc., at a deeper level than can be found in 'The Reasoned Schemer' or the original microKanren paper. If nothing else, I hope you will find your own connections and inspiration in this semi-random collection of relational programming lore. You are almost guaranteed to stumble across some ideas or techniques or artifacts or perspectives that you haven't seen before, even if you have been programming for a very long time. 32 | 33 | # What is relational programming? 34 | 35 | Relational programming is a programming paradigm in which computations are modeled as mathematical (or logical) relations. This is in constrast, for example, to functional programming, in which computations are modeled as mathematical functions, mapping inputs to outputs. Unlike most approached to programming, relational programming dispenses with the notions of inputs and outputs. Instead, a relations takes zero or more *terms*, and each term can contain zero or more *logic variables* (also known as *unification variables*) that can represent unknown values. Relational programs *constrain* these terms (including the logic variables in these terms) using *constraints*, such as *syntactic equality* and *syntactic disequality*. A constraint logic reasoning engine performs a (potentially very sophisticated) mixture of constraint solving and search in an attempt to find assignments to the logic variables that satisfy all the constraints. If the relational program includes recursion, there may be multiple solutions to one of these constraint problems, including infinitely many solutions. Alternatively, the constraint logic engine might search an infinite search space looking for a non-existent solution to a constraint problem; in this case, the constraint logic engine may end up *diverging* (looping foreer), or may able to prove in finite time that no solution exist (*finite failure*). 36 | 37 | # What is miniKanren? 38 | 39 | miniKanren is a family of constraint logic programming languages, each of which is implemented by one or more constraint logic reasoning engines. Many implementation of miniKanren focus on logical purity, emphasizing the relational aspects of computation. Some variants of miniKanren-like languages, such as core.logic in Clojure, focus more on pragmatic uses of the language, as part of the program logic in a "standard" application. Other variants, such as OCanren in OCaml, explore the relational aspects from a research perspective. 40 | 41 | Most miniKanrens are implemented as *embedded domain-specific languages* (EDSLs), meaning that they extend some *host language* with additional functions, methods, etc., supporting the miniKanren language, along with an implementation in the host language of a constraint logic reasoning engine. Historically miniKanren has been implemented in variants of Lisp (for example, Scheme, Racket, and Clojure) or other functional languages (OCaml and Haskell). There has also been some work on implementing miniKanren as a stand-along language and run-time. 42 | 43 | # What is microKanren? 44 | 45 | microKanren (also written "muKanren" or "muKanren" [change to Greek 'mu' character]) is a minimal version of miniKanren created by Jason Hemann and Daniel P. Friedman [cite paper and github repo]. The original microKanren paper includes a tutorial reconstruction, including a step-by-step reconstruction of how to arrive at the interleaving search strategy, given how simpler search strategies can't find answers that exist in infinite search spaces. 46 | 47 | microKanren is designed to be easily ported to other languages. The canonical core microKanren implementation is fewer than 50 lines of Scheme, and does use Scheme macros. It is possible to implement miniKanren on top of microKanren, which is especially convenient in languages that supportsyntactic extension through macros (such as most Lisps, Rust, etc.). A standard exercise for anyone learning miniKanren is to implement a version of microKanren in a host language of their choice. As a result, microKanren has been implemented hundeds or thousands of times in dozens of host languages. The main [miniKanren website](http://www.minikanren.org) contains links to many microKanren implementations---the website used to keep track of every microKanren implementation, but the number of implementations quickly became overwhelming. 48 | 49 | # What is Kanren? What are the similarities and differences between Kanren and miniKanren? 50 | 51 | Kanren is the language that came before, and inspired, miniKanren. Like miniKanren, the canonical Kanren implementation is an embedded domain-specific language in Scheme, using a combination of functions and Scheme hygienic macros. Like miniKanren, Kanren is based on first-order syntactic unification and a complete, interleaving search strategy. Kanren programs are written at a "higher level" that miniKanren programs. The notion of extending relations is a concept built into Kanren. Unlike miniKanren, Kanren performs unification over the terms passed into a Kanren relation. Kanren's implementation includes an optimization inspired by Prolog called `head-let`, which is metaphorically equivalent to `project`ing the terms that are passed into a relation. Kanren uses pattern matching, and has syntax that is similar in spirit to the clauses in Prolog (at least if you squint). 52 | 53 | miniKanren can be thought of as a "lower level" language than Kanren---for example, there is no notion of extending relations, or of pattern matching, built into miniKanren; since miniKanren is not based on pattern matching, there is no `head-let` optimization built into miniKanren. miniKanren could be thought of as a simpler, lower-level language that a Kanren program might compile (or macro-expand) to, in the same way that a miniKanren program might compile (or macro-expand) to microKanren. 54 | 55 | # What does the name 'Kanren' mean? Where did the name come from? 56 | 57 | 'Kanren' is the Japanese word for 'relation' [include kanji]. Oleg Kiselyov came up with the name. 58 | 59 | # Where is the code for the miniKanren implementation from 'The Reasoned Schemer'? How do they differ? 60 | 61 | ## Code from the second edition of 'The Reasoned Schemer' (2018) 62 | 63 | The code from the second edition of 'The Reasoned Schemer' can be found [here on GitHub](https://github.com/TheReasonedSchemer2ndEd/CodeFromTheReasonedSchemer2ndEd) 64 | 65 | ## Code from the first edition of 'The Reasoned Schemer' (2005) 66 | 67 | The code from the first edition of 'The Reasoned Schemer' can be found [here on GitHub](https://github.com/miniKanren/TheReasonedSchemer) 68 | 69 | ## The main differences between these implementations of miniKanren: 70 | 71 | * The miniKanren language in the first edition contains two versions of conjunction, disjunction, and unification: `conde` and `condi`; `fresh` and `freshi`; `==` and `==-check`. The second edition simplifies the language, and uses only the "safe" (interleaving/occurs-check) versions: the `==` from the second edition is equivalent to `==-check`, the `code` from the second edition is equivalent to `condi`, and `fresh` from the second edition is equivalent to `freshi`. 72 | 73 | * The miniKanren implementation in the second edition is built on a modified version of microKanren. As a result, there is a simple "core" language of binary disjunction and conjunction at the heart of the 2018 implementation. Also, the syntactic forms (`run`, `fresh`, `conde`), which are implemented using Scheme hygienic macros, are cleanly separated from the underlying functions, to allow the implementation to be more easily understood by readers unfamiliar with Scheme hygienic macros, and to make it easier to port the non-macro parts of miniKarnen to other host languages that do not have macros or other syntactic abstraction mechanisms. 74 | 75 | # Where is the original code for Kanren, and early work on miniKanren? 76 | 77 | The original Kanren project, including documentation and code, can be found [here on SourceForce](https://kanren.sourceforge.net/) 78 | 79 | # Are there any interesting ideas from the original Kanren language, implementation, and examples? 80 | 81 | Yes, most definitely. Kanren is underexplored at this point. 82 | 83 | [relational extension] 84 | 85 | [pattern matching syntax and `head-let`] 86 | 87 | [separation of facts from rules] 88 | 89 | [extended type inferencer and fixpoint trick] 90 | 91 | [mirror of mirror] 92 | 93 | [other theorem proving and equational reasoning goodness] 94 | 95 | Exercise: build a Kanren on top of miniKanren, complete with the Kanren syntax, `head-let`, etc. 96 | 97 | Exercise: replicate all the example applications in miniKanren, and extend/improve upon these examples 98 | 99 | Exercise: use the ideas from these example applications to explore other theorem-proving and equational-reasoning programs in Kanren/miniKanren 100 | 101 | # What are the tradeoffs of implementing miniKanren/microKanren as an embedded domain specific language? 102 | 103 | Advantages of implementing miniKanren as an embedded domain specific language include: 104 | 105 | * the implementation can use parts of the host language's implementation---for example, the existance of pairs, symbols, and numbers in Scheme; 106 | 107 | * programmers can get the benefits of a (constraint) logic programming language, without having to give up the features and libraries and runtime of the host language---for example, Clojure programs can write a sophisticated application in Clojure, making full use of the JVM and the many Clojure and Java libraries, while adding logic programming functionality through `core.logic` (David Nolen's miniKanren-inspired EDSL in Clojure); 108 | 109 | * miniKanren or microKanren can be quickly or easily ported to almost any host language, on various runtimes/platforms; 110 | 111 | * the small size of miniKanren, and especially microKanren, makes it quick and easy to modify or extend the implementaion. 112 | 113 | Disadvantages of implementing miniKanren as an embedded domain specific language include: 114 | 115 | * there is not a single "canonical" implementation or set of libraries that the entire miniKanren community uses; 116 | 117 | * the miniKanren community is itself somewhat fragmented, based on host language; 118 | 119 | * the ease of implementation has resulted in hundreds or thousands of simple implementations of microKanren, and a fair number of implementations of miniKanren, which can seem overwhelming to anyone new to miniKanren; 120 | 121 | * the embedded domain specific language approach can make whole-program optimization, compilation, and other techniques challenging or impossible. 122 | 123 | # What are the differences between miniKanren and other logic or constraint logic programming languages? 124 | 125 | [TODO] 126 | 127 | # The Prolog elephant in the room 128 | 129 | ## How does miniKanren differ from Prolog? 130 | 131 | [TODO] 132 | 133 | ## Can't you do all of this in Prolog? 134 | 135 | [TODO] 136 | 137 | ## Shouldn't you just be using Prolog? 138 | 139 | [TODO] 140 | 141 | ## Isn't miniKanren just warmed-up Prolog? 142 | 143 | [TODO] 144 | 145 | ## But Prolog is useful... 146 | 147 | [TODO] 148 | 149 | ## Etc. 150 | 151 | [TODO] 152 | 153 | # What are the supposed advantages of relational programming? 154 | 155 | [TODO] 156 | 157 | # What are the supposed disadvantages of relational programming? 158 | 159 | [TODO] 160 | 161 | # What are the major research themes in relational programming? 162 | 163 | [TODO] 164 | 165 | # What is a "relational interpreter"? 166 | 167 | [TODO] 168 | 169 | # What are the major implementations of miniKanren-inspired languages? 170 | 171 | [TODO] 172 | 173 | # What are experimental implementations of miniKanren-inspired languages under development? 174 | 175 | ## OCanren 176 | 177 | [TODO] 178 | 179 | ## probKanren 180 | 181 | [TODO] 182 | 183 | ## alphaKanren 184 | 185 | [TODO] 186 | 187 | # What are the main learning resources for learning miniKanren? 188 | 189 | [The Reasoned Schemer, 2nd Ed. (MIT Press, 2018)] 190 | 191 | [microKanren paper] 192 | 193 | [ICFP 2017 pearl] 194 | 195 | [SW 2012 quines pearl] 196 | 197 | [Oleg arith FLOPS paper] 198 | 199 | [LogicT paper] 200 | 201 | [alphaKanren + alphaLeanTAP papers] 202 | 203 | [cKanren paper] 204 | 205 | [core OCanren papers and talks] 206 | 207 | [core.logic talks by David Nolen and others] 208 | 209 | [unpublished paper on representations of triangular substs] 210 | 211 | [Ramana undergrad honor's thesis] 212 | 213 | [my dissertation] 214 | 215 | [miniKanren.org] 216 | 217 | [miniKanren.org Livecode tutorial] 218 | 219 | [mK and relational programming workshop talks and papers] 220 | 221 | [YT uncourses/advanced mk hangouts] 222 | 223 | [talks: Conj untalk with Dan; Relational Exploration of Chomsky Hierarchy with Dan at SL; Polyconf'15; TMBPEW; which others?] 224 | 225 | ## Relational programming 226 | 227 | # What came before miniKanren? 228 | 229 | [TODO] 230 | 231 | # How has miniKanren changed over time? 232 | 233 | [TODO] 234 | 235 | # What is the difference between logic programming, constraint programming, constraint logic programming, and relational programming? 236 | 237 | [TODO] 238 | 239 | # Truth versus success/failure 240 | 241 | [gets into why negation can be tricky] 242 | 243 | # Many-worlds interpretation of logic programming 244 | 245 | [includes the OS processes view] 246 | 247 | # Prolog 248 | 249 | ## Standard resources for learning Prolog 250 | 251 | 'The Art of Prolog' -- esp. on meta-interpreters 252 | 253 | 'Clause and Effect' 254 | 255 | 'ISO Prolog' 256 | 257 | 'The Craft of Prolog' 258 | 259 | 'Learn Prolog Now' 260 | 261 | [Ivan Bratko book on AI programming] 262 | 263 | [the book that includes defeasible logic programming -- link to the free version on author's website] 264 | 265 | [online book that discusses program slices] 266 | 267 | ## Cool things about Prolog 268 | 269 | ### Prolog syntax 270 | 271 | * meta programming 272 | 273 | * syntactic extensions (disjunction) and restrictions (Datalog, ASP) naturally map onto extensions/restrictions to the logics expressed, and the computational power/expense/guarantees of those logics 274 | 275 | ### Prolog meta interpreters 276 | 277 | [clauses are in the global database] 278 | 279 | [call] 280 | 281 | ### Many implementations, some with very interesting extensions 282 | 283 | * Ciao Prolog 284 | 285 | * Andorra Prolog 286 | 287 | * CLP(X) extensions (for example, in SWI-Prolog) 288 | 289 | * Constraint Handling Rules extensions [which Prologs support this?] 290 | 291 | ## Less cool things about Prolog (from the perspective of relational programming) 292 | 293 | ### Prolog, purity, and the default language choices 294 | 295 | DFS as default choice 296 | 297 | no occur-check as default choice 298 | 299 | purity, or lack of it: 300 | 301 | * `!` (cut) --- and its different "colors" 302 | 303 | * `copy_term` 304 | 305 | * `set_of`, `bag_of`, etc. 306 | 307 | Many Prolog programmers seem to think that if their program doesn't 308 | contain "red" cuts, their program is "declarative". Whether the 309 | program is declarative may be debatable. However, most likely it 310 | isn't *relational*. 311 | 312 | ## Translating Prolog programs to miniKanren 313 | 314 | [TODO] 315 | 316 | # Restrictions to logic programming 317 | 318 | [Datalog] 319 | 320 | [ASP] 321 | 322 | # Extensions to logic programming 323 | 324 | [higher-order unification and pattern matching] 325 | 326 | [lambdaProlog] 327 | 328 | [nominal logic programming] 329 | 330 | # Modes 331 | 332 | [TODO] 333 | 334 | # Closed world vs. open world 335 | 336 | ## CWA 337 | 338 | [TODO] 339 | 340 | ## OWA 341 | 342 | [TODO] 343 | 344 | ## train table example 345 | 346 | [TODO] 347 | 348 | ## Semantic Web, description logic, etc. 349 | 350 | [TODO] 351 | 352 | # Negation and negative information 353 | 354 | ## Negation as failure 355 | 356 | [TODO] 357 | 358 | ## Constraints and regstricted negation 359 | 360 | [TODO] 361 | 362 | # Aggregation 363 | 364 | [TODO] 365 | 366 | # setof, bagof, etc. 367 | 368 | relational implications of 369 | 370 | # Stratified queries 371 | 372 | [TODO] 373 | 374 | # Nested `run` 375 | 376 | [TODO] 377 | 378 | # Stratified negation 379 | 380 | [TODO] 381 | 382 | # Relational programing techniques 383 | 384 | ## Relational arithmetic 385 | 386 | [explore tradeoffs, laziness, domains, floundering, supported operations, etc.] 387 | 388 | ### passing a ground number as an argument and using normal arith operations 389 | 390 | [TODO] 391 | 392 | ### `project` and normal arithmetic operations --- allows for logic variables and unification, so long as the arithmetic operations aren't used on a fresh logic variable 393 | 394 | [TODO] 395 | 396 | ### delayed goals --- often can have some relational behavior, in that different "modes" can be supported: + and -, sin and arcsin, etc. 397 | 398 | [TODO] 399 | 400 | ### Peano, and how it is good for increment and decrement 401 | 402 | [TODO] 403 | 404 | ### "Oleg arithmetic" [include FLOPS paper, Prolog version, mk version, talk about proofs, decidability, performance, lazy vs. non-lazy, partally-instantiated numerals and which numbers they can represent, etc.] 405 | 406 | [TODO] 407 | 408 | ### CLP(FD) cKanren, core.lgic, etc. 409 | 410 | [TODO] 411 | 412 | ### CLP(Z) 413 | 414 | [TODO] 415 | 416 | ### CLP(R) 417 | 418 | [TODO] 419 | 420 | ### bit vector constraints [does this make sense?] 421 | 422 | [TODO] 423 | 424 | ### CLP(SMT) different solvers and the theories they support, smt-lib, solvers with sin and cos, etc. 425 | 426 | [TODO] 427 | 428 | # Various types of logic 429 | 430 | ## Monotonic vs. non-monotonic reasoning 431 | 432 | [TODO] 433 | 434 | ## Nominal logic 435 | 436 | [TODO] 437 | 438 | ## Defeasible logic 439 | 440 | [TODO] 441 | 442 | ## Linear logic 443 | 444 | [TODO] 445 | 446 | ## Probabilistic logic 447 | 448 | [TODO] 449 | 450 | ## Temporal logic 451 | 452 | [TODO] 453 | 454 | ## Modal logic 455 | 456 | [TODO] 457 | 458 | # Functional logic programming 459 | 460 | [TODO] 461 | 462 | # Logic and constraint logic programming languages 463 | 464 | ## miniKanren 465 | 466 | [TODO] 467 | 468 | ## Prolog 469 | 470 | [TODO] 471 | 472 | ## Datalog 473 | 474 | [TODO] 475 | 476 | ## Answer Set Programming 477 | 478 | [TODO] 479 | 480 | ## Problog 481 | 482 | [TODO] 483 | 484 | ## PRISM 485 | 486 | [TODO] 487 | 488 | ## Mercury 489 | 490 | [TODO] 491 | 492 | ## Verse/Verse Calculus -- similarity to Icon 493 | 494 | [TODO] 495 | 496 | ## Curry -- laziness and needed narrowing 497 | 498 | [TODO] 499 | 500 | ## Godel [dots over the o] [include the successor language] 501 | 502 | [TODO] 503 | 504 | ## [include other languages, esp. older ones] 505 | 506 | [TODO] 507 | 508 | # Constraint solving 509 | 510 | ## Modern view of traditional logic programming as CLP(Tree); Prolog 0 with disunification 511 | 512 | [TODO] 513 | 514 | ### disequality constraints --- H. Comon paper; Prolog 0 and Prolog II; not sure why the Prolog that caught on didn't seem to include disequality constraints 515 | 516 | [TODO] 517 | 518 | ## Modern Prologs support various constraint domains 519 | 520 | [TODO] 521 | 522 | ## CLP(X), typed or sorted logic variables, and combining constraints from various domains on a single variable 523 | 524 | [TODO] 525 | 526 | # Search 527 | 528 | ## DFS 529 | 530 | [TODO] 531 | 532 | ## BFS 533 | 534 | [TODO] 535 | 536 | ## IDFS 537 | 538 | [TODO] 539 | 540 | ## Interleaving search 541 | 542 | [TODO] 543 | 544 | ## Guided search 545 | 546 | ### A* search 547 | 548 | [TODO] 549 | 550 | ### Neural-guided search 551 | 552 | [TODO] 553 | 554 | ### N-grams guided search 555 | 556 | [TODO] 557 | 558 | ### Probabilistic search: sequential MC, etc. 559 | 560 | [TODO] 561 | 562 | # Unification 563 | 564 | ## Variants of unification 565 | 566 | ### First-order syntactic unification 567 | 568 | [TODO] 569 | 570 | ### Nominal unification and equivariant unification 571 | 572 | [TODO] 573 | 574 | ### Higher-order unification and higher-order pattern matching 575 | 576 | [TODO] 577 | 578 | ### Unification with segment variables [should this be thought of as a type of e-unification?] 579 | 580 | [TODO] 581 | 582 | ### E-unification 583 | 584 | #### ACI unification 585 | 586 | [representing subtyping etc. in unification and logic programming] 587 | 588 | # Relational parsing 589 | 590 | [TODO] 591 | 592 | # Relational type checking and inference 593 | 594 | [TODO] 595 | 596 | # The heachaches and how to deal with them: 597 | 598 | ## Conjunction (ugh!!!) 599 | 600 | [TODO] 601 | 602 | ## Negation (ugh!!!) 603 | 604 | [TODO] 605 | 606 | # Debugging 607 | 608 | ("Computer says 'no'") 609 | 610 | ## Divergence 611 | 612 | [causes of divergence, as described in my dissertation] 613 | 614 | [`run 1` rather than `run *` or `run n` for `n` > 1] 615 | 616 | ## No answers/missing answers 617 | 618 | [run with distinct fresh logic variables as the arguments] 619 | 620 | [comment out one or more relations in a conjunction---can replace an entire conjunction with `succeed` or the equivalent, `(== #f #f)`, if necessary] 621 | 622 | ## Unexpected answers 623 | 624 | ## Bizarre and unexplainable behavior 625 | 626 | [missing `fresh`/the infamous `lambda` error] 627 | 628 | [inadvertantly mixing terms and goals, such as in `(== (appendo x y z) out)` and `(== (== x 4) y)`] 629 | 630 | # The art of cheating without being caught 631 | 632 | ## Barliman interpreter hax 633 | 634 | [Greg observed that the relational interpreter was synthesizing huge numbers of `lambda` expressions with increasingly long formal parameter lists, where none of the formal parameters were referenced in the body of the `lambda`. Greg made an adjustement to prevent this behavior (how?)] 635 | 636 | [use `lookup` function in Scheme if the environment is sufficiently ground] 637 | 638 | [dynamically reordering serious goals/recursive calls in the conjunction for procedure application, based on groundness of the arguments] 639 | 640 | [weighted variant of `conde`, in which clauses have hand-crafted weights] 641 | 642 | [ICFP 2017 pearl description] 643 | 644 | [strictly speaking, I think these changes are heuristics rather than optimizations, since an optimization in the algorithmic sense never leads to more inefficient behavior than the unoptimized code. These heuristics have some overhead, or bias the search in a way that might slow down some synthesis problems, or can be sensitive to slight changes in the input (such as how recursive calls in the conjunction are reordered for procedure application, which can greatly speed up synthesis, but can also slow down synthesis)] 645 | 646 | [some of these heuristics seem more important in practice than others. For example, the environment lookup heuristic and the dynamic reordering of recursive calls in procedure application. We tried applying these techniques in the `n-grams` repo, with some success, but without being able to replicate the full speedup seen in Barliman.] 647 | 648 | # Data structures 649 | 650 | ## Pairs and lists 651 | 652 | [TODO] 653 | 654 | ## Sets and CLP(Set) 655 | 656 | [TODO] 657 | 658 | ## ADTs 659 | 660 | [TODO] 661 | 662 | ## records 663 | 664 | [TODO] 665 | 666 | # Program synthesis 667 | 668 | ## e-graphs, VSA, tree autamata 669 | 670 | [TODO] 671 | 672 | # Semantics of logic programming 673 | 674 | Herbrand Universe 675 | 676 | Fixpoint semantics 677 | 678 | unification/anti-unification and lattices (Reynolds and Plotkin papers from ~1971/1970ish) 679 | 680 | [John W. Lloyd book] 681 | 682 | [Kees Doets book] 683 | 684 | [stable-model semantics for ASP] 685 | 686 | [Ramana Kumar and Michael Norrish's mechanized proof of the correctness of mK-style unification with triangular substitutions and walk] 687 | 688 | [St. Petersburg work on semantics for OCanren (and perhaps miniKanren)] 689 | 690 | # Tabled evaluation 691 | 692 | [ACM article by Warren (IIRC)] 693 | 694 | [there was an ACM article by J. Cohen---was it on tabled evaluation, or on constraint logic programming? I forget, though I found the paper interesting. Look up that paper!] 695 | 696 | [SLG-resolution] 697 | 698 | [the approach used on the tabling implementation with Ramana] 699 | 700 | [the connection between tabled logic programming and co-inductive logic programming] 701 | 702 | [when are calls considered equivalent? subsumption] 703 | 704 | [XSB Prolog and various notions of tabling] 705 | 706 | # Term rewriting and term reduction 707 | 708 | ## Confluence and Church-Rosser 709 | 710 | ### Modified notion for Verse Calculus 711 | 712 | [TODO] 713 | 714 | ## Knuth-Bendix completion 715 | 716 | [TODO] 717 | 718 | ## Linear logic multiset rewriting 719 | 720 | [TODO] 721 | 722 | # Things I'm excited about right now 723 | 724 | ## machine learning for automated theorem proving and proof assistants, inspired by Alpha Go [add CPP'24 talk] [implement this!!!!] 725 | 726 | [TODO] 727 | 728 | ## Natural deduction [implement this!!!!] 729 | 730 | [TODO] 731 | 732 | ## Sequent calculus [add tutorial] 733 | 734 | [TODO] 735 | 736 | ## Incorrectness logics 737 | 738 | [TODO] 739 | 740 | ## Using sequent calculus to implement a type system proving an expression won't evaluate [TODO <- add POPL'24 reference] [implement this!!!!] 741 | 742 | [TODO] 743 | 744 | # Interesting things I know almost nothing about, but which seem relevant 745 | 746 | ## monadic second-order logic 747 | 748 | [TODO] 749 | 750 | # What does `conde` stand for? Where did it come from? Why does it resemble Scheme's `cond`? 751 | 752 | [TODO] 753 | 754 | # What is environment trimming? Does miniKanren implement environment trimming? 755 | 756 | [TODO] 757 | 758 | # Is there an abstract machine for miniKanren? 759 | 760 | [TODO] 761 | 762 | # Is there a formal semantics for miniKanren? 763 | 764 | [TODO] 765 | 766 | # Difference lists and relational programming 767 | 768 | [TODO -- are Prolog-style difference lists useful when programming purely relationally? Why, or why not? What are good examples, either way? What are canonical use cases?] 769 | 770 | # Prolog II and rational infinite trees 771 | 772 | [TODO - A.C. paper describing the rational infinite trees in terms of rewriting instead of unification, and the followup paper by others on a logical reconstruction of Prolog II, showing that there is a logic programming interpretation. Did they ever figure out if there is a logic programming interpretation of disequality over rational trees? What is the relationship, if any, to tree automata, tabling, co-inductive logic programming, etc.?] -------------------------------------------------------------------------------- /perishable/wills-dubious-and-opinionated-collection-of-minikanren-and-relational-programming-resources/Makefile: -------------------------------------------------------------------------------- 1 | BOOK=book 2 | 3 | all: 4 | pandoc -f markdown -t pdf ${BOOK}.md -o ${BOOK}.pdf 5 | 6 | squeaky: clean 7 | rm -f ${BOOK}.pdf 8 | -------------------------------------------------------------------------------- /perishable/wills-dubious-and-opinionated-collection-of-minikanren-and-relational-programming-resources/README.md: -------------------------------------------------------------------------------- 1 | # Will’s Dubious and Opinionated Collection of miniKanren and Relational Programming Resources 2 | 3 | This book is released under a Creative Commons Attribution 4.0 International (CC BY 4.0) license (http://creativecommons.org/licenses/by/4.0/). The code accompanying this book is covered under the MIT license---please see the code for details. 4 | 5 | Creative Commons License
Will’s Dubious and Opinionated Collection of miniKanren and Relational Programming Resources by William E. Byrd is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/webyrd/imperishable-wonderland. 6 | 7 | Book file: `book.md` 8 | 9 | To typeset a PDF version of the book, just type `make` (assuming you have Pandoc installed). 10 | -------------------------------------------------------------------------------- /perishable/wills-dubious-and-opinionated-collection-of-minikanren-and-relational-programming-resources/book.md: -------------------------------------------------------------------------------- 1 | % Will’s Dubious and Opinionated Collection of miniKanren and Relational Programming Resources 2 | % William E. Byrd 3 | % March 25, 2024 4 | 5 | Copyright 2024 by William E. Byrd 6 | 7 | This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). (CC BY 4.0) 8 | 9 | # What is this book? 10 | 11 | This book is a collection of potentially useful resources related to miniKanren (and miniKanren-like languages), and related to relational programming more broadly. I describe each of these resources, attempting to balance being fair and level-headed with my personal idiosyncratic view of relational programming and miniKanren. 12 | 13 | # Why this book? 14 | 15 | There does not currently exist a curated, opinionated collection of the most important miniKanren-related resources. The main [miniKanren website](http://www.minikanren.org) contains links to some of these resources, but serves disparate purposes: providing a quick overview of miniKanren; announcing workshops; linking to various implementations of miniKanren and microKanren submitted by the creators of those implementations; linking to old blog posts about miniKanren; etc. The website is also intended to serve the needs of the overall miniKanren community, and avoids expressing opinions. 16 | 17 | # The writing philosophy behind this book 18 | 19 | This collection is a work in progress, and is intended to evolve over time. Also, as I better understand the context of work, I may revise my opinion, or even decide to remove a resource that no longer seems as important in the current miniKanren landscape. 20 | 21 | I will attempt to be fair in my descriptions of each work, even as I use my best judgement in the selection of the works, and my view on the importance of the work to relational programming. I will try to be clear when I don't think I understand a work, or its context or intent. If you think I am off in my assessments, or that I'm missing the point of a work, or that I misunderstand the technical details, or have overlooked an important work, etc., please let me know! I'm happy to consider other perspectives. Still, I'd rather have this book retain my perspective than merely be a list of paper titles, or whatever, so I reserve the right to stick with my original assessment. 22 | 23 | # Who is the audience for this book? 24 | 25 | Anyone interested in miniKanren or relational programming who is trying to make sense of the bewildering number of implementations, and growing number papers, talks, and books related to miniKanren. 26 | 27 | # Important miniKanren Implementations 28 | 29 | # miniKanren Learning Resources 30 | 31 | ## Online Tutorials 32 | 33 | [Livecode] 34 | 35 | # Conferences and Workshops 36 | 37 | [miniKanren and Relational Programming Workshop] 38 | 39 | [Scheme and Functional Programming Workshop] 40 | 41 | [Unconfo] 42 | 43 | [ML/OCaml Workshops] 44 | 45 | [ICFP] 46 | 47 | [ICLP] 48 | 49 | [FLOPS] 50 | 51 | [LOPSTR] 52 | 53 | [PADL] 54 | 55 | # Summer Schools 56 | 57 | [ALP -- for general LP] 58 | 59 | # Annotated Bibliography 60 | 61 | ## Books 62 | 63 | [TRS 2018] 64 | 65 | [TRS 2005] 66 | 67 | [Joy of Clojure] 68 | 69 | [7 More Languagues in 7 Weeks] 70 | 71 | [Imperishable Wonderland...] 72 | 73 | [which other books?] 74 | 75 | ## Dissertations 76 | 77 | [Ramana Kumar's undergrad honor's diss from ANU] 78 | 79 | [William E. Byrd's diss from IU] 80 | 81 | [Jason Hemann diss] 82 | 83 | [St. P. dissertations] 84 | 85 | [Naval architecture] 86 | 87 | [game/storytelling diss that used core.logic (I believe)] 88 | 89 | [etc.] 90 | 91 | ## Papers 92 | 93 | [Robinson 1965] 94 | 95 | [Plotkin 1970] 96 | 97 | [Reynolds 1971] 98 | 99 | [A.C. infinite terms in Prolog II] 100 | 101 | [a logical reconstruction of Prolog II] 102 | 103 | [logicT paper] 104 | 105 | [ICLP paper on alphaLeanTAP] 106 | 107 | [2017 ICFP pearl] 108 | 109 | [Galadriel paper] 110 | 111 | [OCanren papers from various venues, such as ML and OCaml workshops] 112 | 113 | [FLOPS paper on pure relational arithmetic] 114 | 115 | [relevant papers from Scheme Workshop; 2006 original paper on mk; alphaKanren; cKanren; 2012 quines pearl; what else?] 116 | 117 | [papers from miniKanren and Relational Programming workshops] 118 | 119 | # Talks 120 | 121 | [TMBPEW] 122 | 123 | [Untalk] 124 | 125 | [David Nolen talks] 126 | 127 | [collect academic talks] 128 | 129 | [recorded talks from SW/ICFP/mkW/etc.] 130 | -------------------------------------------------------------------------------- /perishable/writing-log.txt: -------------------------------------------------------------------------------- 1 | # Writing Log 2 | 3 | ## Sunday, March 31, 2024 4 | 5 | ### Session 1 6 | 7 | Writing on 'Will's Big Bad Boring Braindump on Relational Programming'. 8 | 9 | ## Saturday, March 30, 2024 10 | 11 | ### Session 1 12 | 13 | Writing on 'Will's Big Bad Boring Braindump on Relational Programming'. 14 | 15 | ## Friday, March 29, 2024 16 | 17 | ### Session 1 18 | 19 | Writing on 'Will's Big Bad Boring Braindump on Relational Programming'. 20 | 21 | ## Thursday, March 28, 2024 22 | 23 | ### Session 2 24 | 25 | Writing on 'An Imperishable Wonderland of Infinite Fun: A Relational View of Computation', really for the first time. 26 | 27 | ### Session 1 28 | 29 | Writing on 'How I Think About Relational Programming'. Added sketch of table model. 30 | 31 | ## Wednesday, March 27, 2024 32 | 33 | ### Session 1 34 | 35 | Added to `topics.txt` from email I sent myself earlier today. 36 | 37 | Started Yet Another New Book, 'How I Think About Relational Programming', to talk about...how I think about relational programming, starting with these new topics. 38 | 39 | ## Tuesday, March 26, 2024 40 | 41 | ### Session 1 42 | 43 | Added [TODO] to empty sections of Big Boring Braindump book so that the PDF would display the sections correctly on the page. Worked on entries. 44 | 45 | ## Monday, March 25, 2024 46 | 47 | ### Session 1 48 | 49 | Started Yet Another Book! 'Will’s Dubious and Opinionated Collection of miniKanren and Relational Programming Resources', which will be a collection of lovely and most useful resources related to miniKanren and reltional programming that may be useful, along with my questionable take on these resources. 50 | 51 | ## Sunday, March 24, 2024 52 | 53 | ### Session 1 54 | 55 | Put in 18 minutes on 'Will's Big Bad Boring Braindump on Relational Programming', describing tradeoffs of the EDSL approach to miniKanren. 56 | 57 | ## Saturday, March 23, 2024 58 | 59 | ### Session 2 60 | 61 | Put in 45 minutes on 'Confused Will’s Big List of Things He’d Like to Know about Relational Programming' 62 | 63 | ### Session 1 64 | 65 | Put in an hour on 'Will's Big Bad Boring Braindump on Relational Programming' 66 | 67 | ## Friday, March 22, 2024 68 | 69 | ### Session 4 70 | 71 | Continued working on 'Will's Big List', listing more questions and filling in some intro sections. 72 | 73 | ### Session 3 74 | 75 | Started yet another book: 'Confused Will’s Big List of Things He’d Like to Know about Relational Programming' 76 | 77 | Sort of the dual to 'An Imperishable Wonderland of Infinite Fun', although really both books will explore the Wonders and Mysteries of my beloved Relational Programming! 78 | 79 | This book is about the things I find really mysterious, or really promising, and would love to see explored deeply, either by me or by others. 80 | 81 | ### Session 2 82 | 83 | Added topics and a super-rough outline for parts of the Big Bad Braindump. 84 | 85 | ### Session 1 86 | 87 | Created new book, 'Will's Big Bad Boring Braindump on Relational Programming', which I intend to worrk on at the same time as 'An Imperishable Wonderland of Infinite Fun'. This book, as advertised, is intended to be a giant, semi-organized (at best!) braindump of everything I know about relational programming and miniKanren. Hence, the book is located in the `perishable` subdirectory of this repository. 88 | 89 | ## Tuesday, March 19, 2024 90 | 91 | Today I had many stimulating conversations regarding logic, logic programming, functional programming, machine learning, search, etc. I've recorded many of these ideas in my private topics file. I'll think about which I can make public. I plan to start triaging topics, public and private, soon. 92 | 93 | Looking forward to making more videos soon. 94 | 95 | ## Monday, March 18, 2024 96 | 97 | This morning I woke up early and finished going through the private repos on my laptop. 98 | 99 | I now have a list of interesting private repos on GitHub, BitBucket, and my laptop, with short descriptions of their contents. 100 | 101 | I need to: (1) figure out which of these I can add to the public `ideas.txt` file; (2) triage the public ideas; (3) triage the private ideas. 102 | 103 | This is taking longer than I had hoped for, although it's actually only been a week since I started this repo and writing log. I need to remind myself of 'TTT' from Piet Hein's 'Grooks': Things Take Time. 104 | 105 | ## Sunday, March 17, 2024 106 | 107 | Today I went through my private GitHub and BitBucket repos, and went through private repos on my laptop. I didn't record this work, since some of the repos are for unpublished work with collaborators, etc. 108 | 109 | I still have to write up about 50 repos on my laptop. ~20 years of hacking with collaborators adds up! 110 | 111 | ## Saturday, March 16, 2024 112 | 113 | ### Session 5 114 | 115 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad, GitHub repos, miniKanren Workshop papers, etc. 116 | 117 | Going through miniKanren.org to collect more ideas and implementations and documents 118 | 119 | ### Session 4 120 | 121 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad, GitHub repos, miniKanren Workshop papers, etc. 122 | 123 | Going through miniKanren.org to collect more ideas and implementations and documents 124 | 125 | ### Session 3 126 | 127 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad, GitHub repos, miniKanren Workshop papers, etc. 128 | 129 | Going through miniKanren.org to collect more ideas and implementations and documents 130 | 131 | ### Session 2 132 | 133 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad, GitHub repos, miniKanren Workshop papers, etc. 134 | 135 | Added notes from my phone. 136 | 137 | Going through miniKanren.org to collect more ideas and implementations and documents 138 | 139 | ### Session 1 140 | 141 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad, GitHub repos, miniKanren Workshop papers, etc. 142 | 143 | Finished going through my public GitHub repos, looking for miniKanren-related repos and topics. 144 | 145 | Began going through miniKanren.org to collect more ideas and implementations and documents 146 | 147 | ## Friday, March 15, 2024 148 | 149 | ### Session 1 150 | 151 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad, GitHub repos, miniKanren Workshop papers, etc. 152 | 153 | ## Thursday, March 14, 2024 154 | 155 | ### Session 3 156 | 157 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad, GitHub repos, miniKanren Workshop papers, etc. 158 | 159 | ### Session 2 160 | 161 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad, GitHub repos, miniKanren Workshop papers, etc. 162 | 163 | ### Session 1 164 | 165 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad. 166 | 167 | ## Wednesday, March 13, 2024 168 | 169 | ### Session 3 170 | 171 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad. 172 | 173 | ### Session 2 174 | 175 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad. 176 | 177 | ### Session 1 178 | 179 | Spent 30 minutes adding to the topics I might want to talk about in AIWOIF, based on the notes on my phone and on my notepad. 180 | 181 | ## Tuesday, March 12, 2024 182 | 183 | ### Session 2 184 | 185 | Switched from LaTeX to Markdown and Pandoc. I want to do this to keep from ending up with a format (PDF or complex LaTeX/BibTeX/etc) that is hard to read or manipulate, and hard to translate to other formats. 186 | 187 | The switch to Markdown and Pandoc seemed painless enough. I'll have to get used to giving up some control over formatting. The extended Pandoc version of Markdown has special features that might prove useful. I updated the Makefile to generate a PDF version of the document from the Markdown. I could also do more fancy LaTeX generation, but I'll defer that for now. 188 | 189 | ### Session 1 190 | 191 | Showed off pinned repo on GitHub: `imperishable-wonderland` 192 | 193 | Created this writing log that will include sticky notes I use to communicate with viewers when making silent writing videos, along with what I attempted and/or accomplished during my writing sessions. I will order the log entries so that the most recent writting sessions come first. 194 | 195 | Created a new file `contents.txt` in the `images` directory that contains the contents of the image files in that directory. 196 | 197 | Added a `README.md` file for the book in the `imperishable` directory, and included the Creative Commons CC BY Attribution 4.0 International license for the book and said that the code was under an MIT license, but to check the code for details. 198 | 199 | Added the Creative Commons CC BY Attribution 4.0 International license to a new page in the book itself. Created a new `macros.tex` file to contain handy LaTeX macros, such as the `wspace` (Will's Space) macro to give just a tiny bit of vertical spacing. 200 | 201 | ## Monday, March 11, 2024 202 | 203 | Created repository, and created initial outline and files. 204 | --------------------------------------------------------------------------------