• Sorry Stargate , Europe was quicker again (Was: It was already uploaded

    From Mild Shock@21:1/5 to Mild Shock on Sun Jul 20 18:14:26 2025
    Hi,

    The Stargate Project is a new company which intends
    to invest $500 billion over the next four years
    building new AI infrastructure for OpenAI in
    the United States. SoftBank having financial
    responsibility and OpenAI having operational
    responsibility. Masayoshi Son will be the chairman.

    https://openai.com/index/announcing-the-stargate-project/

    What a shame no, solution from USA or Japan
    for decades? Ok, maybe my solution doesn't work
    either. Don't know yet, so far I am using

    my intuition. Which tells me if a polish
    prefix is equivalent then the corresponding
    subterm is equivalent. And where the polish

    prefix diagrees for the first time, one
    has found a conflict which is anyways the
    typical f/n versus g/n conflict, or otherwise

    different arguments used, in this case the algorithm
    will make a choice based on the primtitives and
    the '$VAR'/1 in the compounds. But for acyclic

    terms the '$VAR'/1 values are kind of normed,
    and their appearance indicates a non-primitive.

    Bye

    Mild Shock schrieb:

    BTW: Its essentially the same code like
    here from 2023, a little “polished”:

    Cheap compare for cyclic terms [injective collation keys] https://swi-prolog.discourse.group/t/cheap-compare-for-cyclic-terms-injective-collation-keys/6427


    But I have removed my old file rep2.p,
    since I wanted a more didactic presentation.

    Mild Shock schrieb:

    % polish(+Term, -List, -Term)
    polish(X, L, T) :-
        sys_polish_term(X, [], H, T),
        sys_strip_reverse(H, [], L).

    % sys_polish_term(+Term, +List, -List, -Term)
    sys_polish_term(T, L, L, T) :- (var(T); atomic(T)), !.
    sys_polish_term(T, L, L, V) :-
        member(v(S,V,_), L),
        S == T, !.
    sys_polish_term(T, L, R, V) :-
        length(L, N),
        V = '$VAR'(N),
        T =.. [F|P],
        sys_polish_terms(P, [v(T,V,S)|L], R, Q),
        S =.. [F|Q].

    % sys_polish_terms(+List, +List, -List, -List)
    sys_polish_terms([], L, L, []).
    sys_polish_terms([X|P], L, R, [Y|Q]) :-
        sys_polish_term(X, L, H, Y),
        sys_polish_terms(P, H, R, Q).

    % sys_strip_reverse(+List, +List, -List)
    sys_strip_reverse([], L, L).
    sys_strip_reverse([v(_,V,T)|L], R, S) :-
        sys_strip_reverse(L, [V=T|R], S).

    Mild Shock schrieb:
    Strange this little Prolog code snippet,
    that creates a polish notation with sharing
    out of a Prolog term, either acyclic or cyclic,
    works for me to compare terms (that do not contain ‘$VAR’/1):

    polish(X, L, T) :-
        sys_polish_term(X, [], H, T),
        sys_strip_reverse(H, [], L).

    Here the test cases from the top-level ticket:

    ?- p(X,Y), polish(p(X,Y),L,T).
    L = [A=p(B, B), B=f(B)],
    L = [A=p(B, D), B=a(C), C=f(B, D), D=b(E), E=g(B, D)],
    L = [A=p(B, D), B=s(C, _A), C=s(B, D), D=s(D, B)],

    The description “Polish” refers to the nationality
    of logician Jan Łukasiewicz who invented Polish notation
    in 1924. In the above I am more doing what is called

    reverse polish notation, known from pocket calculators
    such as HP-41C, the perfect toy for, boring math classes
    during school. You can imagine the sharing happens

    by pressing the memory store and recall keys of a HP-41C.

    Defining a comparison as:

    compare2(C,X,Y) :- polish(X,L,T), polish(Y,R,S),
        compare(C,L-T,R-S).

    Has the following properties:

    - It is conservative:
       For acyclic terms compare2/3 and compare/3 agree.

    - It is a total order:
       Because compare2/3 falls back to compare/3, and polish
       is injective versus (==)/2, it has all desired properties.

    https://www.hpmuseum.org/hp41.htm

    Julio Di Egidio schrieb:
    On 20/07/2025 16:15, Julio Di Egidio wrote:
    On 20/07/2025 15:13, Mild Shock wrote:

    ;  > Let (H, <) be the standard total oder an the
    ;  > Prolog finite terms. Let R be the set of rational
    ;  > term. H c R. Then there is total order
    ;  > extention (R, <') of (H, <).
    ;
    Is the problem of a compare/3 for rational trees,
    that is a extension of the compare/3 for finite aka
    acyclic terms with the submodel property.

    Your "discourse" implicitly assumes that the
    "extension" is somewhat "trivial" and/or
    "natural".  Which, in turn, I'd think is the
    case (can be done) only if we can *effectively*
    (and, ideally, somewhat "naturally") define
    *canonical form* then *normalization* of
    (Prolog's) cyclic terms...

    P.S.  I have not actually investigated this, but
    if "normalization" is not a problem, then I do not
    see what the problem is...

    -Julio





    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sun Jul 20 18:28:39 2025
    Hi,

    Seems I posted the wrong code, I posted
    some code that is used for printing, which has
    different requirements. Well you can figure out

    the correct code by yourself.

    LoL

    Bye

    Mild Shock schrieb:
    Hi,

    The Stargate Project is a new company which intends
    to invest $500 billion over the next four years
    building new AI infrastructure for OpenAI in
    the United States. SoftBank having financial
    responsibility and OpenAI having operational
    responsibility. Masayoshi Son will be the chairman.

    https://openai.com/index/announcing-the-stargate-project/

    What a shame no, solution from USA or Japan
    for decades? Ok, maybe my solution doesn't work
    either. Don't know yet, so far I am using

    my intuition. Which tells me if a polish
    prefix is equivalent then the corresponding
    subterm is equivalent. And where the polish

    prefix diagrees for the first time, one
    has found a conflict which is anyways the
    typical f/n versus g/n conflict, or otherwise

    different arguments used, in this case the algorithm
    will make a choice based on the primtitives and
    the '$VAR'/1 in the compounds. But for acyclic

    terms the '$VAR'/1 values are kind of normed,
    and their appearance indicates a non-primitive.

    Bye

    Mild Shock schrieb:

    BTW: Its essentially the same code like
    here from 2023, a little “polished”:

    Cheap compare for cyclic terms [injective collation keys]
    https://swi-prolog.discourse.group/t/cheap-compare-for-cyclic-terms-injective-collation-keys/6427


    But I have removed my old file rep2.p,
    since I wanted a more didactic presentation.

    Mild Shock schrieb:

    % polish(+Term, -List, -Term)
    polish(X, L, T) :-
        sys_polish_term(X, [], H, T),
        sys_strip_reverse(H, [], L).

    % sys_polish_term(+Term, +List, -List, -Term)
    sys_polish_term(T, L, L, T) :- (var(T); atomic(T)), !.
    sys_polish_term(T, L, L, V) :-
        member(v(S,V,_), L),
        S == T, !.
    sys_polish_term(T, L, R, V) :-
        length(L, N),
        V = '$VAR'(N),
        T =.. [F|P],
        sys_polish_terms(P, [v(T,V,S)|L], R, Q),
        S =.. [F|Q].

    % sys_polish_terms(+List, +List, -List, -List)
    sys_polish_terms([], L, L, []).
    sys_polish_terms([X|P], L, R, [Y|Q]) :-
        sys_polish_term(X, L, H, Y),
        sys_polish_terms(P, H, R, Q).

    % sys_strip_reverse(+List, +List, -List)
    sys_strip_reverse([], L, L).
    sys_strip_reverse([v(_,V,T)|L], R, S) :-
        sys_strip_reverse(L, [V=T|R], S).

    Mild Shock schrieb:
    Strange this little Prolog code snippet,
    that creates a polish notation with sharing
    out of a Prolog term, either acyclic or cyclic,
    works for me to compare terms (that do not contain ‘$VAR’/1):

    polish(X, L, T) :-
        sys_polish_term(X, [], H, T),
        sys_strip_reverse(H, [], L).

    Here the test cases from the top-level ticket:

    ?- p(X,Y), polish(p(X,Y),L,T).
    L = [A=p(B, B), B=f(B)],
    L = [A=p(B, D), B=a(C), C=f(B, D), D=b(E), E=g(B, D)],
    L = [A=p(B, D), B=s(C, _A), C=s(B, D), D=s(D, B)],

    The description “Polish” refers to the nationality
    of logician Jan Łukasiewicz who invented Polish notation
    in 1924. In the above I am more doing what is called

    reverse polish notation, known from pocket calculators
    such as HP-41C, the perfect toy for, boring math classes
    during school. You can imagine the sharing happens

    by pressing the memory store and recall keys of a HP-41C.

    Defining a comparison as:

    compare2(C,X,Y) :- polish(X,L,T), polish(Y,R,S),
        compare(C,L-T,R-S).

    Has the following properties:

    - It is conservative:
       For acyclic terms compare2/3 and compare/3 agree.

    - It is a total order:
       Because compare2/3 falls back to compare/3, and polish
       is injective versus (==)/2, it has all desired properties.

    https://www.hpmuseum.org/hp41.htm

    Julio Di Egidio schrieb:
    On 20/07/2025 16:15, Julio Di Egidio wrote:
    On 20/07/2025 15:13, Mild Shock wrote:

    ;  > Let (H, <) be the standard total oder an the
    ;  > Prolog finite terms. Let R be the set of rational
    ;  > term. H c R. Then there is total order
    ;  > extention (R, <') of (H, <).
    ;
    Is the problem of a compare/3 for rational trees,
    that is a extension of the compare/3 for finite aka
    acyclic terms with the submodel property.

    Your "discourse" implicitly assumes that the
    "extension" is somewhat "trivial" and/or
    "natural".  Which, in turn, I'd think is the
    case (can be done) only if we can *effectively*
    (and, ideally, somewhat "naturally") define
    *canonical form* then *normalization* of
    (Prolog's) cyclic terms...

    P.S.  I have not actually investigated this, but
    if "normalization" is not a problem, then I do not
    see what the problem is...

    -Julio






    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)