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
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
No related tags found
1 merge request
!231
Many improvements to `multiset_solver`
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.
...
@@ -225,8 +225,8 @@ Section multiset_unfold.
Proof
.
constructor
.
by
rewrite
<-
(
multiset_unfold
x
X
n
)
.
Qed
.
Proof
.
constructor
.
by
rewrite
<-
(
multiset_unfold
x
X
n
)
.
Qed
.
End
multiset_unfold
.
End
multiset_unfold
.
(** Step 3: instantiate hypotheses *)
Ltac
multiset_instantiate
:=
Ltac
multiset_instantiate
:=
(* Step 3.1: instantiate hypotheses *)
repeat
match
goal
with
repeat
match
goal
with
|
H
:
(
∀
x
:
?A
,
@
?P
x
)
|
-
_
=>
|
H
:
(
∀
x
:
?A
,
@
?P
x
)
|
-
_
=>
let
e
:=
fresh
in
evar
(
e
:
A
);
let
e
:=
fresh
in
evar
(
e
:
A
);
...
@@ -245,20 +245,30 @@ Ltac multiset_instantiate :=
...
@@ -245,20 +245,30 @@ Ltac multiset_instantiate :=
(* Use [unless] to avoid creating a new hypothesis [H y : P y] if [P y]
(* Use [unless] to avoid creating a new hypothesis [H y : P y] if [P y]
already exists. *)
already exists. *)
unless
(
P
y
)
by
assumption
;
pose
proof
(
H
y
)
unless
(
P
y
)
by
assumption
;
pose
proof
(
H
y
)
end
;
end
.
(* Step 3.2: simplify singletons. *)
(** 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
repeat
match
goal
with
|
H
:
context
[
multiplicity
?x
{[
?y
]}]
|
-
_
=>
|
H
:
context
[
multiplicity
?x
{[
?y
]}]
|
-
_
=>
first
first
[
progress
rewrite
?multiplicity_singleton
,
?multiplicity_singleton_ne
in
H
by
done
[
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
/=
]
|
rewrite
multiplicity_singleton'
in
H
;
destruct
(
decide
(
x
=
y
));
simplify_eq
/=
]
|
|
-
context
[
multiplicity
?x
{[
?y
]}]
=>
|
|
-
context
[
multiplicity
?x
{[
?y
]}]
=>
first
first
[
progress
rewrite
?multiplicity_singleton
,
?multiplicity_singleton_ne
by
done
[
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
/=
]
|
rewrite
multiplicity_singleton'
;
destruct
(
decide
(
x
=
y
));
simplify_eq
/=
]
end
.
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
.
Section
more_lemmas
.
Context
`{
Countable
A
}
.
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