我曾尝试使用prover9来证明一个对人类来说很明显的非常简单的陈述,但幸运的是,我无法使其发挥作用。我有以下情况:
% Three boys - Dan, Louise and Tom have t-shirts in three diffrent colors
% (white, yellow and green) and with three different patterns: (giraffe, camel and
% panda). Dan has the t-shirt with giraffe, Louise has the yelow one and Tom has
% not the white t-shirt. The boy with the yellow one has not the one with camel
% pattern. Task:
% Represent exercise with classical boolean statements and using
% resolution algorithm answer the question: "who has the t-shirt with the camel pattern?"
formulas(sos).
% (pattern(Dan, Giraffe) & pattern(Louise, Panda) & pattern(Tom, Camel))
% | (pattern(Dan, Giraffe) & pattern(Louise, Camel) & pattern(Tom, Panda))
% | (pattern(Dan, Panda) & pattern(Louise,Giraffe) & pattern(Tom, Camel))
% | (pattern(Dan, Panda) & pattern(Louise, Camel) & pattern(Tom, Giraffe))
% | (pattern(Dan, Camel) & pattern(Louise, Panda) & pattern(Tom, Giraffe))
% | (pattern(Dan, Camel) & pattern(Louise, Giraffe) & pattern(Tom, Panda)).
% This does not works, unfortunately
(pattern(Dan, Giraffe) & pattern(Louise, Panda) & pattern(Tom, Camel))
| (pattern(Dan, Giraffe) & pattern(Louise, Camel) & pattern(Tom, Panda)).
% This works
(color(Dan, White) & color(Louise, Yellow) & color(Tom, Green))
| (color(Dan, White) & color(Louise, Green) & color(Tom, Yellow))
| (color(Dan, Yellow) & color(Louise,White) & color(Tom, Green))
| (color(Dan, Yellow) & color(Louise, Green) & color(Tom, White))
| (color(Dan, Green) & color(Louise, Yellow) & color(Tom, White))
| (color(Dan, Green) & color(Louise, White) & color(Tom, Yellow)).
pattern(Dan, Giraffe).
color(Louise, Yellow).
-color(Tom,White).
all x (color(x,Yellow) -> -pattern(x,Camel)).
end_of_list.
formulas(goals).
pattern(Tom,Camel). % Our solution
% pattern(Louise, Panda).
end_of_list.
我不知道,我是否使用了严重的prover9或只是忽略了我的问题中的某些东西(或者它在经典布尔语句中的表示)。我能做错什么?
答案 0 :(得分:0)
添加一条声明,说明特定动物只能在一件T恤上: 所有x(模式(Dan,x) - >( - 模式(Tom,x)& -pattern(Louise,x)))。
这解释了我们在解释时所做的事情:丹有长颈鹿而露易丝没有骆驼。由于露易丝不能拥有长颈鹿,路易丝必须拥有熊猫。
添加完成后,您的第一组语句和问题信息将导致证明。
事情与第二种约束形式(但不是第一种形式)相关的原因是选项较少。分辨率将语句更改为连接正常形式。给定的陈述的形式为(A& B& C)| (A& D& E)。应用分配法导致9个单独的陈述:A | A,A | D,A | E,B | A,B | D,B | E,C | A,C | D,C | E.这些中的每一个都只有两部分。一旦-pattern(Louise,Camel)派生解析可以将这些语句中的一些减少到单个原语并完成证明。
约束的第一个表述有更多的选择 - 并且将其改为合取的正常形式会导致诸如模式之类的陈述(Dan,Giraffe)|模式(丹,熊猫)|模式(路易丝,熊猫)|图案(路易丝,长颈鹿)。
% Saved by Prover9-Mace4 Version 0.5, December 2007.
set(ignore_option_dependencies). % GUI handles dependencies
if(Prover9). % Options for Prover9 assign(max_seconds, 60).
end_if.
if(Mace4). % Options for Mace4 assign(max_seconds, 60). end_if.
formulas(assumptions).
% Three boys - Dan, Louise and Tom have t-shirts in three different colors
% (white, yellow and green) and with three different patterns: (giraffe, camel and
% panda). Dan has the t-shirt with giraffe, Louise has the yellow one and Tom has
% not the white t-shirt. The boy with the yellow one has not the one with camel
% pattern. Task:
% Represent exercise with classical boolean statements and using
% resolution algorithm answer the question: "who has the t-shirt with the camel pattern?"
%formulas(sos).
(pattern(Dan, Giraffe) & pattern(Louise, Panda) & pattern(Tom, Camel))
| (pattern(Dan, Giraffe) & pattern(Louise, Camel) & pattern(Tom, Panda))
| (pattern(Dan, Panda) & pattern(Louise,Giraffe) & pattern(Tom, Camel))
| (pattern(Dan, Panda) & pattern(Louise, Camel) & pattern(Tom, Giraffe))
| (pattern(Dan, Camel) & pattern(Louise, Panda) & pattern(Tom, Giraffe))
| (pattern(Dan, Camel) & pattern(Louise, Giraffe) & pattern(Tom, Panda)).
% The above now works
(color(Dan, White) & color(Louise, Yellow) & color(Tom, Green))
| (color(Dan, White) & color(Louise, Green) & color(Tom, Yellow))
| (color(Dan, Yellow) & color(Louise,White) & color(Tom, Green))
| (color(Dan, Yellow) & color(Louise, Green) & color(Tom, White))
| (color(Dan, Green) & color(Louise, Yellow) & color(Tom, White))
| (color(Dan, Green) & color(Louise, White) & color(Tom, Yellow)).
pattern(Dan, Giraffe).
color(Louise, Yellow).
-color(Tom,White).
all x (color(x,Yellow) -> -pattern(x,Camel)).
% Dan has the giraffe and Louise does NOT have the camel; therefore Louise
% has the Panda (because Louise cannot also have the giraffe)
% A pattern on Dan's t-shirt cannot be on Tom's or Louise's t-shirt
all x (pattern (Dan, x) -> (- pattern(Tom, x) & -pattern (Louise, x))).
end_of_list.
formulas(goals).
pattern(Tom, Camel).
end_of_list.