Skip to content
Snippets Groups Projects
Commit d6dbed9e authored by Dmitry Khalanskiy's avatar Dmitry Khalanskiy
Browse files

Add a stronger version of `list_core_id`.

A new lemma, `list_core_id'`, allows to infer that a list is
`CoreId` by only checking that all its elements are `CoreId`, as
opposed to the existing instance, `list_core_id`, that only works
when the list contains elements of the type where every element is
`CoreId`.
parent 446bc644
No related branches found
No related tags found
No related merge requests found
...@@ -296,12 +296,17 @@ Section cmra. ...@@ -296,12 +296,17 @@ Section cmra.
by apply cmra_discrete_valid. by apply cmra_discrete_valid.
Qed. Qed.
Global Instance list_core_id l : ( x : A, CoreId x) CoreId l. Lemma list_core_id' l : ( x, x l CoreId x) CoreId l.
Proof. Proof.
intros ?; constructor; apply list_equiv_lookup=> i. intros Hyp. constructor. apply list_equiv_lookup=> i.
by rewrite list_lookup_core (core_id_core (l !! i)). rewrite list_lookup_core.
destruct (l !! i) eqn:E; last done.
by eapply Hyp, elem_of_list_lookup_2.
Qed. Qed.
Global Instance list_core_id l : ( x : A, CoreId x) CoreId l.
Proof. intros Hyp; by apply list_core_id'. Qed.
(** Internalized properties *) (** Internalized properties *)
Lemma list_equivI {M} l1 l2 : l1 l2 ⊣⊢@{uPredI M} i, l1 !! i l2 !! i. Lemma list_equivI {M} l1 l2 : l1 l2 ⊣⊢@{uPredI M} i, l1 !! i l2 !! i.
Proof. uPred.unseal; constructor=> n x ?. apply list_dist_lookup. Qed. Proof. uPred.unseal; constructor=> n x ?. apply list_dist_lookup. 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