Questions tagged [vdm-sl]

A language for the design and specification of systems, supporting the Vienna Development Method. The VDM language is supported by the Overture Tool.

A language for the design and specification of systems, supporting the Vienna Development Method. The VDM language is supported by the Overture Tool at http://overturetool.org/

16 questions
2
votes
1 answer

A recursive function in VDM

How would I define a recursive function to find the biggest power of two less than an input number in VDM? The function is as follows: largest: N -> N All I've got so far is: largest(n) = if n=1 then 0 else if n=2 then 1 else ... largest(...)
Dazzler95
  • 93
  • 7
2
votes
1 answer

From implicit to explicit function definitions

I have been creating specifications using implicit function definitions in VDM-SL and it has worked out very well. I now want to prototype the specification using explicit function definitions (no operations at this stage). One way I can see of…
Paul
  • 113
  • 6
1
vote
2 answers

Set/sequence summation operator?

I have a set, S = { 1, 2, 3, 4, 5 }. If I wanted to sum this in standard logic it's just ∑S (no MathJax on SO so I can't format this nicely). What's the VDM equivalent? I don't see anything in the numerics/sets section of the language reference.
vertmanip
  • 25
  • 3
1
vote
1 answer

How can I apply a predicate to a set?

Say I have a set, S = { 1, 2, 3, 4 } (the contents don't really matter) I can say forall x in set S & x mod 2 = 0 but that will give me a boolean answer - are all the numbers in it even? What if I want to see all members of the set for which x mod 2…
vertmanip
  • 25
  • 3
1
vote
1 answer

Function and Product Types Peculiarity

What is the difference between the types (seq of nat * seq of nat) -> nat and seq of nat * seq of nat -> nat According to the Language Reference Manual * has higher precedence than -> so the parentheses have no effect; the are semantically the…
Paul
  • 113
  • 6
1
vote
1 answer

Implicit functions: currying and totality

When specifying an implicit function in VDM-SL, is it possible to specify a curried function? In the following test1 and test2 are explicit uncurried and curried functions, and test3 is an implicit uncurried function. All are accepted by Overture.…
Paul
  • 113
  • 6
1
vote
2 answers

VDMSL Recursive function minimum value of sequence

I think this should be relatively straightforward, was wondering if anyone knew how to answer this: Define a recursive function seq-min : N+ -> N which returns the smallest value in a sequence of natural numbers. I was thinking something along the…
bonapart3
  • 469
  • 7
  • 20
0
votes
1 answer

What is the difference between implicit and explicit in VDM-SL

So as the title explains, what's the difference between the implicit and explicit? Is implicit the function and explicit the operation? or is implicit the overture code and the explicit the VDM-SL specifications itself? I'm kind of confused
user17712850
0
votes
1 answer

VDM++ type error: The state component "totalPrice" must not be used here

I wrote a code which is for the total price of book when multiplied by number of book and the book price in VDM++. class Book types public Title = seq of char; instance variables private bookTitle: Title; private numberOfPages:…
0
votes
1 answer

How do I transform/operate on a set/sequence?

I have a set S = { 1, 2, 3, 4, 5 }. What is the syntax for changing the contents of the set (or rather, creating a new set) by applying a mathematical operation to it e.g. multiplication, power?
vertmanip
  • 25
  • 3
0
votes
1 answer

VDM-SL - function accepts a set of integers and returns an identical set

Trying for a function that accepts an integer and returns the non-negative value of that integer which I figured out Abs : int -> nat Abs(num) == if num < 0 then -num else num; now I am trying to create another function that…
F.Sajid
  • 1
  • 1
0
votes
1 answer

Can't return each element from a set when running it through a for all loop

I am trying to return each element from a set containing Brewage objects by running it through a for all loop. But the return value gets messed up when i try to do so. The loop function: public pure Scan: set of Brewage ==> Brewage Scan(brewage)…
Theis Hansen
  • 53
  • 1
  • 5
0
votes
1 answer

VDM to Isabelle translation

I am trying to translate a VDM model to Isabelle, but for some reason, what I do, do not work The following sample is a VDM function of my model Dot_Move_invariant: Dot * Dot -> bool Dot_Move_invariant(d1, d2) == d1 < d2 and let…
0
votes
1 answer

VDM-SL notation for a single, finite subset

Not sure if this is within the realm of SO but: Using VDM-SL, I have been looking around for the 'best' way of describing a single, finite subset of ℕ. In my travels I have found several ways that people are conveying this but I wonder which is the…
1
2