-
Notifications
You must be signed in to change notification settings - Fork 2
/
l14.v
80 lines (66 loc) · 2.07 KB
/
l14.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Require Import Bool Arith List Omega.
Require Import Recdef Morphisms.
Require Import Program.Tactics.
Require Import Relation_Operators.
Require FMapList.
Require FMapFacts.
Require Import Classical.
Require Import Coq.Classes.RelationClasses.
Require Import OrderedType OrderedTypeEx DecidableType.
Require Import Sorting.Permutation.
Import ListNotations.
Section ListFacts.
Context {A:Type}.
Implicit Types l:list A.
Lemma filter_app (f:A -> bool) l1 l2:
filter f (l1 ++ l2) = filter f l1 ++ filter f l2.
Admitted.
Lemma filter_app_eq (f:A -> bool) x y:
filter f (x ++ y) = x ++ y ->
filter f x = x /\ filter f y = y.
Admitted.
Lemma Forall_app (P:A -> Prop) l1 l2:
Forall P (l1 ++ l2) <-> Forall P l1 /\ Forall P l2.
Admitted.
End ListFacts.
Module WXFacts_fun (E:DecidableType) (Import Map:FMapInterface.WSfun E).
Module MapFacts := FMapFacts.WFacts_fun E Map.
Section XFacts.
Notation eq_dec := E.eq_dec.
Variable elt: Type.
Implicit Types m: t elt.
Implicit Types x y z: key.
Implicit Types e: elt.
Lemma add_same_Equal: forall m x e,
MapsTo x e m ->
Equal m (add x e m).
Proof.
intros; rewrite MapFacts.Equal_mapsto_iff; split; intros.
- destruct (eq_dec x k); subst.
+ rewrite <- e1 in H0.
rewrite (MapFacts.MapsTo_fun H H0).
now eapply Map.add_1.
+ now eapply Map.add_2.
- rewrite MapFacts.add_mapsto_iff in H0;
destruct H0; destruct_conjs.
+ rewrite <- H0; now rewrite <- H1.
+ auto.
Qed.
Lemma add_redundant_Equal: forall m x e e',
Equal (add x e m) (add x e (add x e' m)).
Admitted.
Lemma add_commutes: forall m x y e e',
~ E.eq x y ->
Equal (add x e (add y e' m)) (add y e' (add x e m)).
Admitted.
Lemma add_remove_Equal: forall m x e,
Equal (add x e m) (add x e (remove x m)).
Admitted.
Lemma remove_redundant_Equal: forall m x e,
Equal (remove x m) (remove x (add x e m)).
Admitted.
Lemma remove_commutes: forall m x y,
Equal (remove x (remove y m)) (remove y (remove x m)).
Admitted.
End XFacts.
End WXFacts_fun.