kanren
kanren copied to clipboard
An extensible, lightweight relational/logic programming DSL written in pure Python
The following code fails with a `RecursionError`: ```python from kanren import eq, lall, lany, run, vars observations = [(0, 1), (1, 0)] def generate(pixels): pairs = [(a, b) for a,...
This PR provides an implementation of [“A Surprisingly Competitive Conditional Operator”](https://www.brinckerhoff.org/scheme2018/papers/Boskin_Ma_Christiansen_Friedman.pdf). As I mentioned in [this comment](https://github.com/pymc-devs/symbolic-pymc/issues/6#issuecomment-470765132), there's an interesting avenue to explore regarding cross-`cond`-branch states, and I've included an...
With a `ChainMap`-like state class, we could constrain the amount of state (e.g. `dict`) cloning that `kanren` does, which should provide a big performance improvement when states are large `Mapping`s...
In relation to https://github.com/pythological/kanren/issues/55, using a [`WeakKeyDictionary`](https://github.com/pythological/kanren/issues/55) might help automatically thin large states containing "auxiliary" logic variables that are no longer relevant. We would definitely need to profile this and...
Looking at the `walko` example in https://github.com/aesara-devs/aesara/discussions/1082, I'm starting to wonder if some of those entries in the state are necessary or not. In particular, ```python from kanren import eq,...
`ground_order` doesn't really order terms in a way that avoids infinite recursion in `term_walko` (e.g. when called by the `kanren.assoccomm` goals). There should be a way to handle this—at least...
This PR introduces a simple relational typing example for Python AST. This implementation is based on Racket examples provided by @jasonhemann. - [ ] Add all function body statements to...
With `condp` from #48, we could implement a simple, usable version of Pie as a demo of a type system with minimal dependent typing.
This project needs type annotations and a Mypy `pre-commit` hook.
I was trying to write a simple transitive relation, and had a bit of a difficult time (and as I can see in previous issues I am not the first)....