• Entering the Age of Rational Trees (2025) (Re: The End of Deutsch-Schorr-Waite [cycle_detection.rs])

    From Mild Shock@janburse@fastmail.fm to sci.math on Sat Aug 16 13:05:01 2025
    From Newsgroup: sci.math


    I like your vibe, clearing the mind of
    everything existing has a touch of a mystic
    human being living an eremitic solitary
    vocation on a far out mountain top.

    It is not accidential that there is a resemblage
    to the ivory tower of academics. Which might create
    incestual orthodoxical knowledge, with very less value.

    Prolog systems development is especially susceptible
    to this fallacy, since it has a long tradition
    going always the same paths, like WAM, etc.. etc..

    The pointer swizzling algorithms of SWI-Prolog,
    in connection with cyclic terms are a little
    problematic. What if a Prolog term sits in a

    read-only memory, or is shared among multiple threads.
    How do you do pointer swizzling of ROM and not RAM?
    We might indeed see the The End of Deutsch-Schorr-Waite,

    although it made it still into Scryer Prolog:

    **cycle_detection.rs**
    Use the pointer reversal technique of the Deutsch-Schorr-
    Waite algorithm to detect cycles in Prolog terms. https://github.com/mthom/scryer-prolog/blob/master/src/machine/cycle_detection.rs

    To enter the age of rational trees, it is probably
    advisable to arm oneself not only with Fuzzy Testing,
    but unlike the dislike of @kuniaki.mukai , one needs

    to probably also study all the goodies from 1970's
    computer science. But add a salt of scepticism, since
    hardware and programming languages look different now.

    Its not ALGOL anymore.

    Mild Shock schrieb:
    Hi,

    Assume that we live in a world where we
    have excess memory. So we can afford stacks!
    And then make the crucial observation,

    we can use the stack of the Prolog engine,
    no need to create an artificial stack in C,
    or use the native stack of C.

    I guess SWI-Prolog has already groked the
    first we can "afford stacks". But did anybody
    already grok the "100% Prolog" idea?

    Well we are not yet there 100% Prolog
    has still an overhead. Here is a little
    test acyclic_term/2:

    /* SWI-Prolog 9.3.26, C Stacks and/or Agendas */
    ?- time((between(1,30,_), acyclic2, fail; true)).
    % 330,150 inferences, 0.016 CPU in 0.023 seconds
    (69% CPU, 21129600 Lips)
    true.

    /* Trealla Prolog 2.79.6, ?? */
    ?- time((between(1,30,_), acyclic2, fail; true)).
    % Time elapsed 0.063s, 643413 Inferences, 10.166 MLips
    -a-a true.

    /* Dogelog Player 1.3.5, 100% Prolog */
    ?- time((between(1,30,_), acyclic2, fail; true)).
    % Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03
    true.

    /* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite-a */
    ?- time((between(1,30,_), acyclic2, fail; true)).
    % CPU time: 0.130s, 626_829 inferences
    true.

    Bye

    --- Synchronet 3.21a-Linux NewsLink 1.2