Sitemap
Val Deleplace

Val Deleplace

Engineer on cloudy things @Google. Opinions my own. Twitter @val_deleplace

When <= ≡ =>

--

This one was for me the most disturbing realization about boolean operators.

1. Comparable booleans

For better or for worse, programming languages like Python, C++, JavaScript, PHP, Rust support comparing boolean values with the <= operator. For all of them, false < true.

Here is the truth table for the expression a <= b :

2. Implication

Though less common in programming, the implies operator => is defined as : ( a => b ) is true IFF ( ¬a ∨ b ) is true.

Get Val Deleplace’s stories in your inbox

Join Medium for free to get updates from this writer.

Informally, a => b gives you valuable information about b when a is true, and no information when a is false.

Here is the truth table for “a implies b” :

Conclusion

The two truth tables are identical. The two operators have the same semantics (only on booleans), even though they look symmetric.

This should mean that a<=b is equal to a=>b, fortunately there exists no programming language that supports both operators. That would be confusing.

--

--

Val Deleplace
Val Deleplace

Written by Val Deleplace

Engineer on cloudy things @Google. Opinions my own. Twitter @val_deleplace