Skip to content

Commit

Permalink
implementation of sets in terms of finite maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Malecha committed Oct 5, 2012
1 parent fdb6196 commit 1701f05
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions theories/Sets/SetMap.v
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.

0 comments on commit 1701f05

Please sign in to comment.