2013-03-31 4 views
0

와 상징적 인 논리를 해결하고 그 페이지에있는 수수께끼 수 60 질문이 있습니다 :내가 <a href="http://www.yesfine.com/carroll_symbolic_logic.htm" rel="nofollow">Lewis Carrols logical quizzes</a> 의 일부를 통해 갈거야 프롤로그

: 이제 다음 프롤로그 프로그램을 마련

(1) The only animals in this house are cats; 
(2) Every animal is suitable for a pet, that loves to gaze at the moon; 
(3) When I detest an animal, I avoid it; 
(4) No animals are carnivorous, unless they prowl at night; 
(5) No cat fails to kill mice; 
(6) No animals ever take to me, except what are in this house; 
(7) Kangaroos are not suitable for pets; 
(8) None but carnivora kill mice; 
(9) I detest animals that do not take to me; 
(10) Animals, that prowl at night, always love to gaze at the moon. 
Univ. "animals"; a = avoided by me; b = carnivora; c = cats; d = detested by me; 
e = in this house; h = kangaroos; k = killing mice; l = loving to gaze at the moon; 
m = prowling at night; n = suitable for pets, r = taking to me. 

animal(cat). 
animal(kangaroo). 

prowl_at_night(cat). 

carnivore(A) :- prowl_at_night(A). 

loves_moongazing(A) :- prowl_at_night(A). 

animals_in_house(cat). 

suitable_pet(A) :- 
    animal(A), 
    A \= kangaroo, 
    loves_moongazing(A). 

can_kill_mice(cat). 
can_kill_mice(A) :- carnivore(A). 

take_to_me(A) :- animals_in_house(A). 

detest(A) :- \+ take_to_me(A). 

avoid(A) :- animal(A), detest(A). 

이제는 무엇을 taking to me가 실제로 의미하는지 잘 모르겠습니다. 나는 프롤로그를 조회 할 경우 둘째 : ?- avoid(A)A = kangoroo 정답 과 통합,하지만 난 그게 이상한 take_to_mecan_kill_mice 조건이 답변을 얻을하는 데 사용되지 않습니다 것을 찾을 수 있습니다. 아마 나는 명백한 것을 보지 않을 것입니다.

답변

1

무언가를 "가져 가라"는 것은 무언가를 붙이는 것입니다.

A가 동물이고 그것이 혐오 스럽다면 (A)가 충족되지 않습니다. 당신은 당신에게 가져 가지 않는 것을 싫어합니다. 집에있는 동물 인 경우에만 뭔가 걸릴 수 있습니다. 따라서 캥거루는 정답입니다.