diff options
author | jadep <jade.philipoom@gmail.com> | 2016-04-20 13:59:33 -0400 |
---|---|---|
committer | jadep <jade.philipoom@gmail.com> | 2016-04-20 13:59:33 -0400 |
commit | f2629738a4dfd748a4829323959607ee36e6fd6d (patch) | |
tree | 7ffd7b5aefdef22e34aea54f97367833f3ff3084 /src/Util/ListUtil.v | |
parent | b5663bdb42176ac0e808eda16af031c795c22164 (diff) |
moved lemmas from ModularBaseSystemProofs to various Util files
Diffstat (limited to 'src/Util/ListUtil.v')
-rw-r--r-- | src/Util/ListUtil.v | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Util/ListUtil.v b/src/Util/ListUtil.v index d65c65723..0e061d5e5 100644 --- a/src/Util/ListUtil.v +++ b/src/Util/ListUtil.v @@ -439,6 +439,16 @@ Proof. boring. Qed. +Lemma nth_error_Some_nth_default : forall {T} i x (l : list T), (i < length l)%nat -> + nth_error l i = Some (nth_default x l i). +Proof. + intros ? ? ? ? i_lt_length. + destruct (nth_error_length_exists_value _ _ i_lt_length) as [k nth_err_k]. + unfold nth_default. + rewrite nth_err_k. + reflexivity. +Qed. + Lemma set_nth_cons : forall {T} (x u0 : T) us, set_nth 0 x (u0 :: us) = x :: us. Proof. auto. @@ -539,3 +549,10 @@ Lemma cons_eq_tail : forall {T} (x y:T) xs ys, x::xs = y::ys -> xs=ys. Proof. intros; solve_by_inversion. Qed. + +Lemma map_nth_default_always {A B} (f : A -> B) (n : nat) (x : A) (l : list A) + : nth_default (f x) (map f l) n = f (nth_default x l n). +Proof. + revert n; induction l; simpl; intro n; destruct n; [ try reflexivity.. ]. + nth_tac. +Qed. |