-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLattice.v
175 lines (153 loc) · 3.09 KB
/
Lattice.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
Inductive label : Type :=
| High
| Low.
Definition join l1 l2 :=
match l1, l2 with
| High, High => High
| High, Low => High
| Low, High => High
| Low, Low => Low
end.
Lemma join_idempotent :
forall l,
l = join l l.
Proof.
destruct l; reflexivity.
Qed.
Definition flows_to l1 l2 :=
l2 = join l1 l2.
Lemma flows_to_refl :
forall l,
flows_to l l.
Proof.
unfold flows_to.
apply join_idempotent.
Qed.
Lemma flows_to_trans :
forall l l' l'',
flows_to l l' ->
flows_to l' l'' ->
flows_to l l''.
Proof.
intros l l' l'';
destruct l;
destruct l';
destruct l'';
auto.
intros.
apply flows_to_refl.
Qed.
Lemma flows_to_antisym :
forall l l',
flows_to l l' ->
flows_to l' l ->
l = l'.
Proof.
destruct l;
destruct l';
intros;
auto.
Qed.
Lemma high_is_top :
forall l,
flows_to l High.
Proof.
destruct l; reflexivity.
Qed.
Lemma low_is_bot :
forall l,
flows_to Low l.
Proof.
destruct l; reflexivity.
Qed.
Lemma join_high_r :
forall l,
join l High = High.
Proof.
destruct l; reflexivity.
Qed.
Lemma join_high_l :
forall l,
join High l = High.
Proof.
destruct l; reflexivity.
Qed.
Lemma join_low_r :
forall l,
join l Low = l.
Proof.
destruct l; reflexivity.
Qed.
Lemma join_low_l :
forall l,
join Low l = l.
Proof.
destruct l; reflexivity.
Qed.
Lemma join_is_upper_bound :
forall l l',
flows_to l (join l l') /\ flows_to l' (join l l').
Proof.
destruct l; destruct l'; split; (auto ) || (unfold flows_to; reflexivity).
Qed.
Lemma join_is_least_upper_bound :
forall l l' u,
flows_to l u ->
flows_to l' u ->
flows_to (join l l') u.
Proof.
destruct l; destruct l'; destruct u; intros; auto.
Qed.
Lemma flows_to_questionable :
forall l l' l'',
flows_to l l' ->
flows_to l l'' ->
flows_to l (join l'' l').
Proof.
destruct l; destruct l'; destruct l''; intros; try reflexivity.
inversion H0.
Qed.
Lemma join_comm :
forall l l',
join l l' = join l' l.
Proof.
intros.
destruct (join_is_upper_bound l l').
destruct (join_is_upper_bound l' l).
assert (flows_to (join l l') (join l' l)).
apply join_is_least_upper_bound; assumption.
assert (flows_to (join l' l) (join l l')).
apply join_is_least_upper_bound; assumption.
apply flows_to_antisym; auto.
Qed.
Lemma join_assoc :
forall l l' l'',
join (join l l') l'' = join l (join l' l'').
Proof.
destruct l; destruct l'; destruct l''; reflexivity.
Qed.
Lemma join_flows_to_join :
forall l l' ls ls',
flows_to l l' ->
flows_to ls ls' ->
flows_to (join l ls) (join l' ls').
Proof.
intros l l' ls ls' l_l'_flows_to ls_ls'_flows_to.
assert (flows_to l' (join l' ls')).
apply join_is_upper_bound.
assert (flows_to l (join l' ls')).
apply (flows_to_trans l l' (join l' ls')).
apply l_l'_flows_to.
apply H.
clear H.
assert (flows_to ls' (join l' ls')).
apply join_is_upper_bound.
assert (flows_to ls (join l' ls')).
apply (flows_to_trans ls ls' (join l' ls')).
apply ls_ls'_flows_to.
apply H.
clear H.
apply join_is_least_upper_bound.
apply H0.
apply H1.
Qed.