Advertisement
logicmoo

Prolog Clauses From FOL

Apr 11th, 2017
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 16.70 KB | None | 0 0
  1. % ================
  2. % all rooms have a door
  3. % ================
  4. test_boxlog(all(R,implies(room(R),exists(D,and(door(D),has(R,D)))))).
  5.  
  6. % door(D) :-
  7. %       room(R),
  8. %       skolem(D, skIsDoorInUnkArg2ofHas_1Fn(R)).
  9. % ~room(R) :-
  10. %       \+ (
  11. %            door(D)
  12. %          ).
  13. % ~room(R) :-
  14. %       \+ (
  15. %            has(R, D)
  16. %          ).
  17. % has(R, D) :-
  18. %       room(R),
  19. %       skolem(D, skIsDoorInUnkArg2ofHas_1Fn(R)).
  20.  
  21. % ================
  22. % For joe to eat the food it must be possible that the food is food and joe can eat it
  23. % ================
  24. test_foodoxlog(poss(&(eats(joe,X),food(X)))=>(eats(joe,X),food(X))).
  25. % eats(joe,X) :-
  26. %       \+ ~eats(joe,X),
  27. %       \+ ~food(X).
  28. % food(X) :-
  29. %       \+ ~eats(joe,X),
  30. %       \+ ~food(X).
  31.  
  32.  
  33. % ================================================
  34. %  Organized Groups of prolog programmers have prolog programmers as members
  35. % ================================================
  36.  
  37. test_boxlog(implies(and(isa(M,tGroupedPrologOrganization),hasMembers(M,A)), isa(A,tClazzPrologPerson))).
  38.  ~hasMembers(_11164,_11142):- \+ (isa(_11164,tGroupedPrologOrganization),isa(_11142,tClazzPrologPerson))
  39.  ~isa(_11540,tGroupedPrologOrganization):- \+ (hasMembers(_11540,_11518),isa(_11518,tClazzPrologPerson))
  40.  isa(_11874,tClazzPrologPerson):-isa(_11896,tGroupedPrologOrganization),hasMembers(_11896,_11874)
  41.  
  42. % ================================================
  43. % Those competeing in watersports may not wear shoes
  44. % ================================================
  45. test_boxlog( =>(isa(ATH,tAgent),implies(and(isa(COMP,actAquaticSportsEvent),competingAgents(COMP,ATH)),holdsIn(COMP,all(CLOTHING,not(and(isa(CLOTHING,tObjectShoe),wearsClothing(ATH,CLOTHING)))))))).
  46. /*
  47.  ~competingAgents(_20514,_20492):- ~holdsIn(_20514,v(~isa(_20470,tObjectShoe),~wearsClothing(_20492,_20470))),isa(_20514,actAquaticSportsEvent),isa(_20492,tAgent)
  48.  ~isa(_20902,tAgent):- ~holdsIn(_20858,v(~isa(_20880,tObjectShoe),~wearsClothing(_20902,_20880))),isa(_20858,actAquaticSportsEvent),competingAgents(_20858,_20902)
  49.  ~isa(_21272,actAquaticSportsEvent):- ~holdsIn(_21272,v(~isa(_21250,tObjectShoe),~wearsClothing(_21228,_21250))),competingAgents(_21272,_21228),isa(_21228,tAgent)
  50.  holdsIn(_21612,v(~isa(_21634,tObjectShoe),~wearsClothing(_21590,_21634))):-isa(_21612,actAquaticSportsEvent),competingAgents(_21612,_21590),isa(_21590,tAgent)
  51. */
  52. % ~occuring(COMP) :-
  53. %       isa(ATH, tAgent),
  54. %       isa(COMP, actAquaticSportsEvent),
  55. %       competingAgents(COMP, ATH),
  56. %       isa(CLOTHING, tObjectShoe),
  57. %       wearsClothing(ATH, CLOTHING).
  58. % ~competingAgents(COMP, ATH) :-
  59. %       isa(ATH, tAgent),
  60. %       isa(COMP, actAquaticSportsEvent),
  61. %       occuring(COMP),
  62. %       isa(CLOTHING, tObjectShoe),
  63. %       wearsClothing(ATH, CLOTHING).
  64. % ~isa(CLOTHING, tObjectShoe) :-
  65. %       isa(ATH, tAgent),
  66. %       isa(COMP, actAquaticSportsEvent),
  67. %       competingAgents(COMP, ATH),
  68. %       occuring(COMP),
  69. %       wearsClothing(ATH, CLOTHING).
  70. % ~isa(COMP, actAquaticSportsEvent) :-
  71. %       isa(ATH, tAgent),
  72. %       competingAgents(COMP, ATH),
  73. %       occuring(COMP),
  74. %       isa(CLOTHING, tObjectShoe),
  75. %       wearsClothing(ATH, CLOTHING).
  76. % ~isa(ATH, tAgent) :-
  77. %       isa(COMP, actAquaticSportsEvent),
  78. %       competingAgents(COMP, ATH),
  79. %       occuring(COMP),
  80. %       isa(CLOTHING, tObjectShoe),
  81. %       wearsClothing(ATH, CLOTHING).
  82. % ~wearsClothing(ATH, CLOTHING) :-
  83. %       isa(ATH, tAgent),
  84. %       isa(COMP, actAquaticSportsEvent),
  85. %       competingAgents(COMP, ATH),
  86. %       occuring(COMP),
  87. %       isa(CLOTHING, tObjectShoe).
  88.  
  89. % ====================================================================
  90. % When sightgseeing is occuring .. there is a tourist present
  91. % ====================================================================
  92. test_boxlog(implies(and(isa(Act,actSightseeing),performedBy(Person,Act)),holdsIn(Act,isa(Y,mobTourist)))).
  93.  
  94. /* OLD
  95.  ~isa(_11704,actSightseeing):- \+ (performedBy(_11704,_11682),holdsIn(_11704,isa(_11682,mobTourist)))
  96.  ~performedBy(_12092,_12070):- \+ (isa(_12092,actSightseeing),holdsIn(_12092,isa(_12070,mobTourist)))
  97.  holdsIn(_12442,isa(_12420,mobTourist)):-isa(_12442,actSightseeing),performedBy(_12442,_12420)
  98.  
  99. */
  100. % ~occuring(Act) :-
  101. %       \+ ( isa(Act, actSightseeing),
  102. %            naf(~performedBy(Person, Act)),
  103. %            isa(Y, mobTourist)
  104. %          ).
  105. % ~isa(Act, actSightseeing) :-
  106. %       \+ ( performedBy(Person, Act),
  107. %            naf(~occuring(Act)),
  108. %            isa(Y, mobTourist)
  109. %          ).
  110. % ~performedBy(Person, Act) :-
  111. %       \+ ( isa(Act, actSightseeing),
  112. %            naf(~occuring(Act)),
  113. %            isa(Y, mobTourist)
  114. %          ).
  115. % isa(Y, mobTourist) :-
  116. %       isa(Act, actSightseeing),
  117. %       performedBy(Person, Act),
  118. %       occuring(Act).
  119. true.
  120.  
  121.  
  122.  
  123. % ====================================================================
  124. % All rooms have a door (Odd syntax issue)
  125. % ====================================================================
  126.  
  127. test_boxlog(all(R,room(R) => exists(D, and([door(D) , has(R,D)]))))
  128. % door(D) :-
  129. %       room(R),
  130. %       skolem(D, skIsDoorInUnkArg2ofHas_2Fn(R)),
  131. %       \+ ~has(R, D).
  132. % ~room(R) :-
  133. %       \+ ( has(R, D),
  134. %            door(D)
  135. %          ).
  136. % has(R, D) :-
  137. %       room(R),
  138. %       skolem(D, skIsDoorInUnkArg2ofHas_2Fn(R)),
  139. %       \+ ~door(D).
  140.  
  141.  
  142.  
  143.  
  144. % ====================================================================
  145. % No one whom pays taxes in North america can be a dependant of another in the same year
  146. % ====================================================================
  147. test_boxlog(or(
  148.   holdsIn(YEAR, isa(PERSON, nartR(tClazzCitizenFn, iGroup_UnitedStatesOfAmerica))),
  149.   holdsIn(YEAR, isa(PERSON, nartR(mobTaxResidentsFn, iGroup_Canada))),
  150.   holdsIn(YEAR, isa(PERSON, nartR(mobTaxResidentsFn, iMexico))),
  151.   holdsIn(YEAR, isa(PERSON, nartR(mobTaxResidentsFn, iGroup_UnitedStatesOfAmerica))),
  152.   forbiddenToDoWrt(iCW_USIncomeTax, SUPPORTER, claimsAsDependent(YEAR, SUPPORTER, SUPPORTEE)))).
  153.  
  154.  
  155. % ~occuring(YEAR) :-
  156. %       ~isa(PERSON, nartR(tClazzCitizenFn, iGroup_UnitedStatesOfAmerica)),
  157. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_Canada)),
  158. %       \+ ( ( forbiddenToDoWrt(iCW_USIncomeTax,
  159. %                               SUPPORTER,
  160. %                               claimsAsDependent(YEAR, SUPPORTER, SUPPORTEE)),
  161. %              isa(PERSON,
  162. %                  nartR(mobTaxResidentsFn, iGroup_UnitedStatesOfAmerica))
  163. %            ),
  164. %            isa(PERSON, nartR(mobTaxResidentsFn, iMexico))
  165. %          ).
  166. % isa(PERSON, nartR(mobTaxResidentsFn, iGroup_UnitedStatesOfAmerica)) :-
  167. %       occuring(YEAR),
  168. %       ~isa(PERSON, nartR(tClazzCitizenFn, iGroup_UnitedStatesOfAmerica)),
  169. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_Canada)),
  170. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iMexico)),
  171. %       \+ ~forbiddenToDoWrt(iCW_USIncomeTax, SUPPORTER, claimsAsDependent(YEAR, SUPPORTER, SUPPORTEE)).
  172. % isa(PERSON, nartR(mobTaxResidentsFn, iMexico)) :-
  173. %       occuring(YEAR),
  174. %       ~isa(PERSON, nartR(tClazzCitizenFn, iGroup_UnitedStatesOfAmerica)),
  175. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_Canada)),
  176. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_UnitedStatesOfAmerica)),
  177. %       \+ ~forbiddenToDoWrt(iCW_USIncomeTax, SUPPORTER, claimsAsDependent(YEAR, SUPPORTER, SUPPORTEE)).
  178. % isa(PERSON, nartR(mobTaxResidentsFn, iGroup_Canada)) :-
  179. %       occuring(YEAR),
  180. %       ~isa(PERSON, nartR(tClazzCitizenFn, iGroup_UnitedStatesOfAmerica)),
  181. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iMexico)),
  182. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_UnitedStatesOfAmerica)),
  183. %       \+ ~forbiddenToDoWrt(iCW_USIncomeTax, SUPPORTER, claimsAsDependent(YEAR, SUPPORTER, SUPPORTEE)).
  184. % isa(PERSON, nartR(tClazzCitizenFn, iGroup_UnitedStatesOfAmerica)) :-
  185. %       occuring(YEAR),
  186. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_Canada)),
  187. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iMexico)),
  188. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_UnitedStatesOfAmerica)),
  189. %       \+ ~forbiddenToDoWrt(iCW_USIncomeTax, SUPPORTER, claimsAsDependent(YEAR, SUPPORTER, SUPPORTEE)).
  190. % forbiddenToDoWrt(iCW_USIncomeTax, SUPPORTER, claimsAsDependent(YEAR, SUPPORTER, SUPPORTEE)) :-
  191. %       occuring(YEAR),
  192. %       ~isa(PERSON, nartR(tClazzCitizenFn, iGroup_UnitedStatesOfAmerica)),
  193. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_Canada)),
  194. %       ~isa(PERSON, nartR(mobTaxResidentsFn, iMexico)),
  195. %       \+ ~isa(PERSON, nartR(mobTaxResidentsFn, iGroup_UnitedStatesOfAmerica)).
  196. true.
  197.  
  198. % ====================================================================
  199. % Something is human or male
  200. % ====================================================================
  201. test_boxlog(human(X) v male(X)).
  202. % human(_19658) :-
  203. %       ~male(_19658).
  204. % male(_23530) :-
  205. %       ~human(_23530).
  206.  
  207. % ====================================================================
  208. % Something is human and male
  209. % ====================================================================
  210.  
  211. % BAD!! these need co-mingled!
  212. test_boxlog((human(X) & male(X))).
  213.  
  214. % human(_21936).
  215. % male(_24006).
  216.  
  217.  
  218.  
  219.  
  220. ========
  221. % Co-mingled!
  222. ========
  223. ?- P= (human(X) & male(X)) , test_boxlog(poss(P) => P).
  224.  
  225. % human(X) :-
  226. %       \+ ~human(X),
  227. %       \+ ~male(X).
  228. % male(X) :-
  229. %       \+ ~human(X),
  230. %       \+ ~male(X).
  231. P = &(human(X), male(X)).
  232.  
  233.  
  234.  
  235. % ====================================================================
  236. % Nothing is both human and male
  237. % ====================================================================
  238. test_boxlog(~ (human(X) & male(X))).
  239.  
  240. % ~human(_830) :-
  241. %       male(_830).
  242. % ~male(_904) :-
  243. %       human(_904).
  244.  
  245. % ====================================================================
  246. % There exists something not evil
  247. % ====================================================================
  248. test_boxlog(exists(X,~evil(X))).
  249.  
  250. % ~evil(_788{sk = ...}) :-
  251. %       skolem(_788{sk = ...}, skIsIn_8Fn).
  252.  
  253. % ====================================================================
  254. % There exists something evil
  255. % ====================================================================
  256. test_boxlog(exists(X,evil(X))).
  257. % evil(_788{sk = ...}) :-
  258. %       skolem(_788{sk = ...}, skIsIn_9Fn).
  259.  
  260. % ====================================================================
  261. % When a man exists there will be a god
  262. % ====================================================================
  263. test_boxlog(exists(X,man(X))=>exists(G,god(G))).
  264. % god(_866{sk = ...}) :-
  265. %       man(_1082),
  266. %       skolem(_866{sk = ...}, skIsGodIn_1Fn(_1082)).
  267. % ~man(_2276) :-
  268. %       \+ ( skolem(_896{sk = ...}, skIsGodIn_1Fn(_2276)),
  269. %            god(_896{sk = ...})
  270. %          ).
  271.  
  272. % this would be better though if
  273. % god(_866{sk = ...}) :-
  274. %       \= \+ (man(_1082)),
  275. %       skolem(_866{sk = ...}, skIsGodIn_1Fn).
  276. % ~man(_2276) :-
  277. %       \+ god(_896).
  278.  
  279.  
  280. % ====================================================================
  281. % When two men exists there will be a god
  282. % ====================================================================
  283. test_boxlog(atleast(2,X,man(X))=>exists(G,god(G))).
  284.  
  285. % god(_1298{sk = ...}) :-
  286. %       skolem(_1358{sk = ...}, skIsManIn_1Fn(_10978, _1298{sk = ...})),
  287. %       ~man(_1358{sk = ...}),
  288. %       skolem(_1298{sk = ...}, skIsGodIn_2Fn(_10978)).
  289. % god(_3110{sk = ...}) :-
  290. %       man(_11144),
  291. %       man(_11166),
  292. %       skolem(_3110{sk = ...}, skIsGodIn_2Fn(_11166)).
  293. % man(_2204{sk = ...}) :-
  294. %       skolem(_2204{sk = ...}, skIsManIn_1Fn(_11314, _2224{sk = ...})),
  295. %       skolem(_2224{sk = ...}, skIsGodIn_2Fn(_11314)),
  296. %       \+ ~god(_2224{sk = ...}).
  297. % ~man(_11494) :-
  298. %       \+ ( man(_11516),
  299. %            naf(~skolem(_4090{sk = ...}, skIsGodIn_2Fn(_11494))),
  300. %            god(_4090{sk = ...})
  301. %          ).
  302. % ~man(_11656) :-
  303. %       \+ ( man(_11678),
  304. %            naf(~skolem(_4504{sk = ...}, skIsGodIn_2Fn(_11678))),
  305. %            god(_4504{sk = ...})
  306. %          ).
  307.  
  308.  
  309. OR?
  310.  
  311.  
  312. % god(G) :-
  313. %       skolem(_1316_sk, skIsManIn_1Fn(X, G)),
  314. %       ~man(_1316_sk),
  315. %       skolem(G, skIsGodIn_1Fn(X)).
  316. % god(G) :-
  317. %       man(_2720),
  318. %       ~equals(_2742, X),
  319. %       man(X),
  320. %       skolem(G, skIsGodIn_1Fn(X)).
  321. % man(_1342_sk) :-
  322. %       skolem(_1342_sk, skIsManIn_1Fn(X, G)),
  323. %       skolem(G, skIsGodIn_1Fn(X)),
  324. %       \+ ~god(G).
  325. % naf(~equals(_3108, X)) :-
  326. %       man(_3148),
  327. %       man(X),
  328. %       skolem(G, skIsGodIn_1Fn(X)),
  329. %       \+ ~god(G).
  330. % ~man(X) :-
  331. %       man(_3330),
  332. %       \+ ( \+ ~ (~equals(_3352, X)),
  333. %            naf(~skolem(G, skIsGodIn_1Fn(X))),
  334. %            god(G)
  335. %          ).
  336. % ~man(_3544) :-
  337. %       ~equals(_3566, X),
  338. %       \+ ( man(X),
  339. %            naf(~skolem(G, skIsGodIn_1Fn(X))),
  340. %            god(G)
  341. %          ).
  342. % ~equals(_1478_sk, X) :-
  343. %       \+ ( skolem(G, skIsGodIn_1Fn(X)),
  344. %            god(G)
  345. %          ).
  346.  
  347.  
  348.  % ====================================================================
  349.  % A person holding a bird is performing bird holding
  350.  % ====================================================================
  351.  
  352. test_boxlog(implies(
  353.   and(isa(HOLD, actHoldingAnObject), objectActedOn(HOLD, BIRD), isa(BIRD, tClazzBird),
  354.                 performedBy(HOLD, PER), isa(PER, mobPerson)),
  355.   holdsIn(HOLD, onPhysical(BIRD, PER))), O),maplist(wdmsg,O).
  356.  
  357. % ~occuring(_2056) :-
  358. %       isa(_2056, actHoldingAnObject),
  359. %       objectActedOn(_2056, _2078),
  360. %       isa(_2078, tClazzBird),
  361. %       \+ ( performedBy(_2056, _2100),
  362. %            naf(~isa(_2100, mobPerson)),
  363. %            onPhysical(_2078, _2100)
  364. %          ).
  365. % ~isa(_2260, mobPerson) :-
  366. %       isa(_2282, actHoldingAnObject),
  367. %       objectActedOn(_2282, _2304),
  368. %       isa(_2304, tClazzBird),
  369. %       \+ ( performedBy(_2282, _2260),
  370. %            naf(~occuring(_2282)),
  371. %            onPhysical(_2304, _2260)
  372. %          ).
  373. % ~isa(_2520, tClazzBird) :-
  374. %       isa(_2542, actHoldingAnObject),
  375. %       objectActedOn(_2542, _2520),
  376. %       performedBy(_2542, _2564),
  377. %       \+ ( isa(_2564, mobPerson),
  378. %            naf(~occuring(_2542)),
  379. %            onPhysical(_2520, _2564)
  380. %          ).
  381. % ~isa(_2752, actHoldingAnObject) :-
  382. %       objectActedOn(_2752, _2774),
  383. %       isa(_2774, tClazzBird),
  384. %       performedBy(_2752, _2796),
  385. %       \+ ( isa(_2796, mobPerson),
  386. %            naf(~occuring(_2752)),
  387. %            onPhysical(_2774, _2796)
  388. %          ).
  389. % ~objectActedOn(_2984, _3006) :-
  390. %       isa(_2984, actHoldingAnObject),
  391. %       isa(_3006, tClazzBird),
  392. %       performedBy(_2984, _3028),
  393. %       \+ ( isa(_3028, mobPerson),
  394. %            naf(~occuring(_2984)),
  395. %            onPhysical(_3006, _3028)
  396. %          ).
  397. % ~performedBy(_3190, _3212) :-
  398. %       isa(_3190, actHoldingAnObject),
  399. %       objectActedOn(_3190, _3234),
  400. %       isa(_3234, tClazzBird),
  401. %       \+ ( isa(_3212, mobPerson),
  402. %            naf(~occuring(_3190)),
  403. %            onPhysical(_3234, _3212)
  404. %          ).
  405. % onPhysical(_3396, _3418) :-
  406. %       isa(_3440, actHoldingAnObject),
  407. %       objectActedOn(_3440, _3396),
  408. %       isa(_3396, tClazzBird),
  409. %       performedBy(_3440, _3418),
  410. %       isa(_3418, mobPerson),
  411. %       occuring(_3440).
  412.  
  413.  
  414.  
  415.  
  416. test_boxlog(sourceSchemaObjectID(SOURCE, SCHEMA, uU(uSourceSchemaObjectFn, SOURCE, SCHEMA, ID), ID)).
  417. % ~mudEquals(_1236{???UUUSOURCESCHEMAOBJECTFN1}, uU(uSourceSchemaObjectFn, _2438, _2460, _2482)) :-
  418. %       ~sourceSchemaObjectID(_2438, _2460, _1280{???UUUSOURCESCHEMAOBJECTFN1}, _2482).
  419. % sourceSchemaObjectID(_2614, _2636, UUUSOURCESCHEMAOBJECTFN1_VAR, _2658) :-
  420. %       mudEquals(_1006{???UUUSOURCESCHEMAOBJECTFN1},
  421. %                 uU(uSourceSchemaObjectFn, _2614, _2636, _2658)).
  422.  
  423.  
  424. test_boxlog(sourceSchemaObjectID(SOURCE, SCHEMA, THING, uU(uSourceSchemaObjectIDFn, SOURCE, SCHEMA, THING))).
  425. % ~mudEquals(_886{???UUUSOURCESCHEMAOBJECTIDFN1}, uU(uSourceSchemaObjectIDFn, _1072, _1094, _1116)) :-
  426. %       ~sourceSchemaObjectID(_1072, _1094, _1116, _906{???UUUSOURCESCHEMAOBJECTIDFN1}).
  427. % sourceSchemaObjectID(_1248, _1270, _1292, UUUSOURCESCHEMAOBJECTIDFN1_VAR) :-
  428. %       mudEquals(_868{???UUUSOURCESCHEMAOBJECTIDFN1},
  429. %                 uU(uSourceSchemaObjectIDFn, _1248, _1270, _1292)).
  430.  
  431.  
  432.  
  433. defunctionalize(implies(isa(YEAR, tClazzCalendarYear), temporallyFinishedBy(YEAR, uU(iTimeOf_SecondFn, 59, uU(iTimeOf_MinuteFn, 59, uU(iTimeOf_HourFn, 23, uU(iTimeOf_DayFn, 31, uU(iTimeOf_MonthFn, vDecember, YEAR)))))))).
  434.  
  435. % =>(mudEquals(UUITIMEOF_SECONDFN1_VAR, uU(iTimeOf_SecondFn, 59, UUITIMEOF_MINUTEFN1_VAR)), =>(mudEquals(UUITIMEOF_MINUTEFN1_VAR, uU(iTimeOf_MinuteFn, 59, UUITIMEOF_HOURFN1_VAR)), =>(mudEquals(UUITIMEOF_HOURFN1_VAR, uU(iTimeOf_HourFn, 23, UUITIMEOF_DAYFN1_VAR)), =>(mudEquals(UUITIMEOF_DAYFN1_VAR, uU(iTimeOf_DayFn, 31, UUITIMEOF_MONTHFN1_VAR)), =>(mudEquals(UUITIMEOF_MONTHFN1_VAR, uU(iTimeOf_MonthFn, vDecember, _200)), implies(isa(_200, tClazzCalendarYear), temporallyFinishedBy(_200, UUITIMEOF_SECONDFN1_VAR))))))).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement