Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof search produces ill-typed terms #355

Open
ziman opened this issue May 6, 2020 · 0 comments
Open

Proof search produces ill-typed terms #355

ziman opened this issue May 6, 2020 · 0 comments

Comments

@ziman
Copy link
Collaborator

ziman commented May 6, 2020

Steps to Reproduce

import Data.Vect

%default total

data Number = N1 | N2 | N3 | N4

Eq Number where
  N1 == N1 = True
  N2 == N2 = True
  N3 == N3 = True
  N4 == N4 = True
  _ == _ = False

namespace All
  public export
  data All : (p : a -> Type) -> (xs : Vect n a) -> Type where
    Nil : All p []
    (::) : {x : a} -> p x -> All p xs -> All p (x :: xs)

namespace AllDifferent
  public export
  data AllDifferent : Vect n Number -> Type where
    Nil : AllDifferent []
    (::) :
        All (\y => x == y = False) xs
        -> AllDifferent xs
        -> AllDifferent (x :: xs)

bug : AllDifferent [N1, N1, N1]
bug = %search

Expected Behavior

%search fails to find the value

Observed Behavior

$ rm -rf build
$ idris2 --debug-elab-check bug.idr
Welcome to Idris 2.  Enjoy yourself!
1/1: Building bug (bug.idr)
Main> :t bug
Main.bug : AllDifferent [N1, N1, N1]
Main> bug
[[Refl, Refl], [Refl], []]

When I lift the lambda from the definition of AllDifferent.(::), the program is correctly rejected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant