Skip to content
Snippets Groups Projects
Verified Commit 87eeafaf authored by Dorian Lesbre's avatar Dorian Lesbre
Browse files

Add Img class

parent 0727c134
No related branches found
No related tags found
1 merge request!444Add images (codomains) to finite maps
...@@ -1342,6 +1342,16 @@ Global Instance: Params (@dom) 3 := {}. ...@@ -1342,6 +1342,16 @@ Global Instance: Params (@dom) 3 := {}.
Global Arguments dom : clear implicits. Global Arguments dom : clear implicits.
Global Arguments dom {_ _ _} !_ / : simpl nomatch, assert. Global Arguments dom {_ _ _} !_ / : simpl nomatch, assert.
(** The function [img m] should yield the image/codomain of [m]. That is a finite
set of type [D] that contains the values that appear in [m].
[D] is an output of the typeclass, i.e., there can be only one instance per map
type [M]. *)
Class Img (M D : Type) := img: M D.
Global Hint Mode Img ! - : typeclass_instances.
Global Instance: Params (@img) 3 := {}.
Global Arguments img : clear implicits.
Global Arguments img {_ _ _} !_ / : simpl nomatch, assert.
(** The function [merge f m1 m2] should merge the maps [m1] and [m2] by (** The function [merge f m1 m2] should merge the maps [m1] and [m2] by
constructing a new map whose value at key [k] is [f (m1 !! k) (m2 !! k)].*) constructing a new map whose value at key [k] is [f (m1 !! k) (m2 !! k)].*)
Class Merge (M : Type Type) := Class Merge (M : Type Type) :=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment