{"action":"created","issue":{"url":"https://api.github.com/repos/kyledewey/typed-prolog/issues/12","repository_url":"https://api.github.com/repos/kyledewey/typed-prolog","labels_url":"https://api.github.com/repos/kyledewey/typed-prolog/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/kyledewey/typed-prolog/issues/12/comments","events_url":"https://api.github.com/repos/kyledewey/typed-prolog/issues/12/events","html_url":"https://github.com/kyledewey/typed-prolog/issues/12","id":129636312,"number":12,"title":"Comparison predicates don't support arithmetic expressions","user":{"login":"maemre","id":562910,"avatar_url":"https://avatars.githubusercontent.com/u/562910?v=3","gravatar_id":"","url":"https://api.github.com/users/maemre","html_url":"https://github.com/maemre","followers_url":"https://api.github.com/users/maemre/followers","following_url":"https://api.github.com/users/maemre/following{/other_user}","gists_url":"https://api.github.com/users/maemre/gists{/gist_id}","starred_url":"https://api.github.com/users/maemre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maemre/subscriptions","organizations_url":"https://api.github.com/users/maemre/orgs","repos_url":"https://api.github.com/users/maemre/repos","events_url":"https://api.github.com/users/maemre/events{/privacy}","received_events_url":"https://api.github.com/users/maemre/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-29T01:35:03Z","updated_at":"2016-02-22T22:35:39Z","closed_at":"2016-02-22T22:35:39Z","body":"Comparison predicates like `>=/2` don't support arithmetic expressions, they only support numbers and variables. They should be treated like `is/2`, this can be done with infrastructure we have for arithmetic expressions. As an example, the following code fails with a syntax error:\r\n\r\n```prolog\r\nmodule(test, [], []).\r\n\r\nclausedef(test1, [], [int, int, int]).\r\ntest1(X, Y, Z) :-\r\n    X >= Y + Z.\r\n```\r\n\r\nalthough Prolog parses it correctly. The error given is:\r\n\r\n```\r\nType error at term public_2_term_constructor(+,[public_2_term_var(_G509),public_2_term_var(_G510)])\r\n        Found: UNKNOWN\r\n        Expected: public_2_intType\r\n\r\nType error at body public_2_firstOrderCall(>=,[public_2_term_var(_G508),public_2_term_constructor(+,[public_2_term_var(_G509),public_2_term_var(_G510)])])\r\n\r\nType error at clause public_2_clauseclause(private_0_test1,[public_2_term_var(_G508),public_2_term_var(_G509),public_2_term_var(_G510)],public_2_firstOrderCall(>=,[public_2_term_var(_G508),public_2_term_constructor(+,[public_2_term_var(_G509),public_2_term_var(_G510)])]))\r\n```\r\n\r\nOn the other hand, following code compiles correctly, and this can be used as a workaround for now:\r\n```prolog\r\nmodule(test, [], []).\r\n\r\nclausedef(test1, [], [int, int, int]).\r\ntest1(X, Y, Z) :-\r\n    T is Y + Z,\r\n    X >= T.\r\n```"},"comment":{"url":"https://api.github.com/repos/kyledewey/typed-prolog/issues/comments/187419534","html_url":"https://github.com/kyledewey/typed-prolog/issues/12#issuecomment-187419534","issue_url":"https://api.github.com/repos/kyledewey/typed-prolog/issues/12","id":187419534,"user":{"login":"kyledewey","id":992190,"avatar_url":"https://avatars.githubusercontent.com/u/992190?v=3","gravatar_id":"","url":"https://api.github.com/users/kyledewey","html_url":"https://github.com/kyledewey","followers_url":"https://api.github.com/users/kyledewey/followers","following_url":"https://api.github.com/users/kyledewey/following{/other_user}","gists_url":"https://api.github.com/users/kyledewey/gists{/gist_id}","starred_url":"https://api.github.com/users/kyledewey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyledewey/subscriptions","organizations_url":"https://api.github.com/users/kyledewey/orgs","repos_url":"https://api.github.com/users/kyledewey/repos","events_url":"https://api.github.com/users/kyledewey/events{/privacy}","received_events_url":"https://api.github.com/users/kyledewey/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T22:35:39Z","updated_at":"2016-02-22T22:35:39Z","body":"Added support with commit 3e9e6e1020b75cd0778bc2ae77976136cfdcb7d2."}}