Agda Type-Checking and Commutativity / Associativity of +
问题 Since the _+_ -Operation for Nat is usually defined recursively in the first argument, its obviously non-trivial for the type-checker to know that i + 0 == i . However, I frequently run into this issue when I write functions on fixed-size Vectors. One example: How can I define an Agda-function swap : {A : Set}{m n : Nat} -> Vec A (n + m) -> Vec A (m + n) which puts the first n values at the end of the vector? Since a simple solution in Haskell would be swap 0 xs = xs swap n (x:xs) = swap (n-1