Lawrence D'Oliveiro

2024-06-07 10:52:51 UTC

I wonder why, traditionally, shortcut evaluation of boolean subexpressions

has been applied to “and” and “or” connectives, but not any others.

For example, what about “implies”?

a implies b

Truth table:

a b result

------------

0 0 1

0 1 1

1 0 0

1 1 1

But C does not have an “implies” operator, I hear you say? Of course this

can be written

not a or b

and shortcut evaluation would apply. But it can also be written

a <= b

and shortcut evaluation would *not* apply. Why not, if a and b are

boolean-valued subexpressions?

has been applied to “and” and “or” connectives, but not any others.

For example, what about “implies”?

a implies b

Truth table:

a b result

------------

0 0 1

0 1 1

1 0 0

1 1 1

But C does not have an “implies” operator, I hear you say? Of course this

can be written

not a or b

and shortcut evaluation would apply. But it can also be written

a <= b

and shortcut evaluation would *not* apply. Why not, if a and b are

boolean-valued subexpressions?