Is there an xor (exclusive or) infix operator in TLA+?

℡╲_俬逩灬. 提交于 2019-12-11 05:11:28

问题


Does TLA+ have an xor operator defined as part of the language itself, or do I have to define my own?


回答1:


Under the assumption that A \in BOOLEAN /\ B \in BOOLEAN, what is known in propositional logic as "XOR" is inequality:

A # B

which under the same assumption is equivalent to ~ (A <=> B). When A, B take non-Boolean values, these two formulas are not necessarily equivalent. The operator <=> means the following

/\ A \in BOOLEAN
/\ B \in BOOLEAN
/\ A = B

So

(~ (A <=> B)) <=> \/ ~ A \in BOOLEAN
                  \/ ~ B \in BOOLEAN
                  \/ ~ (A = B)

Thus, if the first two disjuncts are false, then <=> and = are equivalent. Otherwise it can be the case that

/\ A \notin BOOLEAN
/\ A = B

which could satisfy A <=> B. See also p.10 and Sec. 16.1.3 of the TLA+ book. The formula

(A \/ B) /\ ~ (A /\ B)

is meaningful also for non-Boolean values of the identifiers A and B, because TLA+ is untyped. So

(15 \/ "a") /\ ~ (15 /\ "a")

is a possible value. As far as I know, the language doesn't specify whether this formula has the same value as

15 # "a"


来源:https://stackoverflow.com/questions/46698480/is-there-an-xor-exclusive-or-infix-operator-in-tla

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!