range - Formal methods - Map of price relating cars to price with two sets BL and Fiat -


i have question chapter 5 in practical formal methods vdm derek andrews , darrel ince unsure how answer, here is, help!

if map price relates cars price, set bl contains cars made british leyland , fiat cars made fiat. write down following descriptions using map facilities , set facilities described in chapter , chapter on sets.

(d) number of fiat cars have price between £6000 , £7000

this think far...

1.get prices of fiats i.e. price(fiat) returning subset of price map

i.e. {punto -→ 5500, panda -→ 6600}

2.possibly card on map restriction on range of price(fiat)...

   **{6000...7000} ◁ rng price(fiat)** 

but not sure legal

  1. i think function application not need subset of price map, want restrict map domain of fiats, let's use domain restriction:

    fiat <: price  

    that should yield {punto → 5500, panda → 6600}

  2. now want subset of prices (the right side, i.e. range) restricted 6000..7000:

    (fiat <: price) :> {6000,...,7000} 

    that gives set of couples (fiat,price) prices in given interval.

  3. apply cardinality operator result number of found cars.

(caveat: i'm not familiar vdm underlying logic should quite same in vdm, b, z, etc. did not check if used syntax above correct.)

edit: fixed syntax of interval, nick's answer.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -