I want to prove a nearly trivial property of the take function for Vec in Agda.
open import Data.Vec
open import Data.Nat
open import Relation.Binary.PropositionalEquality
take-idempotent : ∀ n (xs : Vec ℕ n) → take n (take n xs) ≡ take n xs
take-idempotent n xs = ?
My problem stems from the fact that the type index of take consists of the addition of natural numbers.
Agda outputs the following message to the above code.
n != n + _n_9 of type ℕ
when checking that the inferred type of an application
Vec _A_8 n
matches the expected type
Vec _A_8 (n + _n_9)
I could make xs to have a type like Vec ℕ (n + 0) and apply take once, but the type of the outcome will be Vec ℕ n. To apply take twice, I need to set the type of xs to be Vec ℕ (n + 0 + 0) and use take (n + 0) for the first application. In addition, I would need + 0 adjustments to pass lhs and rhs to _≡_, since these have different numbers of applications of take.
Is there a simple way to state and prove this proposition?