(** * Dupfree vector *)
(* Author: Maximilian Wuttke *)
Require PslBase.Lists.Dupfree.
Open Scope vector_scope.
Inductive dupfree X : forall n, Vector.t X n -> Prop :=
dupfreeVN :
dupfree (@Vector.nil X)
| dupfreeVC n (x : X) (V : Vector.t X n) :
~ Vector.In x V -> dupfree V -> dupfree (x ::: V).
Ltac vector_dupfree :=
match goal with
| [ |- dupfree (Vector.nil _) ] =>
constructor
| [ |- dupfree (?a ::: ?bs)] =>
constructor; [vector_not_in | vector_dupfree]
end.
Goal dupfree [| 4; 8; 15; 16; 23; 42 |].

Lemma dupfree_map_injective (X Y : Type) (n : nat) (f : X -> Y) (V : Vector.t X n) :
(forall x y, f x = f y -> x = y) ->
dupfree V ->
dupfree (map f V).