Write formal for the following informal specifications In ea
Write formal for the following informal specifications. In each case the signature is {“x” N, “x ” N}. Use angle bracket notation.
(a) x is bigger than x.
(b) x twice as big as x if x is smaller than 100; otherwise it doesn’t matter what x is.
(c) x twice as big as x if x is smaller than 100; otherwise x is 200.
(d) x is at least 1 and x is smaller than x.
Solution
a) x > x bcoz x is bigger than x
b) if(x<100)
x=2*x;
else //if x is not smaller
x=anything;
c) if(x<100)
x=2*x;
else
x=200;
d) (x>=1 &x<x) //x can be greater than 1 and should be smaller than x
