• Chicken and egg, with curry?

    From Julio Di Egidio@21:1/5 to All on Fri Jan 3 21:04:19 2025
    Partial and tentative:

    ```
    Functional = Closures/applications, Reduction/canonicity
    / |
    Logical | = Predicates/queries, Resolution/subsumption
    \ |
    Imperative = Procedures/invocations, Execution/...
    ```

    And there are two views of that triangle: Logical is the top of the
    *ideal* such triangle, along the lines of a universe with Prop on top,
    which we can reason with; Imperative is the bottom of a *concrete* such triangle, the bootstrap as well as the final point of application of any concrete system.

    And Logical is the constructive (structural) type-theory founding the Functional, where Functional exists for expressivity and modularity
    (what else?), plus can be compiled back/down to machine language...

    Right?

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Fri Jan 3 22:14:02 2025
    (Ok I resolved the shitty header problem:
    Newsgroups: sci.logic,comp.lang.prolog
    Followup-To: comp.lang.prolog )

    Hi,

    Just a side note, don't let you get distracted.
    A side node about the chicken/egg problem, i.e.
    without the curry:

    - a) Eggs came first, for example Turtles had eggs
    Turtles are part of an ancient reptilian
    lineage ca 300 million years ago

    - b) Chickens came after Turtles
    Chickens, on the other hand, are much younger
    in comparison, evolved from theropod dinosaurs
    around 150 million years ago

    Not sure whether this helps. But I think it could help
    nevertheless:

    - i) Logic Programming is the Egg

    - ii) From the Egg Turtles or Chickens can hatch,
    its very easy to program functionally or
    procdurally in Prolog. Just add small DSLs:

    https://en.wikipedia.org/wiki/Domain-specific_language

    here is an example of a DSL for array manipulation,
    and an implementation of Floyd Warshall algorithm:

    :- op(100, yf, []).
    :- op(800, fx, new).
    :- op(800, fx, let).
    :- op(800, fx, if).

    warshall(N, D) :-
    new D[N,N],
    (between(1,N,U), between(1,N,V), let D[U,V] = 999, fail; true),
    (edge(U,V,W), let D[U,V] = W, fail; true),
    (vertex(V), let D[V,V] = 0, fail; true),
    (between(1,N,K),
    between(1,N,I),
    between(1,N,J),
    let H = D[I,K] + D[K,J],
    (if D[I,J] > H -> let D[I,J] = H; true),
    fail; true).

    The definition of the DSL needs only one extension
    of Prolog, i.e. nb_setarg/3 (SWI-Prolog) respectively
    change_arg/3 (Dogelog Player):

    new D[N,M] :-
    functor(D, '', N),
    D =.. [_|L],
    new2(L, M).

    new2([], _).
    new2([X|L], N) :-
    functor(X, '', N),
    new2(L, N).

    let V = E :- var(V), !,
    let2(E,V).
    let D[R,C] = E :-
    let2(E,V),
    arg(R, D, H),
    nb_setarg(C, H, V).

    let2(D[R,C], V) :- !,
    arg(R, D, H),
    arg(C, H, V).
    let2(E+F, R) :- !,
    let2(E, V),
    let2(F, W),
    R is V+W.
    let2(V, V).

    if E > F :-
    let2(E, V),
    let2(F, W),
    V > W.

    Idiot Prolog systems like Scryer Prolog or Trealla Prolog
    refuse to provide such imperative gadgets, which are quite
    useful. If you interpret the DSL, its already bleeing fast,

    much faster than a pure implementation:

    ?- time((between(1,1000,_), graph(G),
    floyd_warshall(4, G, M), fail; true)).
    % 3,803,998 inferences, 0.156 CPU in 0.183 seconds (85% CPU, 24345587 Lips) true.

    ?- time((between(1,1000,_), warshall(4,D), fail; true)).
    % 1,046,998 inferences, 0.062 CPU in 0.062 seconds (100% CPU, 16751968 Lips) true.

    If you compile the DSL, you can again an itch more speed:

    /* DSL compiled */
    ?- time((between(1,1000,_), warshall(4,D), fail; true)).
    % 336,998 inferences, 0.000 CPU in 0.020 seconds (0% CPU, Infinite Lips)
    true.

    Bye


    Julio Di Egidio schrieb:
    Partial and tentative:

    ```
      Functional = Closures/applications, Reduction/canonicity
        /    |
    Logical  |   = Predicates/queries, Resolution/subsumption
        \    |
      Imperative = Procedures/invocations, Execution/...
    ```

    And there are two views of that triangle: Logical is the top of the
    *ideal* such triangle, along the lines of a universe with Prop on top,
    which we can reason with; Imperative is the bottom of a *concrete* such triangle, the bootstrap as well as the final point of application of any concrete system.

    And Logical is the constructive (structural) type-theory founding the Functional, where Functional exists for expressivity and modularity
    (what else?), plus can be compiled back/down to machine language...

    Right?

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Fri Jan 3 22:28:22 2025
    On 03/01/2025 22:14, Mild Shock wrote:

    Not sure whether this helps. But I think it could help
    nevertheless:

    - i) Logic Programming is the Egg

    - ii) From the Egg Turtles or Chickens can hatch,
        its very easy to program functionally or
        procdurally in Prolog. Just add small DSLs:

    I was indeed thinking along that line, though a full-fledged
    dependently-typed functional language is not a small DSL, and I don't
    think we can eventually do with less: for expressivity and modularity up
    to arbitrary "functions" (I am thinking computability logic a la
    Japaridze here, anyway indeed functional are the *problem* domains) as
    well as proofs of properties of those "functions".

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Julio Di Egidio on Thu Apr 3 13:34:51 2025
    On 03/01/2025 21:04, Julio Di Egidio wrote:
    Partial and tentative:

    ```
      Functional = Closures/applications, Reduction/canonicity
        /    |
    Logical  |   = Predicates/queries, Resolution/subsumption
        \    |
      Imperative = Procedures/invocations, Execution/...
    ```

    And there are two views of that triangle: Logical is the top of the
    *ideal* such triangle, along the lines of a universe with Prop on top,
    which we can reason with; Imperative is the bottom of a *concrete* such triangle, the bootstrap as well as the final point of application of any concrete system.

    And Logical is the constructive (structural) type-theory founding the Functional, where Functional exists for expressivity and modularity
    (what else?), plus can be compiled back/down to machine language...

    Right?

    No: and I won't repeat the whole Aristotle-up-to-1994 story, but once
    upon a time we had vocabularies vs dictionaries (we kids were simply
    explained that the latter are "sort of" a simplification of the former):
    today we only have dictionaries... The point here being:

    A word is not a locution (not an idiom), and a dictionary is not an encyclopedia: that is, *meaning is not compositional*! Contrast with
    the by now ubiquitous paradigm of compositionality from a foundation,
    i.e. bottom-up from some fixed ground, with closure in category theory,
    the other side of the same coin: and in spite of decades of warnings
    from actual linguists, not to even mention the philosophers: indeed,
    from that point of view, what I am saying is pretty basic.

    But, preparing for my Nobel article, I have spent a week now looking for "something else" in the mathematical and mathematico-logical literature, namely, a genuine mathematisation, if not formalisation, of some notion
    of "encyclopedic compendium" ("floating co-definitions"?), and I just
    cannot yet find or see any of it... can you?

    Ah, the good old Leibniz and what a Monad actually is, or a
    Characteristica Universalis. Or, a seed and the plant...

    "It's a long way, back to where we were."

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Julio Di Egidio on Fri Apr 4 21:52:22 2025
    On 03/04/2025 13:34, Julio Di Egidio wrote:
    On 03/01/2025 21:04, Julio Di Egidio wrote:

    A word is not a locution (not an idiom), and a dictionary is not an encyclopedia: that is, *meaning is not compositional*!  Contrast with
    the by now ubiquitous paradigm of compositionality from a foundation,
    i.e. bottom-up from some fixed ground, with closure in category theory,
    the other side of the same coin: and in spite of decades of warnings
    from actual linguists, not to even mention the philosophers:

    Or the pedagogists, or the anthropologists, or the cyberneticians.

    indeed, from that point of view, what I am saying is pretty basic.

    But, preparing for my Nobel article, I have spent a week now looking for "something else" in the mathematical and mathematico-logical literature, namely, a genuine mathematisation, if not formalisation, of some notion
    of "encyclopedic compendium" ("floating co-definitions"?), and I just
    cannot yet find or see any of it... can you?

    Ah, the good old Leibniz and what a Monad actually is, or a
    Characteristica Universalis.  Or, a seed and the plant...

    "It's a long way, back to where we were."

    Or, number vs numeral.
    Or, spatial vs temporal.
    Or, structural vs ...?

    But there is no such thing as a theory that is not a concrete theory:
    even the most abstract category theory, to be a theory, is a synthetic
    theory (I am learning). So, there can be no numbers in a theory...(?)

    Maybe I am pushing it too far: I am not sure. What seems sure is that compositionality is surely important but cannot be the only dimension.

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Julio Di Egidio on Fri Apr 4 21:56:47 2025
    On 04/04/2025 21:52, Julio Di Egidio wrote:

    Or, number vs numeral.
    Or, spatial vs temporal.
    Or, structural vs ...?

    Eh, of course number goes with temporal, etc.,
    not the other way round. Sorry for the confusion.

    Julio

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