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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Glen Mével
stdpp
Commits
64cafa57
Commit
64cafa57
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Minimal elements in a set.
parent
b29200a2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theories/collections.v
+31
-0
31 additions, 0 deletions
theories/collections.v
theories/fin_collections.v
+21
-0
21 additions, 0 deletions
theories/fin_collections.v
with
52 additions
and
0 deletions
theories/collections.v
+
31
−
0
View file @
64cafa57
...
...
@@ -993,3 +993,34 @@ Section seq_set.
seq_set
start
(
S
len
)
=
{[
start
+
len
]}
∪
seq_set
start
len
.
Proof
.
unfold_leibniz
.
apply
seq_set_S_union
.
Qed
.
End
seq_set
.
(** Mimimal elements *)
Definition
minimal
`{
ElemOf
A
C
}
(
R
:
relation
A
)
(
x
:
A
)
(
X
:
C
)
:
Prop
:=
∀
y
,
y
∈
X
→
R
y
x
→
y
=
x
.
Instance
:
Params
(
@
minimal
)
5
.
Section
minimal
.
Context
`{
SimpleCollection
A
C
}
{
R
:
relation
A
}
.
Global
Instance
minimal_proper
x
:
Proper
(
@
equiv
C
_
==>
iff
)
(
minimal
R
x
)
.
Proof
.
intros
X
X'
y
;
unfold
minimal
;
set_solver
.
Qed
.
Lemma
empty_minimal
x
:
minimal
R
x
∅.
Proof
.
unfold
minimal
;
set_solver
.
Qed
.
Lemma
singleton_minimal
x
:
minimal
R
x
{[
x
]}
.
Proof
.
unfold
minimal
;
set_solver
.
Qed
.
Lemma
singleton_minimal_not_above
y
x
:
¬
R
y
x
→
minimal
R
x
{[
y
]}
.
Proof
.
unfold
minimal
;
set_solver
.
Qed
.
Lemma
union_minimal
X
Y
x
:
minimal
R
x
X
→
minimal
R
x
Y
→
minimal
R
x
(
X
∪
Y
)
.
Proof
.
unfold
minimal
;
set_solver
.
Qed
.
Lemma
minimal_subseteq
X
Y
x
:
minimal
R
x
X
→
Y
⊆
X
→
minimal
R
x
Y
.
Proof
.
unfold
minimal
;
set_solver
.
Qed
.
Lemma
minimal_weaken
`{
!
StrictOrder
R
}
X
x
x'
:
minimal
R
x
X
→
R
x'
x
→
minimal
R
x'
X
.
Proof
.
intros
Hmin
?
y
??
.
assert
(
y
=
x
)
as
->
by
(
apply
(
Hmin
y
);
[
done
|
by
trans
x'
])
.
destruct
(
irreflexivity
R
x
)
.
by
trans
x'
.
Qed
.
End
minimal
.
This diff is collapsed.
Click to expand it.
theories/fin_collections.v
+
21
−
0
View file @
64cafa57
...
...
@@ -184,6 +184,27 @@ Lemma collection_fold_proper {B} (R : relation B) `{!Equivalence R}
Proper
((
≡
)
==>
R
)
(
collection_fold
f
b
:
C
→
B
)
.
Proof
.
intros
??
E
.
apply
(
foldr_permutation
R
f
b
);
auto
.
by
rewrite
E
.
Qed
.
Lemma
minimal_exists
`{
!
StrictOrder
R
,
∀
x
y
,
Decision
(
R
x
y
)}
(
X
:
C
)
:
X
≢
∅
→
∃
x
,
x
∈
X
∧
minimal
R
x
X
.
Proof
.
pattern
X
;
apply
collection_ind
;
clear
X
.
{
by
intros
X
X'
HX
;
setoid_rewrite
HX
.
}
{
done
.
}
intros
x
X
?
IH
Hemp
.
destruct
(
collection_choose_or_empty
X
)
as
[[
z
?]|
HX
]
.
{
destruct
IH
as
(
x'
&
Hx'
&
Hmin
);
[
set_solver
|]
.
destruct
(
decide
(
R
x
x'
))
.
-
exists
x
;
split
;
[
set_solver
|]
.
eauto
using
union_minimal
,
singleton_minimal
,
minimal_weaken
.
-
exists
x'
;
split
;
[
set_solver
|]
.
auto
using
union_minimal
,
singleton_minimal_not_above
.
}
exists
x
;
split
;
[
set_solver
|]
.
rewrite
HX
,
(
right_id
_
(
∪
))
.
apply
singleton_minimal
.
Qed
.
Lemma
minimal_exists_L
`{
!
LeibnizEquiv
C
,
!
StrictOrder
R
,
∀
x
y
,
Decision
(
R
x
y
)}
(
X
:
C
)
:
X
≠
∅
→
∃
x
,
x
∈
X
∧
minimal
R
x
X
.
Proof
.
unfold_leibniz
.
apply
minimal_exists
.
Qed
.
(** * Decision procedures *)
Global
Instance
set_Forall_dec
`
(
P
:
A
→
Prop
)
`{
∀
x
,
Decision
(
P
x
)}
X
:
Decision
(
set_Forall
P
X
)
|
100
.
...
...
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