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
bb1d27f6
Commit
bb1d27f6
authored
2 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Add `ScalarMul` operational type class.
parent
3af97445
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!452
Add scalar multiplication for multisets.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stdpp/base.v
+12
-0
12 additions, 0 deletions
stdpp/base.v
with
12 additions
and
0 deletions
stdpp/base.v
+
12
−
0
View file @
bb1d27f6
...
...
@@ -1079,6 +1079,18 @@ Fixpoint list_to_set `{Singleton A C, Empty C, Union C} (l : list A) : C :=
Fixpoint
list_to_set_disj
`{
SingletonMS
A
C
,
Empty
C
,
DisjUnion
C
}
(
l
:
list
A
)
:
C
:=
match
l
with
[]
=>
∅
|
x
::
l
=>
{[
+
x
+
]}
⊎
list_to_set_disj
l
end
.
Class
ScalarMul
N
A
:=
scalar_mul
:
N
→
A
→
A
.
Global
Hint
Mode
ScalarMul
-
!
:
typeclass_instances
.
(** The [N] arguments is typically [nat] or [Z], so we do not want to rewrite
in that. Hence, the value of [Params] is 3. *)
Global
Instance
:
Params
(
@
scalar_mul
)
3
:=
{}
.
(** The notation [*:] and level is taken from ssreflect, see
https://github.com/math-comp/math-comp/blob/master/mathcomp/ssreflect/ssrnotations.v *)
Infix
"*:"
:=
scalar_mul
(
at
level
40
,
left
associativity
)
:
stdpp_scope
.
Notation
"(*:)"
:=
scalar_mul
(
only
parsing
)
:
stdpp_scope
.
Notation
"( x *:.)"
:=
(
scalar_mul
x
)
(
only
parsing
)
:
stdpp_scope
.
Notation
"(.*: x )"
:=
(
λ
y
,
scalar_mul
y
x
)
(
only
parsing
)
:
stdpp_scope
.
(** The class [Lexico A] is used for the lexicographic order on [A]. This order
is used to create finite maps, finite sets, etc, and is typically different from
the order [(⊆)]. *)
...
...
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