Skip to content
Snippets Groups Projects
Commit 80bc3965 authored by Jonas Kastberg's avatar Jonas Kastberg
Browse files

Added some useful lemmas about [list_subseteq]

parent f23a05c3
No related branches found
No related tags found
No related merge requests found
......@@ -2743,6 +2743,26 @@ Proof.
rewrite <-(elem_of_nil x).
apply Hl, elem_of_cons. by left.
Qed.
Lemma list_subseteq_cons x l1 l2 : l1 l2 x :: l1 x :: l2 .
Proof.
intros Hin y Hy%elem_of_cons.
destruct Hy as [-> | Hy]; [by left|]. right. by apply Hin.
Qed.
Lemma list_subseteq_cons_r x l1 l2 : l1 l2 l1 x :: l2.
Proof. intros Hin y Hy. right. by apply Hin. Qed.
Lemma list_delete_subseteq i l : delete i l l.
Proof.
revert i. induction l as [|x l IHl]; intros i; [done|].
destruct i as [|i];
[by apply list_subseteq_cons_r|by apply list_subseteq_cons].
Qed.
Lemma filter_subseteq P `{! x : A, Decision (P x)} l :
filter P l l.
Proof.
induction l as [|x l IHl]; [done|]. rewrite filter_cons.
destruct (decide (P x));
[by apply list_subseteq_cons|by apply list_subseteq_cons_r].
Qed.
Global Instance list_subseteq_Permutation: Proper (() ==> () ==> ()) (⊆@{list A}) .
Proof. intros l1 l2 Hl k1 k2 Hk. apply forall_proper; intros x. by rewrite Hl, Hk. 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