# On the arbitrariness of truth(iness)

**URL:** <https://discourse.julialang.org/t/on-the-arbitrariness-of-truth-iness/81381>\
**Category:** Internals & Design\
**Created:** [May 20, 2022, 3:32pm UTC](https://discourse.julialang.org/t/on-the-arbitrariness-of-truth-iness/81381 "2022-05-20T15:32:55Z")\
**Posts on this page:** 1\
**Showing post:** 48

<div class="post-metadata">

**Author:** ![uniment](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uniment/32/24532_2.png) [@uniment](https://discourse.julialang.org/u/uniment)\
**Post date:** [March 22, 2023, 5:39am UTC](https://discourse.julialang.org/t/on-the-arbitrariness-of-truth-iness/81381/48 "2023-03-22T05:39:30Z")

</div>

Since @jar1 thrust this conversation into discussing Boolean algebra, a field in which they recently [changed](https://discourse.julialang.org/t/add-varargs-methods-of-any-all-and-count/95072/27) my mind, I wanted to share some of these new thoughts.

TLDR: Corresponding false/true with 0/1 is arbitrary and awkward; it’s more coherent to use -inf/inf instead.

Like the truthy and falsy values of the OP, the choice to consider 0 falsy and 1 truthy is similarly arbitrary, and as this thread demonstrates it makes for an awkward algebra. There are other ways in which it’s awkward too: for example, _and_ (\wedge) and _or_ (\vee) are commonly considered analogous to multiplication and addition respectively, with [operator](https://en.wikipedia.org/wiki/Logical_connective#Order_of_precedence) [precedences](https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm#L23) reflecting that, yet they both distribute over each other (in contrast, numeric addition does _not_ distribute over multiplication!).

In these _Unified Algebra_ essays [1](http://www.cs.toronto.edu/~hehner/BAUA.pdf) and [2](https://www.cs.utoronto.ca/~hehner/UA.pdf), compsci prof Hehner at U of T argues that, to integrate Boolean algebra cleanly into our algebra of numbers, the numeric value corresponding to truth should be \top (the top of the number lattice, usually positive infinity), and the numeric value of falsity should be \bot (the bottom of the number lattice, usually negative infinity). Instead of the conjunction \wedge and disjunction \vee operators, use \downarrow (min) and \uparrow (max) respectively.

Then, where p,q\in\{\bot,\top\}, instead of p\wedge q (p and q) you’d write p \downarrow q (p min q), instead of p \vee q (p or q) you’d write p \uparrow q (p max q), and instead of p \veebar q (p xor q) you’d write p \ne q. Also, instead of p \implies q (p implies q) you’d write p \le q (p order q), instead of p \iff q (p iff q) you’d write p=q, and instead of writing DeMorgan’s laws as \neg(p\wedge q)\iff\neg p\vee\neg q and \neg(p\wedge q)\iff\neg p\vee\neg q, they’d be written: -(p\downarrow q)=-p\uparrow -q and -(p\uparrow q)=-p\downarrow -q. Notice that all the operators—min, max, negation, and comparisons—are in common with regular numeric algebra.

Mathematically, I like that this concept unifies Boolean algebra with numeric algebra. Epistemologically, I like that whatever discomfort people have toward the concept of infinity, they should rightly have toward the attainability of certain truth (an attitude of _humility_). And practically, with a background in analog chips, I like that this concept is reflective of the circuits we design to convert a continuous signal into a binary one: comparators, circuits which ideally have _infinite gain_ about their decision point, whose output saturates at finite V\_L and V\_H out of practical necessity but which otherwise could be thought of as returning V\_\bot or V\_\top. Also, the designs of _and_ and _or_ gates are complementary; it’s strange for one to correspond to an operator with higher precedence than the other (mobility \mu\_e/\mu\_h notwithstanding).

It’s a major departure from popular languages though, so I don’t think we’ll see it anytime soon, but dropping other silly notions of truthy and falsy is a good start. Maybe in Julia 3.0 😉

---

_[View the full topic](https://discourse.julialang.org/t/on-the-arbitrariness-of-truth-iness/81381)._
