forked from arademaker/delphin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathagatha.ergo
67 lines (67 loc) · 2.2 KB
/
agatha.ergo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* Quantifier rules */
a_q(?X, ?Restr, ?Body) :- apply(?Restr, ?X), apply(?Body, ?X).
every_q(?X, ?Restr, ?Body) :- \+ (apply(?Restr, ?X), \+ apply(?Body, ?X)).
some_q(?X, ?Restr, ?Body) :- apply(?Restr, ?X), apply(?Body, ?X).
the_q(?X, ?Restr, ?Body) :- apply(?Restr, ?X), apply(?Body, ?X), \+ (apply(?Restr, ?Y), ?Y \= ?X).
proper_q(?X, ?Restr, ?Body) :- apply(?Restr, ?X), \+ (apply(?Restr, ?Y), \+ apply(?Body, ?Y)).
no_q(?X, ?Restr, ?Body) :- \+ (apply(?Restr, ?X), apply(?Body, ?X)).
/* Type definitions */
event(?E) :- event_value(?E, _).
individual(?X) :- person(?X).
individual(?X) :- place(?X).
individual(?X) :- other_object(?X).
/* Core domain predicates */
person(?X) :-
(butler_n_1(?X); named(?X,'Agatha'); named(?X,'Charles')),
\+ place(?X),
\+ other_object(?X).
/* Butler uniqueness */
butler_unique(?X) :-
butler_n_1(?X),
person(?X),
\+ named(?X,'Agatha'),
\+ named(?X,'Charles'),
\+ (butler_n_1(?Y), ?Y \= ?X).
/* Include the translated sentences */
#include rulelog-outputs/sentences.ergo
/* Main puzzle logic */
agatha_killed_herself :-
/* Entity identifications */
named(?X4_3,'Agatha'),
butler_n_1(?X4_15),
named(?X1_24,'Charles'),
aunt_n_of(?X3_20, ?_I1),
named(?X0_29,'Aunt'),
named(?X0_16,'Dreadbury'),
named(?X0_10,'Mansion'),
/* Entity equivalences */
?X0_23 = ?X1_8, ?X0_23 = ?X3_15, ?X0_23 = ?X4_3,
?X0_23 = ?X5_19, ?X0_23 = ?X6_14, ?X0_23 = ?X8_3,
?X1_19 = ?X4_15, ?X1_19 = ?X5_3, ?X1_19 = ?X6_3,
?X1_19 = ?X8_10,
?X1_24 = ?X3_3,
?X0_16 = ?X1_38,
?X0_10 = ?X1_32,
?X3_20 = ?X6_19,
?X0_29 = ?X5_25,
/* Living arrangements */
live_v_1(?E1_30, ?X1_8),
live_v_1(?E1_30, ?X1_24),
live_v_1(?E1_30, ?X1_19),
/* Hatred relationships */
\+ hate_v_1(?E4_2, ?X3_3, ?X3_3),
\+ hate_v_1(?E4_2, ?X3_3, ?X3_15),
hate_v_1(?E4_2, ?X4_3, ?X1_24),
hate_v_1(?E4_2, ?X4_3, ?X4_3),
\+ hate_v_1(?E4_2, ?X4_3, ?X4_15),
more_comp(?E5_18, ?E5_16, ?X5_19),
rich_a_in(?E5_16, ?X4_15, ?_I2),
hate_v_1(?E4_2, ?X4_15, ?X1_24),
hate_v_1(?E4_2, ?X4_15, ?X4_3),
\+ hate_v_1(?E4_2, ?X4_15, ?X4_15),
/* Additional constraints */
?X4_3 \= ?X4_15,
/* The conclusion */
kill_v_1(?E0_2, ?X0_23, ?X0_23).
/* Query to solve the puzzle */
?- agatha_killed_herself.