Article View: comp.lang.prolog
Article #40Where would steadfastness be needed? (Was: What would Robert Stärk say? [Have Fun!])
From: Mild Shock
Date: Tue, 03 Nov 2026 15:07
Date: Tue, 03 Nov 2026 15:07
97 lines
4069 bytes
4069 bytes
Hi, Well in this definition, the second normal_form/2 call is with mode (+,+), ad not anymore with mode (+,-): joined_pair(Name) :- critical_pair(Name, Left, Right), normal_form(Left, Normal), normal_form(Right, Normal). Bye Mild Shock schrieb: > Hi, > > Well the interesting part of the normal_form/2 > predicate, is also that negation as failure is > not called with a ground goal argument, so the > example leans out of the framework > > of SLDNF, where \+ G are supposed to have G ground > at runtime. If it were ground, as a next step in > some Datalog frameworks it can then indeed be > interpreted as absence of a fact or > > derived fact, due to negation stratification. But > Robert Stärk already observed that the two extra > variables _and _, in the call, make it basically > asking a not exists query, > > and therefore the justifiation is not only > absence but rather the proof tree of a finite > failure. But if we look at the example it is also > not stead fast, an input 2nd argument > > my divert the derivation, and last but not least > rewrite_once is left recursive, and has an infinite > answer set, i.e. all normal terms. One might wonder > whether Robert Stärk left academia back then, > > because such a large number of problems is just too > much for a Human. Just joking. The resilient Prologer > might also see it as the birth place of cuts, since > an alternative formulation often > > found in the wild would be: > > normal_form(Term, Normal) :- > rewrite_once(Term, Next, _), !, > normal_form(Next, Normal). > normal_form(Term, Term). > > Its even steadfast now in the 2nd argument, and > calls rewrite_once/3 not in two different places, > but only in one place, giving yet anoter inch > more performance. > > Have Fun! > > Bye > > Mild Shock schrieb: >> Hi, >> >> Using the EyeProlog example code, I get this >> result in a ISO compliant Prolog processor. >> The predicate turns out to be non-deterministic >> operational: >> >> ?- normal_form(append(append(append(a,b),c),d), X). >> X = append(a, append(b, append(c, d))) ; >> X = append(a, append(b, append(c, d))) ; >> false. >> >> So normal form has spurious choice points. And >> would explode in practice, when deployed as a >> normal form routine and when supplied larger terms. >> >> A fix would be: >> >> normal_form(Term, Term) :- >> \+ rewrite_once(Term, _, _). >> normal_form(Term, Normal) :- >> once(rewrite_once(Term, Next, _)), >> normal_form(Next, Normal). >> >> But once/1 is not among your list of "by" justifications? >> Lean 4 does solve this problem in that already match/with >> is deterministic. But Lean 4 can make it declarative >> >> by a recursor / motive translation. >> >> Bye >> >
Technical Details
Message-ID:
<11cctc1$u2bc$1@solani.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mailReferences:
<11cb9rh$ssq2$1@solani.org> <11ccssl$u1mc$1@solani.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Mild Shock <janburse@fastmail.fm> Newsgroups: comp.lang.prolog Subject: Where would steadfastness be needed? (Was: What would Robert Stärk say? [Have Fun!]) Date: Tue, 3 Nov 2026 16:07:44 +0100 Message-ID: <11cctc1$u2bc$1@solani.org> References: <11cb9rh$ssq2$1@solani.org> <11ccssl$u1mc$1@solani.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 3 Nov 2026 15:07:45 -0000 (UTC) Injection-Info: solani.org; logging-data="985452"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0 SeaMonkey/2.53.24 Cancel-Lock: sha1:NTYkzOPPuD5azTSFYlEOMBW52DY= X-User-ID: eJwNy8kBwCAMA7CVyGEnjENNs/8Irf5C0KhKgonBKGOZjoAxb2nu+yxmx2wvuxw/Pg+qib3zYHWlxVU5/5b4AFSrFQQ= In-Reply-To: <11ccssl$u1mc$1@solani.org>