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
bb8ce569
Commit
bb8ce569
authored
4 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Tweak `multiset_simplify_singletons` to avoid needless case-splits.
parent
8cf6ac9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/gmultiset.v
+14
-4
14 additions, 4 deletions
theories/gmultiset.v
with
14 additions
and
4 deletions
theories/gmultiset.v
+
14
−
4
View file @
bb8ce569
...
...
@@ -225,8 +225,8 @@ Section multiset_unfold.
Proof
.
constructor
.
by
rewrite
<-
(
multiset_unfold
x
X
n
)
.
Qed
.
End
multiset_unfold
.
(** Step 3: instantiate hypotheses *)
Ltac
multiset_instantiate
:=
(* Step 3.1: instantiate hypotheses *)
repeat
match
goal
with
|
H
:
(
∀
x
:
?A
,
@
?P
x
)
|
-
_
=>
let
e
:=
fresh
in
evar
(
e
:
A
);
...
...
@@ -245,20 +245,30 @@ Ltac multiset_instantiate :=
(* Use [unless] to avoid creating a new hypothesis [H y : P y] if [P y]
already exists. *)
unless
(
P
y
)
by
assumption
;
pose
proof
(
H
y
)
end
;
(* Step 3.2: simplify singletons. *)
end
.
(** Step 4: simplify singletons *)
Local
Lemma
multiplicity_singleton_forget
`{
Countable
A
}
x
y
:
∃
n
,
multiplicity
(
A
:=
A
)
x
{[
y
]}
=
n
∧
n
≤
1
.
Proof
.
rewrite
multiplicity_singleton'
.
case_decide
;
eauto
with
lia
.
Qed
.
Ltac
multiset_simplify_singletons
:=
repeat
match
goal
with
|
H
:
context
[
multiplicity
?x
{[
?y
]}]
|
-
_
=>
first
[
progress
rewrite
?multiplicity_singleton
,
?multiplicity_singleton_ne
in
H
by
done
|
destruct
(
multiplicity_singleton_forget
x
y
)
as
(?
&
->
&
?);
clear
y
|
rewrite
multiplicity_singleton'
in
H
;
destruct
(
decide
(
x
=
y
));
simplify_eq
/=
]
|
|
-
context
[
multiplicity
?x
{[
?y
]}]
=>
first
[
progress
rewrite
?multiplicity_singleton
,
?multiplicity_singleton_ne
by
done
|
destruct
(
multiplicity_singleton_forget
x
y
)
as
(?
&
->
&
?);
clear
y
|
rewrite
multiplicity_singleton'
;
destruct
(
decide
(
x
=
y
));
simplify_eq
/=
]
end
.
Ltac
multiset_solver
:=
set_solver
by
(
multiset_instantiate
;
lia
)
.
(** Putting it all together *)
Ltac
multiset_solver
:=
set_solver
by
(
multiset_instantiate
;
multiset_simplify_singletons
;
lia
)
.
Section
more_lemmas
.
Context
`{
Countable
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