Lately I’ve been messing around with automated theorem provers. Specifically Prover9.

The moment you open it, if you use the GUI mode, you will see 2 big text boxes – assumptions and goals. Naturally, when playing one starts with simple stuff.

We leave the assumptions blank and set as our goal. If we click Start, we see that it proves it immediately.

% -------- Comments from original proof -------- % Proof 1 at 0.00 (+ 0.00) seconds. % Length of proof is 2. % Level of proof is 1. % Maximum clause weight is 0. % Given clauses 0. 1 P -> (Q -> P) # label(non_clause) # label(goal). [goal]. 2 $F. [deny(1)]. ============================== end of proof ==========================

That was fun, but what stood out for me is that in mathematics we often take axioms for “granted”, i.e. it’s rarely that we ever think about the logic behind it. But with Prover9, we need to express all of it using logic.

For Prover9 there is a general rule, that variables start with u through z lowercase. Everything else is a term (atom).

For start, let’s define set membership. We say denotes set membership, and that’s it. Because that’s all there’s to it, it’s like an atom. So let’s say that member(x, y) denotes that.

Now let’s define our sets A = {1}, B = {1, 2}, and C = {1}.

all x ((x = 1) <-> member(x, A)). all x ((x = 1 | x = 2) <-> member(x, B)). all x ((x = 1) <-> member(x, C)).

Now if we try to prove member(1, A), it will succeed. But it will not for member(2, A).

What do we know about the equivalence of 2 sets? They are equal if there doesn’t exist an element that is in the first and not in the second, or that is in the second and not in the first.

In other words:

set_equal(x, y) <-> - (exists z ((member(z, x) & - member(z, y)) | (- member(z, x) & member(z, y)))).

So, Prover9 can prove set_equal(A, C), but not set_equal(A, B).

Another example is that we can define the set of the naturals with just:

member(Zero, Nat). member(x, Nat) -> member(Suc(x), Nat).

So, it can easily prove:

0: member(zero, Nat)

1: member(Suc(Zero), Nat)

2: member(Suc(Suc(Zero)), Nat), etc.