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
Terraform modules
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
Adam
stdpp
Commits
407d8414
Commit
407d8414
authored
3 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
relate size of map to size of its domain
parent
608a079a
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/fin_map_dom.v
+17
-0
17 additions, 0 deletions
theories/fin_map_dom.v
theories/fin_sets.v
+16
-0
16 additions, 0 deletions
theories/fin_sets.v
with
33 additions
and
0 deletions
theories/fin_map_dom.v
+
17
−
0
View file @
407d8414
...
...
@@ -165,6 +165,23 @@ Proof.
-
simpl
.
by
rewrite
dom_insert
,
IH
.
Qed
.
(** Alternative definition of [dom] in terms of [map_to_list]. *)
Lemma
dom_alt
{
A
}
(
m
:
M
A
)
:
dom
D
m
≡
list_to_set
(
map_to_list
m
).
*
1
.
Proof
.
rewrite
<-
(
list_to_map_to_list
m
)
at
1
.
rewrite
dom_list_to_map
.
done
.
Qed
.
Lemma
size_dom
`{
!
Elements
K
D
,
!
FinSet
K
D
}
{
A
}
(
m
:
M
A
)
:
size
(
dom
D
m
)
=
size
m
.
Proof
.
rewrite
dom_alt
,
list_to_set_size
.
2
:{
apply
NoDup_fst_map_to_list
.
}
unfold
size
,
map_size
.
rewrite
fmap_length
.
done
.
Qed
.
Lemma
dom_singleton_inv
{
A
}
(
m
:
M
A
)
i
:
dom
D
m
≡
{[
i
]}
→
∃
x
,
m
=
{[
i
:=
x
]}
.
Proof
.
...
...
This diff is collapsed.
Click to expand it.
theories/fin_sets.v
+
16
−
0
View file @
407d8414
...
...
@@ -119,6 +119,15 @@ Proof. intros ?. rewrite elem_of_list_to_set. apply elem_of_elements. Qed.
Lemma
list_to_set_elements_L
`{
!
LeibnizEquiv
C
}
X
:
list_to_set
(
elements
X
)
=
X
.
Proof
.
unfold_leibniz
.
apply
list_to_set_elements
.
Qed
.
Lemma
elements_list_to_set
l
:
NoDup
l
→
elements
(
list_to_set
(
C
:=
C
)
l
)
≡
ₚ
l
.
Proof
.
intros
Hl
.
induction
Hl
.
{
rewrite
list_to_set_nil
.
rewrite
elements_empty
.
done
.
}
rewrite
list_to_set_cons
,
elements_disj_union
by
set_solver
.
rewrite
elements_singleton
.
apply
Permutation_skip
.
done
.
Qed
.
(** * The [size] operation *)
Global
Instance
set_size_proper
:
Proper
((
≡
)
==>
(
=
))
(
@
size
C
_)
.
Proof
.
intros
??
E
.
apply
Permutation_length
.
by
rewrite
E
.
Qed
.
...
...
@@ -194,6 +203,13 @@ Proof.
by
apply
size_non_empty_iff
,
non_empty_difference
.
Qed
.
Lemma
list_to_set_size
l
:
NoDup
l
→
size
(
list_to_set
(
C
:=
C
)
l
)
=
length
l
.
Proof
.
intros
Hl
.
unfold
size
,
set_size
.
simpl
.
rewrite
elements_list_to_set
;
done
.
Qed
.
(** * Induction principles *)
Lemma
set_wf
:
wf
(
⊂@
{
C
})
.
Proof
.
apply
(
wf_projected
(
<
)
size
);
auto
using
subset_size
,
lt_wf
.
Qed
.
...
...
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