mk: phase 5C — nafc, negation as finite failure
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 52s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 52s
(nafc g) is a three-line primitive: peek the goal's stream for one answer; if empty, yield (unit s); else mzero. Carries the standard miniKanren caveats — open-world unsound, diverges on infinite streams. 7 tests: failed-goal-succeeds, successful-goal-fails, double-negation, conde-all-fail-makes-nafc-succeed, conde-any-success-makes-nafc-fail, nafc as a guard accepting and blocking. 201/201 cumulative.
This commit is contained in:
@@ -128,7 +128,9 @@ Key semantic mappings:
|
||||
- [x] `conda` — soft-cut: first non-failing head wins; ALL of head's answers
|
||||
flow through rest-goals; later clauses not tried (`Phase 5 piece A`)
|
||||
- [x] `condu` — committed choice (Phase 2)
|
||||
- [ ] `nafc` — negation as finite failure with constraint
|
||||
- [x] `nafc` — negation as finite failure: `(nafc g)` yields the input subst
|
||||
iff g has zero answers. Standard caveats apply (open-world unsoundness;
|
||||
diverges if g is infinite). `Phase 5 piece C`.
|
||||
- [ ] Tests: Zebra puzzle, N-queens, Sudoku via `project`, family relations via `matche`
|
||||
|
||||
### Phase 6 — arithmetic constraints CLP(FD)
|
||||
@@ -157,6 +159,9 @@ _(none yet)_
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-05-07** — **Phase 5 piece C — nafc**: `lib/minikanren/nafc.sx`. Three-line
|
||||
primitive: stream-take 1; if empty, `(unit s)`, else `mzero`. 7 tests including
|
||||
double-negation and use as a guard. 201/201 cumulative.
|
||||
- **2026-05-07** — **Phase 5 piece B — project**: `lib/minikanren/project.sx` —
|
||||
defmacro that walks each named var, rebinds them, and runs the body's mk-conj.
|
||||
Demonstrated escape into host arithmetic / string ops (`(* n n)`, `(str s "!")`).
|
||||
|
||||
Reference in New Issue
Block a user