{"push_id":1461185448,"size":2,"distinct_size":2,"ref":"refs/heads/master","head":"6e307e0d0bf4aecea896b86011a521c5b2ec31ad","before":"83ee23245ece33669880c8e3416d349b093a0631","commits":[{"sha":"f7dba6db85d2527a1326a079edd568a876ce4170","author":{"name":"Zebulun Arendsee","email":"ac14ef23968b97f10f44a676fb1e2a6996a39440@iastate.edu"},"message":"Add a simple syllogism\n\nI entered a simple syllogism from Harry Gensler's logic book.\n\n```\nplace(You,Europe).\nplace(Sally,Paris).\nplace(Paris,France).\nplace(France,Europe).\n\n% e.g. isin(Sally,Europe).\nisin(X,Z) :- place(X,Z).\nisin(X,Z) :- place(X,Y) , isin(Y,Z).\n```\n\nIt seemed perfect, but upon compiling threw the error:\n\n```\nGNU Prolog 1.4.4 (64 bits)\nCompiled Apr 29 2013, 20:42:46 with gcc\nBy Daniel Diaz\nCopyright (C) 1999-2013 Daniel Diaz\ncompiling\n/home/shoggoth/src/git/prolog-practice/more-syllogisms/syllogisms.pro\nfor byte code...\n/home/shoggoth/src/git/prolog-practice/more-syllogisms/syllogisms.pro:6:\nwarning: singleton variables [You,Europe] for place/2\n/home/shoggoth/src/git/prolog-practice/more-syllogisms/syllogisms.pro:7:\nwarning: singleton variables [Sally,Paris] for place/2\n/home/shoggoth/src/git/prolog-practice/more-syllogisms/syllogisms.pro:8:\nwarning: singleton variables [Paris,France] for place/2\n/home/shoggoth/src/git/prolog-practice/more-syllogisms/syllogisms.pro:9:\nwarning: singleton variables [France,Europe] for place/2\n/home/shoggoth/src/git/prolog-practice/more-syllogisms/syllogisms.pro\ncompiled, 13 lines read - 756 bytes written, 30 ms\n```\n\nSingleton variable? WTF? I soon learned that this class of warnings when\na variable is declared but never used. It is a reasonable enough thing\nto trigger a warning, since such singletons are probably the result of a\ntypo. But, I didn't even know what Prolog had variables, and I certainly\nhadn't intended to make one. My code really really seemed perfect.\n\nFinally, I found the only possible reason this could be failing was bad\nsyntax, and the only possible syntax difference was capitalization. So I\nconverted everything to lowercase and suddenly everything was grand.\nApparently, uppercase is reserved for variables and lowercase for\nconcrete entities.\n\nIncidentally, if you replace the X,Y,Z with x,y,z in the rules, the\nprogram compiles fine, but every query returns false. I think this is\nbecause it is testing whether literal `place(x,z)` is true.\n\nSo. Watch your capitalization.","distinct":true,"url":"https://api.github.com/repos/arendsee/prolog-practice/commits/f7dba6db85d2527a1326a079edd568a876ce4170"},{"sha":"6e307e0d0bf4aecea896b86011a521c5b2ec31ad","author":{"name":"Zebulun Arendsee","email":"ac14ef23968b97f10f44a676fb1e2a6996a39440@iastate.edu"},"message":"Implement mystery party (Gensler pp. 17)\n\nThis puzzle consists of a collection of 6 facts and 6 rules.\n\n F1 - Alice doesn't love money\n F2 - Bob loves money\n F3 - Bob isn't the richest person at the party\n F4 - Carol knew where the money was\n F5 - David works for Herman\n F6 - David isn't the nastiest person at the party\n R1 - All who stole money love money\n R2 - The richest person at the party didn't steal the money\n R3 - All who stole money knew where the money was\n R4 - All who hate herman stole money\n R5 - The nastiest person at the party stole money\n R6 - All who work for herman hate herman\n\nIf we take the mappings\n\n Alice,Bob,Carol,Dabid -> a,b,c,d\n\nand\n\n ym <- loves money\n yr <- is richest\n yw <- works for Herman\n yn <- is nastiest\n yk <- knows where the money is\n\nand nm,nr,nw,nk to the negations of the above\n\nI can express this in Prolog with\n\n```\nnm(a).     %F1\nym(b).     %F2\nnr(b).     %F3\nyk(c).     %F4\nyw(d).     %F5\nnn(d).     %F6\n\nn_stole(X) :- nm(X).    %R1\ny_stole(X) :- yh(X).    %R4\nyh(X)      :- yw(X).    %R6\n```\n\nI can then query whether each person did or didn't steal.\n\nNotice R2, R3, and R5 are all missing. This is because the variables yr,\nnk, and yn do not exist. That is a sorry excuse, but I couldn't find a\ngood way to deal with items known to be missing from a set. So I\nseparated `m` into `nm` and `ym` (for `no` and `yes`). This means I need\nto derive the missing variables from the existing variables. I will work\non doing this, perhaps in the next commit.\n\nWe know David stole money (F5 -> R6 -> R4). We also know that there is\nat least one other thief (R5 , F6). We know Alice didn't steal money\n(F1, R1). This leaves David and Carol. One or both of them stole money.","distinct":true,"url":"https://api.github.com/repos/arendsee/prolog-practice/commits/6e307e0d0bf4aecea896b86011a521c5b2ec31ad"}]}
{"actor":{"display_login":"arendsee"}}