-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implementation of sets in terms of finite maps.
- Loading branch information
Gregory Malecha
committed
Oct 5, 2012
1 parent
fdb6196
commit 1701f05
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Require Import ExtLib.FMaps.FMaps. | ||
Require Import ExtLib.Sets.Sets. | ||
|
||
Set Implicit Arguments. | ||
Set Strict Implicit. | ||
|
||
(** Canonical instance, a set is the same as a map where the values | ||
** are unit | ||
**) | ||
Section SetFromMap. | ||
Variable T : Type. | ||
Variable R : T -> T -> Prop. | ||
|
||
Variable m : Type -> Type. | ||
Variable Map_T : Map T m. | ||
|
||
Global Instance CSet_map : @CSet (m unit) T R := | ||
{ empty := FMaps.empty | ||
; contains := fun k m => match lookup k m with | ||
| None => false | ||
| Some _ => true | ||
end | ||
; add := fun k m => FMaps.add k tt m | ||
; remove := fun k m => FMaps.remove k m | ||
}. | ||
End SetFromMap. |