A simple fact about politics

Disclaimer: I am not a politics expert (whatever that may mean) nor have I read any books about politics. My background is in software engineering and maths.

Every party wants to be the ruling party

  1. A political party is formed with the intent of it to be a ruling party.
  2. A political party spends resources on marketing.
  3. Therefore every political party wants to be ruling.

Every politician must lie sometimes

  1. Assume a politician of a party A always tells the truth.
  2. Assume there’s an opposing party B.
  3. Since every political party wants to be ruling, opposing party B can abuse the truth.
  4. Since every political party wants to be ruling, Party A doesn’t want the truth to be manipulated and lose points.
  5. Therefore it is not the case that a politician of party A always tells the truth, that is, a politician of party A must lie sometimes. Without loss of generality, every politician must lie sometimes.

Lying can be a simple fact about GDP, or even worse when combined with the fact that every party wants to be ruling: manipulate the population into believing that the other party is the ultimate evil.

Sophie’s World: History of Philosophy (part 1)

I’ve recently started reading this book, and it’s been a great summer read for me. It is about a 14 years old girl who starts receiving letters from a mysterious person that is explaining philosophical concepts and trying to capture the beauty of philosophy.

The book is full of ideas and in this post, I will post a brief overview of the topics and the thoughts that came to me as I was reading it. (Mainly writing them down for my future self, even though I might have different thoughts if I re-read the book at a later time 🙂)

Reading strategy, for each chapter:

  1. Skim through it
  2. Read it and, as reading, take notes and add them to blog posts like this
  3. Iterate on the notes one more time using the study guide linked in every chapter
Continue reading “Sophie’s World: History of Philosophy (part 1)”

Recursion from first principles

Recursion is one of the things that makes computation happen – whether you’re doing something on your computer, smart TV, or smartphone.

For example, here’s a definition of the addition function represented in first-order logic:

\forall y, add(0, y, y) \\ \forall x, y, z, add(x, y, z) \to add(S(x), y, S(z))

Or, the more commonly known variant:

\begin{aligned} 0+y &= y \\ S(x)+y &= S(x+y) \end{aligned}

In this blog post, we will generalize recursive functions.

Continue reading “Recursion from first principles”

Implementing a formal system in Python

Some of the contents of this post are contained in my third book.

In this post, we’ll go deeper into the syntactical part of a formal system, along with the semantical. We’ve discussed formal systems in the past, and in this post, we’ll get more practical by providing an implementation of an example formal system.

Continue reading “Implementing a formal system in Python”

An algorithm for a BNF matcher

BNF (short for Backus-Naur Form) is a notation for specifying syntaxes. It allows specifying syntax with sums (|) and products (). For example, foo ::= 1 | 2 specifies that foo can be either 1 or 2, and baz = <foo>2 specifies that baz can be either 12 or 22.

A BNF matcher is a program that takes as input a grammar and a string and tells us whether the string is captured by the grammar or not. A BNF parser works similarly, but instead, it generates a syntax tree out of it rather than telling if a particular string matches the structure.

BNF is important because it’s used as the syntax of languages in computing, mainly in programming languages. That is, any time you get a “Syntax error! Missing ;” or a similar error, you can freely blame BNF 🙂

We will start with a concrete example, then give a general algorithm and finally write a BNF matcher in PHP and Lisp.

Continue reading “An algorithm for a BNF matcher”