Logic, Math and Code
What logic taught me about structured thinking and life.
I wanted to write a series of notes about what I learnt in math, logic and code in the last decade. Here’s the intro of what the notes are about:
Logical Intro
I was really into math/ logic growing up. My love for coding and system design was a logical and natural extension of my love for math.
But after a point, the role of math in my life fizzled out. And I am not alone. After a point, the only folks in touch with math are AI/ ML folks. Everyone else got into the rote of learning gimmicks or boiled-down processes. We stopped learning and being in touch with the atoms of logic.
Studying number theory made us love Math/ Logic. Learning programming languages and recursion made us love Coding/ System design. In the next phases of life. Before we spend more time understanding philosophy/ spirituality/ consciousness/ art. I believe there is a catalyst missing.
As far as philosophy, spirituality, consciousness, or art are concerned, I am a nobody. I don't have any answers. In fact, I don't even know what I mean by those four words I just used.
I had a discussion with one of the smartest engineers I worked with. Is coding art? My stance was yes. The friend's stance was no. I didn't have a solid answer to explain my reasoning—just a fleeting, vague and unexplainable feeling in my head.
Over the last five years, I realized I am cornering around a thesis. A thesis for not the answer but the toolkit I need before proceeding to the next phase of my life. This toolkit I am dubbing 'Mathematical Philosophy'. Before I delve into what and why we need to study "mathematical philosophy", let me give a gist of how I stumbled into this-
I spent a reasonable amount of time designing different system architectures for Adaface. These solutions and problem statements often left me with the magic of logic. The magic I used to feel back when I tinkered with math.
I read books which structured what I was feeling more concretely. The main books are
Fermat's Enigma
The Code Book
Quantum computing since Democritus
Godel Escher Bach
The more I read these books, the more I realized that they need to be condensed into an easy form. A form that folks in tech can pick up in their 20s or 30s.
So, here's the 'why.'
Get better at structured thinking. The core of mathematics has always been atoms, axioms and structured processes. These are the core of most art we still do in our careers. System design and coding are just modern workplace forms of math and logic. Learning to design systems from scratch drives us to actual problem-solving. Instead of rote solution copying.
Build a toolkit for philosophy. As we age, we ponder topics like existential crisis and philosophy. Throughout history, mathematics and philosophy often went hand in hand. Many mathematicians were philosophers (and vice versa). It only makes sense to rely on math to build the toolkit to understand these complex concepts.
Now as to the 'what'.
These are the slices that I want to put together. Each segment fits into one of the why's.
Math basics through the lens of stories and failures
Nuggets of philosophy in recursions, paradoxes and loops
Functional programming as an example of structured logic
A different way of looking at proofs and theorems
Conversational trees as an example of recursive systems
An existential crisis in math- Godel's incompleteness theorem
Looking at life in a non-deterministic and probabilistic way
RSA algorithm as an example of structured logic and art
Designing a REPL system as an example of structured design
Some ideas I am still mulling over (Blockchain paper? LLMs? Quantum?)
In and out between the chapters, I plan to sprinkle some inspiring stories of mathematicians. The idea is to keep each chapter short and easy to understand. So that it can work as a general read for everyone in "tech". The easy the chapter is, the more vague we can leave the definition of what "tech" is.
Philosophical intro
When I wanted to introduce this idea, I came up with two versions. Here's the weirder one.
Ever heard this meme/ joke that the brain named itself? Let me expand on that point a bit. Humans named rabbits. Rabbits themselves don't care about the word "rabbits". It's something humans made to refer to an external entity. The same way humans came up with the term "Earth", the entity where they belong. Now here's where things get interesting. "Humans" named themselves "humans". This is one argument for consciousness—the ability to refer to oneself.
But humans didn't name themselves humans. We can zoom in a level and say the consciousness part belongs to the brain. Brains named external entities like "hands". Brains named the entity that they are part of "humans". In the same way humans named Earth.
We can keep on zooming into this kind of discussion. But let's segue here into a different level of discussion. And say at the centre of the brain lies intelligence and consciousness.
Intelligence feels mathematical. We consider it as logic. It has duality. It can draw lines between the internal self and external others. It can say right from wrong. It can say 2 + 2 rabbits = 4 rabbits. We built computers with the bare bones of this intelligence. 1s and 0s. Now, when we talk about "artificial intelligence", what do we mean? Do we mean a formal system that computes so fast that it is the same or better than a human in all "intelligent" things?
Godel says that any system built out of logical methods will be incomplete. Because it will have statements about itself that the system can't say are true or false. Thus breaking its duality. So however fast the "AI" is, it won't be able to refer itself completely and consistently. Which brings us to consciousness.
Is that what consciousness is? Is it the feeling or ability to refer to ourselves? It's our 'conscious' mind about to understand itself in this world. And that understanding has no dual answers? It can't have statements that fit into our true/ false way of viewing the world. These questions can segue into philosophy. But before we do that,
There are three related and interesting questions here around Gen-AI:
Are we saying we humans are special because we are intelligent and conscious?
How good and active is our consciousness's ability to refer to and make peace with I?
So if we can design the most portions of "being" a day-to-day human and club them with a sufficiently faster intelligence. Will we be able to distinguish this intelligence from a human? We can input Chat-GPT with an instruction that "you are a soft-speaking person", and it starts speaking softly. It is not that far off that we can extend the number and type of instructions. To the point that, for most practical purposes, we might not be able to distinguish it from a human?
Coming back. In the first intro, I gave two reasons why someone in tech could read this. First is to improve at structured system design, and second is to understand mathematical philosophy. You might ask- why have two motivations? But I think there is a journey from one 'why' to the other.
So far, logical learning and formal systems have got us into coding. We want to nurture and relish that skill. That's where we board the bus that is this book. System design and probabilities are just a reminder of how delicious that skill is. That is the core part of this book's journey. The destination is where we realize formal systems won't answer everything about life. The maximum they get us to is to ask interesting questions about consciousness. And that's where the last stop for the logical bus is. To explore the next stops, like philosophy, we need to internalize how far the logical bus can go.
The worst-case hope is that you fall in love with code/ math/ system design, yet again. The best-case hope is that we build our mental toolkit to kick off the journey into philosophy. In terms of categories, here's what the book is going to do:
Remind fun examples and stories of Math/ Logic.
Some fun examples of recursion used in Coding/ System designing.
Looking at probability and algorithms as a base for mental models.
Creating a computer based on formal systems. Looking at why such a computer can't talk about itself.
Some fun discussions of system designs.