Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
stdpp
Commits
e4e27935
Commit
e4e27935
authored
4 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Comment about `SingletonMS` and reorganize a bit.
parent
fde7718b
No related branches found
No related tags found
1 merge request
!251
Introduce `SingletonMS` class for multiset singletons.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/base.v
+25
-16
25 additions, 16 deletions
theories/base.v
with
25 additions
and
16 deletions
theories/base.v
+
25
−
16
View file @
e4e27935
...
@@ -854,14 +854,6 @@ Definition union_list `{Empty A} `{Union A} : list A → A := fold_right (∪)
...
@@ -854,14 +854,6 @@ Definition union_list `{Empty A} `{Union A} : list A → A := fold_right (∪)
Global
Arguments
union_list
_
_
_
!
_
/
:
assert
.
Global
Arguments
union_list
_
_
_
!
_
/
:
assert
.
Notation
"⋃ l"
:=
(
union_list
l
)
(
at
level
20
,
format
"⋃ l"
)
:
stdpp_scope
.
Notation
"⋃ l"
:=
(
union_list
l
)
(
at
level
20
,
format
"⋃ l"
)
:
stdpp_scope
.
Class
DisjUnion
A
:=
disj_union
:
A
→
A
→
A
.
Global
Hint
Mode
DisjUnion
!
:
typeclass_instances
.
Instance
:
Params
(
@
disj_union
)
2
:=
{}
.
Infix
"⊎"
:=
disj_union
(
at
level
50
,
left
associativity
)
:
stdpp_scope
.
Notation
"(⊎)"
:=
disj_union
(
only
parsing
)
:
stdpp_scope
.
Notation
"( x ⊎.)"
:=
(
disj_union
x
)
(
only
parsing
)
:
stdpp_scope
.
Notation
"(.⊎ x )"
:=
(
λ
y
,
disj_union
y
x
)
(
only
parsing
)
:
stdpp_scope
.
Class
Intersection
A
:=
intersection
:
A
→
A
→
A
.
Class
Intersection
A
:=
intersection
:
A
→
A
→
A
.
Global
Hint
Mode
Intersection
!
:
typeclass_instances
.
Global
Hint
Mode
Intersection
!
:
typeclass_instances
.
Instance
:
Params
(
@
intersection
)
2
:=
{}
.
Instance
:
Params
(
@
intersection
)
2
:=
{}
.
...
@@ -888,14 +880,6 @@ Notation "{[ x ; y ; .. ; z ]}" :=
...
@@ -888,14 +880,6 @@ Notation "{[ x ; y ; .. ; z ]}" :=
(
union
.
.
(
union
(
singleton
x
)
(
singleton
y
))
.
.
(
singleton
z
))
(
union
.
.
(
union
(
singleton
x
)
(
singleton
y
))
.
.
(
singleton
z
))
(
at
level
1
)
:
stdpp_scope
.
(
at
level
1
)
:
stdpp_scope
.
Class
SingletonMS
A
B
:=
singletonMS
:
A
→
B
.
Global
Hint
Mode
SingletonMS
-
!
:
typeclass_instances
.
Instance
:
Params
(
@
singletonMS
)
3
:=
{}
.
Notation
"{[+ x +]}"
:=
(
singletonMS
x
)
(
at
level
1
)
:
stdpp_scope
.
Notation
"{[+ x ; y ; .. ; z +]}"
:=
(
disj_union
.
.
(
disj_union
(
singletonMS
x
)
(
singletonMS
y
))
.
.
(
singletonMS
z
))
(
at
level
1
)
:
stdpp_scope
.
Class
SubsetEq
A
:=
subseteq
:
relation
A
.
Class
SubsetEq
A
:=
subseteq
:
relation
A
.
Global
Hint
Mode
SubsetEq
!
:
typeclass_instances
.
Global
Hint
Mode
SubsetEq
!
:
typeclass_instances
.
Instance
:
Params
(
@
subseteq
)
2
:=
{}
.
Instance
:
Params
(
@
subseteq
)
2
:=
{}
.
...
@@ -934,6 +918,31 @@ Notation "X ⊆ Y ⊂ Z" := (X ⊆ Y ∧ Y ⊂ Z) (at level 70, Y at next level)
...
@@ -934,6 +918,31 @@ Notation "X ⊆ Y ⊂ Z" := (X ⊆ Y ∧ Y ⊂ Z) (at level 70, Y at next level)
Notation
"X ⊂ Y ⊆ Z"
:=
(
X
⊂
Y
∧
Y
⊆
Z
)
(
at
level
70
,
Y
at
next
level
)
:
stdpp_scope
.
Notation
"X ⊂ Y ⊆ Z"
:=
(
X
⊂
Y
∧
Y
⊆
Z
)
(
at
level
70
,
Y
at
next
level
)
:
stdpp_scope
.
Notation
"X ⊂ Y ⊂ Z"
:=
(
X
⊂
Y
∧
Y
⊂
Z
)
(
at
level
70
,
Y
at
next
level
)
:
stdpp_scope
.
Notation
"X ⊂ Y ⊂ Z"
:=
(
X
⊂
Y
∧
Y
⊂
Z
)
(
at
level
70
,
Y
at
next
level
)
:
stdpp_scope
.
(** We define type classes for multisets: disjoint union [⊎] and the multiset
singleton [{[+ _ +]}]. Multiset literals [{[+ x1; ..; xn +]}] are defined in
terms of iterated disjoint union [{[+ x1 +]} ⊎ .. ⊎ {[+ xn +]}], and are thus
different from set literals [{[ x1; ..; xn ]}], which use [∪].
Note that in principle we could reuse the set singleton [{[ _ ]}] for multisets,
and define [{[+ x1; ..; xn +]}] as [{[ x1 ]} ⊎ .. ⊎ {[ xn ]}]. However, this
would risk accidentally using [{[ x1; ..; xn ]}] for multisets (leading to
unexpected results) and lead to ambigious pretty printing for [{[+ x +]}]. *)
Class
DisjUnion
A
:=
disj_union
:
A
→
A
→
A
.
Global
Hint
Mode
DisjUnion
!
:
typeclass_instances
.
Instance
:
Params
(
@
disj_union
)
2
:=
{}
.
Infix
"⊎"
:=
disj_union
(
at
level
50
,
left
associativity
)
:
stdpp_scope
.
Notation
"(⊎)"
:=
disj_union
(
only
parsing
)
:
stdpp_scope
.
Notation
"( x ⊎.)"
:=
(
disj_union
x
)
(
only
parsing
)
:
stdpp_scope
.
Notation
"(.⊎ x )"
:=
(
λ
y
,
disj_union
y
x
)
(
only
parsing
)
:
stdpp_scope
.
Class
SingletonMS
A
B
:=
singletonMS
:
A
→
B
.
Global
Hint
Mode
SingletonMS
-
!
:
typeclass_instances
.
Instance
:
Params
(
@
singletonMS
)
3
:=
{}
.
Notation
"{[+ x +]}"
:=
(
singletonMS
x
)
(
at
level
1
)
:
stdpp_scope
.
Notation
"{[+ x ; y ; .. ; z +]}"
:=
(
disj_union
.
.
(
disj_union
(
singletonMS
x
)
(
singletonMS
y
))
.
.
(
singletonMS
z
))
(
at
level
1
)
:
stdpp_scope
.
Definition
option_to_set
`{
Singleton
A
C
,
Empty
C
}
(
mx
:
option
A
)
:
C
:=
Definition
option_to_set
`{
Singleton
A
C
,
Empty
C
}
(
mx
:
option
A
)
:
C
:=
match
mx
with
None
=>
∅
|
Some
x
=>
{[
x
]}
end
.
match
mx
with
None
=>
∅
|
Some
x
=>
{[
x
]}
end
.
Fixpoint
list_to_set
`{
Singleton
A
C
,
Empty
C
,
Union
C
}
(
l
:
list
A
)
:
C
:=
Fixpoint
list_to_set
`{
Singleton
A
C
,
Empty
C
,
Union
C
}
(
l
:
list
A
)
:
C
:=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment