• Re: Is this correct Prolog?

    From Mikko@21:1/5 to olcott on Sat Apr 30 12:31:52 2022
    On 2022-04-30 07:02:23 +0000, olcott said:

    LP := ~True(LP) is translated to Prolog:

    ?- LP = not(true(LP)).
    LP = not(true(LP)).

    This is correct but to fail would also be correct.

    ?- unify_with_occurs_check(LP, not(true(LP))).
    false.

    unify_with_occurs_check must fail if the unified data structure
    would contain loops.

    Mikko

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aleksy Grabowski@21:1/5 to Mikko on Sat Apr 30 20:15:19 2022
    I just want to add some small note.

    This "not(true(_))" thing is misleading.
    Please note that it is *not* a negation.
    Functionally it is equivalent to:

    X = foo(bar(X)).

    On 4/30/22 11:31, Mikko wrote:
    On 2022-04-30 07:02:23 +0000, olcott said:

    LP := ~True(LP) is translated to Prolog:

    ?- LP = not(true(LP)).
    LP = not(true(LP)).

    This is correct but to fail would also be correct.

    ?- unify_with_occurs_check(LP, not(true(LP))).
    false.

    unify_with_occurs_check must fail if the unified data structure
    would contain loops.

    Mikko


    --
    Alex

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Aleksy Grabowski on Sat Apr 30 16:08:05 2022
    On 4/30/2022 1:15 PM, Aleksy Grabowski wrote:
    I just want to add some small note.

    This "not(true(_))" thing is misleading.
    Please note that it is *not* a negation.
    Functionally it is equivalent to:

    X = foo(bar(X)).


    negation, not, \+
    The concept of logical negation in Prolog is problematical, in the sense
    that the only method that Prolog can use to tell if a proposition is
    false is to try to prove it (from the facts and rules that it has been
    told about), and then if this attempt fails, it concludes that the
    proposition is false. This is referred to as negation as failure.

    http://www.cse.unsw.edu.au/~billw/dictionaries/prolog/negation.html

    On 4/30/22 11:31, Mikko wrote:
    On 2022-04-30 07:02:23 +0000, olcott said:

    LP := ~True(LP) is translated to Prolog:

    ?- LP = not(true(LP)).
    LP = not(true(LP)).

    This is correct but to fail would also be correct.

    ?- unify_with_occurs_check(LP, not(true(LP))).
    false.

    unify_with_occurs_check must fail if the unified data structure
    would contain loops.

    Not according to Clocksin & Mellish, unify_with_occurs_check detects an "infinite term" which is the same thing as infinititely recursive
    definition, thus not at all any sort of "do while loop".

    LP := ~True(LP)
    specifies ~True(~True(~True(~True(~True(..)))))


    Mikko




    --
    Copyright 2022 Pete Olcott

    "Talent hits a target no one else can hit;
    Genius hits a target no one else can see."
    Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Mikko on Sat Apr 30 15:48:47 2022
    On 4/30/2022 4:31 AM, Mikko wrote:
    On 2022-04-30 07:02:23 +0000, olcott said:

    LP := ~True(LP) is translated to Prolog:

    ?- LP = not(true(LP)).
    LP = not(true(LP)).

    This is correct but to fail would also be correct.

    ?- unify_with_occurs_check(LP, not(true(LP))).
    false.

    unify_with_occurs_check must fail if the unified data structure
    would contain loops.

    Mikko


    The above is the actual execution of actual Prolog code using
    (SWI-Prolog (threaded, 64 bits, version 7.6.4).

    According to Clocksin & Mellish it is not a mere loop, it is an
    "infinite term" thus infinitely recursive definition.

    I am trying to validate whether or not my Prolog code encodes the Liar
    Paradox. I believe that it does and it also shows exactly how the Liar
    Paradox is erroneous.

    From all of my analysis and research this expression correctly
    formalizes the Liar Paradox: LP := ~True(LP)

    --
    Copyright 2022 Pete Olcott

    "Talent hits a target no one else can hit;
    Genius hits a target no one else can see."
    Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mikko@21:1/5 to olcott on Sun May 1 12:38:26 2022
    On 2022-04-30 20:48:47 +0000, olcott said:

    On 4/30/2022 4:31 AM, Mikko wrote:
    On 2022-04-30 07:02:23 +0000, olcott said:

    LP := ~True(LP) is translated to Prolog:

    ?- LP = not(true(LP)).
    LP = not(true(LP)).

    This is correct but to fail would also be correct.

    ?- unify_with_occurs_check(LP, not(true(LP))).
    false.

    unify_with_occurs_check must fail if the unified data structure
    would contain loops.

    Mikko


    The above is the actual execution of actual Prolog code using
    (SWI-Prolog (threaded, 64 bits, version 7.6.4).

    Another Prolog implementation might interprete LP = not(true(LP)) differently and still conform to the prolog standard.

    According to Clocksin & Mellish it is not a mere loop, it is an
    "infinite term" thus infinitely recursive definition.

    When discussing data structures, "infinite" and "loop" mean the same.
    The data structure is infinitely deep but contains only finitely many
    distinct objects and occupies only a finite amount of memory.

    I am trying to validate whether or not my Prolog code encodes the Liar Paradox.

    That cannot be inferred from Prolog rules. Prolog defines some encodings
    like how to encode numbers with characters of Prolog character set but for
    more complex things you must make your own encoding rules.

    Mikko

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mikko@21:1/5 to Aleksy Grabowski on Sun May 1 12:24:09 2022
    On 2022-04-30 18:15:19 +0000, Aleksy Grabowski said:

    I just want to add some small note.

    This "not(true(_))" thing is misleading.
    Please note that it is *not* a negation.
    Functionally it is equivalent to:

    X = foo(bar(X)).

    That's correct. Prolog language does not give any inherent semantics to
    data structures. It only defines the execution semantics of language
    structures and standard library symbols. Those same synbols can be used
    in data structures with entirely different purposes.

    Mikko

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mikko@21:1/5 to olcott on Sun May 1 12:45:28 2022
    On 2022-05-01 03:15:56 +0000, olcott said:

    Not in this case, it is very obvious that no theorem prover can
    possibly prove any infinite expression.

    Doesn't matter as you can't give an infinite expression to a theorem
    prover.

    Mikko

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mikko@21:1/5 to olcott on Sun May 1 12:26:15 2022
    On 2022-04-30 21:08:05 +0000, olcott said:

    negation, not, \+
    The concept of logical negation in Prolog is problematical, in the
    sense that the only method that Prolog can use to tell if a proposition
    is false is to try to prove it (from the facts and rules that it has
    been told about), and then if this attempt fails, it concludes that the proposition is false. This is referred to as negation as failure.

    Note that the negation discussed above is not present in LP = not(true(LP)).

    Mikko

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Aleksy Grabowski on Mon May 2 07:59:55 2022
    On Monday, 2 May 2022 at 15:35:10 UTC+2, Aleksy Grabowski wrote:
    The whole purpose of this thread is to find out exactly how to encode: "This sentence is not true" in Prolog when we assume that True is
    exactly the same thing as Provable in Prolog.

    As long as it's equal to "<whatever> is not provable",
    that's just any proposition <whatever> that fails, e.g.
    g :- fail. As to how to rather encode self-referentiality,
    and to begin with one needs first-order, that's something
    to think about... just I am not sure how you do without
    the whole Goedel construction unless by using Prolog
    and maybe its meta-programming in some clever way.

    "This sentence is not provable" can be naïvely encoded:

    g :- \+ g.

    Then you can ask Prolog if this sentence is true:

    ?- g.

    Prolog won't give any answer, it'll just crash. You (think you)
    know what the answer is, but in fact it's the same answer
    you'd get with g :- g.

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Julio Di Egidio on Mon May 2 10:45:22 2022
    On 5/2/2022 9:59 AM, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 15:35:10 UTC+2, Aleksy Grabowski wrote:
    The whole purpose of this thread is to find out exactly how to encode:
    "This sentence is not true" in Prolog when we assume that True is
    exactly the same thing as Provable in Prolog.

    As long as it's equal to "<whatever> is not provable",
    that's just any proposition <whatever> that fails, e.g.
    g :- fail. As to how to rather encode self-referentiality,
    and to begin with one needs first-order, that's something
    to think about... just I am not sure how you do without
    the whole Goedel construction unless by using Prolog
    and maybe its meta-programming in some clever way.

    "This sentence is not provable" can be naïvely encoded:

    g :- \+ g.

    Then you can ask Prolog if this sentence is true:

    ?- g.

    Prolog won't give any answer, it'll just crash. You (think you)
    know what the answer is, but in fact it's the same answer
    you'd get with g :- g.

    Julio

    That is exactly what I expected.
    Does it crash because it ran out of memory?

    unify_with_occurs_check is supposed to determine in advance that
    unification will crash. Can it be applied to the above?

    Do we have any Prolog that shows in advance that the above expressions
    would crash?

    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to olcott on Mon May 2 09:02:22 2022
    On Monday, 2 May 2022 at 17:45:26 UTC+2, olcott wrote:
    On 5/2/2022 9:59 AM, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 15:35:10 UTC+2, Aleksy Grabowski wrote:
    The whole purpose of this thread is to find out exactly how to encode: >>> "This sentence is not true" in Prolog when we assume that True is
    exactly the same thing as Provable in Prolog.

    As long as it's equal to "<whatever> is not provable",
    that's just any proposition <whatever> that fails, e.g.
    g :- fail. As to how to rather encode self-referentiality,
    and to begin with one needs first-order, that's something
    to think about... just I am not sure how you do without
    the whole Goedel construction unless by using Prolog
    and maybe its meta-programming in some clever way.

    "This sentence is not provable" can be naïvely encoded:

    g :- \+ g.

    Then you can ask Prolog if this sentence is true:

    ?- g.

    Prolog won't give any answer, it'll just crash. You (think you)
    know what the answer is, but in fact it's the same answer
    you'd get with g :- g.

    That is exactly what I expected.

    g:-\+g as g:-g are literally and simply infinite loops: neither
    captures anything deep about anything. Aka plain and
    simple divergent computation.

    Does it crash because it ran out of memory?

    Yes, but even if it didn't, it'd be you at some point who would
    have to switch it off. And still that wouldn't be a proof of
    anything.

    unify_with_occurs_check is supposed to determine in
    advance that unification will crash. Can it be applied to
    the above?

    So far you aren't using unification at all: you need to go
    first order, i.e. predicates with (variable) arguments.

    Do we have any Prolog that shows in advance that the
    above expressions would crash?

    Would "not terminate", "crash" is quite broader... and no,
    not in general: i.e. not until you solve the halting problem.

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aleksy Grabowski@21:1/5 to Julio Di Egidio on Mon May 2 17:15:35 2022
    On 5/2/22 16:59, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 15:35:10 UTC+2, Aleksy Grabowski wrote:
    "This sentence is not provable" can be naïvely encoded:

    g :- \+ g.

    Then you can ask Prolog if this sentence is true:

    ?- g.

    Prolog won't give any answer, it'll just crash. You (think you)
    know what the answer is, but in fact it's the same answer
    you'd get with g :- g.

    Julio

    Yep, that's exactly what I was saying. IMHO, the only correct behavior
    is to go to infinite loop and refuse to give any answer.

    --
    Alex Grabowski

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Aleksy Grabowski on Mon May 2 09:51:27 2022
    On Monday, 2 May 2022 at 18:38:10 UTC+2, Aleksy Grabowski wrote:
    On 5/2/22 18:04, olcott wrote:

    Is there any Prolog that can detect that the above will not terminate prior to executing it?

    As I have said previously, my example is naïve.

    And as I have pointed out to you, your "solution" solves nothing at all.

    Maybe if you will think
    hard enough you can make it detect such conditions, probably by writing meta-interpreter of some sort, and terminate. Personally, I don't think
    that using Prolog can be accepted as a "rigorous proof" of anything.

    That's just nonsense: Prolog is a formal language no less than any other.
    Plus you too must think you have a solution to the halting problem...

    Enough said.

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Julio Di Egidio on Mon May 2 11:26:55 2022
    On 5/2/2022 11:02 AM, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 17:45:26 UTC+2, olcott wrote:
    On 5/2/2022 9:59 AM, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 15:35:10 UTC+2, Aleksy Grabowski wrote:
    The whole purpose of this thread is to find out exactly how to encode: >>>>> "This sentence is not true" in Prolog when we assume that True is
    exactly the same thing as Provable in Prolog.

    As long as it's equal to "<whatever> is not provable",
    that's just any proposition <whatever> that fails, e.g.
    g :- fail. As to how to rather encode self-referentiality,
    and to begin with one needs first-order, that's something
    to think about... just I am not sure how you do without
    the whole Goedel construction unless by using Prolog
    and maybe its meta-programming in some clever way.

    "This sentence is not provable" can be naïvely encoded:

    g :- \+ g.

    Then you can ask Prolog if this sentence is true:

    ?- g.

    Prolog won't give any answer, it'll just crash. You (think you)
    know what the answer is, but in fact it's the same answer
    you'd get with g :- g.

    That is exactly what I expected.

    g:-\+g as g:-g are literally and simply infinite loops: neither
    captures anything deep about anything. Aka plain and
    simple divergent computation.

    Does it crash because it ran out of memory?

    Yes, but even if it didn't, it'd be you at some point who would
    have to switch it off. And still that wouldn't be a proof of
    anything.

    unify_with_occurs_check is supposed to determine in
    advance that unification will crash. Can it be applied to
    the above?

    So far you aren't using unification at all: you need to go
    first order, i.e. predicates with (variable) arguments.

    Do we have any Prolog that shows in advance that the
    above expressions would crash?

    Would "not terminate", "crash" is quite broader... and no,
    not in general: i.e. not until you solve the halting problem.

    Julio

    What is occurring internally with Prolog's evaluation of the above
    expressions? Does it build an infinite structure?

    I think that I have refuted the conventional proofs of the halting
    problem. I spent a man-year creating the x86 operating system so that I
    could encode the conventional HP counter example in C/x86. My halt
    decider does correctly determine that its input specifies infinitely
    nested simulation.

    void P(u32 x)
    {
    if (H(x, x))
    HERE: goto HERE;
    return;
    }

    int main()
    {
    Output("Input_Halts = ", H((u32)P, (u32)P));
    }


    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Aleksy Grabowski on Mon May 2 11:04:14 2022
    On Monday, 2 May 2022 at 19:39:01 UTC+2, Aleksy Grabowski wrote:
    On 5/2/22 18:51, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 18:38:10 UTC+2, Aleksy Grabowski wrote:
    On 5/2/22 18:04, olcott wrote:

    Is there any Prolog that can detect that the above will not terminate >>> prior to executing it?

    As I have said previously, my example is naïve.

    And as I have pointed out to you, your "solution" solves nothing at all.
    The request from topic poster was — how would I represent sentence "This sentence is not provable". I came up with some small example

    No, you didn't, and I have said why twice by now.

    Maybe if you will think
    hard enough you can make it detect such conditions, probably by writing >> meta-interpreter of some sort, and terminate. Personally, I don't think >> that using Prolog can be accepted as a "rigorous proof" of anything.

    That's just nonsense: Prolog is a formal language no less than any other. Plus you too must think you have a solution to the halting problem...

    No, I don't have a solution for a halting problem, I'm not a freak, but
    also solving termination for _some_ specially designed simple programs doesn't require halting problem. It's some first grader stuff, c'mon.

    You bring it up: and it is in fact irrelevant here, as long as the
    original question is the question you noticed it is.

    Anyway, discussing with Olcott's interlocutors is always even
    worse than discussing with Olcott himself...

    (EOD.)

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aleksy Grabowski@21:1/5 to Julio Di Egidio on Mon May 2 19:38:59 2022
    On 5/2/22 18:51, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 18:38:10 UTC+2, Aleksy Grabowski wrote:
    On 5/2/22 18:04, olcott wrote:

    Is there any Prolog that can detect that the above will not terminate
    prior to executing it?

    As I have said previously, my example is naïve.

    And as I have pointed out to you, your "solution" solves nothing at all.

    The request from topic poster was — how would I represent sentence "This sentence is not provable". I came up with some small example of "not
    provable sentence" which happens to be a simple infinite loop. I did
    *not* claim that it captures anything deep and solves halting problem,
    that would've been absurd. If you have any better idea please write it.

    Maybe if you will think
    hard enough you can make it detect such conditions, probably by writing
    meta-interpreter of some sort, and terminate. Personally, I don't think
    that using Prolog can be accepted as a "rigorous proof" of anything.

    That's just nonsense: Prolog is a formal language no less than any other. Plus you too must think you have a solution to the halting problem...

    No, I don't have a solution for a halting problem, I'm not a freak, but
    also solving termination for _some_ specially designed simple programs
    doesn't require halting problem. It's some first grader stuff, c'mon.

    Like this random example from my head (in C++):

    int sum = 0;
    for (int i = 5; i > 0; i--)
    sum += i;

    Can be proved to always terminate, because loop's variant `i` has lower
    bound, has total ordering and it's value decreases on each iteration. In
    some cases you can automatically detect such loop variants, and
    automatically prove termination of _some_ loops.

    --
    Alex Grabowski

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Aleksy Grabowski on Mon May 2 14:14:58 2022
    On 5/2/2022 12:38 PM, Aleksy Grabowski wrote:
    On 5/2/22 18:51, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 18:38:10 UTC+2, Aleksy Grabowski wrote:
    On 5/2/22 18:04, olcott wrote:

    Is there any Prolog that can detect that the above will not terminate
    prior to executing it?

    As I have said previously, my example is naïve.

    And as I have pointed out to you, your "solution" solves nothing at all.

    The request from topic poster was — how would I represent sentence "This sentence is not provable". I came up with some small example of "not
    provable sentence" which happens to be a simple infinite loop. I did
    *not* claim that it captures anything deep and solves halting problem,
    that would've been absurd. If you have any better idea please write it.


    ?- LP = not(LP).
    LP = not(LP).

    ?- unify_with_occurs_check(LP, not(LP)).
    false.

    I simplified it because the "not" of Prolog "negation as failure"
    already means not(true(LP)) when we assume that true(LP) means
    provable(LP).

    This version precisely captures the pathological self-reference of the
    Liar Paradox in a way that Prolog detects and rejects.

    "equal" converted to = for SWI Prolog

    ?- =(foo(Y), Y).
    Y = foo(Y).

    ?- unify_with_occurs_check(Y, foo(Y)).
    false

    Maybe if you will think
    hard enough you can make it detect such conditions, probably by writing
    meta-interpreter of some sort, and terminate. Personally, I don't think
    that using Prolog can be accepted as a "rigorous proof" of anything.

    That's just nonsense: Prolog is a formal language no less than any other.
    Plus you too must think you have a solution to the halting problem...

    No, I don't have a solution for a halting problem, I'm not a freak, but
    also solving termination for _some_ specially designed simple programs doesn't require halting problem. It's some first grader stuff, c'mon.

    Like this random example from my head (in C++):

        int sum = 0;
        for (int i = 5; i > 0; i--)
            sum += i;

    Can be proved to always terminate, because loop's variant `i` has lower bound, has total ordering and it's value decreases on each iteration. In
    some cases you can automatically detect such loop variants, and
    automatically prove termination of _some_ loops.



    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aleksy Grabowski@21:1/5 to olcott on Mon May 2 21:43:53 2022
    On 5/2/22 21:24, olcott wrote:
    What do you think of this version:

    ?- LP = not(LP).
    LP = not(LP).

    In this expression, `not` is treated as a term — a symbol without any meaning, just text "not", and not the _negation_.

    If you want to check if a variable can be different from itself you can
    try this:

    ?- dif(X, X).

    But, remember that dif/2 isn't available in all Prolog implementations.

    --
    Alex Grabowski

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Aleksy Grabowski on Mon May 2 14:24:50 2022
    On 5/2/2022 12:38 PM, Aleksy Grabowski wrote:
    On 5/2/22 18:51, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 18:38:10 UTC+2, Aleksy Grabowski wrote:
    On 5/2/22 18:04, olcott wrote:

    Is there any Prolog that can detect that the above will not terminate
    prior to executing it?

    As I have said previously, my example is naïve.

    And as I have pointed out to you, your "solution" solves nothing at all.

    The request from topic poster was — how would I represent sentence "This sentence is not provable". I came up with some small example of "not
    provable sentence"

    I would say that you did an excellent job of that.
    What do you think of this version:

    ?- LP = not(LP).
    LP = not(LP).

    ?- unify_with_occurs_check(LP, not(LP)).
    false.

    The "not" of Prolog's "negation as failure" already means not(true(LP))
    when we assume that true(LP) means provable(LP).


    which happens to be a simple infinite loop. I did
    *not* claim that it captures anything deep and solves halting problem,
    that would've been absurd. If you have any better idea please write it.

    Maybe if you will think
    hard enough you can make it detect such conditions, probably by writing
    meta-interpreter of some sort, and terminate. Personally, I don't think
    that using Prolog can be accepted as a "rigorous proof" of anything.

    That's just nonsense: Prolog is a formal language no less than any other.
    Plus you too must think you have a solution to the halting problem...

    No, I don't have a solution for a halting problem, I'm not a freak, but
    also solving termination for _some_ specially designed simple programs doesn't require halting problem. It's some first grader stuff, c'mon.

    Like this random example from my head (in C++):

        int sum = 0;
        for (int i = 5; i > 0; i--)
            sum += i;

    Can be proved to always terminate, because loop's variant `i` has lower bound, has total ordering and it's value decreases on each iteration. In
    some cases you can automatically detect such loop variants, and
    automatically prove termination of _some_ loops.



    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Aleksy Grabowski on Mon May 2 15:10:51 2022
    On 5/2/2022 2:43 PM, Aleksy Grabowski wrote:
    On 5/2/22 21:24, olcott wrote:
    What do you think of this version:

    ?- LP = not(LP).
    LP = not(LP).

    In this expression, `not` is treated as a term — a symbol without any meaning, just text "not", and not the _negation_.


    (SWI-Prolog (threaded, 64 bits, version 7.6.4)
    Predicate not/1

    not(:Goal)
    True if Goal cannot be proven. Retained for compatibility only. New code
    should use \+/1.

    https://www.swi-prolog.org/pldoc/man?predicate=not/1

    SWI Prolog does not accept this, did I say it incorrectly?
    ?- g :- \+ g.
    ?- g.

    If you want to check if a variable can be different from itself you can
    try this:

        ?- dif(X, X).

    But, remember that dif/2 isn't available in all Prolog implementations.


    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Julio Di Egidio on Mon May 2 14:22:56 2022
    On 5/2/2022 1:04 PM, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 19:39:01 UTC+2, Aleksy Grabowski wrote:
    On 5/2/22 18:51, Julio Di Egidio wrote:
    On Monday, 2 May 2022 at 18:38:10 UTC+2, Aleksy Grabowski wrote:
    On 5/2/22 18:04, olcott wrote:

    Is there any Prolog that can detect that the above will not terminate >>>>> prior to executing it?

    As I have said previously, my example is naïve.

    And as I have pointed out to you, your "solution" solves nothing at all.
    The request from topic poster was — how would I represent sentence "This >> sentence is not provable". I came up with some small example

    No, you didn't, and I have said why twice by now.


    Encoding "This sentence is not true" in Prolog:

    ?- LP = not(LP).
    LP = not(LP).

    ?- unify_with_occurs_check(LP, not(LP)).
    false.

    The "not" of Prolog's "negation as failure" already means not(true(LP))
    when we assume that true(LP) means provable(LP).


    Maybe if you will think
    hard enough you can make it detect such conditions, probably by writing >>>> meta-interpreter of some sort, and terminate. Personally, I don't think >>>> that using Prolog can be accepted as a "rigorous proof" of anything.

    That's just nonsense: Prolog is a formal language no less than any other. >>> Plus you too must think you have a solution to the halting problem...

    No, I don't have a solution for a halting problem, I'm not a freak, but
    also solving termination for _some_ specially designed simple programs
    doesn't require halting problem. It's some first grader stuff, c'mon.

    You bring it up: and it is in fact irrelevant here, as long as the
    original question is the question you noticed it is.

    Anyway, discussing with Olcott's interlocutors is always even
    worse than discussing with Olcott himself...

    (EOD.)

    Julio


    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aleksy Grabowski@21:1/5 to olcott on Mon May 2 22:37:35 2022
    On 5/2/22 22:10, olcott wrote:
    (SWI-Prolog (threaded, 64 bits, version 7.6.4)
    Predicate not/1

    not(:Goal)
    True if Goal cannot be proven. Retained for compatibility only. New code should use \+/1.

    https://www.swi-prolog.org/pldoc/man?predicate=not/1

    SWI Prolog does not accept this, did I say it incorrectly?
    ?- g :- \+ g.
    ?- g.

    You have said it incorrectly. Prolog program has two different parts:
    knowledge base and a query.

    Knowledge base is usually loaded from the text file before starting
    Prolog runtime.

    Query can be asked using interactive prompt.

    The general distinction is that knowledge base should contain everything
    that is known, and query is used to ask questions to that database.

    ?- g :- \+ g.

    This expression asks a question (note question mark), which isn't
    correct, it should be stated as a fact.

    Quick and dirty way to add facts dynamically is to use very special
    `assertz/1` predicate. Like this:

    ?- assertz( (g :- \+ g) ).
    true.

    Then you can normally ask a question:

    ?- g.

    This question causes infinite loop, so you will never see an answer,
    which is correct.

    There are couple of strategies to detect infinite recursion in some very limited number of predicates, but they are quite advanced and probably
    we don't want to go there.

    --
    Alex Grabowski

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Aleksy Grabowski on Mon May 2 15:58:46 2022
    On 5/2/2022 3:37 PM, Aleksy Grabowski wrote:
    On 5/2/22 22:10, olcott wrote:
    (SWI-Prolog (threaded, 64 bits, version 7.6.4)
    Predicate not/1

    not(:Goal)
    True if Goal cannot be proven. Retained for compatibility only. New
    code should use \+/1.

    https://www.swi-prolog.org/pldoc/man?predicate=not/1

    SWI Prolog does not accept this, did I say it incorrectly?
    ?- g :- \+ g.
    ?- g.

    You have said it incorrectly. Prolog program has two different parts: knowledge base and a query.

    Knowledge base is usually loaded from the text file before starting
    Prolog runtime.

    Query can be asked using interactive prompt.

    The general distinction is that knowledge base should contain everything
    that is known, and query is used to ask questions to that database.

    ?- g :- \+ g.

    This expression asks a question (note question mark), which isn't
    correct, it should be stated as a fact.

    Quick and dirty way to add facts dynamically is to use very special `assertz/1` predicate. Like this:

        ?- assertz( (g :- \+ g) ).
        true.

    Then you can normally ask a question:

        ?- g.

    This question causes infinite loop, so you will never see an answer,
    which is correct.


    I do see that it is rejected by SWI Prolog:

    ?- assertz( (g :- \+ g) ).
    true.

    ?- g.
    ERROR: Out of local stack
    ?-

    There are couple of strategies to detect infinite recursion in some very limited number of predicates, but they are quite advanced and probably
    we don't want to go there.


    This one seems to work:

    ?- LP = \+(true(LP)).
    LP = (\+true(LP)).

    ?- unify_with_occurs_check(LP, \+(true(LP))).
    false.


    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Aleksy Grabowski on Mon May 2 16:42:20 2022
    On 5/2/2022 4:33 PM, Aleksy Grabowski wrote:
    On 5/2/22 22:58, olcott wrote:
    This one seems to work:

    ?- LP = \+(true(LP)).
    LP =  (\+true(LP)).

    ?- unify_with_occurs_check(LP, \+(true(LP))).
    false.

    Sadly you aren't using Prolog correctly. You still have to *execute* predicates, because right now they don't mean anything. You can try to
    enable predicate tracer and see for yourself that neither \+ nor `true`
    is ever executed.

    To enable tracer issue following command in the prompt:

        ?- trace.
        true.

    Then you can run your queries again. Then don't forget to disable
    tracer, by issuing command:

        ?- notrace.
        true.

    Also, Prolog doesn't define true/1 predicate it defines only true/0
    without any arguments. First of all you need to define it:

       ?- assertz( (true(X) :- call(X)) ).

    Then still you need to execute your goals by using special call/1
    predicate.

       ?- LP = \+(true(LP)), call(LP).

    With occurs check you will see that it will fail even sooner, and it
    wont be even executed.


    That is why I updated it to this:

    ?- LP = \+(LP).
    LP = (\+LP).

    ?- unify_with_occurs_check(LP, \+(LP)).
    false.

    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aleksy Grabowski@21:1/5 to olcott on Tue May 3 00:13:31 2022
    On 5/2/22 23:42, olcott wrote:
    That is why I updated it to this:

    ?- LP = \+(LP).
    LP =  (\+LP).

    ?- unify_with_occurs_check(LP, \+(LP)).
    false.


    This still is incorrect.

    First of all, enable tracing:

    ?- trace.
    true.

    Then *execute* the predicates that you are trying to use:

    [trace] ?- LP = \+(LP), call(LP).
    Call: (11) _6566=(\+_6566) ? creep
    Exit: (11) (\+ \+ \+ \+ \+ \+ \+ \+ \+ ...)=(\+ \+ \+ \+ \+ \+
    \+ \+ \+ ...) ? creep
    ERROR: Cannot represent due to `cyclic_term'
    ERROR: In:
    ERROR: [10] '<meta-call>'(user:user: ...)
    ERROR: [9] toplevel_call(user:user: ...)

    Which will throw an exception, because Prolog can't deal with it.

    If you will try to unify without occurs check:

    [trace] ?- unify_with_occurs_check(LP, \+(LP)), call(LP).
    Call: (11) unify_with_occurs_check(_1010, \+_1010) ? creep
    Fail: (11) unify_with_occurs_check(_1010, \+_1010) ? creep
    false.

    Then you will see, that your operator \+ isn't even mentioned, as it
    wasn't executed by the Prolog system, because unification with occurs
    check doesn't work for self referential terms. The whole reason of
    occurs check is to reject such terms, this is why this check was added
    in the first place.

    --
    Alex Grabowski

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to olcott on Mon May 2 16:30:09 2022
    On 5/2/2022 3:58 PM, olcott wrote:
    On 5/2/2022 3:37 PM, Aleksy Grabowski wrote:
    On 5/2/22 22:10, olcott wrote:
    (SWI-Prolog (threaded, 64 bits, version 7.6.4)
    Predicate not/1

    not(:Goal)
    True if Goal cannot be proven. Retained for compatibility only. New
    code should use \+/1.

    https://www.swi-prolog.org/pldoc/man?predicate=not/1

    SWI Prolog does not accept this, did I say it incorrectly?
    ?- g :- \+ g.
    ?- g.

    You have said it incorrectly. Prolog program has two different parts:
    knowledge base and a query.

    Knowledge base is usually loaded from the text file before starting
    Prolog runtime.

    Query can be asked using interactive prompt.

    The general distinction is that knowledge base should contain
    everything that is known, and query is used to ask questions to that
    database.

    ?- g :- \+ g.

    This expression asks a question (note question mark), which isn't
    correct, it should be stated as a fact.

    Quick and dirty way to add facts dynamically is to use very special
    `assertz/1` predicate. Like this:

         ?- assertz( (g :- \+ g) ).
         true.

    Then you can normally ask a question:

         ?- g.

    This question causes infinite loop, so you will never see an answer,
    which is correct.


    I do see that it is rejected by SWI Prolog:

    ?- assertz( (g :- \+ g) ).
    true.

    ?- g.
    ERROR: Out of local stack
    ?-

    There are couple of strategies to detect infinite recursion in some
    very limited number of predicates, but they are quite advanced and
    probably we don't want to go there.



    Here it is even simpler:

    ?- LP = \+(LP).
    LP = (\+LP).

    ?- unify_with_occurs_check(LP, \+(LP)).
    false.

    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aleksy Grabowski@21:1/5 to olcott on Mon May 2 23:33:29 2022
    On 5/2/22 22:58, olcott wrote:
    This one seems to work:

    ?- LP = \+(true(LP)).
    LP =  (\+true(LP)).

    ?- unify_with_occurs_check(LP, \+(true(LP))).
    false.

    Sadly you aren't using Prolog correctly. You still have to *execute* predicates, because right now they don't mean anything. You can try to
    enable predicate tracer and see for yourself that neither \+ nor `true`
    is ever executed.

    To enable tracer issue following command in the prompt:

    ?- trace.
    true.

    Then you can run your queries again. Then don't forget to disable
    tracer, by issuing command:

    ?- notrace.
    true.

    Also, Prolog doesn't define true/1 predicate it defines only true/0
    without any arguments. First of all you need to define it:

    ?- assertz( (true(X) :- call(X)) ).

    Then still you need to execute your goals by using special call/1 predicate.

    ?- LP = \+(true(LP)), call(LP).

    With occurs check you will see that it will fail even sooner, and it
    wont be even executed.

    --
    Alex Grabowski

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Aleksy Grabowski on Mon May 2 16:00:05 2022
    On Tuesday, 3 May 2022 at 00:41:18 UTC+2, Aleksy Grabowski wrote:
    On Tuesday, 3 May 2022 at 00:38:57 UTC+2, Richard Damon wrote:
    IF you are defining that your logic system is limited to what Prolog can "Prove", that is fine. Just realize that you have just defined that your logic system can't handle a lot of the real problems in the world, and
    in particular, it is very limited in the mathematics it can handle.

    I am pretty sure that Prolog is NOT up to handling the logic needed to handle the mathematics needed to express Godel's G, or the Halting Problem.

    Thus, your "Proof" that these Theorems are "Wrong" is incorrect, you
    have only proven that your limited logic system can't reach them in expressibility.

    Thanks for confirmation, that's what exactly what I was trying to tell
    to topic poster in one of my previous posts. Prolog in it's bare form is
    a bad theorem solver. It wasn't designed a such.

    If you want to deal with such problems maybe it is better to use Coq
    theorem prover, I've never used it by myself, but it looks like one of
    the best proving assistants out there.

    Prolog is a Turing-complete language, duh.
    When Dunning-Kruger is a compliment...

    Get the fuck out of comp.lang.prolog.

    *Plonk*

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aleksy Grabowski@21:1/5 to Julio Di Egidio on Tue May 3 01:39:50 2022
    On 5/3/22 01:00, Julio Di Egidio wrote:
    Prolog is a Turing-complete language, duh.
    When Dunning-Kruger is a compliment...

    Get the fuck out of comp.lang.prolog.

    *Plonk*

    Julio

    I've already wrote it in one of my previous posts, I just didn't want to
    repeat myself:

    Prolog *by itself* is a very bad theorem prover and it is very limited framework for formal logic, because it implements only Horn clauses.
    However it is a very good programming language and you can implement
    any theorem prover in it, like you can implement any theorem prover
    in C++ or Java.

    I probably have found your profile on the internet and I conclude that
    your arrogance directly stems from your lack of any formal education.
    You didn't graduate from any high school and that's why you want to show everybody your perceived superiority.

    I'll just ignore you for the time being.

    --
    Alex Grabowski

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Aleksy Grabowski on Mon May 2 17:26:29 2022
    On Tuesday, 3 May 2022 at 01:39:53 UTC+2, Aleksy Grabowski wrote:
    On 5/3/22 01:00, Julio Di Egidio wrote:
    Prolog is a Turing-complete language, duh.
    When Dunning-Kruger is a compliment...

    Get the fuck out of comp.lang.prolog.

    *Plonk*

    Julio
    I've already wrote it in one of my previous posts, I just didn't want to repeat myself:

    Prolog *by itself* is a very bad theorem prover and it is very limited framework for formal logic, because it implements only Horn clauses. However it is a very good programming language and you can implement
    any theorem prover in it, like you can implement any theorem prover
    in C++ or Java.

    I probably have found your profile on the internet and I conclude that
    your arrogance directly stems from your lack of any formal education.

    LOL, that rather tells about your reading abilities.

    You didn't graduate from any high school and that's why you want to show everybody your perceived superiority.

    I'll just ignore you for the time being.

    Go fuck yourself, you utter imbecille, you and the whole indecent bandwagon.

    *Plonk*

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to Ben on Mon May 2 17:20:11 2022
    On Tuesday, 3 May 2022 at 01:43:56 UTC+2, Ben wrote:
    Aleksy Grabowski <hur...@gmail.com> writes:

    IF you are defining that your logic system is limited to what Prolog can "Prove", that is fine. Just realize that you have just defined that your
    logic system can't handle a lot of the real problems in the world, and in particular, it is very limited in the mathematics it can handle.
    I am pretty sure that Prolog is NOT up to handling the logic needed to
    handle the mathematics needed to express Godel's G, or the Halting Problem.
    Thus, your "Proof" that these Theorems are "Wrong" is incorrect, you
    have only proven that your limited logic system can't reach them in expressibility.

    Thanks for confirmation, that's what exactly what I was trying to tell
    to topic poster in one of my previous posts. Prolog in it's bare form
    is a bad theorem solver. It wasn't designed a such.

    If you want to deal with such problems maybe it is better to use Coq theorem prover, I've never used it by myself, but it looks like one of
    the best proving assistants out there.

    And indeed there is a fully formalised proof of GIT in Coq (though I
    think it's the slightly tighter Gödel-Rosser version).

    That's just another piece of nonsense, GIT can be formalised in BASIC for that sake.

    You bunch of spamming absolute assholes and spammers of all poonds, indeed Olcott is your good measure.

    *Plonk*

    Julio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From olcott@21:1/5 to Aleksy Grabowski on Mon May 2 19:35:50 2022
    On 5/2/2022 5:13 PM, Aleksy Grabowski wrote:
    On 5/2/22 23:42, olcott wrote:
    That is why I updated it to this:

    ?- LP = \+(LP).
    LP =  (\+LP).

    ?- unify_with_occurs_check(LP, \+(LP)).
    false.


    This still is incorrect.

    First of all, enable tracing:

        ?- trace.
        true.

    Then *execute* the predicates that you are trying to use:

        [trace]  ?- LP = \+(LP), call(LP).
           Call: (11) _6566=(\+_6566) ? creep
           Exit: (11) (\+ \+ \+ \+ \+ \+ \+ \+ \+ ...)=(\+ \+ \+ \+ \+ \+ \+ \+ \+ ...) ? creep
        ERROR: Cannot represent due to `cyclic_term'
        ERROR: In:
        ERROR:   [10] '<meta-call>'(user:user: ...)
        ERROR:    [9] toplevel_call(user:user: ...)

    Which will throw an exception, because Prolog can't deal with it.

    If you will try to unify without occurs check:

        [trace]  ?- unify_with_occurs_check(LP, \+(LP)), call(LP).
           Call: (11) unify_with_occurs_check(_1010, \+_1010) ? creep
           Fail: (11) unify_with_occurs_check(_1010, \+_1010) ? creep
        false.

    Then you will see, that your operator \+ isn't even mentioned, as it
    wasn't executed by the Prolog system, because unification with occurs
    check doesn't work for self referential terms. The whole reason of
    occurs check is to reject such terms, this is why this check was added
    in the first place.


    So we still have not gotten to a best way to encode the Liar Paradox.

    --
    Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
    Genius hits a target no one else can see." Arthur Schopenhauer

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Julio Di Egidio@21:1/5 to olcott on Tue May 3 01:18:38 2022
    On Tuesday, 3 May 2022 at 05:01:46 UTC+2, olcott wrote:
    On 5/2/2022 9:21 PM, Ben wrote:
    olcott <polc...@gmail.com> writes:
    On 5/2/2022 6:43 PM, Ben wrote:
    Aleksy Grabowski <hur...@gmail.com> writes:

    Thanks for confirmation, that's what exactly what I was trying to tell >>>> to topic poster in one of my previous posts. Prolog in it's bare form >>>> is a bad theorem solver. It wasn't designed a such.

    If you want to deal with such problems maybe it is better to use Coq >>>> theorem prover, I've never used it by myself, but it looks like one of >>>> the best proving assistants out there.

    And indeed there is a fully formalised proof of GIT in Coq (though I
    think it's the slightly tighter Gödel-Rosser version).

    It is true that G is not provable.

    G is provable. Proofs abound. I was pointing out one in a proper proof assistant, Coq.

    It is OK that you are not a math guy.

    Or a programmer for that sake, that fucking moron just full of shit.

    But it's NOT OK to cross-spam 5 Usenet groups with just your personal demented chats.

    Eat shit and die you all.

    Julio

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