I'm writing some specifications of a system in B-method. I have the following variables which are subsets of a general set:
- First Notation: a :={x,y,z,v} b :={x,y,z}
I want to state a rule that whenever something exists in set "b", it also exists in set "a" which helps writing the above specifications as the following:
- second Notation: a :={v} b :={x,y,z}
Explanation of second notation: I want the machine to infer that a :={x,y,z,v} from a :={v}, b :={x,y,z}, and the rule.
How can I express the rule so I avoid the first notation and instead write the second notation?
I tried the following but it didn't work
INITIALISATION
a :={v} &
b :={x,y,z}
ASSERTIONS
!x.(x:b => x:a)
First of all, the predicate
!x.(x:b => x:a)
can be more easily expressed just byb<:a
.It's not clear to me what exactly you want to express: Should
b
always be a subset ofa
or just in the initialisation?If always, the
INVARIANT
would be the correct location for that.ASSERTIONS
are similar but should be an implication by the other invariants. But then you must explicitly ensure that in your initialisation.Another point which is unclear to me is what you mean by "infer". Do you just not want to specify the details? An initialisation where you assign
a
set with one element more thanb
could look like the following (assuming thata
andb
contain elements ofS
):(Disclaimer: I haven't actually tested it.)
If
a
should always be larger thanb
, you could add something likev/:s
. Your description does not make it clear what exactly you want to achieve.Another approach would use the "becomes such substitution" (but in my opinion it is less readable):