Prolog query :- true, fail; not true, not fail; true, not fail

Viewed 36

I am solving a test for an exam and I got this question with the following answers:

  • fail
  • yes
  • true
  • no

Running it in the shell i get True, but i cannot understand how this answer is obtained. I get the first part true, fail;but the rest is a mistery. Am i supposed to look just at the last part true, not fail?

1 Answers
true, fail; not true, not fail; true, not fail

Can be translated into the following logical expression:

(true and false) or (((not true) and (not false)) or (true and (not false)))

That we can simplify progressively...

(true and false) or ((false and true) or (true and true))

false or (false or true)

false or true

true

Related