Goals as Constraints: Writing miniKanren Constraints in miniKanren
summary
Adds an extension to miniKanren that runs arbitrary miniKanren goals as constraints, implemented as two cooperating interpreters that treat constraints as first‑order goal objects. Introduces three forms: constraint, P-constraint, and natto (negation), reuses miniKanren for constraint code, and generalizes disequality handling to arbitrary goals. Prototype in Scheme exists on GitHub; microbenchmarks vs fasterMK show consistent speedups on disequality-heavy tests and mixed results for absent/present constraints, and the system successfully expresses presento/absento and finite‑domain style checks.
AI-written summary · about
chapters (22)
- 0:00miniKanren constraints intro
- 1:04Talk overview and motivation
- 2:07Limitations of traditional constraints
- 3:31Goals as constraints in miniKanren
- 4:56Constraint forms in miniKanren
- 7:23Recursive structures and matching
- 8:26Negation in constraints
- 10:11Primitive constraints with P
- 11:58Type constraints implementation
- 12:40Natto: Negation of goals
- 14:25Q&A on constraint interface
- 17:16Constraint solver overview
- 19:02Unification and state management
- 25:38Q&A on interpreter structure
- 26:02Natto and disequality generalization
- 31:00Disjunction handling in constraints
- 35:56Attributed variables and dependencies
- 37:37Fresh variables and matching
- 38:19Performance benchmarks
- 41:53Performance results analysis
- 42:13GitHub repo and future work
- 42:55Q&A on satisfiability
