This version updates IsarMathLib to Isabelle2020. It was the easiest update ever – nothing had to be changed, so I just changed the abstract in the proof document with the project description.

## IsarMathLib version 1.12.1

May 12, 2020## IsarMathLib version 1.12.0

May 5, 2020This release adds three theory files contributed by Daniel de la Concepción Sáez. Two them, Topology_ZF_properties_2 and Topology_ZF_properties_3 have been in IsarMathLib for a long time, but I forgot to add them to the file that lists theories to be presented, so they were not showing up in the Isabelle generated HTML presentation or the proof document. Now they do.

The third theory TopologicalGroup_Uniformity_ZF (see also the section *Topological groups – uniformity* in the proof document or the outline) is brand new in this release and contains a proof that every topological group is a uniform space.

## IsarMathLib version 1.11.0

February 11, 2020I have released the next IsarMathLib version both on the GNU Savannah server and the IsarMathLib’s repository on GitHub. This release adds a theory about unifom spaces.

## IsarMathLib version 1.10.0

November 23, 2019This release adds a short theory on neighborhood systems in topological spaces. Besides the usual places for the sources, proof document and the outline on the GNU Savannah server one can download those from the GitHub mirror.

Years ago I had a plan to formalize some notion of measure and integration that would be different and perhaps more general than the usual Borel/Lebesque measure. I recently came back to this and searched a bit what is known about measures and integration taking values in topological groups. One of the things I found was a story about Grothendieck’s manuscript titled “*L’intégration à valeurs dans un groupe topologique*” that he presented to Dieudonné when he arrived to the University of Nancy to become a doctoral student there. The paper was harshly criticized by Dieudonné for its “reprehensible tendency to gratuitous generality” (I love gratuitous generality). The manuscript is now lost for ever probably.

On the measure side of things I found an old (1973) book “*A Theory of Semigroup Valued Measures” *by Maurice Sion and some earlier papers on the subject. The Google preview of the book suggests that the setting considered there are topological semigroups. This notion depends on uniform spaces, which depend on neighborhood systems, hence the the subject of new theory in this release.

For the integration I found an interesting paper “*Lattice Valuations: a Generalisation of Measure and Integral*” by Bram Westerbaan. This presents a unification of the notions of measure and integral under a common notion of lattice valuations (that would be a gratuitous generality again I guess). This is done in the setting of (partially) ordered abelian (topological) group. From my point of view I was kind of hoping that someone has come up with a way to define say **SO(3)** valued measures, or at least SO(2) if we really need the group to be abelian.

There is also the paper “Notes on Lebesgue integration” by Gyula Lakos that I had known before. This one is written is style that is very difficult to formalize and assumes that we already have measures.

## Lean and Metamath Zero

November 10, 2019It seems there is a wave of interest in formalized mathematics among professional mathematicians, driven by a very successful Lean mathlib project. There is a video of Kevin Buzzard’s talk about the project and an arXiv paper describing it. Kevin Buzzard is an algebraic number theorist and a professor of pure mathematics at Imperial College of London. In the summer 2018 he led a summer project with twenty undergraduates that were were learning Lean and formalizing mathematics in it. He also sometime uses Lean live coding while teaching classes and runs a Lean club at Imperial called the Xena Project. His article in the London Mathematical Society newsletter provides more info on this.

Lean is a programming language and software verification tool from Microsoft Research. I think Thomas Hales’ review is the best source on its strengths and weaknesses from the formalized mathematics point of view. Lean’s logic is calculus of inductive constructions (CIC, similar to what Coq is based on). So Lean mathlib formalizes mathematics in (dependent) type theory. Of course this is a bit unfortunate from my point of view as I am more of a set theory person. There is no doubt though that type theory is nowadays more popular (not to say successful) foundation in formalization efforts. Jeremy Avigad wrote a rare compelling explanation of why this is the case. I personally prefer the opinion of Lawrence Paulson, the original author of Isabelle and its ZF logic (he also implemented a formalization of ZFC set theory in Isabelle/HOL recently). Here is what he says:

I would guess that the amount of effort and funding going into type theory exceeds the amount that went into set theory by an order of magnitude if not two. It’s not unusual to encounter open hostility to set theory and classical logic combined with an air of moral superiority: “Oh, you aren’t constructive? And you don’t store proof objects? Really?” And I have seen “proof assistant” actually DEFINED as “a software system for doing mathematics in a constructive type theory.

The academic interest simply isn’t there. Consider the huge achievements of the Mizar group and the minimal attention they have received.(…)

I am certain that we would now have highly usable and flexible proof assistants based on some form of axiomatic set theory if this objective had enjoyed half the effort that has gone into type theory-based systems in the past 25 years.

In January 2020 there will be a conference on Formal Methods in Mathematics and Lean in Pittsburgh, Pennsylvania.

Another project related to formalized mathematics that I think is very interesting is Metamath Zero by Mario Carneiro. This is a formal proof verifier, heavily inspired by Metamath, but with a different architecture, some improvements in the metalogic and the ambition to be a “bootstraping theorem prover”, i.e. be able to verify itself. The details are in the arXiv paper, but below is the summary of what I think I understood from it.

Metamath Zero (MM0) separates the specification from the proofs, so there are two inputs to the verifier. The specification is a a human readable text written in mm0 language which is as generic as the Metamath language, i.e. it can specify logics from ZFC on FOL, through Quantum Logic(s), type theories like HOL or CIC, to the Intel x86 instruction set architecture. Anything, really. The proofs are provided separately in a binary whose format (mmb) is optimized for verification speed. This is the format that allowed MM0 to verify the material contained in the Metamath’s set.mm with its 23000 proofs in 195 ms on Intel i7 3.9GHz (the previous record was 0.7s). This part of the architecture can serve as independent backend of any theorem prover that is able to provide the mm0 specification and mmb proof binary.

