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
3dce1fea
Commit
3dce1fea
authored
4 years ago
by
sarahzrf
Committed by
Robbert Krebbers
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added sig_finite (and elem_of_list_fmap_inj, proj1_inj_pi)
parent
370c0cf4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
theories/finite.v
+36
-0
36 additions, 0 deletions
theories/finite.v
theories/list.v
+8
-0
8 additions, 0 deletions
theories/list.v
theories/proof_irrel.v
+3
-0
3 additions, 0 deletions
theories/proof_irrel.v
with
47 additions
and
0 deletions
theories/finite.v
+
36
−
0
View file @
3dce1fea
...
@@ -361,3 +361,39 @@ Next Obligation.
...
@@ -361,3 +361,39 @@ Next Obligation.
Qed
.
Qed
.
Lemma
fin_card
n
:
card
(
fin
n
)
=
n
.
Lemma
fin_card
n
:
card
(
fin
n
)
=
n
.
Proof
.
unfold
card
;
simpl
.
induction
n
;
simpl
;
rewrite
?fmap_length
;
auto
.
Qed
.
Proof
.
unfold
card
;
simpl
.
induction
n
;
simpl
;
rewrite
?fmap_length
;
auto
.
Qed
.
Section
sig_finite
.
Context
{
A
}
(
P
:
A
→
Prop
)
`{
∀
x
,
Decision
(
P
x
)}
.
Fixpoint
list_filter_sig
(
l
:
list
A
)
:
list
(
sig
P
)
:=
match
l
with
|
[]
=>
[]
|
x
::
l
=>
match
decide
(
P
x
)
with
|
left
H
=>
x
↾
H
::
list_filter_sig
l
|
_
=>
list_filter_sig
l
end
end
.
Lemma
list_filter_sig_filter
(
l
:
list
A
)
:
proj1_sig
<$>
list_filter_sig
l
=
filter
P
l
.
Proof
.
induction
l
as
[|
a
l
IH
];
[
done
|]
.
simpl
;
rewrite
filter_cons
.
destruct
(
decide
_);
csimpl
;
by
rewrite
IH
.
Qed
.
Context
`{
Finite
A
}
`{
∀
x
,
ProofIrrel
(
P
x
)}
.
Global
Program
Instance
sig_finite
:
Finite
(
sig
P
)
:=
{|
enum
:=
list_filter_sig
(
enum
A
)
|}
.
Next
Obligation
.
eapply
NoDup_fmap_1
.
rewrite
list_filter_sig_filter
.
apply
NoDup_filter
,
NoDup_enum
.
Qed
.
Next
Obligation
.
intros
p
.
apply
(
elem_of_list_fmap_2_inj
proj1_sig
)
.
rewrite
list_filter_sig_filter
,
elem_of_list_filter
.
split
;
[
by
destruct
p
|
apply
elem_of_enum
]
.
Qed
.
Lemma
sig_card
:
card
(
sig
P
)
=
length
(
filter
P
(
enum
A
))
.
Proof
.
by
rewrite
<-
list_filter_sig_filter
,
fmap_length
.
Qed
.
End
sig_finite
.
This diff is collapsed.
Click to expand it.
theories/list.v
+
8
−
0
View file @
3dce1fea
...
@@ -3474,6 +3474,14 @@ Section fmap.
...
@@ -3474,6 +3474,14 @@ Section fmap.
Proof
.
Proof
.
naive_solver
eauto
using
elem_of_list_fmap_1_alt
,
elem_of_list_fmap_2
.
naive_solver
eauto
using
elem_of_list_fmap_1_alt
,
elem_of_list_fmap_2
.
Qed
.
Qed
.
Lemma
elem_of_list_fmap_2_inj
`{
!
Inj
(
=
)
(
=
)
f
}
l
x
:
f
x
∈
f
<$>
l
→
x
∈
l
.
Proof
.
intros
(
y
,
(
E
,
I
))
%
elem_of_list_fmap_2
.
by
rewrite
(
inj
f
)
in
I
.
Qed
.
Lemma
elem_of_list_fmap_inj
`{
!
Inj
(
=
)
(
=
)
f
}
l
x
:
f
x
∈
f
<$>
l
↔
x
∈
l
.
Proof
.
naive_solver
eauto
using
elem_of_list_fmap_1
,
elem_of_list_fmap_2_inj
.
Qed
.
Lemma
NoDup_fmap_1
l
:
NoDup
(
f
<$>
l
)
→
NoDup
l
.
Lemma
NoDup_fmap_1
l
:
NoDup
(
f
<$>
l
)
→
NoDup
l
.
Proof
.
Proof
.
...
...
This diff is collapsed.
Click to expand it.
theories/proof_irrel.v
+
3
−
0
View file @
3dce1fea
...
@@ -38,6 +38,9 @@ Proof.
...
@@ -38,6 +38,9 @@ Proof.
destruct
x
as
[
x
Hx
],
y
as
[
y
Hy
];
simpl
;
intros
;
subst
.
destruct
x
as
[
x
Hx
],
y
as
[
y
Hy
];
simpl
;
intros
;
subst
.
f_equal
.
apply
proof_irrel
.
f_equal
.
apply
proof_irrel
.
Qed
.
Qed
.
Instance
proj1_sig_inj
`
(
P
:
A
→
Prop
)
`{
∀
x
,
ProofIrrel
(
P
x
)}
:
Inj
(
=
)
(
=
)
(
proj1_sig
(
P
:=
P
))
.
Proof
.
intros
??
.
apply
(
sig_eq_pi
P
)
.
Qed
.
Lemma
exists_proj1_pi
`
(
P
:
A
→
Prop
)
`{
∀
x
,
ProofIrrel
(
P
x
)}
Lemma
exists_proj1_pi
`
(
P
:
A
→
Prop
)
`{
∀
x
,
ProofIrrel
(
P
x
)}
(
x
:
sig
P
)
p
:
`
x
↾
p
=
x
.
(
x
:
sig
P
)
p
:
`
x
↾
p
=
x
.
Proof
.
apply
(
sig_eq_pi
_);
reflexivity
.
Qed
.
Proof
.
apply
(
sig_eq_pi
_);
reflexivity
.
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