when is an inference not an inference?

35 views
Skip to first unread message

Mark Tarver

unread,
Sep 7, 2022, 9:50:37 AM9/7/22
to Shen
The standard benchmark for Prolog is Lips or logical inferences per second.  Happily
Shen Prolog under Scheme is doing between 2-3 MLips (2.5 x 10^6 Lips) on my 4.7GHz which is pretty good for version designed to port over umpteen languages and written at a high level..  Here is a computation running at 2.5 MLips.

(11-) (ftp.<-kb (ec))

run time: 1.0140064999999998 secs
2509580 inferences
true

However I find that SWI Prolog counts stuff like numeric comparision as an inference

?- time(5 > 7).
% 2 inferences, 0.000 CPU in 0.000 seconds (?% CPU, Infinite Lips)
false.

?- time(15 > 7).
% 1 inferences, 0.000 CPU in 0.000 seconds (?% CPU, Infinite Lips)
true.

Shen Prolog does not count invocations of when as inferences; ditto call and var? and the other walk on parts.   So Lips comparisons are misleading.

On Einstein's Riddle I get SWI Prolog as about 2.5 times faster than Shen Prolog.

Mark

nha...@gmail.com

unread,
Oct 22, 2022, 5:15:27 PM10/22/22
to Shen
I just notice the docs comment on it here: https://www.swi-prolog.org/pldoc/doc_for?object=call_with_inference_limit/3

"An inference is defined as a call or redo on a predicate. Please note that some primitive built-in predicates are compiled to virtual machine instructions for which inferences are not counted. The execution of predicates defined in other languages (e.g., C, C++) count as a single inference. This includes potentially expensive built-in predicates such as sort/2."

Reply all
Reply to author
Forward
0 new messages