I've defined vector types on a type A
by using functions as fin n -> A
. I cannot come up with a way for concatenating the vectors without going through inductive vectors.
The definition of finite sets I am using is
Fixpoint fin (k : nat) : Type :=
match k with
| 0 => False
| S k => option (fin k)
end.
Then I define vectors of size k
as functions fin k -> A
.
How can I concatenate such vectors?
concat {A : Type} (n m : nat) (v1 : fin n -> A) (v2 : fin m -> A) (i : fin (n + m)) : A
I've tried pattern matching on n
, but it doesn't seem to acknowledge then that i
is of type fin m
then in the 0
case.
I guess this is a well-known definition, but I couldn't find this variant of vectors. Maybe moving from this type to vectors in Coq's library, concatenate there, and then come back, is an option, but I would like to have a more direct approach.