An example of such theorem prover is included in the MM0 system, together with a proof language mm1 (similar to mm0) and an formal text authoring tool as a Visual Studio Code plugin implementing Language Server Protocol.

I don’t want to write about the MM0 metalogic as there is too much risk to say something wrong here. I only want to mention that the paper contains a very clear explanation of Tarski-Megill metalogic (used by Metamath) that replaces the notion of free and bound variables by the notion of distinct variable groups.

The bootstraping goal which I understand is work in progress consists of specifying Peano Arithmetic, then x86 instruction set architecture and the formal system of MM0 to get a complete specification of the working of the ELF binary file that executes the verifier.

## IsarMathLib version 1.9.8 released

August 29, 2019## FMM 2018 and IsarMathLib release 1.9.7

August 26, 2018I gave a talk on IsarMathLib at the Third workshop on Formal Mathematics for Mathematicians (FMM 2018) on August 13. The workshop was part of 11th Conference on Intelligent Computer Mathematics (CICM 2018). The slides for my talk are available online on the CCIM page. The paper (an “extended abstract”) can be also found there, but they somehow cut the pictures from it, so it’s better to look at the original.

In other news I updated IsarMathLib to Isabelle 2018 which was released about a week ago.

## IsarMathLib updated to Isabelle2016-1

March 20, 2017I finally got around to update IsarMathLib to Isabelle2016-1 that was released in December last year. This was a quite time consuming update. The Isabelle system integrates LaTeX to be able to typeset well looking document proofs. This indeed works well – when it does. When there is a problem though it requires LaTeX specific knowledge or long time to fix. This is what happened this time. The Isabelle team removed an element of its LaTeX setup that was obsoleted a couple of releases ago. They provided a script that was supposed to make necessary changes to theory files, but in my case running it on IsarMathLib’s 78 theory files just caused the errors to multiply. Fortunately Isabelle distribution sources provide lots of examples how LaTeX should be currently set up. After struggling for some time to understand the errors scattered over a 10MB log file I just created the IsarMathLib LaTeX setup from scratch following the examples and it worked. The IsarMathLib’s proof document and outline look better than ever.

## Visualizing Pandas GroupBy object

March 15, 2017I am a beginner again, this time learning Python and Pandas. I am enjoying it quite a lot. For learning I write code in a Jupyter notebook and this post is actually written as one – converted to HTML with nbconvert. The quality of the conversion is rather bad, but this is probably the best one can do without adding custom CSS to this blog setup, which would require upgrading to WordPress.com Premium.

Development using Jupyter is similar to how KDB+ coding is mostly done. In KDB+ one sends commands to a KDB+ server from a client like Studio for KDB+, getting an instant feedback on the result. Pandas is not as expressive and concise as q, but the style of a high-level API for vectorized data manipulation with avoidance of explicit iteration (loops) is similar.

One exception to the instant feedback rule in Jupyter and Pandas is the `GroupBy`

object. To see what I mean let’s define a simple data frame from a dictionary of columns:

```
import pandas as pd
data = pd.DataFrame({'sym':['a','b','c'],
'price1':[100.0,150.0,130.0],
'price2':[110.0,150.0,120.0],
'vol1':[1000.0,1200.0,1300.0],
'vol2':[1500.0,1300.0,1100.0]})
data
```

Grouping is more often done for rows (along the 0 axis), but this time we want to group columns (along `axis=1`

). One group is made of the `price1`

and `price2`

columns, the second one groups `vol1`

and `vol2`

and the `sym`

column forms its one element group. To do this we define a function that takes a column name and classifies it into one of three categories:

```
def classifier(column):
if column.startswith('price'): return 'price'
if column.startswith('vol'): return 'volume'
return 'sym'
```

Now we can group the columns using the classifier:

```
data.groupby(classifier,axis=1)
```

As we can see, the GroupBy object is not printed nicely (at least in Pandas 0.19.2 that I am using).

Of course, there are many ways to print it. One way that I found intuitive and useful is to first convert the `GroupBy`

object to a dictionary of dataframes keyed by the classifier value. This can be done using the dictionary comprehension like `{grp:subdf for grp,subdf in df.groupby(classifier,axis=1)}`

. The dictionary obtained this way can be passed to Panda’s `concat`

function. `concat`

puts the dictionary of dataframes together to get a single dataframe with multi-level columns. The additional column level clearly shows the structure of the original `GroupBy`

object.

```
def groupCols(df,classifier):
return pd.concat({grp:subdf for grp,subdf in df.groupby(classifier,axis=1)},
axis=1)
groupCols(data,classifier)
```

This trick also works for classifying rows if one uses `axis=0`

instead of `axis=1`

in a function similar to `groupCols`

above.

## Cheap air quality monitoring

January 16, 2017About a year ago I set up an air quality monitoring station based on the Air Quality Egg product by Wicked Device (see also my previous post on AQE). It was working during the winter season, providing real time data on PM2.5 concentrations near my house. This graph shows some of the data collected.

This worked OK, except that the data from the device were uploaded to Xively and available only from there. Xively was providing this service free as it was fulfilling an old commitment from one of their acquisitions. It was not high on their priority list and the service was frequently down. I decided to build my own device then to have full control over the process – from collecting the data to displaying them on a public web page. And to have some creative fun. The result works well (at least at the time of the writing) and cost less than $80 in materials, including a Raspberry Pi that I used. I think building a PM2.5 monitoring station in a way similar to what I describe below would make an excellent high school project.