I am having difficulties wrapping my head around how the answer is being produced. How does the solution come up with the answer 3? How does one derive the answer 3 from the truth table?

For example the following file :

TELL p2=> p3; p3 => p1;

ASK p2

Produces the following result.

enter image description here

Standard output is an answer of the form YES or NO, depending on whether the ASK(ed) query q follows from the TELL(ed) knowledge base KB. When the method is TT and the answer is YES, it should be followed by a colon (:) and the number of models of KB


The provided result is a non-sense for this input.

In a closed world paradigm (ie: prolog), where all non-provable facts are assumed as false, from "p2->p3 and p3->p1", p2 is false, and the program result should be "p2 ? No".

In an open world, as it is not possible to proof "p2" nor "not p2", the result must be "p2 ? unknown"

"p2 -> p3 and p3 -> p1" doesn't provides any information about "p2" in the same way that "if it is sunny then I'm happy" doesn't provides information about if it is sunny or raining.

The meaning of the number after the "yes" (the number of "models") is unknown. Even present two true tables for a single fact "p2 -> p3 and p3 -> p1" can be considered an error.

| improve this answer | |

I'm not quite sure I'm getting this right, as you don't go into much detail in your question:

You show two truth tables for "p implies q", or "p => q". (your variable names are p2 and p3, and p3 and p1 respectively). In a truth table you have a list of all possible combinations of values for the variables. With two boolean values you have four possible combinations, TT/TF/FT/FF (T is represented by 1, and F by 0 in your tables).

The rule for '=>' is that it is true unless the precedent is false and the output is true. For example, if we use it rains for p, and the road is wet for q, we get the following table:

  1. 0 0 IF it DOES NOT rain THEN the road is NOT wet (true)
  2. 0 1 IF it DOES NOT rain THEN the road is wet (true)
  3. 1 0 IF it rains THEN the road is NOT wet (false)
  4. 1 1 IF it rains THEN the road is wet (true)

This mirrors your truth tables above. Even though it might seem counter intuitive, only line 3 is false (0). Line 1 and 4 are obvious, and line 2 states that even if it does not rain, the road could still be wet (by someone using a hose pipe to make it wet).

So in the implication, 3 of the possible 4 combinations result in a true outcome. Which is why you get "Yes: 3".

| improve this answer | |
  • $\begingroup$ You say "3 of the possible 4 combinations result in a true outcome. Which is why you get 'Yes: '". Assume one of the facts is "p2 and not p2". This will result in an all false table. But that doesn't means p2 is false nor gives any other useful information about p2. $\endgroup$ – pasaba por aqui May 15 '18 at 8:05
  • $\begingroup$ No, it indeed does not. But that is not part of this question about "p2 implies p3" $\endgroup$ – Oliver Mason May 15 '18 at 8:12
  • $\begingroup$ "p2->p3" gives also no information about p2, that is the value in the ask part. $\endgroup$ – pasaba por aqui May 15 '18 at 8:17
  • $\begingroup$ And how exactly is that relevant to either the question or the answer? $\endgroup$ – Oliver Mason May 15 '18 at 8:37
  • $\begingroup$ This program is asked "p2 ?" and displays as result "yes: 3". This result is a non-sense. Your answer starts by "I'm not quite sure I'm getting this right, ..." followed by a long explanation trying to justify what is, in fact, an invalid program result. All together, a low quality answer. $\endgroup$ – pasaba por aqui May 15 '18 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.