Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 as seen on the slides.
datatype MapSet MapSet s : map
predicate member m:MapSet, x:T
Replace with your definition
true
function size m:MapSet: int
Replace with your definition
function insert m:MapSet, x:T: MapSet
Replace with your definition
MapSet map
function delete m:MapSet, x:T: MapSet
Replace with your definition
MapSet map
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started