{"action":"created","issue":{"url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/1917","labels_url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/1917/labels{/name}","comments_url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/1917/comments","events_url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/1917/events","html_url":"https://github.com/idris-lang/Idris-dev/issues/1917","id":57573109,"number":1917,"title":"Totality checker too permissive ?","user":{"login":"nicolabotta","id":2726946,"avatar_url":"https://avatars.githubusercontent.com/u/2726946?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolabotta","html_url":"https://github.com/nicolabotta","followers_url":"https://api.github.com/users/nicolabotta/followers","following_url":"https://api.github.com/users/nicolabotta/following{/other_user}","gists_url":"https://api.github.com/users/nicolabotta/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolabotta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolabotta/subscriptions","organizations_url":"https://api.github.com/users/nicolabotta/orgs","repos_url":"https://api.github.com/users/nicolabotta/repos","events_url":"https://api.github.com/users/nicolabotta/events{/privacy}","received_events_url":"https://api.github.com/users/nicolabotta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/idris-lang/Idris-dev/labels/Confirmed","name":"Confirmed","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-13T08:44:10Z","updated_at":"2015-02-16T10:32:22Z","closed_at":null,"body":"The program\r\n````\r\n> import Data.Vect\r\n\r\n> total\r\n> Dec1 : {A : Type} -> (P : A -> Type) -> Type\r\n> Dec1 {A} P = (a : A) -> Dec (P a) \r\n\r\n> total\r\n> filter : {A : Type} ->\r\n>          {P : A -> Type} ->\r\n>          Dec1 P ->\r\n>          Vect n A -> \r\n>          (m : Nat ** Vect m A)\r\n> filter d1P Nil = (Z ** Nil)\r\n> filter d1P (a :: as) with (filter d1P as)\r\n>   | (_ ** tail) with (d1P a)\r\n>     | (Yes p)     = (_ ** a :: tail)\r\n>     | (No contra) = (_ ** tail)\r\n\r\n> total\r\n> filterLemma : {A : Type} ->\r\n>               {P : A -> Type} ->\r\n>               (d1P : Dec1 P) ->\r\n>               (a : A) ->\r\n>               (as : Vect n A) ->\r\n>               Elem a as ->\r\n>               (p : P a) ->\r\n>               Elem a (getProof (filter d1P as))\r\n> filterLemma d1P a Nil  Here       p impossible\r\n```\r\ntype checks fine although |filterLemma| is obviously not total. Is this the expected behavior ? Is the totality checker too permissive ?"},"comment":{"url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/comments/74487969","html_url":"https://github.com/idris-lang/Idris-dev/issues/1917#issuecomment-74487969","issue_url":"https://api.github.com/repos/idris-lang/Idris-dev/issues/1917","id":74487969,"user":{"login":"nicolabotta","id":2726946,"avatar_url":"https://avatars.githubusercontent.com/u/2726946?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolabotta","html_url":"https://github.com/nicolabotta","followers_url":"https://api.github.com/users/nicolabotta/followers","following_url":"https://api.github.com/users/nicolabotta/following{/other_user}","gists_url":"https://api.github.com/users/nicolabotta/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolabotta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolabotta/subscriptions","organizations_url":"https://api.github.com/users/nicolabotta/orgs","repos_url":"https://api.github.com/users/nicolabotta/repos","events_url":"https://api.github.com/users/nicolabotta/events{/privacy}","received_events_url":"https://api.github.com/users/nicolabotta/received_events","type":"User","site_admin":false},"created_at":"2015-02-16T10:32:22Z","updated_at":"2015-02-16T10:32:22Z","body":"Thanks Edwin. I cannot claim I understand what is going on but avoiding |impossible| appears to help:\r\n````\r\n> filterLemma d1P a Nil  prf p = absurd prf -- impossible\r\n```\r\ngives\r\n````\r\n*totalityChecker> :total filterLemma\r\nMain.filterLemma is not total as there are missing cases\r\n```\r\nas one would expect. For the time being, I am going to adopt this scheme and restrict the usage of |impossible| to instance declarations. Best, Nicola"}}