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

Bug with definition of last on Vectors #102

Open
GuiltyDolphin opened this issue Apr 15, 2019 · 1 comment
Open

Bug with definition of last on Vectors #102

GuiltyDolphin opened this issue Apr 15, 2019 · 1 comment
Labels

Comments

@GuiltyDolphin
Copy link
Member

The following example:

data Vec (n : Nat) (a : Type) where
  Nil : Vec 0 a;
  Cons : a -> Vec n a -> Vec (n + 1) a

last : forall {a : Type, k : Nat} . Vec (k + 1) (a [0..1]) -> a
-- when k = 0
last (Cons [x] Nil) = x;
-- when k = k' + 1
last (Cons [_] xs)  = last xs

Doesn't type check, it results in the following error:

The following theorem associated with `last` is falsifiable:
	∀ n0.1 : ↑Nat,a1.1 : Type,t2.1 : Type,t3.1 : ↑Nat . ((0..0 ≤ 0..1) ∧ (n0.1 + 1 = k + 1) -> (0..1 ≤ 0..1))

Ouch.

@dorchard
Copy link
Member

For this we need to be able to propagate information between equations which we used to do, but realised we were doing it in not a fine-grained enough way. This would make a very useful project...

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

No branches or pull requests

2 participants