Module theories.CapSets
Require
Import
Coq.Lists.List
.
Require
Import
Cap
.
Require
Import
Notations
.
Definition
capset
:=
list
ecap
.
Definition
compatible_set
(λ
s
λ
s
':
capset
) :
Prop
:=
forall
λ λ',
In
λ λ
s
->
In
λ' λ
s
' ->
compatible
λ λ'.
Fixpoint
combine_one
(λ
s
:
capset
) (κ:
cap
) :
capset
:=
match
λ
s
with
| λ0::
tail
=>
match
adapt
read
λ0 κ,
adapt
extract
λ0 κ
with
|
Some
λ
r
,
Some
λ
e
=> λ
r
:: λ
e
::
combine_one
tail
κ
|
Some
λ
r
,
None
=> λ
r
::
combine_one
tail
κ
|
None
,
Some
λ
e
=> λ
e
::
combine_one
tail
κ
|
None
,
None
=>
combine_one
tail
κ
end
|
nil
=>
nil
end
.
Definition
combine
(λ
s
:
capset
) (κ
s
:
list
cap
) :
capset
:=
fold_left
combine_one
κ
s
λ
s
.
Instance
blob_combine_one
:
Blob
capset
cap
:= {
blob
:=
combine_one
}.
Instance
blob_combine
:
Blob
capset
(
list
cap
) := {
blob
:=
combine
}.