Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Iris
stdpp
Commits
4b5d254e
Commit
4b5d254e
authored
Oct 27, 2017
by
Jacques-Henri Jourdan
Browse files
Notation for disjointness: replace ⊥ with ##, so that ⊥ can be used for bottom.
parent
f41a35e8
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
theories/base.v
View file @
4b5d254e
...
...
@@ -660,7 +660,7 @@ Arguments sig_map _ _ _ _ _ _ !_ / : assert.
(** We define operational type classes for the traditional operations and
relations on collections: the empty collection [∅], the union [(∪)],
intersection [(∩)], and difference [(∖)], the singleton [{[_]}], the subset
[(⊆)] and element of [(∈)] relation, and disjointess [(
⊥
)]. *)
[(⊆)] and element of [(∈)] relation, and disjointess [(
##
)]. *)
Class
Empty
A
:
=
empty
:
A
.
Hint
Mode
Empty
!
:
typeclass_instances
.
Notation
"∅"
:
=
empty
:
C_scope
.
...
...
@@ -779,56 +779,56 @@ Notation "( x ∉)" := (λ X, x ∉ X) (only parsing) : C_scope.
Notation
"(∉ X )"
:
=
(
λ
x
,
x
∉
X
)
(
only
parsing
)
:
C_scope
.
Class
Disjoint
A
:
=
disjoint
:
A
→
A
→
Prop
.
Hint
Mode
Disjoint
!
:
typeclass_instances
.
Hint
Mode
Disjoint
!
:
typeclass_instances
.
Instance
:
Params
(@
disjoint
)
2
.
Infix
"
⊥
"
:
=
disjoint
(
at
level
70
)
:
C_scope
.
Notation
"(
⊥
)"
:
=
disjoint
(
only
parsing
)
:
C_scope
.
Notation
"( X
⊥
.)"
:
=
(
disjoint
X
)
(
only
parsing
)
:
C_scope
.
Notation
"(.
⊥
X )"
:
=
(
λ
Y
,
Y
⊥
X
)
(
only
parsing
)
:
C_scope
.
Infix
"
⊥
*"
:
=
(
Forall2
(
⊥
))
(
at
level
70
)
:
C_scope
.
Notation
"(
⊥
*)"
:
=
(
Forall2
(
⊥
))
(
only
parsing
)
:
C_scope
.
Infix
"
⊥
**"
:
=
(
Forall2
(
⊥
*))
(
at
level
70
)
:
C_scope
.
Infix
"
⊥
1*"
:
=
(
Forall2
(
λ
p
q
,
p
.
1
⊥
q
.
1
))
(
at
level
70
)
:
C_scope
.
Infix
"
⊥
2*"
:
=
(
Forall2
(
λ
p
q
,
p
.
2
⊥
q
.
2
))
(
at
level
70
)
:
C_scope
.
Infix
"
⊥
1**"
:
=
(
Forall2
(
λ
p
q
,
p
.
1
⊥
*
q
.
1
))
(
at
level
70
)
:
C_scope
.
Infix
"
⊥
2**"
:
=
(
Forall2
(
λ
p
q
,
p
.
2
⊥
*
q
.
2
))
(
at
level
70
)
:
C_scope
.
Hint
Extern
0
(
_
⊥
_
)
=>
symmetry
;
eassumption
.
Hint
Extern
0
(
_
⊥
*
_
)
=>
symmetry
;
eassumption
.
Infix
"
##
"
:
=
disjoint
(
at
level
70
)
:
C_scope
.
Notation
"(
##
)"
:
=
disjoint
(
only
parsing
)
:
C_scope
.
Notation
"( X
##
.)"
:
=
(
disjoint
X
)
(
only
parsing
)
:
C_scope
.
Notation
"(.
##
X )"
:
=
(
λ
Y
,
Y
##
X
)
(
only
parsing
)
:
C_scope
.
Infix
"
##
*"
:
=
(
Forall2
(
##
))
(
at
level
70
)
:
C_scope
.
Notation
"(
##
*)"
:
=
(
Forall2
(
##
))
(
only
parsing
)
:
C_scope
.
Infix
"
##
**"
:
=
(
Forall2
(
##
*))
(
at
level
70
)
:
C_scope
.
Infix
"
##
1*"
:
=
(
Forall2
(
λ
p
q
,
p
.
1
##
q
.
1
))
(
at
level
70
)
:
C_scope
.
Infix
"
##
2*"
:
=
(
Forall2
(
λ
p
q
,
p
.
2
##
q
.
2
))
(
at
level
70
)
:
C_scope
.
Infix
"
##
1**"
:
=
(
Forall2
(
λ
p
q
,
p
.
1
##
*
q
.
1
))
(
at
level
70
)
:
C_scope
.
Infix
"
##
2**"
:
=
(
Forall2
(
λ
p
q
,
p
.
2
##
*
q
.
2
))
(
at
level
70
)
:
C_scope
.
Hint
Extern
0
(
_
##
_
)
=>
symmetry
;
eassumption
.
Hint
Extern
0
(
_
##
*
_
)
=>
symmetry
;
eassumption
.
Class
DisjointE
E
A
:
=
disjointE
:
E
→
A
→
A
→
Prop
.
Hint
Mode
DisjointE
-
!
:
typeclass_instances
.
Instance
:
Params
(@
disjointE
)
4
.
Notation
"X
⊥
{ Γ } Y"
:
=
(
disjointE
Γ
X
Y
)
(
at
level
70
,
format
"X
⊥
{ Γ } Y"
)
:
C_scope
.
Notation
"(
⊥
{ Γ } )"
:
=
(
disjointE
Γ
)
(
only
parsing
,
Γ
at
level
1
)
:
C_scope
.
Notation
"Xs
⊥
{ Γ }* Ys"
:
=
(
Forall2
(
⊥
{
Γ
})
Xs
Ys
)
(
at
level
70
,
format
"Xs
⊥
{ Γ }* Ys"
)
:
C_scope
.
Notation
"(
⊥
{ Γ }* )"
:
=
(
Forall2
(
⊥
{
Γ
}))
Notation
"X
##
{ Γ } Y"
:
=
(
disjointE
Γ
X
Y
)
(
at
level
70
,
format
"X
##
{ Γ } Y"
)
:
C_scope
.
Notation
"(
##
{ Γ } )"
:
=
(
disjointE
Γ
)
(
only
parsing
,
Γ
at
level
1
)
:
C_scope
.
Notation
"Xs
##
{ Γ }* Ys"
:
=
(
Forall2
(
##
{
Γ
})
Xs
Ys
)
(
at
level
70
,
format
"Xs
##
{ Γ }* Ys"
)
:
C_scope
.
Notation
"(
##
{ Γ }* )"
:
=
(
Forall2
(
##
{
Γ
}))
(
only
parsing
,
Γ
at
level
1
)
:
C_scope
.
Notation
"X
⊥
{ Γ1 , Γ2 , .. , Γ3 } Y"
:
=
(
disjoint
(
pair
..
(
Γ
1
,
Γ
2
)
..
Γ
3
)
X
Y
)
(
at
level
70
,
format
"X
⊥
{ Γ1 , Γ2 , .. , Γ3 } Y"
)
:
C_scope
.
Notation
"Xs
⊥
{ Γ1 , Γ2 , .. , Γ3 }* Ys"
:
=
Notation
"X
##
{ Γ1 , Γ2 , .. , Γ3 } Y"
:
=
(
disjoint
(
pair
..
(
Γ
1
,
Γ
2
)
..
Γ
3
)
X
Y
)
(
at
level
70
,
format
"X
##
{ Γ1 , Γ2 , .. , Γ3 } Y"
)
:
C_scope
.
Notation
"Xs
##
{ Γ1 , Γ2 , .. , Γ3 }* Ys"
:
=
(
Forall2
(
disjoint
(
pair
..
(
Γ
1
,
Γ
2
)
..
Γ
3
))
Xs
Ys
)
(
at
level
70
,
format
"Xs
⊥
{ Γ1 , Γ2 , .. , Γ3 }* Ys"
)
:
C_scope
.
Hint
Extern
0
(
_
⊥
{
_
}
_
)
=>
symmetry
;
eassumption
.
(
at
level
70
,
format
"Xs
##
{ Γ1 , Γ2 , .. , Γ3 }* Ys"
)
:
C_scope
.
Hint
Extern
0
(
_
##
{
_
}
_
)
=>
symmetry
;
eassumption
.
Class
DisjointList
A
:
=
disjoint_list
:
list
A
→
Prop
.
Hint
Mode
DisjointList
!
:
typeclass_instances
.
Instance
:
Params
(@
disjoint_list
)
2
.
Notation
"
⊥
Xs"
:
=
(
disjoint_list
Xs
)
(
at
level
20
,
format
"
⊥
Xs"
)
:
C_scope
.
Notation
"
##
Xs"
:
=
(
disjoint_list
Xs
)
(
at
level
20
,
format
"
##
Xs"
)
:
C_scope
.
Section
disjoint_list
.
Context
`
{
Disjoint
A
,
Union
A
,
Empty
A
}.
Implicit
Types
X
:
A
.
Inductive
disjoint_list_default
:
DisjointList
A
:
=
|
disjoint_nil_2
:
⊥
(@
nil
A
)
|
disjoint_cons_2
(
X
:
A
)
(
Xs
:
list
A
)
:
X
⊥
⋃
Xs
→
⊥
Xs
→
⊥
(
X
::
Xs
).
|
disjoint_nil_2
:
##
(@
nil
A
)
|
disjoint_cons_2
(
X
:
A
)
(
Xs
:
list
A
)
:
X
##
⋃
Xs
→
##
Xs
→
##
(
X
::
Xs
).
Global
Existing
Instance
disjoint_list_default
.
Lemma
disjoint_list_nil
:
⊥
@
nil
A
↔
True
.
Lemma
disjoint_list_nil
:
##
@
nil
A
↔
True
.
Proof
.
split
;
constructor
.
Qed
.
Lemma
disjoint_list_cons
X
Xs
:
⊥
(
X
::
Xs
)
↔
X
⊥
⋃
Xs
∧
⊥
Xs
.
Lemma
disjoint_list_cons
X
Xs
:
##
(
X
::
Xs
)
↔
X
##
⋃
Xs
∧
##
Xs
.
Proof
.
split
.
inversion_clear
1
;
auto
.
intros
[??].
constructor
;
auto
.
Qed
.
End
disjoint_list
.
...
...
theories/collections.v
View file @
4b5d254e
...
...
@@ -186,7 +186,7 @@ Section set_unfold_simple.
Qed
.
Global
Instance
set_unfold_disjoint
(
P
Q
:
A
→
Prop
)
X
Y
:
(
∀
x
,
SetUnfold
(
x
∈
X
)
(
P
x
))
→
(
∀
x
,
SetUnfold
(
x
∈
Y
)
(
Q
x
))
→
SetUnfold
(
X
⊥
Y
)
(
∀
x
,
P
x
→
Q
x
→
False
).
SetUnfold
(
X
##
Y
)
(
∀
x
,
P
x
→
Q
x
→
False
).
Proof
.
constructor
.
unfold
disjoint
,
collection_disjoint
.
naive_solver
.
Qed
.
Context
`
{!
LeibnizEquiv
C
}.
...
...
@@ -371,9 +371,9 @@ Section simple_collection.
Lemma
empty_union
X
Y
:
X
∪
Y
≡
∅
↔
X
≡
∅
∧
Y
≡
∅
.
Proof
.
set_solver
.
Qed
.
Lemma
union_cancel_l
X
Y
Z
:
Z
⊥
X
→
Z
⊥
Y
→
Z
∪
X
≡
Z
∪
Y
→
X
≡
Y
.
Lemma
union_cancel_l
X
Y
Z
:
Z
##
X
→
Z
##
Y
→
Z
∪
X
≡
Z
∪
Y
→
X
≡
Y
.
Proof
.
set_solver
.
Qed
.
Lemma
union_cancel_r
X
Y
Z
:
X
⊥
Z
→
Y
⊥
Z
→
X
∪
Z
≡
Y
∪
Z
→
X
≡
Y
.
Lemma
union_cancel_r
X
Y
Z
:
X
##
Z
→
Y
##
Z
→
X
∪
Z
≡
Y
∪
Z
→
X
≡
Y
.
Proof
.
set_solver
.
Qed
.
(** Empty *)
...
...
@@ -405,22 +405,22 @@ Section simple_collection.
Proof
.
by
rewrite
elem_of_singleton
.
Qed
.
(** Disjointness *)
Lemma
elem_of_disjoint
X
Y
:
X
⊥
Y
↔
∀
x
,
x
∈
X
→
x
∈
Y
→
False
.
Lemma
elem_of_disjoint
X
Y
:
X
##
Y
↔
∀
x
,
x
∈
X
→
x
∈
Y
→
False
.
Proof
.
done
.
Qed
.
Global
Instance
disjoint_sym
:
Symmetric
(@
disjoint
C
_
).
Proof
.
intros
X
Y
.
set_solver
.
Qed
.
Lemma
disjoint_empty_l
Y
:
∅
⊥
Y
.
Lemma
disjoint_empty_l
Y
:
∅
##
Y
.
Proof
.
set_solver
.
Qed
.
Lemma
disjoint_empty_r
X
:
X
⊥
∅
.
Lemma
disjoint_empty_r
X
:
X
##
∅
.
Proof
.
set_solver
.
Qed
.
Lemma
disjoint_singleton_l
x
Y
:
{[
x
]}
⊥
Y
↔
x
∉
Y
.
Lemma
disjoint_singleton_l
x
Y
:
{[
x
]}
##
Y
↔
x
∉
Y
.
Proof
.
set_solver
.
Qed
.
Lemma
disjoint_singleton_r
y
X
:
X
⊥
{[
y
]}
↔
y
∉
X
.
Lemma
disjoint_singleton_r
y
X
:
X
##
{[
y
]}
↔
y
∉
X
.
Proof
.
set_solver
.
Qed
.
Lemma
disjoint_union_l
X1
X2
Y
:
X1
∪
X2
⊥
Y
↔
X1
⊥
Y
∧
X2
⊥
Y
.
Lemma
disjoint_union_l
X1
X2
Y
:
X1
∪
X2
##
Y
↔
X1
##
Y
∧
X2
##
Y
.
Proof
.
set_solver
.
Qed
.
Lemma
disjoint_union_r
X
Y1
Y2
:
X
⊥
Y1
∪
Y2
↔
X
⊥
Y1
∧
X
⊥
Y2
.
Lemma
disjoint_union_r
X
Y1
Y2
:
X
##
Y1
∪
Y2
↔
X
##
Y1
∧
X
##
Y2
.
Proof
.
set_solver
.
Qed
.
(** Big unions *)
...
...
@@ -494,9 +494,9 @@ Section simple_collection.
Lemma
empty_union_L
X
Y
:
X
∪
Y
=
∅
↔
X
=
∅
∧
Y
=
∅
.
Proof
.
unfold_leibniz
.
apply
empty_union
.
Qed
.
Lemma
union_cancel_l_L
X
Y
Z
:
Z
⊥
X
→
Z
⊥
Y
→
Z
∪
X
=
Z
∪
Y
→
X
=
Y
.
Lemma
union_cancel_l_L
X
Y
Z
:
Z
##
X
→
Z
##
Y
→
Z
∪
X
=
Z
∪
Y
→
X
=
Y
.
Proof
.
unfold_leibniz
.
apply
union_cancel_l
.
Qed
.
Lemma
union_cancel_r_L
X
Y
Z
:
X
⊥
Z
→
Y
⊥
Z
→
X
∪
Z
=
Y
∪
Z
→
X
=
Y
.
Lemma
union_cancel_r_L
X
Y
Z
:
X
##
Z
→
Y
##
Z
→
X
∪
Z
=
Y
∪
Z
→
X
=
Y
.
Proof
.
unfold_leibniz
.
apply
union_cancel_r
.
Qed
.
(** Empty *)
...
...
@@ -618,7 +618,7 @@ Section collection.
Proof
.
set_solver
.
Qed
.
Lemma
difference_intersection_distr_l
X
Y
Z
:
(
X
∩
Y
)
∖
Z
≡
X
∖
Z
∩
Y
∖
Z
.
Proof
.
set_solver
.
Qed
.
Lemma
difference_disjoint
X
Y
:
X
⊥
Y
→
X
∖
Y
≡
X
.
Lemma
difference_disjoint
X
Y
:
X
##
Y
→
X
∖
Y
≡
X
.
Proof
.
set_solver
.
Qed
.
Lemma
difference_mono
X1
X2
Y1
Y2
:
...
...
@@ -630,7 +630,7 @@ Section collection.
Proof
.
set_solver
.
Qed
.
(** Disjointness *)
Lemma
disjoint_intersection
X
Y
:
X
⊥
Y
↔
X
∩
Y
≡
∅
.
Lemma
disjoint_intersection
X
Y
:
X
##
Y
↔
X
∩
Y
≡
∅
.
Proof
.
set_solver
.
Qed
.
Section
leibniz
.
...
...
@@ -683,11 +683,11 @@ Section collection.
Lemma
difference_intersection_distr_l_L
X
Y
Z
:
(
X
∩
Y
)
∖
Z
=
X
∖
Z
∩
Y
∖
Z
.
Proof
.
unfold_leibniz
.
apply
difference_intersection_distr_l
.
Qed
.
Lemma
difference_disjoint_L
X
Y
:
X
⊥
Y
→
X
∖
Y
=
X
.
Lemma
difference_disjoint_L
X
Y
:
X
##
Y
→
X
∖
Y
=
X
.
Proof
.
unfold_leibniz
.
apply
difference_disjoint
.
Qed
.
(** Disjointness *)
Lemma
disjoint_intersection_L
X
Y
:
X
⊥
Y
↔
X
∩
Y
=
∅
.
Lemma
disjoint_intersection_L
X
Y
:
X
##
Y
↔
X
∩
Y
=
∅
.
Proof
.
unfold_leibniz
.
apply
disjoint_intersection
.
Qed
.
End
leibniz
.
...
...
@@ -707,7 +707,7 @@ Section collection.
intros
x
.
rewrite
!
elem_of_union
;
rewrite
elem_of_difference
.
split
;
[
|
destruct
(
decide
(
x
∈
Y
))
]
;
intuition
.
Qed
.
Lemma
subseteq_disjoint_union
X
Y
:
X
⊆
Y
↔
∃
Z
,
Y
≡
X
∪
Z
∧
X
⊥
Z
.
Lemma
subseteq_disjoint_union
X
Y
:
X
⊆
Y
↔
∃
Z
,
Y
≡
X
∪
Z
∧
X
##
Z
.
Proof
.
split
;
[|
set_solver
].
exists
(
Y
∖
X
)
;
split
;
[
auto
using
union_difference
|
set_solver
].
...
...
@@ -732,7 +732,7 @@ Section collection.
Proof
.
unfold_leibniz
.
apply
non_empty_difference
.
Qed
.
Lemma
empty_difference_subseteq_L
X
Y
:
X
∖
Y
=
∅
→
X
⊆
Y
.
Proof
.
unfold_leibniz
.
apply
empty_difference_subseteq
.
Qed
.
Lemma
subseteq_disjoint_union_L
X
Y
:
X
⊆
Y
↔
∃
Z
,
Y
=
X
∪
Z
∧
X
⊥
Z
.
Lemma
subseteq_disjoint_union_L
X
Y
:
X
⊆
Y
↔
∃
Z
,
Y
=
X
∪
Z
∧
X
##
Z
.
Proof
.
unfold_leibniz
.
apply
subseteq_disjoint_union
.
Qed
.
Lemma
singleton_union_difference_L
X
Y
x
:
{[
x
]}
∪
(
X
∖
Y
)
=
({[
x
]}
∪
X
)
∖
(
Y
∖
{[
x
]}).
...
...
@@ -1052,7 +1052,7 @@ Section seq_set.
Qed
.
Lemma
seq_set_S_disjoint
start
len
:
{[
start
+
len
]}
⊥
seq_set
(
C
:
=
C
)
start
len
.
{[
start
+
len
]}
##
seq_set
(
C
:
=
C
)
start
len
.
Proof
.
intros
x
.
rewrite
elem_of_singleton
,
elem_of_seq_set
.
omega
.
Qed
.
Lemma
seq_set_S_union
start
len
:
...
...
theories/fin_collections.v
View file @
4b5d254e
...
...
@@ -122,7 +122,7 @@ Proof.
-
set_solver
.
Qed
.
Lemma
size_union
X
Y
:
X
⊥
Y
→
size
(
X
∪
Y
)
=
size
X
+
size
Y
.
Lemma
size_union
X
Y
:
X
##
Y
→
size
(
X
∪
Y
)
=
size
X
+
size
Y
.
Proof
.
intros
.
unfold
size
,
collection_size
.
simpl
.
rewrite
<-
app_length
.
apply
Permutation_length
,
NoDup_Permutation
.
...
...
theories/fin_map_dom.v
View file @
4b5d254e
...
...
@@ -81,14 +81,14 @@ Proof. rewrite not_elem_of_dom. apply delete_partial_alter. Qed.
Lemma
delete_insert_dom
{
A
}
(
m
:
M
A
)
i
x
:
i
∉
dom
D
m
→
delete
i
(<[
i
:
=
x
]>
m
)
=
m
.
Proof
.
rewrite
not_elem_of_dom
.
apply
delete_insert
.
Qed
.
Lemma
map_disjoint_dom
{
A
}
(
m1
m2
:
M
A
)
:
m1
⊥
ₘ
m2
↔
dom
D
m1
⊥
dom
D
m2
.
Lemma
map_disjoint_dom
{
A
}
(
m1
m2
:
M
A
)
:
m1
##
ₘ
m2
↔
dom
D
m1
##
dom
D
m2
.
Proof
.
rewrite
map_disjoint_spec
,
elem_of_disjoint
.
setoid_rewrite
elem_of_dom
.
unfold
is_Some
.
naive_solver
.
Qed
.
Lemma
map_disjoint_dom_1
{
A
}
(
m1
m2
:
M
A
)
:
m1
⊥
ₘ
m2
→
dom
D
m1
⊥
dom
D
m2
.
Lemma
map_disjoint_dom_1
{
A
}
(
m1
m2
:
M
A
)
:
m1
##
ₘ
m2
→
dom
D
m1
##
dom
D
m2
.
Proof
.
apply
map_disjoint_dom
.
Qed
.
Lemma
map_disjoint_dom_2
{
A
}
(
m1
m2
:
M
A
)
:
dom
D
m1
⊥
dom
D
m2
→
m1
⊥
ₘ
m2
.
Lemma
map_disjoint_dom_2
{
A
}
(
m1
m2
:
M
A
)
:
dom
D
m1
##
dom
D
m2
→
m1
##
ₘ
m2
.
Proof
.
apply
map_disjoint_dom
.
Qed
.
Lemma
dom_union
{
A
}
(
m1
m2
:
M
A
)
:
dom
D
(
m1
∪
m2
)
≡
dom
D
m1
∪
dom
D
m2
.
Proof
.
...
...
theories/fin_maps.v
View file @
4b5d254e
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment