Advertisement
logicmoo

Untitled

Jun 10th, 2015
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 8.49 KB | None | 0 0
  1. ?- ace_to_pkif('A person who loves all animals is loved by someone.',X),kif_to_boxlog(X,BOX),portray_clause(user_error,(fol:-BOX)),!.
  2.  
  3. :- snark_tell(all(R,'=>'(room(R) , exists(D, '&'(door(D) , has(R,D)))))).
  4.  
  5. ?- kif_to_boxlog(-((a , b ,  c , d)),_S),!,disjuncts_to_list(_S,_L),list_to_set(_L,_SET),member(_P,_SET),writeln(_P),!.
  6.  
  7.  
  8.       exists([PERSON_OBJ, SOMEBODY_OBJ, _],
  9.                (tPerson(PERSON_OBJ), implies(exists([ANIMAL_OBJ], tAnimal(ANIMAL_OBJ)), exists([_], mudLove(PERSON_OBJ, ANIMAL_OBJ))), tSomebody(SOMEBODY_OBJ), mudLove(SOMEBODY_OBJ, PERSON_OBJ))).
  10. kif :-
  11.         exists(PERSON_OBJ,
  12.                exists(SOMEBODY_OBJ,
  13.                       &(tPerson(PERSON_OBJ),
  14.                         &(=>(exists(ANIMAL_OBJ,
  15.                                     tAnimal(ANIMAL_OBJ)),
  16.                              mudLove(PERSON_OBJ, ANIMAL_OBJ)),
  17.                           &(tSomebody(SOMEBODY_OBJ),
  18.                             mudLove(SOMEBODY_OBJ, PERSON_OBJ)))))).
  19. %      nnf((-),
  20. %          skolemizing(exists(PERSON_OBJ,
  21. %                         exists(SOMEBODY_OBJ,
  22. %                                &(tPerson(PERSON_OBJ),
  23. %                                  &(=>(exists(ANIMAL_OBJ, tAnimal(ANIMAL_OBJ)),
  24. %                                       mudLove(PERSON_OBJ, ANIMAL_OBJ)),
  25. %                                    &(tSomebody(SOMEBODY_OBJ),
  26. %                                      mudLove(SOMEBODY_OBJ, PERSON_OBJ)))))))).
  27. %
  28. %          succeed(user:asserta(constraintRules(PERSON_OBJ, skIsPersonInArg1ofLoveSomebodyArg2ofFn, exists(SOMEBODY_OBJ, &(tPerson(PERSON_OBJ), &(=>(exists(ANIMAL_OBJ, tAnimal(ANIMAL_OBJ)), mudLove(PERSON_OBJ, ANIMAL_OBJ)), &(tSomebody(SOMEBODY_OBJ), mudLove(SOMEBODY_OBJ, PERSON_OBJ)))))))).
  29. %
  30. %           nnf((-),
  31. %               skolemizing(exists(SOMEBODY_OBJ,
  32. %                                 &(tPerson(PERSON_OBJ),
  33. %                                   &(=>(exists(ANIMAL_OBJ, tAnimal(ANIMAL_OBJ)),
  34. %                                        mudLove(PERSON_OBJ, ANIMAL_OBJ)),
  35. %                                     &(tSomebody(SOMEBODY_OBJ),
  36. %                                       mudLove(SOMEBODY_OBJ, PERSON_OBJ))))))).
  37. %
  38. %               succeed(user:asserta(constraintRules(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn, &(tPerson(PERSON_OBJ), &(=>(exists(ANIMAL_OBJ, tAnimal(ANIMAL_OBJ)), mudLove(PERSON_OBJ, ANIMAL_OBJ)), &(tSomebody(SOMEBODY_OBJ), mudLove(SOMEBODY_OBJ, PERSON_OBJ))))))).
  39. %
  40. conj :-
  41.  
  42.         [ v(not({ constraintExists(PERSON_OBJ,
  43.                                    skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  44.                 }),
  45.             v(not({ constraintExists(SOMEBODY_OBJ,
  46.                                      skIsSomebodyInArg1ofLoveFn)
  47.                   }),
  48.               tPerson(PERSON_OBJ))),
  49.           v(not({ constraintExists(PERSON_OBJ,
  50.                                    skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  51.                 }),
  52.             v(not({ constraintExists(SOMEBODY_OBJ,
  53.                                      skIsSomebodyInArg1ofLoveFn)
  54.                   }),
  55.               tSomebody(SOMEBODY_OBJ))),
  56.           v(not({ constraintExists(PERSON_OBJ,
  57.                                    skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  58.                 }),
  59.             v(not({ constraintExists(SOMEBODY_OBJ,
  60.                                      skIsSomebodyInArg1ofLoveFn)
  61.                   }),
  62.               mudLove(SOMEBODY_OBJ, PERSON_OBJ))),
  63.           v(not({ constraintExists(PERSON_OBJ,
  64.                                    skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  65.                 }),
  66.             v(not({ constraintExists(SOMEBODY_OBJ,
  67.                                      skIsSomebodyInArg1ofLoveFn)
  68.                   }),
  69.               v(not(tAnimal(ANIMAL_OBJ)),
  70.                 mudLove(PERSON_OBJ, ANIMAL_OBJ))))
  71.         ].
  72. cf :-
  73.         cl([tPerson(PERSON_OBJ)],
  74.  
  75.            [ { constraintExists(PERSON_OBJ,
  76.                                 skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  77.              },
  78.              { constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)
  79.              }
  80.            ]).
  81. cf :-
  82.         cl([tSomebody(SOMEBODY_OBJ)],
  83.  
  84.            [ { constraintExists(PERSON_OBJ,
  85.                                 skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  86.              },
  87.              { constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)
  88.              }
  89.            ]).
  90. cf :-
  91.         cl([mudLove(SOMEBODY_OBJ, PERSON_OBJ)],
  92.  
  93.            [ { constraintExists(PERSON_OBJ,
  94.                                 skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  95.              },
  96.              { constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)
  97.              }
  98.            ]).
  99. cf :-
  100.         cl([not(tAnimal(ANIMAL_OBJ))],
  101.  
  102.            [ { constraintExists(PERSON_OBJ,
  103.                                 skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  104.              },
  105.              { constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)
  106.              },
  107.              not(mudLove(PERSON_OBJ, ANIMAL_OBJ))
  108.            ]).
  109. cf :-
  110.         cl([mudLove(PERSON_OBJ, ANIMAL_OBJ)],
  111.  
  112.            [ { constraintExists(PERSON_OBJ,
  113.                                 skIsPersonInArg1ofLoveSomebodyArg2ofFn)
  114.              },
  115.              { constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)
  116.              },
  117.              tAnimal(ANIMAL_OBJ)
  118.            ]).
  119. fol :-
  120.  
  121.         tPerson(PERSON_OBJ):-{constraintExists(PERSON_OBJ, skIsPersonInArg1ofLoveSomebodyArg2ofFn)}, {constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)}.
  122.         tSomebody(SOMEBODY_OBJ):-{constraintExists(PERSON_OBJ, skIsPersonInArg1ofLoveSomebodyArg2ofFn)}, {constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)}.
  123.         mudLove(SOMEBODY_OBJ, PERSON_OBJ):-{constraintExists(PERSON_OBJ, skIsPersonInArg1ofLoveSomebodyArg2ofFn)}, {constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)}.
  124.         not(tAnimal(ANIMAL_OBJ)):-{constraintExists(PERSON_OBJ, skIsPersonInArg1ofLoveSomebodyArg2ofFn)}, {constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)}, not(mudLove(PERSON_OBJ, ANIMAL_OBJ)).
  125.         mudLove(PERSON_OBJ, ANIMAL_OBJ):-{constraintExists(PERSON_OBJ, skIsPersonInArg1ofLoveSomebodyArg2ofFn)}, {constraintExists(SOMEBODY_OBJ, skIsSomebodyInArg1ofLoveFn)}, tAnimal(ANIMAL_OBJ).
  126.        
  127. kif :-
  128.         all(R,
  129.             =>(room(R),
  130.                exists(D, &(door(D), has(R, D))))).
  131. % /devel/PrologMUD/runtime/run_mud_server.pl:66
  132. %        nnf(-, skolemizing(exists(D, &(door(D), has(R, D))))).
  133. %
  134. % /devel/PrologMUD/runtime/run_mud_server.pl:66
  135. %            succeed(user:asserta(constraintRules(D, skIsDoorInRoomArg2ofHasFn(R), &(door(D), has(R, D))))).
  136. %
  137. conj :-
  138.  
  139.         [ v(not(room(R)),
  140.             v(not({ constraintExists(D,
  141.                                      skIsDoorInRoomArg2ofHasFn(R))
  142.                   }),
  143.               door(D))),
  144.           v(not(room(R)),
  145.             v(not({ constraintExists(D,
  146.                                      skIsDoorInRoomArg2ofHasFn(R))
  147.                   }),
  148.               has(R, D)))
  149.         ].
  150. cf :-
  151.         cl([not(room(R))],
  152.  
  153.            [ { constraintExists(D, skIsDoorInRoomArg2ofHasFn(R))
  154.              },
  155.              not(door(D))
  156.            ]).
  157. cf :-
  158.         cl([door(D)],
  159.  
  160.            [ room(R),
  161.              { constraintExists(D, skIsDoorInRoomArg2ofHasFn(R))
  162.              }
  163.            ]).
  164. cf :-
  165.         cl([not(room(R))],
  166.  
  167.            [ { constraintExists(D, skIsDoorInRoomArg2ofHasFn(R))
  168.              },
  169.              not(has(R, D))
  170.            ]).
  171. cf :-
  172.         cl([has(R, D)],
  173.  
  174.            [ room(R),
  175.              { constraintExists(D, skIsDoorInRoomArg2ofHasFn(R))
  176.              }
  177.            ]).
  178. % /devel/PrologMUD/runtime/run_mud_server.pl:66
  179. %                    pfc_add= (neg room(A):-{constraintExists(B, skIsDoorInRoomArg2ofHasFn(A))}, ~(door(B))).
  180. %
  181. % /devel/PrologMUD/runtime/run_mud_server.pl:66
  182. %                     pfc_add= (door(A):-room(B), {constraintExists(A, skIsDoorInRoomArg2ofHasFn(B))}).
  183. %
  184. % /devel/PrologMUD/runtime/run_mud_server.pl:66
  185. %                      pfc_add= (neg room(A):-{constraintExists(B, skIsDoorInRoomArg2ofHasFn(A))}, ~(has(A, B))).
  186. %
  187. % /devel/PrologMUD/runtime/run_mud_server.pl:66
  188. %                       pfc_add= (has(A, B):-room(A), {constraintExists(B, skIsDoorInRoomArg2ofHasFn(A))}).
  189. %
  190. kif :-
  191.         not(&(a, &(b, &(c, d)))).
  192. conj :-
  193.         [v(not(a), v(not(b), v(not(c), not(d))))].
  194. cf :-
  195.         cl([not(a)], [b, c, d]).
  196. cf :-
  197.         cl([not(b)], [a, c, d]).
  198. cf :-
  199.         cl([not(c)], [a, b, d]).
  200. cf :-
  201.         cl([not(d)], [a, b, c]).
  202. not(a):-b,c,d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement