intros until o.
cut
match fsecmat (secmat s) o with
| Some y => set_In (o, y) (secmat s)
| None => ~ set_In o (DOM OBJeq_dec (secmat s))
end.
unfold close_sm in |- *.
elim (fsecmat (secmat s) o); intros.
elim (set_remove SUBeq_dec Sub (ActReaders a));
elim (set_remove SUBeq_dec Sub (ActWriters a)).
replace (fsecmat (set_remove SECMATeq_dec (o, a) (secmat s)) o) with
(None (A:=ReadersWriters)).
auto.
symmetry  in |- *; unfold fsecmat in |- *; unfold FuncPre5 in H0; auto.
intros.
replace
(fsecmat
(set_add SECMATeq_dec (o, NEWRW Sub o a)
(set_remove SECMATeq_dec (o, a) (secmat s))) o) with
(Some (NEWRW Sub o a)).
unfold NEWRW in |- *; simpl in |- *; split; apply Set_remove1.
unfold fsecmat in |- *; apply AddEq1.
auto.
intros;
replace
(fsecmat
(set_add SECMATeq_dec (o, NEWRW Sub o a)
(set_remove SECMATeq_dec (o, a) (secmat s))) o) with
(Some (NEWRW Sub o a)).
unfold NEWRW in |- *; simpl in |- *; split; apply Set_remove1.
unfold fsecmat in |- *; apply AddEq1.
auto.
intros;
replace
(fsecmat
(set_add SECMATeq_dec (o, NEWRW Sub o a)
(set_remove SECMATeq_dec (o, a) (secmat s))) o) with
(Some (NEWRW Sub o a)).
unfold NEWRW in |- *; simpl in |- *; split; apply Set_remove1.
unfold fsecmat in |- *; apply AddEq1.
auto.
tauto.
unfold fsecmat in |- *; apply DOMFuncRel4.
Qed.

Lemma Close_smCorr2 :
forall (s : SFSstate) (Sub u0 : SUBJECT) (o : OBJECT),
FuncPre5 s ->
match fsecmat (secmat s) o with
| Some y => set_In Sub (set_union SUBeq_dec (ActReaders y) (ActWriters y))
| None => False
end ->
match fsecmat (close_sm s Sub o) o, fsecmat (secmat s) o with
| _, None => False
| None, Some z => True
| Some y, Some z =>
(set_In u0 (ActReaders y) -> set_In u0 (ActReaders z)) /\
(set_In u0 (ActWriters y) -> set_In u0 (ActWriters z))
end.