Commit 0158faa7 authored by Robbert Krebbers's avatar Robbert Krebbers

Renaming in prelude/list.

Rename:

- prefix_of -> prefix and suffix_of -> suffix because that saves keystrokes
  in lemma names. However, keep the infix notations with l1 `prefix_of` l2 and
  l1 `suffix_of` l2 because those are easier to read.
- change the notation l1 `sublist` l2 into l1 `sublist_of` l2 to be consistent.
- rename contains -> submseteq and use the notation ⊆+
parent 808b681c
...@@ -69,9 +69,9 @@ Proof. ...@@ -69,9 +69,9 @@ Proof.
apply Permutation_singleton. by rewrite <-(right_id () {[x]}), apply Permutation_singleton. by rewrite <-(right_id () {[x]}),
elements_union_singleton, elements_empty by set_solver. elements_union_singleton, elements_empty by set_solver.
Qed. Qed.
Lemma elements_contains X Y : X Y elements X `contains` elements Y. Lemma elements_submseteq X Y : X Y elements X + elements Y.
Proof. Proof.
intros; apply NoDup_contains; auto using NoDup_elements. intros; apply NoDup_submseteq; auto using NoDup_elements.
intros x. rewrite !elem_of_elements; auto. intros x. rewrite !elem_of_elements; auto.
Qed. Qed.
......
...@@ -699,10 +699,10 @@ Proof. ...@@ -699,10 +699,10 @@ Proof.
by rewrite map_to_list_insert, map_to_list_empty by auto using lookup_empty. by rewrite map_to_list_insert, map_to_list_empty by auto using lookup_empty.
Qed. Qed.
Lemma map_to_list_contains {A} (m1 m2 : M A) : Lemma map_to_list_submseteq {A} (m1 m2 : M A) :
m1 m2 map_to_list m1 `contains` map_to_list m2. m1 m2 map_to_list m1 + map_to_list m2.
Proof. Proof.
intros; apply NoDup_contains; auto using NoDup_map_to_list. intros; apply NoDup_submseteq; auto using NoDup_map_to_list.
intros [i x]. rewrite !elem_of_map_to_list; eauto using lookup_weaken. intros [i x]. rewrite !elem_of_map_to_list; eauto using lookup_weaken.
Qed. Qed.
Lemma map_to_list_fmap {A B} (f : A B) m : Lemma map_to_list_fmap {A B} (f : A B) m :
......
...@@ -107,17 +107,17 @@ Proof. ...@@ -107,17 +107,17 @@ Proof.
unfold card; intros. destruct finA as [[|x ?] ??]; simpl in *; [exfalso;lia|]. unfold card; intros. destruct finA as [[|x ?] ??]; simpl in *; [exfalso;lia|].
constructor; exact x. constructor; exact x.
Qed. Qed.
Lemma finite_inj_contains `{finA: Finite A} `{finB: Finite B} (f: A B) Lemma finite_inj_submseteq `{finA: Finite A} `{finB: Finite B} (f: A B)
`{!Inj (=) (=) f} : f <$> enum A `contains` enum B. `{!Inj (=) (=) f} : f <$> enum A + enum B.
Proof. Proof.
intros. destruct finA, finB. apply NoDup_contains; auto using NoDup_fmap_2. intros. destruct finA, finB. apply NoDup_submseteq; auto using NoDup_fmap_2.
Qed. Qed.
Lemma finite_inj_Permutation `{Finite A} `{Finite B} (f : A B) Lemma finite_inj_Permutation `{Finite A} `{Finite B} (f : A B)
`{!Inj (=) (=) f} : card A = card B f <$> enum A enum B. `{!Inj (=) (=) f} : card A = card B f <$> enum A enum B.
Proof. Proof.
intros. apply contains_Permutation_length_eq. intros. apply submseteq_Permutation_length_eq.
- by rewrite fmap_length. - by rewrite fmap_length.
- by apply finite_inj_contains. - by apply finite_inj_submseteq.
Qed. Qed.
Lemma finite_inj_surj `{Finite A} `{Finite B} (f : A B) Lemma finite_inj_surj `{Finite A} `{Finite B} (f : A B)
`{!Inj (=) (=) f} : card A = card B Surj (=) f. `{!Inj (=) (=) f} : card A = card B Surj (=) f.
...@@ -144,7 +144,7 @@ Proof. ...@@ -144,7 +144,7 @@ Proof.
destruct (finite_surj A B) as (g&?); auto with lia. destruct (finite_surj A B) as (g&?); auto with lia.
destruct (surj_cancel g) as (f&?). exists f. apply cancel_inj. destruct (surj_cancel g) as (f&?). exists f. apply cancel_inj.
- intros [f ?]. unfold card. rewrite <-(fmap_length f). - intros [f ?]. unfold card. rewrite <-(fmap_length f).
by apply contains_length, (finite_inj_contains f). by apply submseteq_length, (finite_inj_submseteq f).
Qed. Qed.
Lemma finite_bijective A `{Finite A} B `{Finite B} : Lemma finite_bijective A `{Finite A} B `{Finite B} :
card A = card B f : A B, Inj (=) (=) f Surj (=) f. card A = card B f : A B, Inj (=) (=) f Surj (=) f.
......
...@@ -345,14 +345,14 @@ Proof. ...@@ -345,14 +345,14 @@ Proof.
Qed. Qed.
(* Mononicity *) (* Mononicity *)
Lemma gmultiset_elements_contains X Y : X Y elements X `contains` elements Y. Lemma gmultiset_elements_submseteq X Y : X Y elements X + elements Y.
Proof. Proof.
intros ->%gmultiset_union_difference. rewrite gmultiset_elements_union. intros ->%gmultiset_union_difference. rewrite gmultiset_elements_union.
by apply contains_inserts_r. by apply submseteq_inserts_r.
Qed. Qed.
Lemma gmultiset_subseteq_size X Y : X Y size X size Y. Lemma gmultiset_subseteq_size X Y : X Y size X size Y.
Proof. intros. by apply contains_length, gmultiset_elements_contains. Qed. Proof. intros. by apply submseteq_length, gmultiset_elements_submseteq. Qed.
Lemma gmultiset_subset_size X Y : X Y size X < size Y. Lemma gmultiset_subset_size X Y : X Y size X < size Y.
Proof. Proof.
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment