{"action":"created","comment":{"url":"https://api.github.com/repos/rlepigre/lambdapi/pulls/comments/180101608","pull_request_review_id":110463184,"id":180101608,"diff_hunk":"@@ -102,28 +116,62 @@ let unify_modulo : term -> term -> bool = fun a b ->\n   if !debug_equa then log \"unif\" \"%a == %a\" pp a pp b;\n   let rec unify_modulo l =\n     match l with\n-    | []                   -> true\n+    | []                      -> true\n     | (a,b)::l when unify a b -> unify_modulo l\n-    | (a,b)::l             ->\n-        let (a,sa) = whnf_stk a [] in\n-        let (b,sb) = whnf_stk b [] in\n-        let rec sync acc la lb =\n-          match (la, lb) with\n-          | ([]   , []   ) -> (a, b, acc)\n-          | (a::la, b::lb) -> sync ((!a,!b)::acc) la lb\n-          | (la   , []   ) -> (to_term a (List.rev la), b, acc)\n-          | ([]   , lb   ) -> (a, to_term b (List.rev lb), acc)\n-        in\n-        let (a,b,l) = sync l (List.rev sa) (List.rev sb) in\n-        match (a, b) with\n-        | (a          , b          ) when unify a b -> unify_modulo l\n-        | (Abst(aa,ba), Abst(ab,bb)) ->\n-            let (_,ba,bb) = Bindlib.unbind2 mkfree ba bb in\n-            unify_modulo ((aa,ab)::(ba,bb)::l)\n-        | (Prod(aa,ba), Prod(ab,bb)) ->\n-            let (_,ba,bb) = Bindlib.unbind2 mkfree ba bb in\n-            unify_modulo ((aa,ab)::(ba,bb)::l)\n-        | (a          , b          ) ->\n+    | (a,b)::l                ->\n+    let a = whnf a in\n+    let b = whnf b in\n+    let rec get_args args a b =\n+      match (unfold a, unfold b) with\n+      | (Appl(t1,u1), Appl(t2,u2)) -> get_args ((u1,u2)::args) t1 t2\n+      | (Meta(u1,e1), Meta(u2,e2)) when u1 == u2 -> (a,b,args)\n+      | (Meta(m,e)  , b          ) when instantiate m e b -> get_args args a b\n+      | (a          , Meta(m,e)  ) when instantiate m e a -> get_args args a b\n+      | (_          , _          ) -> (a,b,args)\n+    in\n+    let unif =\n+      match !constraints with\n+      | None -> (fun a b -> unify_modulo [(a,b)])\n+      | _    -> unify\n+    in\n+    let (a,b,args) = get_args [] a b in\n+    let args = List.rev args in","path":"src/unif.ml","position":110,"original_position":110,"commit_id":"faf53b5f7c1c5c439de78978c6bdf44536ff13b8","original_commit_id":"faf53b5f7c1c5c439de78978c6bdf44536ff13b8","user":{"login":"rlepigre","id":1555539,"avatar_url":"https://avatars0.githubusercontent.com/u/1555539?v=4","gravatar_id":"","url":"https://api.github.com/users/rlepigre","html_url":"https://github.com/rlepigre","followers_url":"https://api.github.com/users/rlepigre/followers","following_url":"https://api.github.com/users/rlepigre/following{/other_user}","gists_url":"https://api.github.com/users/rlepigre/gists{/gist_id}","starred_url":"https://api.github.com/users/rlepigre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlepigre/subscriptions","organizations_url":"https://api.github.com/users/rlepigre/orgs","repos_url":"https://api.github.com/users/rlepigre/repos","events_url":"https://api.github.com/users/rlepigre/events{/privacy}","received_events_url":"https://api.github.com/users/rlepigre/received_events","type":"User","site_admin":false},"body":"Actually, I'm not sure. Maybe It should not be reversed at all.","created_at":"2018-04-09T13:54:54Z","updated_at":"2018-04-09T13:54:54Z","html_url":"https://github.com/rlepigre/lambdapi/pull/37#discussion_r180101608","pull_request_url":"https://api.github.com/repos/rlepigre/lambdapi/pulls/37","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/rlepigre/lambdapi/pulls/comments/180101608"},"html":{"href":"https://github.com/rlepigre/lambdapi/pull/37#discussion_r180101608"},"pull_request":{"href":"https://api.github.com/repos/rlepigre/lambdapi/pulls/37"}},"in_reply_to_id":180100059},"pull_request":{"url":"https://api.github.com/repos/rlepigre/lambdapi/pulls/37","id":180296526,"html_url":"https://github.com/rlepigre/lambdapi/pull/37","diff_url":"https://github.com/rlepigre/lambdapi/pull/37.diff","patch_url":"https://github.com/rlepigre/lambdapi/pull/37.patch","issue_url":"https://api.github.com/repos/rlepigre/lambdapi/issues/37","number":37,"state":"open","locked":false,"title":"Fixed subject reduction problem","user":{"login":"rlepigre","id":1555539,"avatar_url":"https://avatars0.githubusercontent.com/u/1555539?v=4","gravatar_id":"","url":"https://api.github.com/users/rlepigre","html_url":"https://github.com/rlepigre","followers_url":"https://api.github.com/users/rlepigre/followers","following_url":"https://api.github.com/users/rlepigre/following{/other_user}","gists_url":"https://api.github.com/users/rlepigre/gists{/gist_id}","starred_url":"https://api.github.com/users/rlepigre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlepigre/subscriptions","organizations_url":"https://api.github.com/users/rlepigre/orgs","repos_url":"https://api.github.com/users/rlepigre/repos","events_url":"https://api.github.com/users/rlepigre/events{/privacy}","received_events_url":"https://api.github.com/users/rlepigre/received_events","type":"User","site_admin":false},"body":"I think the subject reduction problem is solved in this branch, but this needs reviewing.","created_at":"2018-04-09T12:31:42Z","updated_at":"2018-04-09T13:54:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"226f5a12319c1773ae243b8352b07a23de54391e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rlepigre/lambdapi/pulls/37/commits","review_comments_url":"https://api.github.com/repos/rlepigre/lambdapi/pulls/37/comments","review_comment_url":"https://api.github.com/repos/rlepigre/lambdapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rlepigre/lambdapi/issues/37/comments","statuses_url":"https://api.github.com/repos/rlepigre/lambdapi/statuses/faf53b5f7c1c5c439de78978c6bdf44536ff13b8","head":{"label":"rlepigre:fixsr","ref":"fixsr","sha":"faf53b5f7c1c5c439de78978c6bdf44536ff13b8","user":{"login":"rlepigre","id":1555539,"avatar_url":"https://avatars0.githubusercontent.com/u/1555539?v=4","gravatar_id":"","url":"https://api.github.com/users/rlepigre","html_url":"https://github.com/rlepigre","followers_url":"https://api.github.com/users/rlepigre/followers","following_url":"https://api.github.com/users/rlepigre/following{/other_user}","gists_url":"https://api.github.com/users/rlepigre/gists{/gist_id}","starred_url":"https://api.github.com/users/rlepigre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlepigre/subscriptions","organizations_url":"https://api.github.com/users/rlepigre/orgs","repos_url":"https://api.github.com/users/rlepigre/repos","events_url":"https://api.github.com/users/rlepigre/events{/privacy}","received_events_url":"https://api.github.com/users/rlepigre/received_events","type":"User","site_admin":false},"repo":{"id":103059740,"name":"lambdapi","full_name":"rlepigre/lambdapi","owner":{"login":"rlepigre","id":1555539,"avatar_url":"https://avatars0.githubusercontent.com/u/1555539?v=4","gravatar_id":"","url":"https://api.github.com/users/rlepigre","html_url":"https://github.com/rlepigre","followers_url":"https://api.github.com/users/rlepigre/followers","following_url":"https://api.github.com/users/rlepigre/following{/other_user}","gists_url":"https://api.github.com/users/rlepigre/gists{/gist_id}","starred_url":"https://api.github.com/users/rlepigre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlepigre/subscriptions","organizations_url":"https://api.github.com/users/rlepigre/orgs","repos_url":"https://api.github.com/users/rlepigre/repos","events_url":"https://api.github.com/users/rlepigre/events{/privacy}","received_events_url":"https://api.github.com/users/rlepigre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rlepigre/lambdapi","description":"Minimal implementation of the λΠ-calculus modulo","fork":false,"url":"https://api.github.com/repos/rlepigre/lambdapi","forks_url":"https://api.github.com/repos/rlepigre/lambdapi/forks","keys_url":"https://api.github.com/repos/rlepigre/lambdapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rlepigre/lambdapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rlepigre/lambdapi/teams","hooks_url":"https://api.github.com/repos/rlepigre/lambdapi/hooks","issue_events_url":"https://api.github.com/repos/rlepigre/lambdapi/issues/events{/number}","events_url":"https://api.github.com/repos/rlepigre/lambdapi/events","assignees_url":"https://api.github.com/repos/rlepigre/lambdapi/assignees{/user}","branches_url":"https://api.github.com/repos/rlepigre/lambdapi/branches{/branch}","tags_url":"https://api.github.com/repos/rlepigre/lambdapi/tags","blobs_url":"https://api.github.com/repos/rlepigre/lambdapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rlepigre/lambdapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rlepigre/lambdapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/rlepigre/lambdapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rlepigre/lambdapi/statuses/{sha}","languages_url":"https://api.github.com/repos/rlepigre/lambdapi/languages","stargazers_url":"https://api.github.com/repos/rlepigre/lambdapi/stargazers","contributors_url":"https://api.github.com/repos/rlepigre/lambdapi/contributors","subscribers_url":"https://api.github.com/repos/rlepigre/lambdapi/subscribers","subscription_url":"https://api.github.com/repos/rlepigre/lambdapi/subscription","commits_url":"https://api.github.com/repos/rlepigre/lambdapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/rlepigre/lambdapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/rlepigre/lambdapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/rlepigre/lambdapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/rlepigre/lambdapi/contents/{+path}","compare_url":"https://api.github.com/repos/rlepigre/lambdapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rlepigre/lambdapi/merges","archive_url":"https://api.github.com/repos/rlepigre/lambdapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rlepigre/lambdapi/downloads","issues_url":"https://api.github.com/repos/rlepigre/lambdapi/issues{/number}","pulls_url":"https://api.github.com/repos/rlepigre/lambdapi/pulls{/number}","milestones_url":"https://api.github.com/repos/rlepigre/lambdapi/milestones{/number}","notifications_url":"https://api.github.com/repos/rlepigre/lambdapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rlepigre/lambdapi/labels{/name}","releases_url":"https://api.github.com/repos/rlepigre/lambdapi/releases{/id}","deployments_url":"https://api.github.com/repos/rlepigre/lambdapi/deployments","created_at":"2017-09-10T20:32:16Z","updated_at":"2018-04-09T12:41:24Z","pushed_at":"2018-04-09T13:39:55Z","git_url":"git://github.com/rlepigre/lambdapi.git","ssh_url":"git@github.com:rlepigre/lambdapi.git","clone_url":"https://github.com/rlepigre/lambdapi.git","svn_url":"https://github.com/rlepigre/lambdapi","homepage":"","size":34892,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":10,"license":null,"forks":3,"open_issues":10,"watchers":0,"default_branch":"master"}},"base":{"label":"rlepigre:master","ref":"master","sha":"44e61ef856625830f88e1b52a8d80b729acdf2d8","user":{"login":"rlepigre","id":1555539,"avatar_url":"https://avatars0.githubusercontent.com/u/1555539?v=4","gravatar_id":"","url":"https://api.github.com/users/rlepigre","html_url":"https://github.com/rlepigre","followers_url":"https://api.github.com/users/rlepigre/followers","following_url":"https://api.github.com/users/rlepigre/following{/other_user}","gists_url":"https://api.github.com/users/rlepigre/gists{/gist_id}","starred_url":"https://api.github.com/users/rlepigre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlepigre/subscriptions","organizations_url":"https://api.github.com/users/rlepigre/orgs","repos_url":"https://api.github.com/users/rlepigre/repos","events_url":"https://api.github.com/users/rlepigre/events{/privacy}","received_events_url":"https://api.github.com/users/rlepigre/received_events","type":"User","site_admin":false},"repo":{"id":103059740,"name":"lambdapi","full_name":"rlepigre/lambdapi","owner":{"login":"rlepigre","id":1555539,"avatar_url":"https://avatars0.githubusercontent.com/u/1555539?v=4","gravatar_id":"","url":"https://api.github.com/users/rlepigre","html_url":"https://github.com/rlepigre","followers_url":"https://api.github.com/users/rlepigre/followers","following_url":"https://api.github.com/users/rlepigre/following{/other_user}","gists_url":"https://api.github.com/users/rlepigre/gists{/gist_id}","starred_url":"https://api.github.com/users/rlepigre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlepigre/subscriptions","organizations_url":"https://api.github.com/users/rlepigre/orgs","repos_url":"https://api.github.com/users/rlepigre/repos","events_url":"https://api.github.com/users/rlepigre/events{/privacy}","received_events_url":"https://api.github.com/users/rlepigre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rlepigre/lambdapi","description":"Minimal implementation of the λΠ-calculus modulo","fork":false,"url":"https://api.github.com/repos/rlepigre/lambdapi","forks_url":"https://api.github.com/repos/rlepigre/lambdapi/forks","keys_url":"https://api.github.com/repos/rlepigre/lambdapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rlepigre/lambdapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rlepigre/lambdapi/teams","hooks_url":"https://api.github.com/repos/rlepigre/lambdapi/hooks","issue_events_url":"https://api.github.com/repos/rlepigre/lambdapi/issues/events{/number}","events_url":"https://api.github.com/repos/rlepigre/lambdapi/events","assignees_url":"https://api.github.com/repos/rlepigre/lambdapi/assignees{/user}","branches_url":"https://api.github.com/repos/rlepigre/lambdapi/branches{/branch}","tags_url":"https://api.github.com/repos/rlepigre/lambdapi/tags","blobs_url":"https://api.github.com/repos/rlepigre/lambdapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rlepigre/lambdapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rlepigre/lambdapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/rlepigre/lambdapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rlepigre/lambdapi/statuses/{sha}","languages_url":"https://api.github.com/repos/rlepigre/lambdapi/languages","stargazers_url":"https://api.github.com/repos/rlepigre/lambdapi/stargazers","contributors_url":"https://api.github.com/repos/rlepigre/lambdapi/contributors","subscribers_url":"https://api.github.com/repos/rlepigre/lambdapi/subscribers","subscription_url":"https://api.github.com/repos/rlepigre/lambdapi/subscription","commits_url":"https://api.github.com/repos/rlepigre/lambdapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/rlepigre/lambdapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/rlepigre/lambdapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/rlepigre/lambdapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/rlepigre/lambdapi/contents/{+path}","compare_url":"https://api.github.com/repos/rlepigre/lambdapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rlepigre/lambdapi/merges","archive_url":"https://api.github.com/repos/rlepigre/lambdapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rlepigre/lambdapi/downloads","issues_url":"https://api.github.com/repos/rlepigre/lambdapi/issues{/number}","pulls_url":"https://api.github.com/repos/rlepigre/lambdapi/pulls{/number}","milestones_url":"https://api.github.com/repos/rlepigre/lambdapi/milestones{/number}","notifications_url":"https://api.github.com/repos/rlepigre/lambdapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rlepigre/lambdapi/labels{/name}","releases_url":"https://api.github.com/repos/rlepigre/lambdapi/releases{/id}","deployments_url":"https://api.github.com/repos/rlepigre/lambdapi/deployments","created_at":"2017-09-10T20:32:16Z","updated_at":"2018-04-09T12:41:24Z","pushed_at":"2018-04-09T13:39:55Z","git_url":"git://github.com/rlepigre/lambdapi.git","ssh_url":"git@github.com:rlepigre/lambdapi.git","clone_url":"https://github.com/rlepigre/lambdapi.git","svn_url":"https://github.com/rlepigre/lambdapi","homepage":"","size":34892,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":10,"license":null,"forks":3,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rlepigre/lambdapi/pulls/37"},"html":{"href":"https://github.com/rlepigre/lambdapi/pull/37"},"issue":{"href":"https://api.github.com/repos/rlepigre/lambdapi/issues/37"},"comments":{"href":"https://api.github.com/repos/rlepigre/lambdapi/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/rlepigre/lambdapi/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/rlepigre/lambdapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rlepigre/lambdapi/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/rlepigre/lambdapi/statuses/faf53b5f7c1c5c439de78978c6bdf44536ff13b8"}},"author_association":"OWNER"}}
{"actor":{"display_login":"rlepigre"}}