#137 new
Bailey523

Binary logic in prolog

Reported by Bailey523 | December 13th, 2018 @ 01:51 AM

I want to solve following problem using inference making power of prolog.

One day, 3 persons, a, b, c were caught by police at the crime spot. When police settled interrogating them:

i) a says I am innocent
ii) b says a is criminal
iii) c says I am innocent.

Its known that

i) Exactly one person speaks true.
ii) Exactly one criminal is there.

Who is criminal? To model above problem in First Order logic: Consider c/1 is a predicate returns true when argument is Criminal we can write:

(not(c(a)),c(c)) ; (c(c),c(a)).
 c(a); c(b); c(c).
(not(c(a)),not(c(b))) ; (not(c(a)),not(c(c))) ; (not(c(b)),not(c(c))).
After modelling above statements in prolog, I will query:
?-c(X).
it should return:
X=c.
But error I got:
"No permission to modify static procedure `(;)/2'"

prepaidgiftbalance

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages