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
3af97445
Commit
3af97445
authored
2 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Plain Diff
Merge branch 'robbert/bijective_finite' into 'master'
Improve `bijective_finite`. See merge request
!453
parents
2cf74f8b
9a50355b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!453
Improve `bijective_finite`.
Pipeline
#79349
passed
2 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
stdpp/finite.v
+14
-5
14 additions, 5 deletions
stdpp/finite.v
with
16 additions
and
5 deletions
CHANGELOG.md
+
2
−
0
View file @
3af97445
...
...
@@ -19,6 +19,8 @@ Coq 8.12 and 8.13 are no longer supported by this release.
-
Add lemmas
`Nat.mul_reg_{l,r}`
for cancellation of multiplication on
`nat`
.
(Names are analogous to the
`Z.`
lemmas for Coq's standard library.)
-
Rename
`map_preimage`
into
`map_preimg`
to be consistent with
`dom`
.
-
Improve
`bijective_finite`
: do not require an inverse, do not unnecessarily
remove duplicates.
The following
`sed`
script should perform most of the renaming
(on macOS, replace
`sed`
by
`gsed`
, installed via e.g.
`brew install gnu-sed`
).
...
...
This diff is collapsed.
Click to expand it.
stdpp/finite.v
+
14
−
5
View file @
3af97445
...
...
@@ -219,6 +219,11 @@ Section enc_finite.
Proof
.
unfold
card
.
simpl
.
by
rewrite
fmap_length
,
seq_length
.
Qed
.
End
enc_finite
.
(** If we have a surjection [f : A → B] and [A] is finite, then [B] is finite
too. The surjection [f] could map multiple [x : A] on the same [B], so we
need to remove duplicates in [enum]. If [f] is injective, we do not need to do that,
leading to a potentially faster implementation of [enum], see [bijective_finite]
below. *)
Section
surjective_finite
.
Context
`{
Finite
A
,
EqDecision
B
}
(
f
:
A
→
B
)
.
Context
`{
!
Surj
(
=
)
f
}
.
...
...
@@ -233,12 +238,16 @@ Section surjective_finite.
End
surjective_finite
.
Section
bijective_finite
.
Context
`{
Finite
A
,
EqDecision
B
}
(
f
:
A
→
B
)
(
g
:
B
→
A
)
.
Context
`{
!
Inj
(
=
)
(
=
)
f
,
!
Cancel
(
=
)
f
g
}
.
Context
`{
Finite
A
,
EqDecision
B
}
(
f
:
A
→
B
)
.
Context
`{
!
Inj
(
=
)
(
=
)
f
,
!
Surj
(
=
)
f
}
.
Definition
bijective_finite
:
Finite
B
:=
let
_
:=
cancel_surj
(
f
:=
f
)
(
g
:=
g
)
in
surjective_finite
f
.
Program
Definition
bijective_finite
:
Finite
B
:=
{|
enum
:=
f
<$>
enum
A
|}
.
Next
Obligation
.
apply
(
NoDup_fmap
f
),
NoDup_enum
.
Qed
.
Next
Obligation
.
intros
b
.
rewrite
elem_of_list_fmap
.
destruct
(
surj
f
b
)
.
eauto
using
elem_of_enum
.
Qed
.
End
bijective_finite
.
Global
Program
Instance
option_finite
`{
Finite
A
}
:
Finite
(
option
A
)
:=
...
...
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