Question: You are given the following MapSet wrapper arround Dafny's maps, which fixes the type of the values to be booleans. As a result, one can
You are given the following MapSet wrapper arround Dafny's maps, which fixes the type of the "values" to be booleans. As a result, one can think of a MapSet as a set, where an element is considered to be in the MapSet iff it maps to true in the wrapped map.
Implement the following set API calls in terms of this wrapper by invoking Dafny map functions given in the image below
The MapSet and the functions needed to be implimented are given here:
datatype MapSet MapSet s : map
predicate member m:MapSet, x:T
code this
true
function size m:MapSet: int
code this
function insert m:MapSet, x:T: MapSet
code this
MapSet map
function delete m:MapSet, x:T: MapSet
code this
MapSet map
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
