Skip to content
Snippets Groups Projects
Commit cb021200 authored by Ralf Jung's avatar Ralf Jung
Browse files

inhabit vectors

parent db2da9af
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -355,3 +355,13 @@ Proof. ...@@ -355,3 +355,13 @@ Proof.
Qed. Qed.
Lemma vlookup_insert_self {A n} i (v : vec A n) : vinsert i (v !!! i) v = v. 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. 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.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment