# AI Knowledge Based System: I am having difficulties understanding proposition logic

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;

Produces the following result. 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.

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".

• 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. – pasaba por aqui May 15 '18 at 8:05
• No, it indeed does not. But that is not part of this question about "p2 implies p3" – Oliver Mason May 15 '18 at 8:12
• "p2->p3" gives also no information about p2, that is the value in the ask part. – pasaba por aqui May 15 '18 at 8:17
• And how exactly is that relevant to either the question or the answer? – Oliver Mason May 15 '18 at 8:37
• 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. – pasaba por aqui May 15 '18 at 9:02