Hacker News new | ask | show | jobs
by 0xfedcafe 33 days ago
fp folks trying to reinvent probability theory is hilarious
4 comments

Non-boolean logic is more than a century old.

We could bring quantum physics as a simple example of binary logic collapsing, but in programming there are countless ones.

A simple one is a table of users in SQL, where age can be `null` and not just a positive number.

For filters like "age < 18" and "age > 18" a binary answer cannot model business logic decisions on this set of data properly.

Thus SQL implements a third logic value, UNKNOWN.

Another simple example "is the room hot?".

This is by intuition a bad fit for binary logic. Even if you define "hot" as 30C it's quite clear that the problem is way too nuanced and context dependent to model with binary logic, you need more than two possible answers than yes/no.

I took a course in advanced logic and there is actually a really broad and diverse world of them that is fascinating. Contextual logic for one.
For 3 values, don’t you just need a pair of booleans ? Known or unknown… If known: 0 or 1 …
unknown | yes | no has the same cardinality (3) of unknown | boolean as you can replace boolean with yes | no.

If you write code that has to handle it, you still need to consider 3 cases, you can never reduce it to two cases only.

> probability theory

Probability theory presupposes that there's a 0 to 1 or 0 to 100 scale of "truthiness" (depending on which scale one might prefer), while the true non-boolean logic has the guts to fully embrace Parmenides's view on One and the Multiple.

We could also try and approach "knowledge" the way that the 5th-6th century Christian mystics were trying to do during their quest to approach the nature of the Divine (or of the Truth, taken in a more restricted manner) via negatives, more exactly via "turning away their faces from said Truth". Interesting that those Christian mystics were an intellectual continuation of the 3rd-4th century Neoplatonists.

I don’t think this is anyhow about fp. Constructive logic appears naturally in proofs and type systems where it is very useful. Also it is quite fascinating to me to learn that law of excluded middle can be omitted and still such logic yields useful results.

I also admit that the blogpost is lacking in many respects.

probability isn't the own non-boolean. analog circuits and fuzzy logic. quantum (ok yeah probabilities!), neural nets. also taking the questions angle - open ended questions.