Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Operational semantics

Tags:

semantics

I have this derivation

(b,σ)→false  (skip,σ)→σ

(if b then c;w else skip)→σ

(With the top line being the precondition and the bottom line the expression)

Does the expression mean:

If b is True, then do command c, else do w and skip,

or

If b is True, then do command c and command w, else skip.

The semi-colon in the middle is confusing me?!

Also, why don't I have to include c in the precondition?

Thanks.

like image 868
hunterge Avatar asked Mar 11 '26 10:03

hunterge


2 Answers

Every operational semantics is different and the question specifies no context, so I can only guess at the answer.

I would parse if b then c; w else skip as if b then {c; w} else skip, that is, the second interpretation from the question. The derivation seems to be about the case that b is false, so c is not mentioned because if b is false, c is not executed. Instead, skip is mentioned because it's executed.

like image 56
Toxaris Avatar answered Mar 13 '26 15:03

Toxaris


This just answers part of your question, heowever: c is not included in the precondition because it does not depend on the precondition. I somehow cannot make sense of the w in the second line either. Furthermore, the question might be off topic as it is more about computer science than actual programming.

like image 35
Codor Avatar answered Mar 13 '26 16:03

Codor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!