From: Markus Triska Date: Sun, 18 Jan 2026 08:57:37 +0000 (+0100) Subject: ADDED: not_si/1 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=0dc94ecc0bf1a40874b844263a48b880e8a596f5;p=scryer-prolog.git ADDED: not_si/1 For a recent example that would benefit from this, see "Prolog Basics Explained with Pokémon" by @alexpetros: https://unplannedobsolescence.com/blog/prolog-basics-pokemon/ Thank you a lot! --- diff --git a/src/lib/si.pl b/src/lib/si.pl index 0e29c190..8a642289 100644 --- a/src/lib/si.pl +++ b/src/lib/si.pl @@ -40,6 +40,7 @@ term_si/1, chars_si/1, dif_si/2, + not_si/1, when_si/2]). :- use_module(library(lists)). @@ -100,6 +101,17 @@ dif_si(X, Y) :- ; throw(error(instantiation_error,dif_si/2)) ). +%% not_si(+Goal). +% +% True if Goal is not provable. Instantiation error if Goal is not +% ground. + +:- meta_predicate(not_si(0)). + +not_si(Goal) :- + term_si(Goal), + \+ Goal. + :- meta_predicate(when_si(+, 0)). %% when_si(Condition, Goal).