I want to do some formalization of mathematics using Mizar. From their Bibliography site I have read "Writing a Mizar article in nine easy steps" by F. Wiedijk (very good for the basic understanding) and "Mizar in a Nutshell" by A. Grabowski, A. Kornilowicz and A. Naumowicz (for deeper understanding and very useful as reference book). So I know have some understanding how to get the semantics right. However, as Wiedijk wrote in his manual:
The most difficult part of writing Mizar is finding what you need in the MML which is the name of the Mizar Mathematical Library. Unfortunately that problem has no easy solution. You will discover that apart from that, writing a Mizar article is straight-forward.
I basically want to get used to working with the MML, but I don't exactly know where to start? There are over 1300 articles as of yet, and while this shows a tremendous amount of work towards the QED manifesto, I cannot be expected to read them all, now can I? I know of the MML Query tool, but it seems to take queries in yet another language which doesn't seem as intuitive as the Mizar language. Also I don't see how it would help me understanding the MML. I haven't studied it deeper yet.
I have worked with Mizar for over two years now and studied it basically on my own (with the help of your mentioned references as well as getting answers to occasional questions about errors I couldn't grasp answered by the very helpful Mizar User Service (see)). I'm about to submit my forth article to the MML these days and when I started I encountered similar problems like the ones you described. As far as I know, there is no introduction to the MML yet, so I'll do my best to write something up.
First of, on a historical note, all issues of Formalized Mathematics, the journal where the abstracts of Mizar articles are published, are available online. If you read it in chronological order (at least the start issues, I mean), you would get a feeling of how the MML was built from the ground up. I found that very interesting.
However, the MML has been revised over time, if not evolved. Most notably, a lot of facts given in the article AXIOMS have originally be built in as true axioms, mainly so people could get some "real" mathematics formalized, but have been removed from their axiomatic nature since then and instead constitute theorems today. Many theorems were also moved so the article is a lot shorter today. For more on the history, see here.
To the present. In your Mizar distribution there is a file of the name
mml.lar. You can open that file with any text editor, just make sure not to accidently change its content. In this file, the articles of the MML are listed one under another in the order they are "read" into the system. So any article can only depend on those above it, never on those below. So it's save to say you can read the first say 40 articles to get an understanding of the current foundation of the MML. The GATES_ series, in my version starting from line 41 are the first I would savely consider "unimportant" unless you want to work with gates. Most of the articles before that are often important, sometimes not, but it's good to know they are there. I was surprised once to get to a point where I needed to prove that $x\in y\in z\in x$ isn't possible and if I had remembered XREGULAR at the time, I could have solved it much faster.I will now highlight some articles and selected content of it which frequently turned up in my work and I consider generally important. On that note let it be said there is a MML Query site about most used theorems, which are most used for a reason. You will do well looking these up on the HTML-linked articles. But now to the highlights!
The set-theoretic articles
ZFMISC:31)).ENUMSET1:29) or $\{x,y,z\}=\{x,z,y\}$ (ENUMSET1:57)ManySortedSet) or functions (calledManySortedFunction) (as indexed sets/functions, i.e. they are functions defined on some index set mapping to sets/functions, so this one already builds on some of the function articles below) and also the appropriate operations between them ($\bigcup_{i\in I} X_i, \bigcap_{i\in I} X_i$, etc.)NatandElement of NATandORDINAL1:def 12(definition of the attributenatural) often proved to be helpful for me to kindly remind the system that both are one and the same.continuumand shown to be equal to $|2^{\mathbb{N}_0}|$, (TOPGEN_3:29) therefore strictly greater as $\omega$ (TOPGEN_3:30).Articles regarding numbers
If you need numbers, you should definitely search for `arytm_3` in `mml.lar` and skim through the next ~30 articles related to that. Searching for "definition" within the article will give you a feeling what's the foundation of numbers in Mizar. Be aware that a proper `requirements` in your article's `environ` can spare you from a lot of citations like $1\neq 2$. I'll now proceed to mention articles out of that scope or of special interest.CARD_1:49ff.) and prove the cardinalities of the usual number sets. ORDINAL1 also introduces the attributezero. The natural numbers in Mizar include zero, so a natural number possibly being $0$ is e.g. instanciated withlet n be Nat, a natural number not being $0$ withlet n be non zero Nat.+^for $+$ and*^for $\cdot$), which therefore can be used for natural numbers, although one usually uses+and*defined later for all complex numbers (henceforth called "basic operations"). ORDINAL2 comes about 20 lines before ARYTM_3, hence the special mention to understand how the numbers are built up.<i>) and the basic operations. The operations will be redefined in subsequent articles, so Mizar knows that i.e. $n+m$ is a natural number (instead of just a complex one) when $n$ and $m$ are natural numbers.XCMPLX_1:23).XXREAL_0:1) and $a\leq b \land b\leq c \Rightarrow a\leq c$ (XXREAL_0:2). These are so very important because you will not find variations of this in the MML. $a\leq b \land b < a$ can be shown to lead to a contradiction usingXXREAL_0:1. $a\leq b \land b < c \Rightarrow a < c$ can be shown byXXREAL_0:2. Mizar is clever on how to use these two theorems and you need to know that before you try to find a substitute or prove it yourself.-', which becomes quite important when dealing with substraction of natural numbers.NAT_1:10).Articles about relations and functions
Depending on your mathematical upbringing, maybe you haven't done much with relations except for equivalence relations. Let it be said that functions can be viewed as a special kind of relations and are exactly introduced that way in Mizar. The FUNCT_ series is worth completely reading in any case, but I'll highlight as usual.RELAT_1:36). Beware that in FUNCT_1 the order $f\circ g$ is switched to $g\circ f$, you have to keep that in mind when looking for composition-related theorems of functions in RELAT_1. Examples for pre-function definitions: Let $f$ be a Relation, then we have $f(A)$ asf.:A, $f|_A$ asf|A, $f^{-1}(A)$ asf"A. *range is defined in XTUPLE_0 asproj2and just given a synonym in this article in the context of relations.f.x(because we need the brackets for our functors in Mizar). Injectivity introduced asone-to-oneas well as constant functions. One should note FUNCT_1 provides the neccessary schemes to construct your own functions.f/.xwhich is basicallyf.x(i.e. $f(x)$) with the difference that, by default,f.xis seen as a set (since for a mere function in the sense of FUNCT_1 we don't know anything about its range), whilef/.xis already seen as an Element of $Y$. This is one of the type casts in Mizar, which comes in handy sometimes. Try to use it only when needed, as it clutters proofs.ontoand $Y^X$ (set of functions from $X$ to $Y$).let a be Real; set f = REAL --> a;. I have found this most useful, but you should check out the other definitions in the article to, may become relevant. Explicitly worth noting is theIFEQ(x,y,a,b)functor.f +* gand most useful to built functions given other functions, which avoids using schemes from FUNCT_1 or FUNCT_2 and making the proofs therefore more readable. There is another version in FUNCT_7 which just changes one point of $f$.I think that concludes the basics. To be fair, I hadn't expected over 40 article myself, but it is much less than it sounds like. Most of the time, theorems encode obvious properties. If you only read the abstracts, i.e. the theorems without the proofs, you may have to translate one or another definition into what you are used to deal with, but besides that you will get really fast through the articles. And I don't really expect you to read through all of XREAL_1 for example. As you said, this is just to get familiar with the MML, not to remember every theorem. You will use grep or the MML Query for that (try
Mizar(keyword)as a query, withkeywordreplaced by whatever troubles you).Other articles of interest
- FINSEQ_ series: Finite sequences, i.e. ordered pairs, triples, quadruples, etc. but not explicitly up to a certain number like XTUPLE_0, but for arbitrary length, since they are given as functions (instead of simple sets) - SEQ_ series: Real (infinite) sequences. - SERIES_ series: Real series. - FCONT_ series: Continuous functions on $\mathbb R$. - FDIFF_ series: Differentiable functions on $\mathbb R$. - INTEGRA series: Integratable functions on $\mathbb R$. - MATRIX_ series: Matrices, building on top of finite sequences.Note that some articles may start with an R or C to indicate they deal with $\mathbb R$ or $\mathbb C$, e.g. the RFUNCT_ series, CFDIFF_ series etc. Be sure to also check out the VALUED_ series and RVSUM_ series. Graphs are formalized several times, I would encourage you to go with GLIB_ (because I'm extending it). When you are going for any kind of structure (relational, group, field, vector space etc.) read STRUCT_0 and possibly ALGSTR_0. Topology starts with PRE_TOPC, but then scatters over the MML, you can find it in BORSUK_, BROUWER, JORDAN_, GOBOARD, T_0TOPSP, TEX_, TOPALG_, TOPGEN_, TOPREAL_, TOPS_, TSEP_, WAYBEL_, YELLOW_ and more. Mannifolds in MFOLD_. For vector spaces see VECTSP_ and RLVECT_ series. Measure theory starts with MEASURE and MESFUNC. Groups in GROUP_, ring in RING_ are further obvious example. Some are somewhat hidden, of course (binomial coefficients in NEWTON, complete graphs in CHORD), but with time and grep you will find them as well. I think the most difficult part is understanding where the MML starts, anyway.
When in doubt about something unknown you encounter, consult the HTML-liked articles and click yourself to the defintion, that is usually faster than backtracking the defintions through the notations file or grep.