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
1efc3af6
Commit
1efc3af6
authored
4 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Update `multiset_solver` documentation.
parent
99b2a184
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
+25
-15
25 additions, 15 deletions
theories/gmultiset.v
with
25 additions
and
15 deletions
theories/gmultiset.v
+
25
−
15
View file @
1efc3af6
...
...
@@ -147,25 +147,35 @@ End basic_lemmas.
(** We define a tactic [multiset_solver] that solves goals involving multisets.
The strategy of this tactic is as follows:
1.
Unfold
all equalities ([=]), equivalences ([≡]),
and
inclusions ([⊆]
) using
the laws of [multiplicity] for the multiset operations. Note that strict
in
clusion ([⊂]) is not supported.
2. Use [naive_solver] to decompose the goal into smaller subgoals
.
3
.
Instantiate all universally quantified hypotheses in the subgoals generated
by [naive_solver] to obtain goals that can be solved using [lia].
Step (1) is implemented using a type class [MultisetUnfold] that hooks into
the [SetUnfold] mechanism of [set_solver]. Since [SetUnfold] already propagates
through logical connectives, we obta
in the
same behavior for our multiset
solver. Note that no [MultisetUnfold] instance is defined for the (non-trivial)
singleton [{[ y ]}] since the singleton receives special treatment in step (3)
.
Step (3) is
achiev
ed using the tactic [multiset_instantiate], which
instantiates
universally quantified hypotheses [H : ∀ x : A, P x] in two ways:
1.
Turn
all equalities ([=]
and [≡]
), equivalences ([≡]), inclusions ([⊆]
and
[⊂]), and set membership relations ([∈]) into arithmetic (in)equalities
in
volving [multiplicity]. The multiplicities of [∅], [∪], [∩], [⊎] and [∖]
are turned into [0], [max], [min], [+], and [-], respectively
.
2
.
Decompose the goal into smaller subgoals through intuitionistic reasoning.
3. Instantiate universally quantified hypotheses in hypotheses to obtain a
goal that can be solved using [lia].
4. Simplify multiplicities of singletons [{[ x ]}].
Step (1) and (2) are implemented us
in
g
the
[set_solver] tactic, which internally
calls [naive_solver] for step (2). Step (1) is implemented by extending the
[SetUnfold] mechanism with a class [MultisetUnfold]
.
Step (3) is
implement
ed using the tactic [multiset_instantiate], which
instantiates
universally quantified hypotheses [H : ∀ x : A, P x] in two ways:
- If [P] contains a multiset singleton [{[ y ]}] it adds the hypothesis [H y].
- If the goal or some hypothesis contains [multiplicity y X] it adds the
hypothesis [H y].
Step (4) is implemented using the tactic [multiset_simplify_singletons], which
simplifies occurences of [multiplicity x {[ y ]}] as follows:
- First, we try to turn these occurencess into [1] or [0] if either [x = y] or
[x ≠ y] can be proved using [done], respectively.
- Second, we try to turn these occurences into a fresh [z ≤ 1] if [y] does not
occur elsewhere in the hypotheses or goal.
- Finally, we make a case distinction between [x = y] or [x ≠ y]. This step is
done last so as to avoid needless exponential blow-ups.
*)
Class
MultisetUnfold
`{
Countable
A
}
(
x
:
A
)
(
X
:
gmultiset
A
)
(
n
:
nat
)
:=
{
multiset_unfold
:
multiplicity
x
X
=
n
}
.
...
...
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