diff --git a/theories/vector.v b/theories/vector.v index a23e8c7a5f1d5b75bb2b4a93afa9370c218348c3..13ed7220f46bc561396667449f60d4277880310c 100644 --- a/theories/vector.v +++ b/theories/vector.v @@ -355,3 +355,13 @@ Proof. Qed. Lemma vlookup_insert_self {A n} i (v : vec A n) : vinsert i (v !!! i) v = v. Proof. by induction v; inv_fin i; intros; f_equal/=. Qed. + +(* Vectors can be inhabited. *) +Global Instance vec_nil_inh T : Inhabited (vec T 0) := populate [#]. + +Global Instance vec_inh T n : Inhabited T → Inhabited (vec T n). +Proof. + intros HT. induction n; [apply _|]. + destruct IHn as [v]. destruct HT as [x]. + exact (populate (x:::v)). +Qed.