Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FMap: add lemmas on range after update #690

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions theories/datatypes/FMap.ec
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,23 @@ move=> x_notin_m; apply/fmap_eqP => y; rewrite remE.
by case (y = x) => // ->>; apply/eq_sym/domNE.
qed.

(* -------------------------------------------------------------------- *)
lemma rng_set (m : ('a, 'b) fmap) (x : 'a) (y z : 'b) :
rng m.[x <- y] z <=> rng (rem m x) z \/ z = y.
proof.
rewrite !rngE /=; split.
+ move=> [] r; rewrite get_setE; case: (r = x)=> />.
by move=> r_neq_x m_r; left; exists r; rewrite remE r_neq_x /= m_r.
case=> [[] r rem_m_x_r|->>] />.
+ by exists r; move: rem_m_x_r; rewrite get_setE remE; case: (r = x).
+ by exists x; rewrite get_set_sameE.
qed.

lemma rng_set_notin (m : ('a, 'b) fmap) (x : 'a) (y z : 'b) :
x \notin m
=> rng m.[x <- y] z <=> rng m z \/ z = y.
proof. by rewrite rng_set=> /rem_id ->. qed.

(* -------------------------------------------------------------------- *)
op eq_except ['a 'b] X (m1 m2 : ('a, 'b) fmap) =
SmtMap.eq_except X (tomap m1) (tomap m2).
Expand Down