• Still on negative translation for substructural logics

    From Julio Di Egidio@21:1/5 to Mild Shock on Sun Dec 1 16:17:42 2024
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line: <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11>
    By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
    solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one. The code
    is functional and pretty flexible actually, `notation/5` is `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results! You
    have no time for anything apparently, except for posting random shit and fucking with thread titles: I have messages all over the place, and it's
    just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !. % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the actual statement, provable intuitionistically, is intrinsically higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have to
    inspect the proof tree, what I actually get). Indeed, I am rather
    worried that it just solves everything I throw at it, though not the falsities... which is why I am also developing a meta-theory for it, in Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gate
  • From Mild Shock@21:1/5 to Julio Di Egidio on Sun Dec 1 16:34:03 2024
    And what are the results? Your gist shows
    this one here:

    % Peirce's law:
    solve_case(neg, pierce, [(p->q)->p]=>p).

    And you reported:

    solve_test::neg:
    - pierce: []=>((p->q)->p)->p --> true
    solve_test::neg: tot.=1, FAIL=0 --> true.

    What do you get with gliv/1?

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line: <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11>
    By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
         solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The code
    is functional and pretty flexible actually, `notation/5` is `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!  You
    have no time for anything apparently, except for posting random shit and fucking with thread titles: I have messages all over the place, and it's
    just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the actual statement, provable intuitionistically, is intrinsically higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have to inspect the proof tree, what I actually get).  Indeed, I am rather
    worried that it just solves everything I throw at it, though not the falsities... which is why I am also developing a meta-theory for it, in
    Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sun Dec 1 16:50:57 2024
    Hi,

    This inference rule is incorrect:

    % (C,X->Y=>Z) --> [(C=>X),(C,Y=>Z)]
    reduction(elim, imp, (C0=>Z), Gs, Ps) :-
    nth1(H, C0, (X->Y), C1),
    append(C1, [Y], C2),
    Gs = [C1=>X,C2=>Z],
    Ps = [H:X,H:Y].

    The correct one would be, X->Y has to
    be repeated in the left proof branch:

    % (C,X->Y=>Z) --> [(C,X->Y=>X),(C,Y=>Z)]
    ... put your prolog code here ...

    Then you can only possibly prove Pierce Law
    with Glivenko. Otherwise there is no chance.

    See also here:

    Mathematical Intuitionism: Introduction to Proof Theory
    A. G. Dragalin
    §3 THE SEQUENT CALCULUS - Page 11
    The calculus GHPC
    https://bookstore.ams.org/MMONO/67

    Good Luck!

    Bye

    Mild Shock schrieb:
    And what are the results? Your gist shows
    this one here:

    % Peirce's law:
    solve_case(neg, pierce, [(p->q)->p]=>p).

    And you reported:

    solve_test::neg:
    - pierce: []=>((p->q)->p)->p --> true
    solve_test::neg: tot.=1, FAIL=0 --> true.

    What do you get with gliv/1?

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line:
    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11> >>  > By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
    ;     solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The
    code is functional and pretty flexible actually, `notation/5` is
    `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!  You
    have no time for anything apparently, except for posting random shit
    and fucking with thread titles: I have messages all over the place,
    and it's just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the
    actual statement, provable intuitionistically, is intrinsically
    higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not
    intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have to
    inspect the proof tree, what I actually get).  Indeed, I am rather
    worried that it just solves everything I throw at it, though not the
    falsities... which is why I am also developing a meta-theory for it,
    in Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sun Dec 1 16:58:55 2024
    You see this behaviour here in the graphic
    I posted with the answer on proofassistants.stackexchange.com:

    Something tells me Glivenko theorem would need at least
    intuitionistic logic, to prove for example Peirce law (*): https://i.sstatic.net/lGQ8Iur9.png

    The (L->) rule is applied twice, to prove
    Pierce Law via Glivenko. You can only apply (L->)
    twice if you implement Dragalins variant that

    keeps X->Y in the right branch of then (L->) rule.
    If you don't implement Dragalins implication, i.e.
    if you don't implement intuitistic implication in

    your Prolog code, I guess there is no chance for
    Glivenkos theorem. You will be pretty much on your
    own in a totally different terrain.

    Mild Shock schrieb:
    Hi,

    This inference rule is incorrect:

    % (C,X->Y=>Z) --> [(C=>X),(C,Y=>Z)]
    reduction(elim, imp, (C0=>Z), Gs, Ps) :-
        nth1(H, C0, (X->Y), C1),
        append(C1, [Y], C2),
        Gs = [C1=>X,C2=>Z],
        Ps = [H:X,H:Y].

    The correct one would be, X->Y has to
    be repeated in the left proof branch:

    % (C,X->Y=>Z) --> [(C,X->Y=>X),(C,Y=>Z)]
    ... put your prolog code here ...

    Then you can only possibly prove Pierce Law
    with Glivenko. Otherwise there is no chance.

    See also here:

    Mathematical Intuitionism: Introduction to Proof Theory
    A. G. Dragalin
    §3 THE SEQUENT CALCULUS - Page 11
    The calculus GHPC
    https://bookstore.ams.org/MMONO/67

    Good Luck!

    Bye

    Mild Shock schrieb:
    And what are the results? Your gist shows
    this one here:

    % Peirce's law:
    solve_case(neg, pierce, [(p->q)->p]=>p).

    And you reported:

    solve_test::neg:
    - pierce: []=>((p->q)->p)->p --> true
    solve_test::neg: tot.=1, FAIL=0 --> true.

    What do you get with gliv/1?

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line:
    ;
    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11>
    By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
    ;     solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The
    code is functional and pretty flexible actually, `notation/5` is
    `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!  You
    have no time for anything apparently, except for posting random shit
    and fucking with thread titles: I have messages all over the place,
    and it's just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the
    actual statement, provable intuitionistically, is intrinsically
    higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not
    intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have
    to inspect the proof tree, what I actually get).  Indeed, I am rather
    worried that it just solves everything I throw at it, though not the
    falsities... which is why I am also developing a meta-theory for it,
    in Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Sun Dec 1 17:07:26 2024
    On 01/12/2024 16:50, Mild Shock wrote:

    This inference rule is incorrect:
    % (C,X->Y=>Z) --> [(C=>X),(C,Y=>Z)]
    reduction(elim, imp, (C0=>Z), Gs, Ps) :-
        nth1(H, C0, (X->Y), C1),
        append(C1, [Y], C2),
        Gs = [C1=>X,C2=>Z],
        Ps = [H:X,H:Y].

    The correct one would be, X->Y has to
    be repeated in the left proof branch:
    % (C,X->Y=>Z) --> [(C,X->Y=>X),(C,Y=>Z)]

    You are incorrect: that the logic is *affine* indeed means that we
    cannot use hypotheses more than once.

    This is a nice intro scheme, notice also that this is all quite
    orthogonal to the classical vs intuitionistic distinction:

    <https://en.wikipedia.org/wiki/Substructural_type_system>

    HTH.

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sun Dec 1 17:06:15 2024
    Hi,

    Linear logic you can of course do the following,
    and define intuitionistic implication as follows:

    A -> B := ! A -o B

    Girards Exponention will do the repeating for you,
    that is found in Dragalins Implication.

    I don't know how to incorporate the same into your Prolog code.

    Bye

    Mild Shock schrieb:
    You see this behaviour here in the graphic
    I posted with the answer on proofassistants.stackexchange.com:

    Something tells me Glivenko theorem would need at least
    intuitionistic logic, to prove for example Peirce law (*): https://i.sstatic.net/lGQ8Iur9.png

    The (L->) rule is applied twice, to prove
    Pierce Law via Glivenko. You can only apply (L->)
    twice if you implement Dragalins variant that

    keeps X->Y in the right branch of then (L->) rule.
    If you don't implement Dragalins implication, i.e.
    if you don't implement intuitistic implication in

    your Prolog code, I guess there is no chance for
    Glivenkos theorem. You will be pretty much on your
    own in a totally different terrain.

    Mild Shock schrieb:
    Hi,

    This inference rule is incorrect:

    % (C,X->Y=>Z) --> [(C=>X),(C,Y=>Z)]
    reduction(elim, imp, (C0=>Z), Gs, Ps) :-
         nth1(H, C0, (X->Y), C1),
         append(C1, [Y], C2),
         Gs = [C1=>X,C2=>Z],
         Ps = [H:X,H:Y].

    The correct one would be, X->Y has to
    be repeated in the left proof branch:

    % (C,X->Y=>Z) --> [(C,X->Y=>X),(C,Y=>Z)]
    ... put your prolog code here ...

    Then you can only possibly prove Pierce Law
    with Glivenko. Otherwise there is no chance.

    See also here:

    Mathematical Intuitionism: Introduction to Proof Theory
    A. G. Dragalin
    §3 THE SEQUENT CALCULUS - Page 11
    The calculus GHPC
    https://bookstore.ams.org/MMONO/67

    Good Luck!

    Bye

    Mild Shock schrieb:
    And what are the results? Your gist shows
    this one here:

    % Peirce's law:
    solve_case(neg, pierce, [(p->q)->p]=>p).

    And you reported:

    solve_test::neg:
    - pierce: []=>((p->q)->p)->p --> true
    solve_test::neg: tot.=1, FAIL=0 --> true.

    What do you get with gliv/1?

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line:
    ;
    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11> >>>>  > By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
    ;     solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The
    code is functional and pretty flexible actually, `notation/5` is
    `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!
    You have no time for anything apparently, except for posting random
    shit and fucking with thread titles: I have messages all over the
    place, and it's just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the
    actual statement, provable intuitionistically, is intrinsically
    higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not
    intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have
    to inspect the proof tree, what I actually get).  Indeed, I am
    rather worried that it just solves everything I throw at it, though
    not the falsities... which is why I am also developing a meta-theory
    for it, in Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Sun Dec 1 17:27:56 2024
    Well then Pierce Law is not povable under
    the usual Glivenko translation in affine logic.

    So what? Whats your point?

    I found only one book that discusses Glivenk
    style translations for substructural logics:

    Chatpter 8: Glivenko Theorems
    Residuated Lattices: an algebraic glimpse at substructural logics https://www.researchgate.net/publication/235626321

    But how do you prove rigorously that affine
    logic rejects certain Glivenko translations.
    You would need to have a (counter-)model finder and

    not a proof finder. The "algebraic viewpoint"
    could help you in building a (counter-)model finder.
    What also sometimes helps is to use modal

    translations together with (counter-)model finders,
    that would then search for some tree models.

    Julio Di Egidio schrieb:
    On 01/12/2024 16:50, Mild Shock wrote:

    This inference rule is incorrect:
    % (C,X->Y=>Z) --> [(C=>X),(C,Y=>Z)]
    reduction(elim, imp, (C0=>Z), Gs, Ps) :-
         nth1(H, C0, (X->Y), C1),
         append(C1, [Y], C2),
         Gs = [C1=>X,C2=>Z],
         Ps = [H:X,H:Y].

    The correct one would be, X->Y has to
    be repeated in the left proof branch:
    % (C,X->Y=>Z) --> [(C,X->Y=>X),(C,Y=>Z)]

    You are incorrect: that the logic is *affine* indeed means that we
    cannot use hypotheses more than once.

    This is a nice intro scheme, notice also that this is all quite
    orthogonal to the classical vs intuitionistic distinction:

    <https://en.wikipedia.org/wiki/Substructural_type_system>

    HTH.

    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sun Dec 1 17:36:32 2024
    Warning: Research gate points to some slides,
    which are not exactly the 2007 book.
    Also in terms of accelerate superhuman AI,
    its probably already an old book.

    I didn't check back with ChatGPT although
    there is no gurantee that ChatGPT gives
    you top notch information, but could be still
    helpful nevertheless, more helpful than

    https://www.lix.polytechnique.fr/~dale/lolli/

    And related systems back then. But did anything
    change since then. What don't you like in
    the answer:

    A -> B := ! A -o B

    In my opinion this gives some cues how a translation
    could nevertheless work. Something along replacing
    A -> B by A -> .. A -> B, i.e. doing the

    repeat as a preprocessing. What makes you doubt that
    this work. Or do you have some aesthetic critieria
    that exclude such a solution?

    Mild Shock schrieb:
    Well then Pierce Law is not povable under
    the usual Glivenko translation in affine logic.

    So what? Whats your point?

    I found only one book that discusses Glivenk
    style translations for substructural logics:

    Chatpter 8: Glivenko Theorems
    Residuated Lattices: an algebraic glimpse at substructural logics https://www.researchgate.net/publication/235626321

    But how do you prove rigorously that affine
    logic rejects certain Glivenko translations.
    You would need to have a (counter-)model finder and

    not a proof finder. The "algebraic viewpoint"
    could help you in building a (counter-)model finder.
    What also sometimes helps is to use modal

    translations together with (counter-)model finders,
    that would then search for some tree models.

    Julio Di Egidio schrieb:
    On 01/12/2024 16:50, Mild Shock wrote:

    This inference rule is incorrect:
    % (C,X->Y=>Z) --> [(C=>X),(C,Y=>Z)]
    reduction(elim, imp, (C0=>Z), Gs, Ps) :-
         nth1(H, C0, (X->Y), C1),
         append(C1, [Y], C2),
         Gs = [C1=>X,C2=>Z],
         Ps = [H:X,H:Y].

    The correct one would be, X->Y has to
    be repeated in the left proof branch:
    % (C,X->Y=>Z) --> [(C,X->Y=>X),(C,Y=>Z)]

    You are incorrect: that the logic is *affine* indeed means that we
    cannot use hypotheses more than once.

    This is a nice intro scheme, notice also that this is all quite
    orthogonal to the classical vs intuitionistic distinction:

    <https://en.wikipedia.org/wiki/Substructural_type_system>

    HTH.

    -Julio



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sun Dec 1 17:17:29 2024
    Hi

    Interesting question whether Jens Ottens Int-Prover
    does also the repeat. I find in Jens Ottens Int-Prover
    that he does indeed also do the repeat for

    intuitionistic implication:

    What is ileanSeP?
    ileanSeP is a Prolog program that implements a very
    compact theorem prover for first-order intuitionistic
    logic. It is based on a single-succedent intuitionistic
    sequent calculus very similar to Gentzen's LJ.
    https://www.leancop.de/ileansep/

    From his source code ileansep_swi.pl (SWI-Prolog, 3 kbytes).
    His tabular prover definition defines copying in the
    last two columns. Copying is more critical when you

    do first order logic the way Jens Otten usually does it:

    fml((A=>B), 1,nin,[(A=>B)], [C],[D],[], _, _,[!],A:B,C:D).

    In propositional logic you don't need copying only
    repeating, so if we would strip down Jens Ottens prover
    to propositional logic, we could go with:

    fml((A=>B), 1,nin,[(A=>B)], [A],[B],[], _, _,[!],[],[]).

    The result will then be the same repeat as in Dragalins
    implication. What I am not aware whether Jens Otten published
    some prover for Linear Logic. Who knows, maybe?

    Bye

    Mild Shock schrieb:
    Hi,

    Linear logic you can of course do the following,
    and define intuitionistic implication as follows:

    A -> B := ! A -o B

    Girards Exponention will do the repeating for you,
    that is found in Dragalins Implication.

    I don't know how to incorporate the same into your Prolog code.

    Bye

    Mild Shock schrieb:
    You see this behaviour here in the graphic
    I posted with the answer on proofassistants.stackexchange.com:

    Something tells me Glivenko theorem would need at least
    intuitionistic logic, to prove for example Peirce law (*):
    https://i.sstatic.net/lGQ8Iur9.png

    The (L->) rule is applied twice, to prove
    Pierce Law via Glivenko. You can only apply (L->)
    twice if you implement Dragalins variant that

    keeps X->Y in the right branch of then (L->) rule.
    If you don't implement Dragalins implication, i.e.
    if you don't implement intuitistic implication in

    your Prolog code, I guess there is no chance for
    Glivenkos theorem. You will be pretty much on your
    own in a totally different terrain.

    Mild Shock schrieb:
    Hi,

    This inference rule is incorrect:

    % (C,X->Y=>Z) --> [(C=>X),(C,Y=>Z)]
    reduction(elim, imp, (C0=>Z), Gs, Ps) :-
         nth1(H, C0, (X->Y), C1),
         append(C1, [Y], C2),
         Gs = [C1=>X,C2=>Z],
         Ps = [H:X,H:Y].

    The correct one would be, X->Y has to
    be repeated in the left proof branch:

    % (C,X->Y=>Z) --> [(C,X->Y=>X),(C,Y=>Z)]
    ... put your prolog code here ...

    Then you can only possibly prove Pierce Law
    with Glivenko. Otherwise there is no chance.

    See also here:

    Mathematical Intuitionism: Introduction to Proof Theory
    A. G. Dragalin
    §3 THE SEQUENT CALCULUS - Page 11
    The calculus GHPC
    https://bookstore.ams.org/MMONO/67

    Good Luck!

    Bye

    Mild Shock schrieb:
    And what are the results? Your gist shows
    this one here:

    % Peirce's law:
    solve_case(neg, pierce, [(p->q)->p]=>p).

    And you reported:

    solve_test::neg:
    - pierce: []=>((p->q)->p)->p --> true
    solve_test::neg: tot.=1, FAIL=0 --> true.

    What do you get with gliv/1?

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line:
    ;
    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11> >>>>>  > By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
    ;     solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The >>>>> code is functional and pretty flexible actually, `notation/5` is
    `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!
    You have no time for anything apparently, except for posting random
    shit and fucking with thread titles: I have messages all over the
    place, and it's just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the
    actual statement, provable intuitionistically, is intrinsically
    higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p). >>>>> ```

    while the statement I am proving above is this one, and it is not
    intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p) >>>>> ```

    Yet with my `dnt`, my solver proves even that one (but I still have
    to inspect the proof tree, what I actually get).  Indeed, I am
    rather worried that it just solves everything I throw at it, though
    not the falsities... which is why I am also developing a
    meta-theory for it, in Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio





    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Sun Dec 1 19:30:22 2024
    On 01/12/2024 17:27, Mild Shock wrote:

    Well then Pierce Law is not povable under
    the usual Glivenko translation in affine logic.
    So what? Whats your point?

    That my TNT (I am now dubbing it "triple-negation translation") instead
    works, and where is some piece of theory to attach to it?

    I found only one book that discusses Glivenk
    style translations for substructural logics:
    Chatpter 8: Glivenko Theorems
    Residuated Lattices: an algebraic glimpse at substructural logics https://www.researchgate.net/publication/235626321

    Indeed there is a lot of not much around. But Girard talks about not
    having and not wanting a separate semantics, it's all purely syntactic.
    But I still have only a vague intuition about what that means. <https://girard.perso.math.cnrs.fr/0.pdf>

    Anyway, pretty much along that line, I am thinking: could I prove in
    Prolog the meta-properties I have proved in Coq (so far)?
    Meta-programming and program-analysis features of Prolog are certainly
    not lacking...

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Mon Dec 2 09:02:44 2024
    It didn't work, I was running:

    ?- solve_case(TT, pierce, G), solve_t__sel(TT, G).

    And it showed me in SWI-Prolog false:

    false.

    But the result shoud be true.

    Julio Di Egidio schrieb:
    On 01/12/2024 17:27, Mild Shock wrote:

    Well then Pierce Law is not povable under
    the usual Glivenko translation in affine logic.
    So what? Whats your point?

    That my TNT (I am now dubbing it "triple-negation translation") instead works, and where is some piece of theory to attach to it?

    I found only one book that discusses Glivenk
    style translations for substructural logics:
    Chatpter 8: Glivenko Theorems
    Residuated Lattices: an algebraic glimpse at substructural logics
    https://www.researchgate.net/publication/235626321

    Indeed there is a lot of not much around.  But Girard talks about not
    having and not wanting a separate semantics, it's all purely syntactic.
    But I still have only a vague intuition about what that means. <https://girard.perso.math.cnrs.fr/0.pdf>

    Anyway, pretty much along that line, I am thinking: could I prove in
    Prolog the meta-properties I have proved in Coq (so far)?
    Meta-programming and program-analysis features of Prolog are certainly
    not lacking...

    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Mon Dec 2 09:31:33 2024
    Can you use your gentzen.v to show
    that your TNT always works?

    Basically giving a Coq verification.

    How does one usually demonstrate
    Glivenkos theorem?

    Mild Shock schrieb:
    Ok my fault I tested Glivenko and not your TNT,
    with TNT I get indeed this here:

    ?- solve_case(TT, pierce, G), solve_t__sel(TT, G).
    TT = neg,
    G = ([((p->q)->p)]=>p).

    Oki Doki

    But I am not familiar with this proof display:

    [
      impI((p->0))
      impI((p->0))
      [
        impE1(1:(p->q))
        impI(p)
        [
          impE1(1:p)
          unif(2:p)
        ]
        [
          impE2(1:0)
          botE(3:0)
        ]
      ]
      [
        impE2(1:p)
        [
          impE1(1:p)
          unif(2:p)
        ]
        [
          impE2(1:0)
          unif(3:0)
        ]
      ]
    ]

    How is one supposed to read the above?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Mon Dec 2 09:49:07 2024
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    ?- solve_case(TT, pelletier, G), time(solve_t__sel(TT, G)).
    Action (h for help) ? abort
    % 844,501,974 inferences, 63.891 CPU in 68.236 seconds (94% CPU,
    13217933 Lips)
    % Execution Aborted

    The test case was:

    solve_case(neg, pelletier, []=>((p<->(q<->r))<->(p<->q))).

    Or just a problem of explosion?

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line: <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11>
    By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
         solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The code
    is functional and pretty flexible actually, `notation/5` is `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!  You
    have no time for anything apparently, except for posting random shit and fucking with thread titles: I have messages all over the place, and it's
    just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the actual statement, provable intuitionistically, is intrinsically higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have to inspect the proof tree, what I actually get).  Indeed, I am rather
    worried that it just solves everything I throw at it, though not the falsities... which is why I am also developing a meta-theory for it, in
    Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Mon Dec 2 09:27:50 2024
    Ok my fault I tested Glivenko and not your TNT,
    with TNT I get indeed this here:

    ?- solve_case(TT, pierce, G), solve_t__sel(TT, G).
    TT = neg,
    G = ([((p->q)->p)]=>p).

    Oki Doki

    But I am not familiar with this proof display:

    [
    impI((p->0))
    impI((p->0))
    [
    impE1(1:(p->q))
    impI(p)
    [
    impE1(1:p)
    unif(2:p)
    ]
    [
    impE2(1:0)
    botE(3:0)
    ]
    ]
    [
    impE2(1:p)
    [
    impE1(1:p)
    unif(2:p)
    ]
    [
    impE2(1:0)
    unif(3:0)
    ]
    ]
    ]

    How is one supposed to read the above?

    Mild Shock schrieb:
    It didn't work, I was running:

    ?- solve_case(TT, pierce, G), solve_t__sel(TT, G).

    And it showed me in SWI-Prolog false:

    false.

    But the result shoud be true.

    Julio Di Egidio schrieb:
    On 01/12/2024 17:27, Mild Shock wrote:

    Well then Pierce Law is not povable under
    the usual Glivenko translation in affine logic.
    So what? Whats your point?

    That my TNT (I am now dubbing it "triple-negation translation")
    instead works, and where is some piece of theory to attach to it?

    I found only one book that discusses Glivenk
    style translations for substructural logics:
    Chatpter 8: Glivenko Theorems
    Residuated Lattices: an algebraic glimpse at substructural logics
    https://www.researchgate.net/publication/235626321

    Indeed there is a lot of not much around.  But Girard talks about not
    having and not wanting a separate semantics, it's all purely
    syntactic. But I still have only a vague intuition about what that means.
    <https://girard.perso.math.cnrs.fr/0.pdf>

    Anyway, pretty much along that line, I am thinking: could I prove in
    Prolog the meta-properties I have proved in Coq (so far)?
    Meta-programming and program-analysis features of Prolog are certainly
    not lacking...

    -Julio



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Mon Dec 2 09:56:47 2024
    Similar problem here:

    ?- solve_case(TT, pelletier2, G), time(solve_t__sel(TT, G)).
    Action (h for help) ? abort
    % 1,368,141,792 inferences, 103.188 CPU in 109.107 seconds (95% CPU,
    13258794 Lips)
    % Execution Aborted

    Mostlikely the reduction has way too much backtracking,
    the implementation of some Gentzen inversion lemmas
    is lacking. Gentzen inversion lemma allow to place

    cuts in the proof search. I don't know how you formulate
    this in Coq. I even don't know whether your Coq formalization
    models the Prolog non-determinism.

    The test case was:

    solve_case(pos, pelletier2, []=>((p<->(q<->(r<->s)))<->(p<->(q<->r)))).

    Mild Shock schrieb:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    ?- solve_case(TT, pelletier, G), time(solve_t__sel(TT, G)).
    Action (h for help) ? abort
    % 844,501,974 inferences, 63.891 CPU in 68.236 seconds (94% CPU,
    13217933 Lips)
    % Execution Aborted

    The test case was:

    solve_case(neg, pelletier, []=>((p<->(q<->r))<->(p<->q))).

    Or just a problem of explosion?

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line:
    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11> >>  > By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
    ;     solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The
    code is functional and pretty flexible actually, `notation/5` is
    `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!  You
    have no time for anything apparently, except for posting random shit
    and fucking with thread titles: I have messages all over the place,
    and it's just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the
    actual statement, provable intuitionistically, is intrinsically
    higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not
    intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have to
    inspect the proof tree, what I actually get).  Indeed, I am rather
    worried that it just solves everything I throw at it, though not the
    falsities... which is why I am also developing a meta-theory for it,
    in Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Mon Dec 2 09:58:21 2024
    The 2nd test case shows that its not
    a problem of TNT, rather a problem of
    the "affine" logic calculus you defined.

    But things might be still ok from a
    functional viewpoint. Performance is
    rather a non-functional requirement.

    Mild Shock schrieb:
    Similar problem here:

    ?- solve_case(TT, pelletier2, G), time(solve_t__sel(TT, G)).
    Action (h for help) ? abort
    % 1,368,141,792 inferences, 103.188 CPU in 109.107 seconds (95% CPU,
    13258794 Lips)
    % Execution Aborted

    Mostlikely the reduction has way too much backtracking,
    the implementation of some Gentzen inversion lemmas
    is lacking. Gentzen inversion lemma allow to place

    cuts in the proof search. I don't know how you formulate
    this in Coq. I even don't know whether your Coq formalization
    models the Prolog non-determinism.

    The test case was:

    solve_case(pos, pelletier2, []=>((p<->(q<->(r<->s)))<->(p<->(q<->r)))).

    Mild Shock schrieb:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    ?- solve_case(TT, pelletier, G), time(solve_t__sel(TT, G)).
    Action (h for help) ? abort
    % 844,501,974 inferences, 63.891 CPU in 68.236 seconds (94% CPU,
    13217933 Lips)
    % Execution Aborted

    The test case was:

    solve_case(neg, pelletier, []=>((p<->(q<->r))<->(p<->q))).

    Or just a problem of explosion?

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line:
    ;
    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11>
    By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
    ;     solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The
    code is functional and pretty flexible actually, `notation/5` is
    `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!  You
    have no time for anything apparently, except for posting random shit
    and fucking with thread titles: I have messages all over the place,
    and it's just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the
    actual statement, provable intuitionistically, is intrinsically
    higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not
    intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have
    to inspect the proof tree, what I actually get).  Indeed, I am rather
    worried that it just solves everything I throw at it, though not the
    falsities... which is why I am also developing a meta-theory for it,
    in Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Mon Dec 2 12:37:44 2024
    On 02/12/2024 09:49, Mild Shock wrote:

    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    As far as I can tell, i.e. modulo bugs I have not found, it must
    terminate, though I do not have the full formal proof yet.

    ?- solve_case(TT, pelletier, G), time(solve_t__sel(TT, G)).
    solve_case(neg, pelletier, []=>((p<->(q<->r))<->(p<->q))).
    Or just a problem of explosion?

    You are using all and only the wrong methods, anyway I happy you...

    The solver *is* very slow at the moment, and you are trying to prove a
    too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), Qs).
    Qs = ((((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->(((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->0).
    ```

    Indeed, haven't you noticed all those appends in `reduction/5`? It's
    very slow, especially in SWI-Prolog... But I won't touch it for now, I
    need clearer ideas about the next step, plus with appends it's much
    easier to match it in formalization.

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Julio Di Egidio on Mon Dec 2 12:47:27 2024
    On 02/12/2024 12:37, Julio Di Egidio wrote:

    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), Qs).

    (That should have been an `X`, not a `Qs`, that is a formula, not a
    proof tree: anyway, you get the point.)

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Mon Dec 2 12:57:36 2024
    On 02/12/2024 09:31, Mild Shock wrote:

    How does one usually demonstrate
    Glivenkos theorem?

    Usually with a semantics: we have already said that up-thread...

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Tue Dec 3 00:33:07 2024
    Glivenko is a basically RAA, reductio ad
    absurdum shifted to the root. This is another
    way to proof Glivenkos theorem.

    I highly confused Joseph Vidal-Rosset on
    SWI-Prolog discourse when I showed him
    a intuitionistic prover that sometimes

    also includes RAA, and then produces a classical
    proof. RAA, reductio ad absurdum is this
    inference rule:

    G, ~A |- f
    ------------- (RAA)
    G |- A

    Compare this to Glivenko, basically double
    negation elimiantion at the root:

    ???
    ---------------
    G |- ~(~A)
    --------------- (GLI)
    G |- A

    But what happens above G |- ~(~A), i.e. the
    ???? . By Gentzen inversion lemma, above
    G |- ~(~A) we must find, G, ~A |- f,

    and we are back to RAA:

    G, ~A |- f
    --------------- (R->) Gentzen inversion lemma
    G |- ~(~A)
    --------------- (GLI)
    G |- A

    So as much as Glivenko appears as a new alien
    ivention, it has much to do with they age old
    idea of "indirect proof".

    Mild Shock schrieb:
    Its actually easier, you don't need to go
    semantical. You need only to show that
    Consequentia mirabilis aka Calvius Law

    becomes admissible as an inference rule:

         G, ~A |- A
       ---------------- (MIR)
           G |- A
    https://de.wikipedia.org/wiki/Consequentia_mirabilis

    Which is a form of contraction. See also

    Lectures on the Curry-Howard Isomorphism
    6.6 The pure impicational fragment https://shop.elsevier.com/books/lectures-on-the-curry-howard-isomorphism/sorensen/978-0-444-52077-7


    The reason is that if you add MIR to
    intuitionistic logic you get classical logic.
    MIR is a very funny inference rule,

    when you show it as an axiom schema:

    ((A -> f) -> A) -> A

    Its a specialization of Peirce Law.

    ((P -> Q) -> P) -> P

    Just set Q = f.

    Julio Di Egidio schrieb:
    On 02/12/2024 09:31, Mild Shock wrote:

    How does one usually demonstrate
    Glivenkos theorem?

    Usually with a semantics: we have already said that up-thread...

    -Julio



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Tue Dec 3 00:26:11 2024
    Its actually easier, you don't need to go
    semantical. You need only to show that
    Consequentia mirabilis aka Calvius Law

    becomes admissible as an inference rule:

    G, ~A |- A
    ---------------- (MIR)
    G |- A
    https://de.wikipedia.org/wiki/Consequentia_mirabilis

    Which is a form of contraction. See also

    Lectures on the Curry-Howard Isomorphism
    6.6 The pure impicational fragment https://shop.elsevier.com/books/lectures-on-the-curry-howard-isomorphism/sorensen/978-0-444-52077-7

    The reason is that if you add MIR to
    intuitionistic logic you get classical logic.
    MIR is a very funny inference rule,

    when you show it as an axiom schema:

    ((A -> f) -> A) -> A

    Its a specialization of Peirce Law.

    ((P -> Q) -> P) -> P

    Just set Q = f.

    Julio Di Egidio schrieb:
    On 02/12/2024 09:31, Mild Shock wrote:

    How does one usually demonstrate
    Glivenkos theorem?

    Usually with a semantics: we have already said that up-thread...

    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Tue Dec 3 00:48:23 2024
    About Gentzens Inversion Lemma that allow
    to place cuts and tremdously speed up proofs.
    You find this in Gentzens original paper:

    Untersuchungen über das logische Schließen. I. In: Mathematische
    Zeitschrift. Band 39 (2), 1935, S. 176–210 https://gdz.sub.uni-goettingen.de/id/PPN266833020_0039?tify={%22view%22:%22info%22,%22pages%22:[180]}

    But you can also draw on Jens Otten.
    In Jens Otten intuitionistic logic prover,
    he has a column in his tabular representation

    of inference rules that indicates whether a rule
    is invertible. "nin" stands for not invertible.
    "inv" stands for invertible.

    fml((A=>B), 1,nin,[(A=>B)], [C],[D],[], _, _,[!],A:B,C:D).
    fml((A=>B), 0,inv,[A], [B],[], [], _, _,[], [], [] ). https://www.leancop.de/ileansep/

    Invertible inference rules are somtimes denoted
    by a double bar ===, whereas the non invertible
    inference rules only use a single bar ---.

    The two implication inference rules are:

    G, A |- B
    =============== (R->)
    G |- A -> B


    G, A -> B |- A G, B |- C
    ------------------------------ (L->)
    G, A -> B |- C

    ) is invertible, (L->) is not invertible.
    Invertible rules such as (R->) can be greedily
    applied with the need for backtracking.

    Roughly expressed when you see an invertible rule,
    you can commit yourself in applying it in
    backward chaining.

    Julio Di Egidio schrieb:
    On 02/12/2024 12:37, Julio Di Egidio wrote:

    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), Qs).

    (That should have been an `X`, not a `Qs`, that is a formula, not a
    proof tree: anyway, you get the point.)

    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Tue Dec 3 00:54:55 2024
    It could be that your TNT translation
    does something like MIR. But didn't spend
    much time with your TNT yet.

    Glivenko validity is basically induced by
    classical double negation elimination:

    (~(~A)) -> A

    Your TNT would be this:

    (~A -> (~(~A))) -> A

    Which is close to MIR:

    (~A -> A) -> A

    Mild Shock schrieb:
    Glivenko is a basically RAA, reductio ad
    absurdum shifted to the root. This is another
    way to proof Glivenkos theorem.

    I highly confused Joseph Vidal-Rosset on
    SWI-Prolog discourse when I showed him
    a intuitionistic prover that sometimes

    also includes RAA, and then produces a classical
    proof. RAA, reductio ad absurdum is this
    inference rule:

       G, ~A |- f
      ------------- (RAA)
         G |- A

    Compare this to Glivenko, basically double
    negation elimiantion at the root:

            ???
      ---------------
         G |- ~(~A)
      --------------- (GLI)
         G |- A

    But what happens above G |- ~(~A), i.e. the
    ???? . By Gentzen inversion lemma, above
    G |- ~(~A) we must find, G, ~A |- f,

    and we are back to RAA:

         G, ~A |- f
      --------------- (R->) Gentzen inversion lemma
         G |- ~(~A)
      --------------- (GLI)
         G |- A

    So as much as Glivenko appears as a new alien
    ivention, it has much to do with they age old
    idea of "indirect proof".

    Mild Shock schrieb:
    Its actually easier, you don't need to go
    semantical. You need only to show that
    Consequentia mirabilis aka Calvius Law

    becomes admissible as an inference rule:

          G, ~A |- A
        ---------------- (MIR)
            G |- A
    https://de.wikipedia.org/wiki/Consequentia_mirabilis

    Which is a form of contraction. See also

    Lectures on the Curry-Howard Isomorphism
    6.6 The pure impicational fragment
    https://shop.elsevier.com/books/lectures-on-the-curry-howard-isomorphism/sorensen/978-0-444-52077-7


    The reason is that if you add MIR to
    intuitionistic logic you get classical logic.
    MIR is a very funny inference rule,

    when you show it as an axiom schema:

    ((A -> f) -> A) -> A

    Its a specialization of Peirce Law.

    ((P -> Q) -> P) -> P

    Just set Q = f.

    Julio Di Egidio schrieb:
    On 02/12/2024 09:31, Mild Shock wrote:

    How does one usually demonstrate
    Glivenkos theorem?

    Usually with a semantics: we have already said that up-thread...

    -Julio




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Julio Di Egidio on Tue Dec 3 12:25:09 2024
    On 01/12/2024 16:17, Julio Di Egidio wrote:

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```
    <snip>
    Yet with my `dnt`, my solver proves even that one (but I still have to inspect the proof tree, what I actually get).  Indeed, I am rather
    worried that it just solves everything I throw at it, though not the falsities...

    I am an idiot: that statement is not true intuitionistically, but it is
    true classically, so in fact nothing strange there.

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Tue Dec 3 13:59:22 2024
    On 03/12/2024 00:26, Mild Shock wrote:

    Its actually easier, you don't need to go
    semantical. You need only to show that
    Consequentia mirabilis aka Calvius Law

    becomes admissible as an inference rule:
         G, ~A |- A
       ---------------- (MIR)
           G |- A
    https://de.wikipedia.org/wiki/Consequentia_mirabilis

    (I have too many links already, and you can't even be bothered to link
    to articles in English?)

    DNE and equivalent is not provable in any intuitionistic logic. So,
    what does it even mean to prove it "admissible" here? In the object
    theory? Under TNT itself??

    Which is a form of contraction.

    Which is not allowed in a linear or affine logic.

    Also, with reference to another comment of yours: my rules are
    "directed", and that is a feature... as I have read somewhere.

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Julio Di Egidio on Tue Dec 3 15:54:42 2024
    On 01/12/2024 16:17, Julio Di Egidio wrote:
    On 01/12/2024 15:32, Mild Shock wrote:

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!  You
    have no time for anything apparently, except for posting random shit and fucking with thread titles: I have messages all over the place, and it's
    just me, you, and Ross once a month...

    And you keep doing it, to the point that again I cannot just continue:
    you have split this thread in two, and managed to get all points
    discussed exactly on the wrong side. -- I am looking back at the past
    week: I cannot find a single reason not to just kill-file you, again.

    ---

    Here are lecture notes that prove that DNT embeds classical into
    intuitionistic (I take it that their "linear" has not to do with
    substructural, structurally theirs is a "normal" system): <https://www.cs.cmu.edu/~fp/courses/15816-f16/lectures/27-classical.pdf>

    If I am not totally misreading it, it is indeed not using semantics (or,
    is it? I don't know what those double brackets mean), though it is
    definitely at the meta-level. But I still cannot even fully parse it.

    Which is a form of contraction.

    Which is not allowed in a linear or affine logic.

    Also, with reference to another comment of yours: my rules are
    "directed", and that is a feature... as I have read somewhere.

    Not only consistency but completeness: and canonicity and
    decidability... with simplicity. Here is a nice intro: <https://www.typetheoryforall.com/episodes/type-theory-properties>

    A propositional logic is easily all of that, but I'd like to keep it
    (the kernel) that way all the way up.

    To
  • From Mild Shock@21:1/5 to Julio Di Egidio on Wed Dec 4 08:47:41 2024
    Now I tried an example by Troelstra & Schwichtenberg:

    ?- solve_case(TT, schwichtenberg, G), time(solve_t__sel(TT, G)).
    % 449 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
    false.

    ?- solve_case(TT, schwichtenberg2, G), time(solve_t__sel(TT, G)).
    % 10,629 inferences, 0.000 CPU in 0.002 seconds (0% CPU, Infinite Lips)
    false.

    The definitions are this here:

    solve_case(pos, schwichtenberg, [((((p->q)->q)->p)->q),(q->p)]=>q). solve_case(neg, schwichtenberg2, [((((p->q)->q)->p)->q),(q->p)]=>q).

    At least the second case shouldn't give false, as is seen here:

    https://web.stanford.edu/class/cs103/tools/truth-table-tool/
    p q ((((((p → q) → q) → p) → q) ∧ (q → p)) → q)
    F F T
    F T T
    T F T
    T T T

    It is a classical tautology, and if your TNT translation
    is supposed to give a means to embed classical propositional
    logic, the result of the second query should be true.

    The example is from here, page 81, 3.5.6 remarks:

    Basic Proof Theory, Cambridge University Press
    A. S. Troelstra & H. Schwichtenberg - June 2012 https://www.cambridge.org/core/books/basic-proof-theory/928508F797214A017D245A1FB67CCCD9

    Helmut Schwichtenberg is still alive: https://en.wikipedia.org/wiki/Helmut_Schwichtenberg

    Anne Troelstra died in 2019:
    https://en.wikipedia.org/wiki/Anne_Sjerp_Troelstra

    Julio Di Egidio schrieb:
    On 01/12/2024 15:32, Mild Shock wrote:

    So although it was very temping to download
    you software, and then replace these line: <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11>
    By these line:
    notation(gliv(X), (~(~X)))
    solve_t__sel(neg, C=>X) :-
         solve(C=>gliv(X)).

    Or just change the definition of `dnt`, or create another one.  The code
    is functional and pretty flexible actually, `notation/5` is `multifile`.

    I am afraid I have no time for that. You
    could do it by yourself. Or what

    I have already done it, and I have already told you the results!  You
    have no time for anything apparently, except for posting random shit and fucking with thread titles: I have messages all over the place, and it's
    just me, you, and Ross once a month...

    ---

    Here is an interesting new case, which I had thought should be
    *unsolvable*:

    ```
    ?- solve_w([]=>dnt((~(~p)->p)<->p\/(~p))), !.  % DNE<->LEM
    ```

    Unsolvable not just because my logic is *affine*, but because the actual statement, provable intuitionistically, is intrinsically higher-order:

    ```
    Theorem DNE_is_LEM : (forall p, ~ ~ p -> p) <-> (forall p, p \/ ~ p).
    ```

    while the statement I am proving above is this one, and it is not intuitionistically provable (AFAICT):

    ```
    Theorem DNE_is_LEM_not_quite : forall p, (~ ~ p -> p) <-> (p \/ ~ p)
    ```

    Yet with my `dnt`, my solver proves even that one (but I still have to inspect the proof tree, what I actually get).  Indeed, I am rather
    worried that it just solves everything I throw at it, though not the falsities... which is why I am also developing a meta-theory for it, in
    Coq:

    <https://gist.github.com/jp-diegidio/b6a7a071f9f81a469c493c4afcc5cb11#file-gentzen-v>


    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Wed Dec 4 10:43:52 2024
    On 04/12/2024 08:47, Mild Shock wrote:

    Now I tried an example by Troelstra & Schwichtenberg:

    solve_case(pos, schwichtenberg, [((((p->q)->q)->p)->q),(q->p)]=>q). solve_case(neg, schwichtenberg2, [((((p->q)->q)->p)->q),(q->p)]=>q).

    At least the second case shouldn't give false, as is seen here:

    It fails if you do (the equivalent of) the intros before the TNT: I had
    a doubt about that, thanks for the test case. This works as expected:

    ?- solve([]=>tnt((((((p->q)->q)->p)->q)/\(q->p))->q)).

    -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 Dec 5 22:26:37 2024
    On 02/12/2024 12:37, Julio Di Egidio wrote:
    On 02/12/2024 09:49, Mild Shock wrote:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    The solver *is* very slow at the moment, and you are trying to prove a
    too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), Qs).
    Qs = ((((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->(((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->0)
    .
    ```

    Yeah, there is definitely a bug, though unrelated to TNT: the reduction
    rules are applied in the order of definition, and I can confirm that,
    depending on that order, the solver may not terminate.

    Would you think there is an order that works? Otherwise it gets
    complicated...

    (Be aware that meanwhile I have changed the code significantly, though
    the main difference is explicit support for the intuitionistic vs
    classical proofs.)

    -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 Dec 6 15:57:42 2024
    On 05/12/2024 22:26, Julio Di Egidio wrote:
    On 02/12/2024 12:37, Julio Di Egidio wrote:
    On 02/12/2024 09:49, Mild Shock wrote:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    The solver *is* very slow at the moment, and you are trying to prove a
    too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), Qs).
    Qs =
    ((((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->(((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->
    0).
    ```

    Yeah, there is definitely a bug, though unrelated to TNT: the reduction
    rules are applied in the order of definition, and I can confirm that, depending on that order, the solver may not terminate.

    Would you think there is an order that works?  Otherwise it gets complicated...

    It's slowly dawning on me what might be going wrong: I have proved that reductions decrease the goal size *for each residual goal*, but each
    reduction may produce more than one residual goal, and I have not proved
    that the proof search will not keep branching indefinitely...

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Fri Dec 6 16:36:28 2024
    Yes, a binary tree of depth n, can still have 2^n nodes.

    Unless you apply some pruning technique.

    The typical pruning technique in proof search is

    Gentzens inversion lemma.

    Julio Di Egidio schrieb:
    On 05/12/2024 22:26, Julio Di Egidio wrote:
    On 02/12/2024 12:37, Julio Di Egidio wrote:
    On 02/12/2024 09:49, Mild Shock wrote:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    The solver *is* very slow at the moment, and you are trying to prove
    a too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), Qs).
    Qs =
    ((((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->(((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->
    0).

    ```

    Yeah, there is definitely a bug, though unrelated to TNT: the
    reduction rules are applied in the order of definition, and I can
    confirm that, depending on that order, the solver may not terminate.

    Would you think there is an order that works?  Otherwise it gets
    complicated...

    It's slowly dawning on me what might be going wrong: I have proved that reductions decrease the goal size *for each residual goal*, but each reduction may produce more than one residual goal, and I have not proved
    that the proof search will not keep branching indefinitely...

    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Fri Dec 6 16:58:03 2024
    Plus a hand full of more techniques, like

    for example what is hard wired into Prolog,

    that you choose goals from left to right.

    See also:

    In both SL and SLD, "S" stands for the fact that the only literal
    resolved upon in any clause C i is one that is uniquely selected by a
    selection rule or selection function. In SL resolution, the selected
    literal is restricted to one which has been most recently introduced
    into the clause. In the simplest case, such a last-in-first-out
    selection function can be specified by the order in which literals are
    written, as in Prolog. https://en.wikipedia.org/wiki/SLD_resolution#The_origin_of_the_name_%22SLD%22

    So basically you would replace something like:

    nth1(N, List, Lit, List2)
    select(Lit, List, List2)
    member(Lit, List)

    By this here:

    once(nth1(N, List, Lit, List2))
    once(select(Lit, List, List2))
    once(member(Lit, List))

    No need to backtrack over multiple literals.

    With Gentzen inversion lemmas you can even go a step farther:

    nth1(N, List, Lit, List2), !
    select(Lit, List, List2), !
    member(Lit, List), !

    Cut away certain rules, avoiding even more backtracking.

    Mild Shock schrieb:

    Yes, a binary tree of depth n, can still have 2^n nodes.

    Unless you apply some pruning technique.

    The typical pruning technique in proof search is

    Gentzens inversion lemma.

    Julio Di Egidio schrieb:
    On 05/12/2024 22:26, Julio Di Egidio wrote:
    On 02/12/2024 12:37, Julio Di Egidio wrote:
    On 02/12/2024 09:49, Mild Shock wrote:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    The solver *is* very slow at the moment, and you are trying to prove
    a too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), Qs).
    Qs =
    ((((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)->(((p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p)->(p->q)/\(q->p))/\((p->q)/\(q->p)->(p->(q->r)/\(r->q))/\((q->r)/\(r->q)->p))->0)-
    0).

    ```

    Yeah, there is definitely a bug, though unrelated to TNT: the
    reduction rules are applied in the order of definition, and I can
    confirm that, depending on that order, the solver may not terminate.

    Would you think there is an order that works?  Otherwise it gets
    complicated...

    It's slowly dawning on me what might be going wrong: I have proved
    that reductions decrease the goal size *for each residual goal*, but
    each reduction may produce more than one residual goal, and I have not
    proved that the proof search will not keep branching indefinitely...

    -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 Dec 6 17:58:39 2024
    On 06/12/2024 17:17, Julio Di Egidio wrote:
    On 06/12/2024 16:58, Mild Shock wrote:

    Cut away certain rules, avoiding even more backtracking.

    I had `once` initially, as that certainly makes sense, but it was
    failing even some of the simpler pos cases.  I shall try again.

    Indeed, not even a plain `once` works since there may be more than one *different* matching hypothesis, and committing to the first one in
    order may lead to failure.

    Anyway, as said, I'd rather not cut on the search space (at all), plus I
    don't see how cutting should matter to termination (given that the
    reduction rules are not recursive).

    I need to think more about it: what is exactly going wrong.

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Fri Dec 6 17:17:18 2024
    On 06/12/2024 16:58, Mild Shock wrote:

    So basically you would replace something like:

       nth1(N, List, Lit, List2)
       select(Lit, List, List2)
       member(Lit, List)

    By this here:

       once(nth1(N, List, Lit, List2))
       once(select(Lit, List, List2))
       once(member(Lit, List))

    No need to backtrack over multiple literals.

    With Gentzen inversion lemmas you can even go a step farther:

       nth1(N, List, Lit, List2), !
       select(Lit, List, List2), !
       member(Lit, List), !

    Cut away certain rules, avoiding even more backtracking.

    I had `once` initially, as that certainly makes sense, but it was
    failing even some of the simpler pos cases. I shall try again.

    OTOH, I do not want to cut on the search space, I like the idea that the
    solver backtracks over all possible proofs. Moreover, I wouldn't think
    that "cutting" matters to termination: 2^n is big, not unbound...

    I need to think more about it.

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Fri Dec 6 20:08:29 2024
    Typo in the meta rules, exchange should be:

    prove([...,X,Y,...])
    ----------------------- (Exchange)
    prove([...,Y,X,...])

    Mild Shock schrieb:
    Hi,

    Or start with a deterministic system,
    and show that it is immune to how the problem
    is stated, immune to all the structural rules.

    For example this deterministic classical prover,
    for propositional logic. It gives an example
    what I mean by Gentzen inversion lemmas:

    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-A,L,R), member(A,R), !.

    The cut (!)/0 in the first and second claus is justified
    by Gentzen inversion lemmas found here, check out page 81:

    Basic Proof Theory, Cambridge University Press
    A. S. Troelstra &  H. Schwichtenberg - June 2012 https://www.cambridge.org/core/books/basic-proof-theory/928508F797214A017D245A1FB67CCCD9


    It can readily prove Peirce Law:

    ?- prove([(((p->q)->p)->p)]).
    true.

    But with Coq or Isabelle/HOL you should be
    also able to prove these meta theorems about
    the Prolog predicate prove/1:

        prove([...,X,Y,...])
       ----------------------- (Exchange)
        prove([...,X,Y,...])

        prove([...,X,X,...])
       ----------------------- (Contraction)
         prove([...,X,...])

         prove([...,X,...])
       ----------------------- (Weakening)
        prove([...,Y,X,...])

    https://en.wikipedia.org/wiki/Structural_rule

    Bye

    Julio Di Egidio schrieb:
    On 06/12/2024 17:17, Julio Di Egidio wrote:
    On 06/12/2024 16:58, Mild Shock wrote:

    Cut away certain rules, avoiding even more backtracking.

    I had `once` initially, as that certainly makes sense, but it was
    failing even some of the simpler pos cases.  I shall try again.

    Indeed, not even a plain `once` works since there may be more than one
    *different* matching hypothesis, and committing to the first one in
    order may lead to failure.

    Anyway, as said, I'd rather not cut on the search space (at all), plus
    I don't see how cutting should matter to termination (given that the
    reduction rules are not recursive).

    I need to think more about it: what is exactly going wrong.

    -Julio



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Fri Dec 6 20:07:11 2024
    Hi,

    Or start with a deterministic system,
    and show that it is immune to how the problem
    is stated, immune to all the structural rules.

    For example this deterministic classical prover,
    for propositional logic. It gives an example
    what I mean by Gentzen inversion lemmas:

    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-A,L,R), member(A,R), !.

    The cut (!)/0 in the first and second claus is justified
    by Gentzen inversion lemmas found here, check out page 81:

    Basic Proof Theory, Cambridge University Press
    A. S. Troelstra & H. Schwichtenberg - June 2012 https://www.cambridge.org/core/books/basic-proof-theory/928508F797214A017D245A1FB67CCCD9

    It can readily prove Peirce Law:

    ?- prove([(((p->q)->p)->p)]).
    true.

    But with Coq or Isabelle/HOL you should be
    also able to prove these meta theorems about
    the Prolog predicate prove/1:

    prove([...,X,Y,...])
    ----------------------- (Exchange)
    prove([...,X,Y,...])

    prove([...,X,X,...])
    ----------------------- (Contraction)
    prove([...,X,...])

    prove([...,X,...])
    ----------------------- (Weakening)
    prove([...,Y,X,...])

    https://en.wikipedia.org/wiki/Structural_rule

    Bye

    Julio Di Egidio schrieb:
    On 06/12/2024 17:17, Julio Di Egidio wrote:
    On 06/12/2024 16:58, Mild Shock wrote:

    Cut away certain rules, avoiding even more backtracking.

    I had `once` initially, as that certainly makes sense, but it was
    failing even some of the simpler pos cases.  I shall try again.

    Indeed, not even a plain `once` works since there may be more than one *different* matching hypothesis, and committing to the first one in
    order may lead to failure.

    Anyway, as said, I'd rather not cut on the search space (at all), plus I don't see how cutting should matter to termination (given that the
    reduction rules are not recursive).

    I need to think more about it: what is exactly going wrong.

    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Fri Dec 6 20:15:08 2024
    Ok, this here is classical logic,
    deterministically expressed:

    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-A,L,R), member(A,R), !.

    It can readily prove Peirce Law:

    ?- prove([(((p->q)->p)->p)]).
    true.

    With Coq or Isabelle/HOL you should be
    also able to prove these meta theorems about
    the Prolog predicate prove/1:

    prove([...,X,Y,...])
    ----------------------- (Exchange)
    prove([...,Y,X,...])

    prove([...,X,X,...])
    ----------------------- (Contraction)
    prove([...,X,...])

    prove([...,X,...])
    ----------------------- (Weakening)
    prove([...,Y,X,...])

    https://en.wikipedia.org/wiki/Structural_rule

    If you replace prove/1 with a deterministic prover
    for affine logic, I guess you will still be
    able to verify (Exchange) and (Weakening) for

    an arbitary input. But not anymore (Contraction)
    in general. What is the deterministic prover for
    affine logic?

    Julio Di Egidio schrieb:
    On 04/12/2024 08:47, Mild Shock wrote:

    Now I tried an example by Troelstra & Schwichtenberg:

    solve_case(pos, schwichtenberg, [((((p->q)->q)->p)->q),(q->p)]=>q).
    solve_case(neg, schwichtenberg2, [((((p->q)->q)->p)->q),(q->p)]=>q).

    At least the second case shouldn't give false, as is seen here:

    It fails if you do (the equivalent of) the intros before the TNT: I had
    a doubt about that, thanks for the test case.  This works as expected:

    ?- solve([]=>tnt((((((p->q)->q)->p)->q)/\(q->p))->q)).

    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Fri Dec 6 21:29:19 2024
    But proving structural rules is a little
    bit unorthodox. In the realm of rewrite rules,
    one would for example prove a CR property:

    https://en.wikipedia.org/wiki/Church%E2%80%93Rosser_theorem

    And then conclude some normalization properties.
    Justifying reference to "the normal form" of a
    given normalizable term.

    But if we do the CR orthodoxy we still have not
    yet closed the abys between specification
    and execution.

    Mild Shock schrieb:
    Ok, this here is classical logic,
    deterministically expressed:

    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-A,L,R), member(A,R), !.

    It can readily prove Peirce Law:

    ?- prove([(((p->q)->p)->p)]).
    true.

    With Coq or Isabelle/HOL you should be
    also able to prove these meta theorems about
    the Prolog predicate prove/1:

        prove([...,X,Y,...])
       ----------------------- (Exchange)
        prove([...,Y,X,...])

        prove([...,X,X,...])
       ----------------------- (Contraction)
         prove([...,X,...])

         prove([...,X,...])
       ----------------------- (Weakening)
        prove([...,Y,X,...])

    https://en.wikipedia.org/wiki/Structural_rule

    If you replace prove/1 with a deterministic prover
    for affine logic, I guess you will still be
    able to verify (Exchange) and (Weakening) for

    an arbitary input. But not anymore (Contraction)
    in general. What is the deterministic prover for
    affine logic?

    Julio Di Egidio schrieb:
    On 04/12/2024 08:47, Mild Shock wrote:

    Now I tried an example by Troelstra & Schwichtenberg:

    solve_case(pos, schwichtenberg, [((((p->q)->q)->p)->q),(q->p)]=>q).
    solve_case(neg, schwichtenberg2, [((((p->q)->q)->p)->q),(q->p)]=>q).

    At least the second case shouldn't give false, as is seen here:

    It fails if you do (the equivalent of) the intros before the TNT: I
    had a doubt about that, thanks for the test case.  This works as
    expected:

    ?- solve([]=>tnt((((((p->q)->q)->p)->q)/\(q->p))->q)).

    -Julio



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Julio Di Egidio on Sat Dec 7 18:19:46 2024
    On 05/12/2024 22:26, Julio Di Egidio wrote:
    On 02/12/2024 12:37, Julio Di Egidio wrote:
    On 02/12/2024 09:49, Mild Shock wrote:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    The solver *is* very slow at the moment, and you are trying to prove a
    too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), X).
    ```

    That 'pelletier' is actually false. I guess you have miscopied it, this
    one is true (classically):

    `((p <-> (q <-> r)) <-> (p <-> q)) <-> r`.

    Meanwhile, I have narrowed the problem of non-termination down to the
    imp-elim rule, and already have a tentative fix in place.

    Though I have added that 'pelletier' to my neg cases and the test is now failing: and I don't know exactly why (the trace is again overwhelming),
    but I guess either I am trading termination for completeness, or this is finally a failure of TNT.

    I need a (more) principled approach...

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Julio Di Egidio on Sat Dec 7 22:47:08 2024
    Hi,

    One of the pelettier test cases was to test
    how long it takes to terminate with "false",
    the other was to test how long it takes to
    terminate with "true". The Prolog time/1

    predicate can be used to measure both, a
    "false" outcome and a "true" outcome.
    Wangs algorithm can be easily extended to
    biconditional:

    :- op(1100, xfx, <->).

    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select((A<->B),L,R), !, prove([-A,B|R]), prove([-B,A|R]).
    prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-(A<->B),L,R), !, prove([-A,-B|R]), prove([B,A|R]).
    prove(L) :- select(-A,L,R), member(A,R), !.

    Usually Theorem Provers choke on these
    test cases, unless they work with some
    XOR representation inspired by Boolean Rings.
    But provers insprired by Boolean Algebra explode:

    /* success timing */
    ?- between(5,10,N), nasty_bicond(N,X),
    time(prove([X<->X])), fail; true.
    % 211,301 inferences, 0.000 CPU in 0.013 seconds
    % 971,051 inferences, 0.047 CPU in 0.060 seconds
    % 4,386,029 inferences, 0.266 CPU in 0.270 seconds
    % 19,547,363 inferences, 1.219 CPU in 1.209 seconds
    % 86,183,093 inferences, 5.141 CPU in 5.355 seconds
    % 376,634,555 inferences, 22.969 CPU in 23.355 seconds
    true.

    /* failure timing */
    ?- between(5,10,N), nasty_bicond(N,X),
    M is N+1, nasty_bicond(M,Y),
    time(\+ prove([X<->Y])), fail; true.
    % 113,383 inferences, 0.000 CPU in 0.008 seconds
    % 514,955 inferences, 0.031 CPU in 0.032 seconds
    % 2,308,703 inferences, 0.141 CPU in 0.143 seconds
    % 10,233,763 inferences, 0.625 CPU in 0.632 seconds
    % 44,928,359 inferences, 2.781 CPU in 2.773 seconds
    % 195,659,867 inferences, 12.078 CPU in 12.142 seconds
    true.

    The pelletier test case generator:

    nasty_bicond(0, x0) :- !.
    nasty_bicond(N, (X<->Y)) :-
    number_codes(N, L),
    atom_codes(X, [0'x|L]),
    M is N-1,
    nasty_bicond(M, Y).

    What is a Boolean Ring:
    https://en.wikipedia.org/wiki/Boolean_ring

    What is a Boolean Algebra: https://en.wikipedia.org/wiki/Boolean_algebra_%28structure%29

    Julio Di Egidio schrieb:
    On 05/12/2024 22:26, Julio Di Egidio wrote:
    On 02/12/2024 12:37, Julio Di Egidio wrote:
    On 02/12/2024 09:49, Mild Shock wrote:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    The solver *is* very slow at the moment, and you are trying to prove
    a too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), X).
    ```

    That 'pelletier' is actually false.  I guess you have miscopied it, this
    one is true (classically):

      `((p <-> (q <-> r)) <-> (p <-> q)) <-> r`.

    Meanwhile, I have narrowed the problem of non-termination down to the imp-elim rule, and already have a tentative fix in place.

    Though I have added that 'pelletier' to my neg cases and the test is now failing: and I don't know exactly why (the trace is again overwhelming),
    but I guess either I am trading termination for completeness, or this is finally a failure of TNT.

    I need a (more) principled approach...

    -Julio


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sat Dec 7 23:01:39 2024
    Ok, what helps here is reordering the rules:

    prove(L) :- select(-A,L,R), member(A,R), !.
    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select((A<->B),L,R), !, prove([-A,B|R]), prove([-B,A|R]).
    prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-(A<->B),L,R), !, prove([-A,-B|R]), prove([B,A|R]).

    The above runs fast in the previous test cases, since
    Axiom does not need to work with atoms anymore, and

    syntactically equivalent formulas are found by Prolog
    unification. But we can make the test case more difficult,

    by swapping sides:

    % nasty1(+Integer, -Expr)
    nasty1(0, x0) :- !.
    nasty1(N, (X<->Y)) :-
    number_codes(N, L),
    atom_codes(X, [0'x|L]),
    M is N-1,
    nasty1(M, Y).

    % nasty1(+Integer, -Expr)
    nasty1(0, x0) :- !.
    nasty1(N, (X<->Y)) :-
    number_codes(N, L),
    atom_codes(X, [0'x|L]),
    M is N-1,
    nasty1(M, Y).

    Now the picture is again not very favorable, despite
    we did an early non atomic Axiom test in prove/1:

    /* success timing */
    ?- between(5,10,N), nasty1(N,X), nasty2(N,Y),
    time(prove([X<->Y])), fail; true.
    % 38,207 inferences, 0.000 CPU in 0.002 seconds
    % 111,919 inferences, 0.000 CPU in 0.006 seconds
    % 314,127 inferences, 0.016 CPU in 0.017 seconds
    % 852,143 inferences, 0.031 CPU in 0.045 seconds
    % 2,248,175 inferences, 0.109 CPU in 0.117 seconds
    % 5,795,311 inferences, 0.281 CPU in 0.299 seconds
    true.

    /* failure timing */
    ?- between(5,10,N), nasty1(N,X), nasty2(N,Y),
    time(\+ prove([(X<->(q<->Y))])), fail; true.
    % 23,651 inferences, 0.000 CPU in 0.002 seconds
    % 66,537 inferences, 0.000 CPU in 0.004 seconds
    % 182,047 inferences, 0.000 CPU in 0.010 seconds
    % 485,421 inferences, 0.000 CPU in 0.025 seconds
    % 1,264,835 inferences, 0.047 CPU in 0.065 seconds
    % 3,229,393 inferences, 0.156 CPU in 0.165 seconds
    true.

    The input size grows linearly but the execution
    time grows exponential.

    Mild Shock schrieb:
    Hi,

    One of the pelettier test cases was to test
    how long it takes to terminate with "false",
    the other was to test how long it takes to
    terminate with "true". The Prolog time/1

    predicate can be used to measure both, a
    "false" outcome and a "true" outcome.
    Wangs algorithm can be easily extended to
    biconditional:

    :- op(1100, xfx, <->).

    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select((A<->B),L,R), !, prove([-A,B|R]), prove([-B,A|R]). prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-(A<->B),L,R), !, prove([-A,-B|R]), prove([B,A|R]). prove(L) :- select(-A,L,R), member(A,R), !.

    Usually Theorem Provers choke on these
    test cases, unless they work with some
    XOR representation inspired by Boolean Rings.
    But provers insprired by Boolean Algebra explode:

    /* success timing */
    ?- between(5,10,N), nasty_bicond(N,X),
       time(prove([X<->X])), fail; true.
    % 211,301 inferences, 0.000 CPU in 0.013 seconds
    % 971,051 inferences, 0.047 CPU in 0.060 seconds
    % 4,386,029 inferences, 0.266 CPU in 0.270 seconds
    % 19,547,363 inferences, 1.219 CPU in 1.209 seconds
    % 86,183,093 inferences, 5.141 CPU in 5.355 seconds
    % 376,634,555 inferences, 22.969 CPU in 23.355 seconds
    true.

    /* failure timing */
    ?- between(5,10,N), nasty_bicond(N,X),
       M is N+1, nasty_bicond(M,Y),
       time(\+ prove([X<->Y])), fail; true.
    % 113,383 inferences, 0.000 CPU in 0.008 seconds
    % 514,955 inferences, 0.031 CPU in 0.032 seconds
    % 2,308,703 inferences, 0.141 CPU in 0.143 seconds
    % 10,233,763 inferences, 0.625 CPU in 0.632 seconds
    % 44,928,359 inferences, 2.781 CPU in 2.773 seconds
    % 195,659,867 inferences, 12.078 CPU in 12.142 seconds
    true.

    The pelletier test case generator:

    nasty_bicond(0, x0) :- !.
    nasty_bicond(N, (X<->Y)) :-
       number_codes(N, L),
       atom_codes(X, [0'x|L]),
       M is N-1,
       nasty_bicond(M, Y).

    What is a Boolean Ring:
    https://en.wikipedia.org/wiki/Boolean_ring

    What is a Boolean Algebra: https://en.wikipedia.org/wiki/Boolean_algebra_%28structure%29

    Julio Di Egidio schrieb:
    On 05/12/2024 22:26, Julio Di Egidio wrote:
    On 02/12/2024 12:37, Julio Di Egidio wrote:
    On 02/12/2024 09:49, Mild Shock wrote:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    The solver *is* very slow at the moment, and you are trying to prove
    a too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), X).
    ```

    That 'pelletier' is actually false.  I guess you have miscopied it,
    this one is true (classically):

       `((p <-> (q <-> r)) <-> (p <-> q)) <-> r`.

    Meanwhile, I have narrowed the problem of non-termination down to the
    imp-elim rule, and already have a tentative fix in place.

    Though I have added that 'pelletier' to my neg cases and the test is
    now failing: and I don't know exactly why (the trace is again
    overwhelming), but I guess either I am trading termination for
    completeness, or this is finally a failure of TNT.

    I need a (more) principled approach...

    -Julio



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sat Dec 7 23:02:40 2024
    Corr.: Forgot to paste nasty2/2:

    nasty2(0, x0) :- !.
    nasty2(N, (Y<->X)) :-
    number_codes(N, L),
    atom_codes(X, [0'x|L]),
    M is N-1,
    nasty2(M, Y).

    Mild Shock schrieb:
    Ok, what helps here is reordering the rules:

    prove(L) :- select(-A,L,R), member(A,R), !.
    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select((A<->B),L,R), !, prove([-A,B|R]), prove([-B,A|R]). prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-(A<->B),L,R), !, prove([-A,-B|R]), prove([B,A|R]).

    The above runs fast in the previous test cases, since
    Axiom does not need to work with atoms anymore, and

    syntactically equivalent formulas are found by Prolog
    unification. But we can make the test case more difficult,

    by swapping sides:

    % nasty1(+Integer, -Expr)
    nasty1(0, x0) :- !.
    nasty1(N, (X<->Y)) :-
       number_codes(N, L),
       atom_codes(X, [0'x|L]),
       M is N-1,
       nasty1(M, Y).

    % nasty1(+Integer, -Expr)
    nasty1(0, x0) :- !.
    nasty1(N, (X<->Y)) :-
       number_codes(N, L),
       atom_codes(X, [0'x|L]),
       M is N-1,
       nasty1(M, Y).

    Now the picture is again not very favorable, despite
    we did an early non atomic Axiom test in prove/1:

    /* success timing */
    ?- between(5,10,N), nasty1(N,X), nasty2(N,Y),
       time(prove([X<->Y])), fail; true.
    % 38,207 inferences, 0.000 CPU in 0.002 seconds
    % 111,919 inferences, 0.000 CPU in 0.006 seconds
    % 314,127 inferences, 0.016 CPU in 0.017 seconds
    % 852,143 inferences, 0.031 CPU in 0.045 seconds
    % 2,248,175 inferences, 0.109 CPU in 0.117 seconds
    % 5,795,311 inferences, 0.281 CPU in 0.299 seconds
    true.

    /* failure timing */
    ?- between(5,10,N), nasty1(N,X), nasty2(N,Y),
       time(\+ prove([(X<->(q<->Y))])), fail; true.
    % 23,651 inferences, 0.000 CPU in 0.002 seconds
    % 66,537 inferences, 0.000 CPU in 0.004 seconds
    % 182,047 inferences, 0.000 CPU in 0.010 seconds
    % 485,421 inferences, 0.000 CPU in 0.025 seconds
    % 1,264,835 inferences, 0.047 CPU in 0.065 seconds
    % 3,229,393 inferences, 0.156 CPU in 0.165 seconds
    true.

    The input size grows linearly but the execution
    time grows exponential.

    Mild Shock schrieb:
    Hi,

    One of the pelettier test cases was to test
    how long it takes to terminate with "false",
    the other was to test how long it takes to
    terminate with "true". The Prolog time/1

    predicate can be used to measure both, a
    "false" outcome and a "true" outcome.
    Wangs algorithm can be easily extended to
    biconditional:

    :- op(1100, xfx, <->).

    prove(L) :- select((A->B),L,R), !, prove([-A,B|R]).
    prove(L) :- select((A<->B),L,R), !, prove([-A,B|R]), prove([-B,A|R]).
    prove(L) :- select(-(A->B),L,R), !, prove([A|R]), prove([-B|R]).
    prove(L) :- select(-(A<->B),L,R), !, prove([-A,-B|R]), prove([B,A|R]).
    prove(L) :- select(-A,L,R), member(A,R), !.

    Usually Theorem Provers choke on these
    test cases, unless they work with some
    XOR representation inspired by Boolean Rings.
    But provers insprired by Boolean Algebra explode:

    /* success timing */
    ?- between(5,10,N), nasty_bicond(N,X),
        time(prove([X<->X])), fail; true.
    % 211,301 inferences, 0.000 CPU in 0.013 seconds
    % 971,051 inferences, 0.047 CPU in 0.060 seconds
    % 4,386,029 inferences, 0.266 CPU in 0.270 seconds
    % 19,547,363 inferences, 1.219 CPU in 1.209 seconds
    % 86,183,093 inferences, 5.141 CPU in 5.355 seconds
    % 376,634,555 inferences, 22.969 CPU in 23.355 seconds
    true.

    /* failure timing */
    ?- between(5,10,N), nasty_bicond(N,X),
        M is N+1, nasty_bicond(M,Y),
        time(\+ prove([X<->Y])), fail; true.
    % 113,383 inferences, 0.000 CPU in 0.008 seconds
    % 514,955 inferences, 0.031 CPU in 0.032 seconds
    % 2,308,703 inferences, 0.141 CPU in 0.143 seconds
    % 10,233,763 inferences, 0.625 CPU in 0.632 seconds
    % 44,928,359 inferences, 2.781 CPU in 2.773 seconds
    % 195,659,867 inferences, 12.078 CPU in 12.142 seconds
    true.

    The pelletier test case generator:

    nasty_bicond(0, x0) :- !.
    nasty_bicond(N, (X<->Y)) :-
        number_codes(N, L),
        atom_codes(X, [0'x|L]),
        M is N-1,
        nasty_bicond(M, Y).

    What is a Boolean Ring:
    https://en.wikipedia.org/wiki/Boolean_ring

    What is a Boolean Algebra:
    https://en.wikipedia.org/wiki/Boolean_algebra_%28structure%29

    Julio Di Egidio schrieb:
    On 05/12/2024 22:26, Julio Di Egidio wrote:
    On 02/12/2024 12:37, Julio Di Egidio wrote:
    On 02/12/2024 09:49, Mild Shock wrote:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    The solver *is* very slow at the moment, and you are trying to
    prove a too complicated statement:

    ```
    ?- unfold(tnt((p<->(q<->r))<->(p<->q)), X).
    ```

    That 'pelletier' is actually false.  I guess you have miscopied it,
    this one is true (classically):

       `((p <-> (q <-> r)) <-> (p <-> q)) <-> r`.

    Meanwhile, I have narrowed the problem of non-termination down to the
    imp-elim rule, and already have a tentative fix in place.

    Though I have added that 'pelletier' to my neg cases and the test is
    now failing: and I don't know exactly why (the trace is again
    overwhelming), but I guess either I am trading termination for
    completeness, or this is finally a failure of TNT.

    I need a (more) principled approach...

    -Julio




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Mild Shock on Sun Dec 8 05:50:45 2024
    On 07/12/2024 22:47, Mild Shock wrote:

    One of the pelettier test cases was to test
    how long it takes to terminate with "false",
    the other was to test how long it takes to
    terminate with "true". The Prolog time/1

    *What* pelletier statements?? You piece of fucker have also been
    linking only to stuff behind a paid wall.

    Wangs algorithm can be easily extended to biconditional:

    WTF is that?? Is it INTUITIONISTIC?? Is it AFFINE??

    You spamming moron.

    -Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Mon Dec 9 21:47:15 2024
    We can recreated the first Wolfram example in Prolog:

    Lets permit that we write the input as [1,2,a,4,5,
    b,c,8,9,10] and then have rewriting rules [a->3,b->6,
    7,d->8] applied, by this little Declarative (What) code:

    step(L,R) :- nth1(K,L,a,H), nth1(K,R,3,H).
    step(L,R) :- nth1(K,L,b,H), nth1(K,R,6,H).
    step(L,R) :- nth1(K,L,c,H), nth1(K,R,7,H).
    step(L,R) :- nth1(K,L,d,H), nth1(K,R,8,H).

    find(L,L) :- \+ step(L,_).
    find(L,R) :- step(L,H), find(H,R).

    Each derivation is a Procedural (How) execution:

    ?- find([1,2,a,4,5,b,c,8,9,10],X).
    X = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    X = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    X = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    Etc..

    Can we count the number of Hows to solve the What?

    ?- aggregate_all(count, find([1,2,a,4,5,b,c,8,9,10],X), C).
    C = 6.

    So there are 6 different Procedures that tell
    us which steps to exactly use when, to solve the
    Declaratively given problem which leaves open

    Mild Shock schrieb:

    Looks like uncontrolled confluence, which usually
    happens when you write down rules declaratively.

    There are some nice pictures:

    Wolfram, S. A New Kind of Science. Champaign, IL:
    Wolfram Media, pp. 507 and 1036-1037, 2002. https://mathworld.wolfram.com/Confluent.html

    Showing how search explodes, by doing redundant work.

    Mild Shock schrieb:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    ?- solve_case(TT, pelletier, G), time(solve_t__sel(TT, G)).
    Action (h for help) ? abort
    % 844,501,974 inferences, 63.891 CPU in 68.236 seconds (94% CPU,
    13217933 Lips)
    % Execution Aborted

    The test case was:

    solve_case(neg, pelletier, []=>((p<->(q<->r))<->(p<->q))).

    Or just a problem of explosion?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Mon Dec 9 21:46:06 2024
    Looks like uncontrolled confluence, which usually
    happens when you write down rules declaratively.

    There are some nice pictures:

    Wolfram, S. A New Kind of Science. Champaign, IL:
    Wolfram Media, pp. 507 and 1036-1037, 2002. https://mathworld.wolfram.com/Confluent.html

    Showing how search explodes, by doing redundant work.

    Mild Shock schrieb:
    Could it be that your procedure doesn't
    terminate always? Why is this not finished
    after more than 1 minute?

    ?- solve_case(TT, pelletier, G), time(solve_t__sel(TT, G)).
    Action (h for help) ? abort
    % 844,501,974 inferences, 63.891 CPU in 68.236 seconds (94% CPU,
    13217933 Lips)
    % Execution Aborted

    The test case was:

    solve_case(neg, pelletier, []=>((p<->(q<->r))<->(p<->q))).

    Or just a problem of explosion?

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