Chapter 1

Writing a Mizar article innine easy steps
After reading this chapter and doing the exercises, you will be able to write abasic Mizar article all by yourself.
The chapter presents an explanation of the nine steps needed to finish a
Mizar article. For each step it also shows how this turns out for a specificexample. There are exercises too, so you can test your understanding.
To be able to read this chapter you should know some basic mathematics
but not much. You should know a little bit about:• first order predicate logic• some basic set theory
Mizar is based on set theory on top of predicate logic, that’s why.
The most difficult part of writing Mizar is finding what you need in the
MML which is the name of the Mizar Mathematical Library. Unfortunatelythat problem has no easy solution. You will discover that apart from that,writing a Mizar article is straight-forward.

1.1

Step 1: the mathematics

Before you start writing a Mizar article you need to decide what it should be
about. It’s very important not to start writing the article too soon! A proof
that takes five minutes to explain – after which people look into the air andthen mumble: ‘hm, yes, I see’ – takes about a week to formalize. So every
improvement to the mathematics that you can make before you start formalizing
will pay off very much.
The example As a running example in this chapter we write a small Mizar
article called my_mizar.miz. It is about Pythagorean triples. Those are triples
1

2

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

of natural numbers {a, b, c} for which holds that:a 2 + b 2 = c2
The Pythagorean theorem tells us that these triples correspond to square angled
triangles that have sides of integer length. The best known of these triples are{3, 4, 5} and {5, 12, 13} but there are an infinite number of them.
The theorem that we will formalize says that all Pythagorean triples are
given by the formula:a = n 2 − m2

b = 2mnc = n 2 + m2

or are multiples of such a triple. For instance the triple {3, 4, 5} is given byn = 2, m = 1, and the triple {5, 12, 13} is given by n = 3, m = 2.
The proof of the theorem is straight-forward. You only needs to consider thecase where a and b are relative prime. Some thought about parity gives that
one of the a and b has to be even, and that the other and c is odd. Then if b isthe even number of the two we get that: b 22=

 c − a  c + a 
c2 − a 2=
42
2

But if the product of two relative prime numbers is a square, then both of thosenumbers are squares. So you get:
c−a
= m2
2

c+a
= n2
2

which leads to the required formula.
Exercise 1.1.1 Study the Mizar Mathematical Library and try to decide
whether Mizar is equally suited to all fields of mathematics and computer science, or that Mizar is best suited to certain subjects. In the latter case, what
is most easily formalized in Mizar? And what least?
Exercise 1.1.2 We mentioned the Pythagorean theorem which says that thesides a, b and c of a square angled triangle satisfy a2 + b2 = c2 . Try to findthis theorem in the MML. If it’s there, in what article does it occur and whatis the theorem’s reference? If not, or if you don’t like the version that you find(exercise for when you finished this chapter): write an article that proves it.

1.2

Step 2: the empty Mizar article

In order to write a Mizar article you need a working Mizar system and a file toput the Mizar article in. In fact, as you will find out, you will need two files: a.miz file for your article and a .voc file for its vocabulary.
In this tutorial we follow the Windows conventions of naming files. For
Mizar under Unix the backslashes should go the other way. So what is called
text\my_mizar.miz here, under Unix should be text/my_mizar.miz.

1.2. STEP 2: THE EMPTY MIZAR ARTICLE

3

We will assume that you already have a properly installed Mizar system.
For a description of how to install Mizar see the readme.txt file that is in the
Mizar distribution (under Unix it is called README).
To write your article, you need to be in a directory that has two subdirectories called text and dict. If those directories don’t exist yet, make them. Putin the text directory an empty file called my_mizar.miz and put in the dictdirectory an empty file called my_mizar.voc. (Replace the my_mizar with amore appropriate name if you are writing an article of your own.)
The smallest legal .voc file is empty but the smallest legal .miz file looks
like this:environbegin
Use your favorite text editor to put those two lines in the my_mizar.miz file.
Then check it using the command:mizf text\my_mizar.miz
It will both check syntax and mathematics of your article. If everything is wellthis command prints something like:
Make Environment, Mizar Ver. 7.0.01 (Win32/FPC)
Copyright (c) 1990,2004 Association of Mizar Users-Vocabularies-Constructors-Clusters-Notation
Verifier, Mizar Ver. 7.0.01 (Win32/FPC)
Copyright (c) 1990,2004 Association of Mizar Users
Processing: text\my_mizar.miz
Parser[2]
0:00
Analyzer
0:00
Checker [1]
0:00
Time of mizaring: 0:00
meaning that this ‘article’ contains no errors. (If you use the emacs editor with
its Mizar mode you don’t need to type the mizf command. In that case all you
need to do to check the file is hit C-c RET.)
Apart from the my_mizar.miz file, the text directory now contains 25 otherfiles. You never need to look inside them. They are only used internally by theMizar system.
The next step is to connect the .miz file to the .voc vocabulary. Add avocabularies directive to your article:
environvocabularies MY_MIZAR;
begin

4

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS(Important: the name of the vocabulary has to be written in capitals! This is aremnant of Mizar’s DOS origins.)
Now the article is ready to be written. For the moment add some line oftext at the end of the file just to find out what happens if the article contains
errors:environvocabularies MY_MIZAR;
begin
hello Mizar!
After you run the mizf text\my_mizar.miz command again, Mizar will insert
the error messages inside your file. It will put a * with a number below any
error. Also there will be an explanation of those error numbers at the end of
the file. So after running the mizf command again your file looks like:environvocabularies MY_MIZAR;
begin
hello Mizar!
::> *143,321::> 143: No implicit qualification::> 321: Predicate symbol or "is" expected
There is no need to try to understand those two error messages, because ofcourse hello Mizar! is not legal Mizar. So remove this line, now that you haveseen what Mizar thinks of it. You don’t need to remove the error message lines.
They vanish the next time you run mizf.
The lines containing error messages can be recognized because they startwith ::>. Mizar only gives you error numbers. It never prints anything about
why it thinks it is wrong. Sometimes this lack of explanation is frustrating but
generally Mizar errors are quite obvious.
Exercise 1.2.1 The minimal Mizar article that we showed is 2 lines long.
What is the shortest article in the MML? What is the longest? What is theaverage number of lines in the articles in the MML?
As a rule of thumb an article less than a 1000 lines is considered too short tobe submitted to the MML. However several articles in the MML are less thana 1000 lines long since articles are shortened during revision of the MML. How
many of the articles in the MML are currently shorter than a 1000 lines?
Exercise 1.2.2 Copy an article from the MML to your private text directory. Check that the Mizar checker mizf processes it without error messages.
Experiment with making small modifications to it and see whether Mizar can
detect where you tampered with it.
Put one screen-full of non-Mizar text – for instance from a Pascal or C
program – somewhere in the middle of the article. How many error messages

1.3. STEP 3: THE STATEMENT

5will you get? Can Mizar sufficiently recover from those errors to check thesecond half of the file reasonably well?

1.3

Step 3: the statement

To start translating your mathematics to Mizar you need to write the theorem
that you want to prove in Mizar syntax.
There are two things about Mizar syntax that are important for you to note:• There are no spelling variants in Mizar. Although Mizar resembles natural
language a lot, it is a formal language and there are no possibilities tochoose between phrasings. For example:
and means something different from &not means something different from nonsuch that means something different from st
assume means something different from suppose
NAT means something different from Nat means something different
from natural
So you should really pay attention to the exact keywords in the Mizar
syntax. It’s not enough if it resembles it.
The only exception to this rule is that be and being are alternative
spellings. So although it’s more natural to write let X be set and for
X being set holds . . . you are also allowed to write let X being set
and for X be set holds . . .
• There is no distinction in Mizar between ‘function notation’ and ‘operator
notation’. In most programming languages something like f(x,y) andx+y are syntactically different things. In Mizar this distinction doesn’t
exist. In Mizar everything is an operator. If you write f(x,y) in Mizar
then it really is a ‘operator symbol’ f with zero left arguments and two
right arguments.
Similarly predicate names and type names can be any string of charactersthat you might wish. You can mix letters, digits and any other character
you might like in them. So for instance if you want to call a predicate\/-distributive you can do so in Mizar. And it will be one ‘symbol’.
If you are not sure what characters go together as a symbol in a Mizar
formula, you can go to the web pages of the MML abstracts. In thosepages the symbols are hyperlinks that point to definitions. So just clickon them to find out what symbol they are.
To write Mizar you need to know how to write terms and how to write formulas.
We tackle this in top-down fashion. First we describe how to translate
formulas from predicate logic into Mizar. Then we describe how the syntax ofMizar terms works.

6

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

1.3.1

FormulasHere is a table that shows all you want to know about how to write predicate
logic in Mizar:
⊥
¬φ
φ∧ψ
φ∨ψ
φ⇒ψ
φ⇔ψ
∃ x. ψ
∀ x. ψ
∀ x. (φ ⇒ ψ)

contradiction
not φ
φ & ψ
φ or ψ
φ implies ψ
φ iff ψex x st ψ
for x holds ψ
for x st φ holds ψ

There is no special way to write ⊤ in Mizar. One usually writes not contradiction for this. Note that with the quantifiers it should be st and not such that.
Also note that for x st φ holds ψ is just ‘syntactic sugar’ for for x holds (φimplies ψ). After the parser processed it, the rest of the system will not see
any difference between those two formulas.
Using this table you now can write logical formulas in Mizar.
There is one more thing that you need to know to write Mizar formulas inpractice. Mizar is a typed language. We will discuss Mizar types in detail in
Section 1.3.4 below, but the types turn up in the predicate logic formulas too.
All variables that you use in formulas need to have a type. There are two ways
to give a variable a type:• Put the type in the formula using a being type attribution. For instanceyou can write an existential formula about natural numbers m and n as:
ex m,n being Nat st . . .
• Give the type for the variable with a reserve statement. This doesn’t
introduce a variable, it just introduces a notation convention. If you usea reserve statement you can leave out the type in the formula:reserve m,n for Nat;ex m,n st . . .
This way of typing variables in formulas is much more convenient than
explicitely typing the variables and so it is the method that is generally
used.
Exercise 1.3.1
notation:Translate the following Mizar formulas into predicate logic

φ iff not not φ
not (φ & ψ) implies not φ or not ψ

7

1.3. STEP 3: THE STATEMENTex x st φ implies ψfor x st for y st φ holds ψ holds χ

To do this exercise you need to know the priorities of the logical operators in
Mizar. They are the usual ones in predicate logic:
ex/for < implies/iff < or < & < notThis means that you should read not φ implies ψ as (not φ) implies ψ(because the not binds stronger), but that ex x st φ implies ψ means ex x st
(φ implies ψ).
Exercise 1.3.2
syntax:Translate the following predicate logic formulas into Mizar¬φ ⇔ ¬¬¬φ¬(φ ∨ ψ) ⇒ (¬φ ∧ ¬ψ)∃ x. (φ ∧ ψ)
∃ x.

1.3.2



∃ y. (φ ⇒ ψ) ⇒ χ

Relations

You still need to know how to write atomic formulas. In Mizar there are two
ways to write those:• If R is a predicate symbol, write:
x1 , x2 , . . ., xm R xm+1 , . . ., xm+n
Both m or n might be 0, in which case this becomes prefix or postfix
notation. Note that postfix notation can have more than one argument,
as for instance in x,y are_relative_prime. Please note that brackets
around the arguments of the predicate are not allowed.
• If T is a type, or the adjectives part of a type, write:
x is TFor instance you can write x is prime. We will discuss types in Section
1.3.4 below.
To find out what relations are available to you, you will need to browse the
MML. Here is a short list of some of the most frequent used relations to get you
started.

8

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS
=
6
=
<
≤
∈
⊆

=
<>
<
<=
in
c=

The first character in the Mizar representation of ⊆ is the letter c.

1.3.3

Terms

There are three ways to write Mizar terms:• If f is an operator symbol, which Mizar calls a functor , write:(x1 , x2 , . . ., xm ) f (xm+1 , . . ., xm+n )Again, m or n might be 0, in which case this becomes prefix or postfix
notation. As an example of a postfix operator there is ^2 for square. The
brackets around either list of arguments can be omitted if there is just one
argument.
• If L and R are bracket symbols, write:
L x1 , x2 , . . ., xn R
In this case brackets ( and ) around the arguments are not necessary,
since the symbols themselves are already brackets. An example of thiskind of term is the ordered pair [x,y]. In that case n = 2, L is [ and Ris ].
• Any natural number is a Mizar term. If you write natural numbers, you
should add to your environ the line:
requirements SUBSET, NUMERALS, ARITHM;
because else they won’t behave like natural numbers.
The word functor for function symbol or operator symbol is Mizar terminology.
It has nothing to do with the notion of functor in category theory. It is used
to distinguish a function symbol in the logic from a function object in the set
theory (which is a set of pairs).
Again to find out what operators are available to you, you will need to browse
the MML. Here is a short list of some of the most frequent used operators to
get you started.

9

1.3. STEP 3: THE STATEMENT∅{x}{x, y}
X ∪Y
X ∩Y
N
Z
R
x+y
x−y
−x
xy
x/y
x2
y
x
√
x
P(X)
(x, y)
X ×Y
YX
f (x)
hi
hxi
hx, yip·q{}{x}{ x,y }X \/ Y
X /\ Y
NAT
INT
REAL
x + y
x - y
-x
x*y
x/y
x^2
x to_power ysqrt xbool X[ x,y ][:X,Y :]
Funcs(X,Y )
f .x
<*>D
<* x *><* x,y *>p^q

The digit 2 is part of the symbol for the square operator. The last four operators
are used to build finite sequences over the set D.
The . operation is function application inside the set theory. If f is a symbolin the language representing a functor with zero left arguments and one rightargument then you write:f x
or (you can always put a term in brackets):f(x)If f is a function in the set theory – a set of pairs – thenf.x
is the image of x under f, in other words it is the y such that [x,y] in f.
Exercise 1.3.3
notation:
NAT c= REAL
1/0 = 0Translate the following Mizar formulas into mathematical

10

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS
sqrt -1 in REAL
sqrt(x^2) <> x{x} /\ {-x} = {x} /\ {0}[x,y] = {{x,y},{x}}p = <*p.1,p.2*>

Exercise 1.3.4 Translate the following mathematical formulas into Mizar
syntax:√xy ≤ x+y2√(−1, 2) ∈ Z × R
X ∩Y ⊆X ∪YY X ∈ P(P(X × Y ))hx, yi = hxi · hyi
p · hi = pf (g(x)) 6= g(f (x))

1.3.4

Types: modes and attributes

The one thing left for you to understand to write Mizar formulas is Mizar’s
types. Although Mizar is based on ZF-style set theory – so the objects of Mizar
are untyped – the terms of Mizar are typed.
An example of a Mizar type is:non empty finite Subset of NATThis type should be parsed as:
non empty

finiteSubset of NAT

A Mizar type consists of an instance of a mode with in front a cluster of adjectives. The type without the adjectives is called the radix type. In this case themode is Subset and its argument is NAT, the radix type is Subset of NAT, andthe two adjectives are non empty and finite.
To put this abstractly, a Mizar type is written:
α1 α2 . . . αm M of x1 , x2 , . . ., xn

1.3. STEP 3: THE STATEMENT

11

where α1 , . . . αm are adjectives, M is a mode symbol and x1 , x2 , . . . , xn areterms. The keyword of binds the arguments of the mode to the mode. It’s likethe brackets in a term.
The number of arguments n is part of the definition of the mode. For instancefor set it is zero. You can’t write set of . . . , because there does not exist a
set mode that takes arguments.
Modes are dependent types. To find out what modes are available to you,
you will need to browse the MML. Here is a short list of some of the mostfrequent used modes to get you started.
set
numberElement of X
Subset of X
NatIntegerReal
OrdinalRelation
Relation of X,YFunction
Function of X,YFinSequence of X
Note that there both are modes Relation and Function with no arguments, andmore specific modes Relation of X,Y and Function of X,Y with two arguments.
They share the mode symbol but they are different.
Also note that the modes depend on terms. So there are no types representing the functions from a type to a type. The Function mode represents the functions from a set to a set. As an example the function space (X → Y ) × X → Y
corresponds to the Mizar type Function of [:Funcs(X,Y),X:],Y
Adjectives restrict a radix type to a subtype. They either are an attribute,or the negation of an attribute using the keyword non. Again, to find out what
attributes are available to you, you will need to browse the MML. Here is a listof a few attributes.
empty
even
odd
prime
naturalintegerreal
finiteinfinitecountable

12

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

Maybe you now wonder about how types are used in Mizar. To clarify this takea look at three Mizar notions – NAT, Nat and natural – that all mean the samething: the set of natural numbers. Here is a table that compares their uses:
meaningdeclaration

formula

n∈N
n:N
n:N

n be Natn be natural number

n in NAT
n is Natn is natural

NAT is a term, Nat is a type and natural is an adjective. be/being are a typing
in a declaration and go between a variable and a type. in is the ∈ relation of
the set theory and goes between two terms. is goes between a term and a typeor between a term and an adjective. Note that in Mizar you can have a ‘type
judgement’ as a formula in the logic.
The example We now give the statement of the theorem for the example.
The statement that we will prove in this chapter is:
reserve a,b,c,m,n for Nat;a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;
So put this after the begin line of your my_mizar.miz file.
We also could have made the quantification of the a, b and c explicit:
for a,b,c sta^2 + b^2 = c^2 & a,b are_relative_prime & a is odd holds
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;
but it is not necessary. Mizar automatically quantifies over free variables.
We now analyze this statement in some detail. The formula has the structure:
φ1 & φ2 & φ3 implies ex m,n st φ4 & φ5 & φ6 & φ7 ;The predicate logic formula that corresponds to this is:(φ1 ∧ φ2 ∧ φ3 ) ⇒ ∃ m, n. (φ4 ∧ φ5 ∧ φ6 ∧ φ7 )The first three atomic formulas in this are:
φ1
φ2
φ3

≡ a^2 + b^2 = c^2≡ a,b are_relative_prime≡ a is odd

They have the structure:
φ1
φ2
φ3

≡

t1 = t2≡

t5 is T≡t3 , t4 are relative prime

13

1.3. STEP 3: THE STATEMENT

In this = and are_relative_prime are predicate symbols. T is the adjective
odd. So we here see both kinds of atomic formula: twice a relation between
terms and once a typing.
The first term t1 in φ1 is:t1≡ a^2 + b^2

t1≡

It has the structure:

u1
u2
v1
v2

u1 + u2

≡

v1 ^2

≡

b

≡
≡

v2 ^2
a

In this + and ^2 are functor symbols.
Exercise 1.3.5

Find Mizar types for the following concepts:

odd number that is not a prime number
empty finite sequence of natural numbers
uncountable set of reals
element of the empty set
non-empty subset of the empty set
What is the problem with the last two concepts? Do you think they should beallowed in Mizar? Study this manual to find out whether they are.
Exercise 1.3.6

Write the following statements as Mizar formulas:

The only even prime number is 2.
If a prime number divides a product it divides one of the factors.
There is no biggest prime number.
There are infinitely many prime twins.
Every even number ≥ 4 is the sum of two primes.
Write these statements first using reserve statements. Then write them again
but this time with the types in the formulas.

14

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

1.4

Step 4: getting the environment right

Add the statement that you wrote to your article. Then check it. You will get
error messages:
environvocabularies MY_MIZAR;
begin
reserve a,b,c,m,n for Nat;::>*151a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies::>,203
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;::> 151: Unknown mode format::> 203: Unknown token, maybe the forbidden underscore character usedin an identifier
That’s because you didn’t import what you used from the MML. There’s nothing
wrong with the statement, there’s something wrong with the environment (it’sempty). To correct this, you need to add directives to the environ part of thearticle to import what you need.
It is hard to get the environment of a Mizar article correct. In practicepeople often just copy the environment of an old article. However that doesn’t
help much when it doesn’t work, and occasionally it doesn’t work. So you still
will have to understand how the environment works, to get it right when you
get environment related errors.
Exercise 1.4.1 Try to use an environment of an existing article from the
MML. Do the errors go away? If so, you might consider the rest of Step 4 for
now, and just use this environment.

1.4.1

Vocabulary, notations, constructors

The rule is quite simple. For everything you use – predicate, functor, mode or
attribute – you have to add a relevant reference to three directives:• vocabularies• notations• constructors
The list of references for notations and constructors is generally almost identical. In fact, if you follow the algorithm from this section to get them rightthey will be identical. These directives are about:15

1.4. STEP 4: GETTING THE ENVIRONMENT RIGHT• Lexical analysis. The tokens in a Mizar article come from lists called vocabularies. Mizar variables are identifiers with a fixed syntax, but thepredicates, functors, types and attributes all are symbols which can contain any character. You need to indicate from what vocabularies you use
symbols.
• Parsing of expressions. To have an expression you need to list the articles that you use predicates, functors, types and attributes from. The
notations directive is for the syntax of expressions. The constructors
directive is for its meaning.
Here is a list of what was use in the statement, what kind of thing it is, andwhat vocabularies and articles you need for it:
symbol

kind

=
<=
+
*
Nat
are_relative_prime
^2
odd

pred
pred
func
func
func
mode
pred
func
attr

vocabulary

articleHIDDENHIDDENHIDDENARYTM_1
HIDDENARYTM_3
SQUARE_1
MATRIX_2

HIDDENXXREAL_0
XCMPLX_0
XCMPLX_0
XCMPLX_0
NAT_1
INT_2
SQUARE_1
ABIAN

You don’t need to refer to the HIDDEN vocabulary or the HIDDEN article but
you need to list the others. The vocabularies should go in the vocabularies
directive and the articles should go both in the notations and constructors
directives. So your environment needs to be:environvocabularies MY_MIZAR, ARYTM_1, ARYTM_3, SQUARE_1, MATRIX_2;
notations XXREAL_0, XCMPLX_0, NAT_1, INT_2, SQUARE_1, ABIAN;
constructors XXREAL_0, XCMPLX_0, NAT_1, INT_2, SQUARE_1, ABIAN;
Here is the way to find out what the vocabulary and article a given symbol are:
• To find the vocabulary use the command:
findvoc -w ’symbol ’
For instance the command:
findvoc -w ’-’gives:

16

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPSFindVoc, Mizar Ver. 7.0.01 (Win32/FPC)
Copyright (c) 1990,2003 Association of Mizar Users
vocabulary: ARYTM_1
O- 32
The O means that this is a functor symbol, and 32 is the priority.
• To find the article, the easiest way is to go to the web pages of the abstractsof the MML on the Mizar web site, find a use of the symbol somewhere,
and click on it to go to the definition.

Exercise 1.4.2

Find out what is in the HIDDEN vocabulary by typing:listvoc HIDDEN
For each of the 25 symbols in this vocabulary, find an article that introduces anotation that uses it.

1.4.2

Redefinitions and clusters

But now things get tough. It turns out that your environment still does notwork! The problem is that the types are wrong. If you check the article with
the new environment you get:a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies::> *103
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;
::>
*102
*103
*103
*103
::> 102: Unknown predicate::> 103: Unknown functor
To get rid of this kind of typing problems is the most difficult part of writinga Mizar article. (In practice this kind of error often is caused because a cluster
is missing. So if you are completely mystified by a Mizar typing error, start
thinking ‘cluster!’)
The errors that you see here are indeed almost all caused by the fact thatsome clusters are not imported in the environment. This causes the expressions
not to have the right types. For instance the first error is caused by the factthat a^2 and b^2 have type Element of REAL, while the + wants its arguments
to have type complex number. We will show in detail why this is the case, andhow to fix this by importing the right clusters.
A Mizar expression doesn’t have just one type, it has a whole set of types.
For instance, with the right environment the number 2 has the following types:

1.4. STEP 4: GETTING THE ENVIRONMENT RIGHT

17

Nat
natural number
prime Nat
Integer
integer number
even IntegerRealreal number
Complexcomplex number
Ordinalordinal number
setfinite set
non empty set...
There are two ways to influence the types of an expression.
• To give a specific expression a more precise radix type, you use redefinitions. A functor can have many redefinitions that cause it to get different
types depending on the types of its arguments.
Here is an example of a redefinition taken from PEPIN:
definition let n be Nat;
redefine func n^2 -> Nat;
end;
What this does is change the type of some of the terms that use the ^2
operator.
The original definition (of which this is a redefinition) is in SQUARE_1:
definition let x be complex number;func x^2 -> set equals x * x;end;
In SQUARE_1 there already are two other redefinitions of ^2:
definition let x be Element of COMPLEX;
redefine func x^2 -> Element of COMPLEX;
end;
definition let x be Element of REAL;
redefine func x^2 -> Element of REAL;
end;
Now suppose that in your environment you have the directive:

18

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS
notations . . . , SQUARE_1, PEPIN, . . . ;Then if you write an expression t^2, the type of this expression will dependon the type of t. All definitions and redefinitions of ^2 will be consideredin the order that they are imported through the notations directive. So
in this case the definition for complex number is first, then there is theredefinition for Element of COMPLEX, then the redefinition for Elementof REAL, and finally (go to the next article, which is PEPIN) there is theredefinition for Nat.
Now the rule is that the last redefinition that fits the type of all arguments
applies.
So if t has type Nat then t^2 has type Nat too, while if t does not haveany of the types Element of COMPLEX or Element of REAL or Nat, then it
will have type set.
Note that since the the order of the articles in the notations directive isimportant for this!
• To generate more adjectives for an expression, Mizar has something called
clusters. The process of adding adjectives according to these clusters iscalled the rounding up of clusters.
Here are three examples of clusters, taken from FINSET_1.
registration
cluster empty -> finite set;
end;
This means that every set that has adjective empty also will get adjective
finite.
registration let B be finite set;cluster -> finite Subset of B;
end;
This means that every expression that has type Subset of B where B has
type finite set also will get adjective finite.
registration let X,Y be finite set;cluster X \/ Y -> finite;
end;
This means that every expression of the shape X \/ Y where X and Y havetype finite set also will get adjective finite.
These examples show both kinds of cluster that add adjectives to the setof types of an expression. The first two do this based on the type ofthe expression (this is called ‘rounding up’ a type), and the third add
adjectives based on the shape of the expression.

1.4. STEP 4: GETTING THE ENVIRONMENT RIGHT

19

To summarize: redefinitions are for narrowing the radix type and clusters are forextending the set of adjectives. (There are also redefinitions that have nothing
to do with typing – because they redefine something different from the type –and a third kind of cluster that has nothing to do with adding adjectives. You
should not be confused by this.)
You can always test whether some type T is in the set of types of an expression t by changing it to ( t qua T ). You get an error if t didn’t have T in its
set of types. In that case you might start looking for a redefinition or clusterthat changes this situation.
The example The first error in the example:a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies::> *103
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;
::>
*102
*103
*103
*103
::> 102: Unknown predicate::> 103: Unknown functor
is that the + in a^2 + b^2 is not well-typed. (The * of the error message *103
indicates the position of the error. In this case it is below the + symbol.) The
definition of ^2 that is in effect here is from SQUARE_1:
definition let x be Element of REAL;
redefine func x^2 -> Element of REAL;
end;
and the definition of + is from XCMPLX_0:
definition let x,y be complex number;func x+y means . . .
...
end;
So this shows that you would like a^2 and b^2 which have type Element of REAL
to also get type complex number. This means that you want these expressions
to get an extra adjective – the adjective complex – and so you need a cluster.
(Once again: for more adjectives you need clusters, while for a more precise
radix type you need a redefinition.)
It turns out that an appropriate cluster is in XCMPLX_0:
registration
cluster -> complex Element of REAL;
end;
After you add
registrations XCMPLX_0;

20

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

to the environment the first error indeed is gone and you only have two errors
left:a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;
::>
*102
*103
::> 102: Unknown predicate::> 103: Unknown functor
The next error (the *102 below the <=) is similar to the previous one. The <=predicate expects arguments of type real number, but m and n have type Nat. If
you study the MML for some time you will find that Nat is the same as Elementof omega (the definition of Nat in NAT_1 and the synonym in NUMBERS.)
Therefore the following two clusters give you what you need. From ARYTM_3:
registration...
cluster -> natural Element of omega;end;
and from XREAL_0:
registration
cluster natural -> real number;...
end;
The cluster directive now has become:registrations XCMPLX_0, ARYTM_3, XREAL_0;
With this directive in the environment the only error left is:a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;::>
*103::> 103: Unknown functor
This error is caused by the fact that Mizar does not consider 2 to be a Nat. You
will see below, after the discussion of the requirement directive, how to get ridof this final error.

1.4.3

The other directives

Here is a list of the eight kinds of directives in the environ and the kind ofreference they take:1.4. STEP 4: GETTING THE ENVIRONMENT RIGHT
vocabularies
notationsconstructors
registrations
definitions
theorems
schemesrequirements

21

vocabulary
articlearticlearticlearticlearticlearticleBOOLE, SUBSET, NUMERALS, ARITHM, REAL

Here is when you need the last four kinds of directive:• The definitions directive is not about being able to use the theorems
that are part of the definitions (that’s part of the theorems directive.)
It’s about automatically unfolding predicates in the thesis that you areproving.
This directive is useful but not important. You can ignore it until you get
up to speed with Mizar.
• The theorems and schemes directives list the articles you use theorems
and schemes from. So whenever you refer to a theorem in a proof, you
should check whether the article is in the list of this directive.
These are easy directives to get right.
• The requirements directive makes Mizar know appropriate things automatically.
For instance to give numerals type Nat you needrequirements SUBSET, NUMERALS;This is the solution to the last typing error left in your article.
With ARITHM Mizar also knows some basic equations about numbers automatically. For instance with it, Mizar accepts 1+1 = 2 without proof.
This is an easy directive to get right. Just put in all requirements and bedone with it.
So now that you got the environment right, the article checks like this:environvocabularies MY_MIZAR, ARYTM_1, ARYTM_3, SQUARE_1, MATRIX_2;
notations XXREAL_0, XCMPLX_0, NAT_1, INT_2, SQUARE_1, ABIAN;
constructors XXREAL_0, XCMPLX_0, NAT_1, INT_2, SQUARE_1, ABIAN;
registrations XCMPLX_0, ARYTM_3, XREAL_0;
requirements SUBSET, NUMERALS;
begin
reserve a,b,c,m,n for Nat;a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies

22

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;::>
*4::> 4: This inference is not accepted
The only error left is *4. It means that Mizar is not able to prove the statementon its own.
This is an important milestone. Articles with only *4 errors are ‘almost
finished’. They just need a bit of proof.
Exercise 1.4.3 For each of the following statements find an environment thatmakes all errors different from error *4 go away:
for X,Y being non empty set,f being Function of X,Y, g being Function of Y,X st
f is one-to-one & g is one-to-one holds
ex h being Function of X,Y st h is bijective
for p being FinSequence, D being set stfor i being Nat st i in dom p holds p.i in D holds
p is FinSequence of D;
for G being Group, H being Subgroup of G st
G is finite holds ord G = ord H * index H;
for GX being TopSpace, A,C being Subset of GX st
C is connected & C meets A & C \ A <> {}GX holds
C meets Fr A;
Exercise 1.4.4

Consider the nine types:

Element of NAT
Element of INT
Element of REAL
Element of COMPLEX
Nat
IntegerReal
Complexnatural number
integer number
real number
complex number
There are 81 pairs of different types T1 and T2 from this list for which theformula:for x being T1 holds (x qua T2 ) = x;

1.5. STEP 5, MAYBE: DEFINITIONS AND LEMMAS

23

should be allowed (however not all of them are provable in the MML). What is anenvironment that gives the minimum number of error messages *116 (meaning
Invalid "qua")? What is used from the articles in this environment?
Exercise 1.4.5 Apart from the kinds of cluster that we showed in Section 1.4.2(the ones that generate extra adjectives for terms), Mizar has something called
existential clusters. These are the clusters without ->. They don’t generate
extra adjectives for a term. Instead they are needed to be allowed to add
adjectives to a type.
The reason for this is that Mizar types always have to be non-empty. So to
be allowed to use a type something has to be proved. That is what an existential
cluster does.
For example to be allowed to use the type:non empty finite Subset of NAT
you needs an existential cluster from GROUP_2:
registration let X be non empty set;cluster finite non empty Subset of X;
end;
If you don’t have the right existential clusters in your article you will get error*136 which means non registered cluster.
Which types in the following list have an existential cluster in the MML?
For the ones that have one, where did you find them? For the ones that don’t
have one, what would be an appropriate existential cluster?
empty set
odd prime Nat
infinite Subset of REAL
non empty Relation of NAT,NAT

1.5

Step 5, maybe: definitions and lemmas

Step 5 you can skip. Then you just start working on the proof of the theorem
immediately.
However if you did step 1 right, you probably have some lemmas that you
know you will need. Or maybe you need to define some notions before being
able to state your theorem at all.
So do so in this step. Add relevant definitions and lemmas to your article
now. Just like the statement in step 3. Without proof. Yet.

24

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

1.5.1

Functors, predicates

There are two ways to define a functor in Mizar:• As an abbreviation:
definition let x be complex number;func x^2 -> complex number equals x * x;
coherence;end;
The coherence correctness condition is that the expression x * x really
has type complex number like it was claimed. If Mizar can’t figure thisout by itself you will have to prove it.
• By a characterization of the result:definition let a be real number;assume 0 <= a;func sqrt a -> real number means
0 <= it & it^2 = a;existence;uniqueness;end;
In the characterizing statement the variable it is the result of the functor.
The existence and uniqueness are again correctness conditions. They
state that there always exists a value that satisfies the defining property,
and that this value is unique. (In the proof of them you are allowed touse that the assumption from the definition is satisfied.)
In this case existence is the statement:
ex x being real number st 0 <= x & x^2 = a
and uniqueness is the statement:
for x,x’ being real number st
0 <= x & x^2 = a & 0 <= x’ & x’^2 = a holds x = x’
And here is an example of the way to define a predicate:• definition let m,n be Nat;
pred m,n are_relative_prime meansm hcf n = 1;
end;
The definition of a predicate doesn’t have a correctness condition. (In thisexample hcf is the greatest common divisor.)

1.5. STEP 5, MAYBE: DEFINITIONS AND LEMMAS

1.5.2

25

Modes and attributes

There are two ways to define a mode in Mizar:• As an abbreviation:
definition let X,Y be set;mode Function of X,Y isquasi_total Function-like Relation of X,Y;
end;
In this definition quasi_total and Function-like are attributes.
• By a characterization of its elements.
definition let X,Y be set;mode Relation of X,Y means
it c= [:X,Y:];
existence;end;
The existence correctness condition states that the mode is inhabited.
This has to be the case because Mizar’s logic wants all Mizar types to be
non-empty.
In this case existence is the statement:
ex R st R c= [:X,Y:]And here is an example of the way to define an attribute:• definition let i be number;
attr i is even means
ex j being Integer st i = 2*j;end;
The example The essential lemma for the example is that if two numbers are
relative prime and their product is a square, then they are squares themselves.
In Mizar syntax this is the statement:
m*n is square & m,n are_relative_prime implies
m is square & n is squareNow the attribute square is already present in the MML, but it is in the article PYTHTRIP, and that is the article that you are currently writing! So let’s
prentend it is not there and add it to the article, to practice writing definitions.
The way to define the attribute square (this will enable you to have a typesquare number) is:

26

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

definition let n be number;
attr n is square means
ex m being Nat st n = m^2;
end;
(Note that we do not only define the attribute square for expressions of typeNat, but for all Mizar terms. Else statements like not -1 is square would not
be well typed.)
Part of most definitions is the introduction of a new symbol. In this case
it is the attribute symbol square. Again, it is already in the MML, in vocabulary PYTHTRIP. But again, we do not want to use that, so let’s add it to the
vocabulary of the MY_MIZAR that you are writing.
So add the line:
Vsquareto the my_mizar.voc file.
The V in front means that this is an attribute symbol. Vocabularies have an
O in front for functors, R in front for predicates, M in front for modes and V in
front for attributes.
The statements in a Mizar article can be local to the article or be visible tothe outside of the article. In the latter case they have to be preceded by the
keyword theorem. So add theorem in front of the statements, like this:theorem Th1:
m*n is square & m,n are_relative_prime implies
m is square & n is square;::>*4,4theorem Th2:a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2;::>
*4::> 4: This inference is not accepted(Note that there are two *4 errors below theorem Th1. The reason for this isthat the Mizar checker considers the two conclusions m is square and n issquare to be two different proof obligations.)
Exercise 1.5.1 Show that in Mizar definition by abbreviation is secondary
to definition by characterization:
How can you simulate the equals variant of a func definition with the means
variant of a func definition? Similarly: how can you simulate the is variant ofa mode definition with the means variant of a mode definition?
Exercise 1.5.2 We claimed that Mizar’s types are always non-empty. However you can write the type:
Element of {}Explain why this is not a problem.

27

1.6. STEP 6: PROOF SKELETON

1.6

Step 6: proof skeleton

Mizar is a block structured language like the Pascal programming language.
Instead of begin/end blocks it has proof/end blocks. And instead of procedures
it has theorems. Apart from that it is a rather similar language.
We will now write the proof of the theorem. For the moment we just write
the steps and not link them together. Linking the steps in the proof will be step
7 of the nine easy steps.
A Mizar proof begins with the keyword proof and ends with the keyword
end.
Important! If you have a proof after a statement there should not be asemicolon after the statement. So:
statement ;proof
proof steps
end;
is wrong! It should be:statement
proof
proof steps
end;This is easy to do wrong. Then you will get a *4 error at the semicolon thatshouldn’t be there.
In this section we will discuss the following kinds of proof step. There aresome more but these are the frequently used ones:

1.6.1

step

sectioncompact
assume
thus
let
take
considerper cases/suppose
setreconsider
iterative equality

1.6.2
1.6.1
1.6.1
1.6.1
1.6.1
1.6.2
1.6.2
1.6.3
1.6.3
1.6.4

Skeleton steps

During the steps of the proof the statement that needs to be proved is kept trackof. This is the ‘goal’ of the proof. It is called the thesis and can be referred towith the keyword thesis.

28

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPSA Mizar proof consists of steps. Steps contain statements that you know to
be true in the given context. Some of the steps reduce the thesis. At the endof the proof the thesis should be reduced to ⊤ or else you will get error *70
meaning Something remains to be proved. Steps that change the thesis arecalled skeleton steps.
The four basic skeleton steps are assume, thus, let and take. They correspond to the shape of the thesis in the following way:thesis to be proved, before
φ implies ψ
φ & ψ
for x being T holds ψ
ex x being T st ψ

the step
assume φthus φlet x be T
take tthesis to be proved, afterψψψψ[x := t]Just like with for the typing can be left out of the let if the variable is in areserve statement.
Here is an example of how these skeleton steps work in a very simple proof:
for x,y st x = y holds y = x
proof
let x,y;assume x = y;thus y = x;end;
At the start of the proof the thesis is for x,y st x = y holds y = x. Afterthe let step it is reduced to x = y implies y = x. After the assume step it
is reduced to y = x. After the thus step it is reduced to ⊤ and the proof iscomplete.
The skeleton steps of the proof of the example will be:theorem Th2:a^2 + b^2 = c^2 & a,b are_relative_prime & a is odd implies
ex m,n st m <= n & a = n^2 - m^2 & b = 2*m*n & c = n^2 + m^2
proof
assume a^2 + b^2 = c^2;
assume a,b are_relative_prime;
assume a is odd;
take m,n;thus m <= n;thus a = n^2 - m^2;
thus b = 2*m*n;thus c = n^2 + m^2;
end;
At this point we don’t have anything to put in the place of the m and n. We
need another kind of step for that.

29

1.6. STEP 6: PROOF SKELETON

Exercise 1.6.1 Explain why you can always end a proof with a thus thesis
step. This is the Mizar version of quod erat demonstrandum. Count in the
MML how many times this construction occurs. (Include in your count hence
thesis which is the same thing.) Is there an occurence of thesis in the MML
which is not part of this construction?
Exercise 1.6.2
statements:

Write the skeleton steps in the proofs for the following Mizar

x = 0 & y = 0 implies x + y = 0 & x*y = 0
ex x st x in X implies for y holds y in X
for n st not ex m st n = 2*m holds ex m st n = 2*m + 1(ex n st n in X) implies
ex n st n in X & for m st m < n holds not m in X
Write a fresh variable in the take steps if there is no good choice for the term.

1.6.2

Compact statements and elimination

The simplest step is a compact step. This is just a statement that is true in thecurrent context. This is the most common step in a Mizar proof. So a Mizar
proof skeleton for the most part just looks like:...
statement ;statement ;statement ;...
where each statement in the list is a consequence of a combination of some ofthe preceding statements.
And then there are the consider and per cases/suppose constructions.
They are both related to a statement:
if you can prove thisex x st φ
φ1 or φ2 or . . . or φn...

you can have this as a proof step
consider x such that φ;per cases;
suppose φ1 ;proof for the case φ1
end;
suppose φ2 ;proof for the case φ2
end;...
suppose φn ;proof for the case φn
end;

30

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

To use natural deduction terminology, these steps correspond to existential anddisjuction elimination. The consider step introduces a variable that you canrefer to in your proof, just like the let step.
We can now add the following steps to the example proof to give us terms m
and n for the take step:...
((c - a)/2)*((c + a)/2) = (b/2)^2;((c - a)/2)*((c + a)/2) is square;(c - a)/2,(c + a)/2 are_relative_prime;(c - a)/2 is square & (c + a)/2 is square;consider m such that (c - a)/2 = m^2;
consider n such that (c + a)/2 = n^2;take m,n;...
The first four steps are compact statements. The two consider steps use theexistential statement that’s part of the definition of square.

1.6.3

Macros and casts

Often in proofs certain expressions occur many times. It is possible to give such
expressions a name using set commands:
set h = b/2;
set m2 = (c - a)/2;
set n2 = (c + a)/2;
A set command is a definition of a constant that is local to the proof. It behavesvery much like a macro.
When writing Mizar articles, often you want to use an expression with adifferent type than it’s got. You can change the type of an expression with thereconsider command. This is like a set, but also gives the type of the newvariable.
In the example we will need the abbreviated variables h, m2 and n2 to havetype Nat. This can be accomplished by changing the set lines in the previous
paragraph to:reconsider h = b/2 as Nat;
reconsider m2 = (c - a)/2 as Nat;
reconsider n2 = (c + a)/2 as Nat;
Again the new variables behave like macros, but now with a different type. So
reconsider is a way to cast the type of a term.

1.6.4

Iterative equalities

In mathematical calculations one often has a chain of equalities. Mizar has thisfeature too.

1.7. STEP 7: COMPLETING THE PROOF

31

You can write a calculation: b 2
 c − a  c + a  (c − a)(c + a)c2 − a 2
b2
=
=
=
=
2
2
4
4
4
2
in Mizar as:((c - a)/2)*((c + a)/2) = (c - a)*(c + a)/4.= (c^2 - a^2)/4.= b^2/4.= (b/2)^2;
Such a chain of .= equalities is called an iterative equality. Note that the firstequality in the chain is written with the = symbol instead of with the .= symbol.
Exercise 1.6.3 Collect the steps for the proof of Th2 that were given in thissection. Put them in the proper order in your my_mizar.miz file. Use thereconsider lines (not the set lines) and replace the abbreviated expressions
everywhere by their abbreviation. Put in the iterated equality as well.
Add two compact statements before the reconsider lines stating that b iseven and that c is odd. They will be needed to justify the reconsider lines.
Add two compact statements relating m2 and n2 to a and c after the reconsiderlines.
Now check your file with mizf. Update the environment if necessary until
you have only *4 errors left. How many *4 errors do you get?

1.7

Step 7: completing the proof

In this section you will add justifications to the steps of your proof. That will
finish your article.

1.7.1

Getting rid of the *4 errors

There are three ways to justify a step in Mizar:• By putting a semicolon ; after it:
statement ;This is the empty justification. It tells Mizar: figure this out by yourself.
• By putting by after it with a list of labels of previous statements:
statement by reference , . . . , reference ;In fact the previous way to justify a step is the special case of this in which
the list of references is empty.

32

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS• By putting a subproof after it:
statement proof steps in the subproof

end;

The subproofs are what gives Mizar proofs the block structured look.
If you don’t use thesis in a subproof, the statement can be reconstructedfrom the skeleton steps in that subproof. Therefore you might want toomit the statement. You can do this by using now:
now steps in the subproof

end;This is exactly the same as the statement with the subproof, but you don’t
need to write the statement.
Here is a small example that shows how by is used:(x in X implies x in Y) & x in X implies x in Y
proof
assumeA1: x in X implies x in Y;
assumeA2: x in X;
thus x in Y by A1,A2;
end;
Of course this one is so easy that Mizar can do it on its own:
(x in X implies x in Y) & x in X implies x in Y ;Often in the list of references after a by justification, there is a reference to theprevious statement. This can also be written by putting the keyword ‘then’ infront of the step. Using then you can often avoid having to label statements.
So you can replace:A1: statement ;A2: statement ;statement by A1,A2:
by
A1: statement ;statement ;then statement by A1;
Some people like writing the then on the previous line, after the statement thatit refers to:
A1: statement ;statement ; thenstatement by A1;

33

1.7. STEP 7: COMPLETING THE PROOF

This is a matter of taste. Other people choose the position of the then dependingon whether the statement after the then has a label or not.
When you want to use then to justify a thus step you are not allowed to write
then thus. You have to write hence. In Mizar when in certain combinationsof two keyword get together you have to replace the combination by somethingelse. Here are the two relevant equations:then +
thus +

thus =
now =hence
herebySo the hence keyword means two things:
1. This follows from the previous step.
2. This is part of what was to be proved.
A common Mizar idiom is hence thesis. You see that many times in any Mizar
article.

1.7.2

Properties and requirements

So now you need to hunt the MML for relevant theorems. This is made difficult
by three reasons:• The MML is big.
• The MML is not ordered systematically but chronologically. It is like a
mediaeval library in which the books are put on the shelf in the order thatthey have been acquired.
• Mizar is smart. The theorem you can use might not look very much likethe theorem you are looking for.
As an example of the fact that theorems can be in unexpected places, the basic
theorem that relates the two kinds of dividability that are in the Mizar libary:m divides n iff m divides (n qua Integer);is in an article called SCPINVAR which is about loop invariants of a certain small
computer program (SCP stands for SCMPDS program and SCMPDS stands forsmall computer model with push-down stack).
The best way to find theorems in the MML is by using the grep command to
search all the .abs abstract files. Although the MML is huge it’s small enoughfor this to be practical. For instance this is an appropriate command to search
for the theorem in the SCPINVAR article:% grep ’divides .* qua’ $MIZFILES/abstr/*.abs/usr/local/lib/mizar/abstr/scpinvar.abs:
m divides n iff m divides (n qua Integer);%

34

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPSAnother problem when looking for theorems is that Mizar is too smart.
If you look at the definitions of +, * and <= you will find that they contain the keywords commutativity, reflexivity, connectedness, synonym andantonym:definition let x,y be complex number;func x + y means:: XCMPLX_0:def 4...
commutativity;
func x * y means:: XCMPLX_0:def 5...
commutativity;end;
definition let x,y be ext-real number;pred x <= y means:: XXREAL_0:def 5...
reflexivity;
connectedness;end;notation let x,y be real number;synonym y >= x for x <= y;antonym y < x for x <= y;antonym x > y for x <= y;end;
These keywords mean two things:• If you use a synonym or antonym then Mizar will internally use the real
name. So if you write:a < bthen internally Mizar will consider this to be an abbreviation of:
not b <= aand if you write:a >= bthen internally Mizar will consider this to mean:b <= a1.7. STEP 7: COMPLETING THE PROOF

35• Mizar will always ‘know’ when justifying a step, about the properties
commutativity, reflexivity and connectedness. So if you have a statement:. . . x*y . . .
then Mizar behaves as if this statement is exactly the same as:. . . y*x . . .
Also Mizar will use all implication of the shape:x=y⇒x≤yand:x≤y∨y≤xwhen trying to do a justification. These properties mean for the < relationthat:¬(x < x)and:x<y⇒x≤y
For instance if you have proved:a < bthen you can refer to this when you only need:a <> bThis is all very nice but let’s look at three examples of the subtlety it leads to:• Suppose you want to justify the following step:a >= 0;then c - a <= c by . . . ;It turns out that the theorem that you need is:theorem :: REAL_2:173(a<0 implies a+b<b & b-a>b) & (a+b<b or b-a>b implies a<0);
It will give you:c - a > c implies a < 0
but because of the antonym definition of < and > this really means:

36

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS
not c - a <= c implies not 0 <= awhich is equivalent to:
0 <= a implies c - a <= cWhich is what you need.
• Suppose you need to prove the equation:(c + a + c - a)/2 = (c + c + a - a)/2
The + and - operators have the same priority and are left associative, so
this has to be read as:(((c + a) + c) - a)/2 = (((c + c) + a) - a)/2
Because of commutativity of + this really is the same as:((c + (c + a)) - a)/2 = (((c + c) + a) - a)/2
So you need to show that: c + (c + a) = (c + c) + a which is associativity of +, a theorem from the XCMPLX_1 article:
theorem :: XCMPLX_1:1
a + (b + c) = (a + b) + c;
Note that the original equation doesn’t look very much like an instance of
associativity!
• Consider the transitive law for <=:theorem :: AXIOMS:22
x <= y & y <= z implies x <= z;
It’s good to have this, but where is the analogous law for <:x < y & y < z implies x < z;
It turns out that this also is AXIOMS:22! To see why this is the case, notethat it is a consequence of the stronger theorem:
x <= y & y < z implies x < z;
and becase of the antonym definition of < this is the same as:x <= y & not z <= y implies not z <= x;1.7. STEP 7: COMPLETING THE PROOF

37

which is equivalent to:z <= x & x <= y implies z <= y;which is indeed AXIOMS:22.
(The ‘arithmetical lemmas’ for the arithmetical operations that we have used
as examples here all are in the articles AXIOMS, REAL_1, REAL_2 and XCMPLX_1.
The rule is that if the lemma that your are looking for is valid in the complex
numbers (which generally means that it just involves equality and not <= or <)then it is in XCMPLX_1. Unfortunately if it does talk about inequalities, then
you will have to look in all the other three articles. In that case there is not aneasy rule that will tell you where it has to be.)Sometimes you should not go look for a theorem. If you have requirements
ARITHM then Mizar knows many facts about the natural numbers without help.
Sometimes those facts even don’t have a theorem in the library anymore, so you
search for a long time if you don’t realize that you should use requirements.
For instance if you use requirements ARITHM:
x + 0 = x;and:0*x = 0;and:
1*x = x;and:0 < 1;
and:0 <> 1;all don’t need any justification.
Suppose you want to justify:a >= 1;then a > 0 by . . . ;If you had 0 < 1 then this would just be an instance of AXIOMS:22 (as we justsaw). But requirements ARITHM gives that to you for free! So you can just
justify this step with AXIOMS:22.
Exercise 1.7.1 We claim that the MML is big. Count how many sourcelines there are in the .miz articles in the MML. Try to guess how many lines ofMizar a competent Mizar author writes per day and then estimate the numberof man-years that are in the MML.

38

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

1.7.3

Automation in Mizar

In Mizar it’s not possible to write tactics to automate part of your proof effort
like you can do in other proof checkers. All Mizar’s automation is built into theMizar system by its developers.
Mizar has four kinds of automation:
Semantic correlates Internally Mizar stores its formulas in some kind of
conjunctive normal form that only uses ∧, ¬ and ∀.
This means that it automatically identifies some equivalent formulas. These
equivalence classes of formulas are called semantic correlates. Because of semantic correlates, the skeleton steps of a formula are more powerful than you
might expect. For instance you can prove:φ
proof
assume not φ;...
thus contradiction;end;
and also you can prove:
φ or ψ
proof
assume not φ;...
thus ψ;end;(Mizar does not identify φ & ψ with ψ & φ. You have to put the thus steps ina proof in the same order as the conjuncts appear in the thesis.)
Properties and requirementsin the previous section.

Properties and requirements were discussed

Clusters Clusters automatically generate adjectives for expressions. Often
theorems can be rephrased as clusters, after which they will become automatic.
Consider for instance the theorem:m is odd square & n is odd square implies m + n is non square;
which says that a square can never be the sum of two odd squares. (The reason
for this is that odd squares are always 1 modulo 4, so the sum would be 2
modulo 4, but an even square is always 0 modulo 4.)This theorem can be rephrased as a cluster:1.7. STEP 7: COMPLETING THE PROOF

39

definition let m,n be odd square Nat;cluster m + n -> non square;end;
Once you have proved this cluster Mizar will apply the theorem automaticallywhen appropriate and you don’t have to give a reference to it in your proofs.
Justification using by The by justifier is a weak first order prover. It tries
to deduce the statement in front of the by from the statements that are referred
to after the by.
A by justification pretty much feels like a ‘natural reasoning step’. Whenone studies the proofs that humans write, it turns out that they tend to chooseslightly smaller steps than by can do.
The way by works is:• It puts the implication that it has to prove in conjunctive normal form.
Then it tries to do each conjunct separately.
That’s why you often get more than one *4 error for a failed justification.
Mizar puts in an error for every conjunct that has not been justified.
• It then tries to prove the inference. In only one of the antecedents can auniversal quantifier be instantiated. Therefore:
A1: for x holds x in X;
A2: for x holds not x in X;
contradiction by A1,A2;
won’t work because it both has to instantiate the for in A1 and A2. You
will need to split this into:
A1: for x holds x in X;
A2: for x holds not x in X;
a in X by A1;
then contradiction by A2;• The by prover will do congruence closure of all the equalities that it knows.
It also will combine the typing information of equal terms.
• A conclusion that has an existential quantifier is equivalent to an antecedent that has a universal quantifier. Therefore by is able to derive
existential statements from instantiations of it.

1.7.4

Unfolding of definitions

Here is a table that shows when Mizar will unfold definitions:

40

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS
func/equals
func/means
pred/means
mode/ismode/means
attr/means
set

−
−
⋄
+
⋄
⋄
+

The items in this table that have a + behave like macros. For instance thedefinition of Nat is:definitionmode Nat is Element of NAT;
end;
If you write Nat it’s exactly like writing Element of NAT. So theorems about
the Element mode will automatically apply to Nat.
The items in the table that have a − will never be expanded. All you get isa definitional theorem about the notion. You will need to refer to this theorem
if you want to use the definition.
The items in the table that have a ⋄ will be expanded if you use thedefinitions directive. Expansion only happens in the thesis. It takes place if
a skeleton step is attempted that disagrees with the shape of the thesis.
For instance the definition of c= is:definition let X,Y;
pred X c= Y means:: TARSKI:def 3
x in X implies x in Y;
reflexivity;end;
If you have TARSKI in your definitions you can prove set inclusion as follows:
X c= Y
proof
let x be set;assume x in X;...
thus x in Y;
end;
Similarly consider the definition of equality in XBOOLE_0:
definition let X,Y;
redefine pred X = Y means:: X_BOOLE_0:def 10
X c= Y & Y c= X;
end;

1.7. STEP 7: COMPLETING THE PROOF

41

If you add XBOOLE_0 to your definitions it will allow you to prove:
X = Y
proof
...
thus X c= Y;...
thus Y c= X;
end;or even:
X = Y
proof
herebylet x be set;assume x in X;...
thus x in Y;
end;
let x be set;assume x in Y;...
thus x in X;
end;
Exercise 1.7.2

Write Mizar proofs of the following three statements:

reserve X,Y,Z,x for set;for X holds X c= X;
for X,Y st X c= Y & Y c= X holds X = Y;
for X,Y,Z st X c= Y & Y c= Z holds X c= Z;
that only make use of the following two theorems from the MML:
theorem :: TARSKI:2
for X,Y holds
X = Y iff for x holds x in X iff x in Y;
theorem :: TARSKI:def 3
for X,Y holds
X c= Y iff for x st x in X implies x in Y;(If you look in the MML, it will turn out that in the TARSKI article this is notexactly what’s there. We present it like this for didactic purposes.)
The approach you should follow in your proof, is that in order to prove a
statement like X c= Z you should first prove that:

42

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS...
A1: for x holds x in X implies x in Z;
proof
...
end;
...
and then justify the X c= Z by referring to this for statement, together withTARSKI:def 3:...
X c= Z by A1,TARSKI def:3;...
Try to make proofs in which the argumentation is as clear as possible, but also
make a second set of proofs that are as small as possible.
Exercise 1.7.3 Take the following skeleton proof of the the drinker’s principle.
It is called the drinker’s principle because if X is the set of people in a roomthat are drinking, then it says that in each room there is a person such that ifthat person is drinking, then everyone in that room is drinking. This sounds
paradoxical (why should one person have the power to make all other people in
the room drink?) but when you really understand what it says, it is not.
reserve X,x,y for set;
ex x st x in X implies for y holds y in X
proof
per cases;
suppose ex x st not x in X;
consider x such that not x in X;
take x;assume x in X;
contradiction;
let y;
thus y in X;
end;
suppose not ex x st not x in X;
for x holds x in X;
assume x in X;
thus thesis;
end;
end;
Add labels to the statements and put in justifications for all the steps.
Experiment with other proofs of the same statement. If you know constructive logic: write a Mizar proof of this statement that shows where thenon-constructive steps in the proof are.

1.8. STEP 8: CLEANING THE PROOF
Exercise 1.7.4

43

Write a proof of the following statement:

reserve X,Y,x,y for set;for X,Y,y holds((ex x st x in X implies y in Y) &(ex x st y in Y implies x in X))
iff (ex x st x in X iff y in Y);
Can you think of a proof that doesn’t need per cases?
Exercise 1.7.5 Finish the proof of Th2. Add as many clusters and lemmas as
you need. For instance you might use:
Lm1: m is odd square & n is odd square implies
m + n is non square;
Lm2: n is even iff n/2 is Nat;
Lm3: m,n are_relative_prime ifffor p being prime Nat holds not (p divides m & p divides n);
Lm4: m^2 = n^2 iff m = n;but if you choose to use different lemmas that’s fine too. Just put them before
the theorem (you can prove them later if you like). If you don’t think a lemma
will be useful to others you don’t have to put theorem in front of it.
Now add compact statements and justifications to the proof of Th2 until all
the *4 errors are gone.

1.8

Step 8: cleaning the proof

Now that you finished your article the fun starts! Mizar has several utilities tohelp you improve your article. These utilities will point out to you what is inyour article that is not necessary.
Those utilities don’t put their error messages inside your file on their own.
You need to put the name of the program as an argument to the program revf
to accomplish that.
relprem This program points out references in a by justifications – as welloccurrences of then – that are not necessary. These references can be safely
removed from your article.
This program also points out the real errors in the article. Some people
prefer to always use relprem instead of mizf.
relinfer This program points out steps in the proof that are not necessary.
It will indicate references to statements that can be short-circuited. You canomit such a reference and replace it with the references from the step that it
referred to.
As an example of relinfer consider the following part of a proof:

44

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

A1: m2*n2 = h^2 by . . . ;A2: m2*n2 is square by A1;
A3: m2,n2 are_relative_prime by . . . ;A4: m2 is square & n2 is square by A2,A3,Th1;
consider m such that m2 = m^2 by A4;...
If you run:revf relinfer my_mizar
then you will get *604 meaning Irrelevant inference:
A1: m2*n2 = h^2 by . . . ;A2: m2*n2 is square by A1;
A3: m2,n2 are_relative_prime by . . . ;A4: m2 is square & n2 is square by A2,A3,Th1;::>*604
consider m such that m2 = m^2 by A4;...
It means that you can replace the reference to A2 in step A4 with the referencesin the justification of A2 itself. In this case that’s A1. So the proof can beshortened to:
A1: m2*n2 = h^2 by . . . ;A3: m2,n2 are_relative_prime by . . . ;A4: m2 is square & n2 is square by A1,A3,Th1;
consider m such that m2 = m^2 by A4;...
Please take note that the relinfer program is dangerous! Not because yourproofs will break but because they might become ugly. relinfer encourages
you to cut steps that a human might want to see.
reliters (pronounced rel-iters, not re-liters) This program points out steps
in an interative equality that can be skipped. If you omit such a step you haveto add its references to the references of the next one.
As an example of reliters consider the following iterative equality:
m2*n2 = (c - a)*(c + a)/(2*2) by XCMPLX_1:77.= (c - a)*(c + a)/4.= (c^2 - a^2)/4 by SQUARE_1:67.= b^2/4 by A1,XCMPLX_1:26.= b^2/(2*2).= b^2/2^2 by SQUARE_1:def 3.= h^2 by SQUARE_1:69;
If you run:

1.8. STEP 8: CLEANING THE PROOF

45

revf reliters my_mizar
then you will get *746 meaning References can be moved to the next stepof this iterative equality:
m2*n2 = (c - a)*(c + a)/(2*2) by XCMPLX_1:77.= (c - a)*(c + a)/4::>*746.= (c^2 - a^2)/4 by SQUARE_1:67.= b^2/4 by A1,XCMPLX_1:26::>*746.= b^2/(2*2).= b^2/2^2 by SQUARE_1:def 3.= h^2 by SQUARE_1:69;
So you can remove the terms with the *746 from the iterative equality. You
then have to move the references in the justification to that of the next term inthe sequence. So the iterative equality can be shortened to:m2*n2 = (c - a)*(c + a)/(2*2) by XCMPLX_1:77.= (c^2 - a^2)/4 by SQUARE_1:67.= b^2/(2*2) by A1,XCMPLX_1:26.= b^2/2^2 by SQUARE_1:def 3.= h^2 by SQUARE_1:69;
trivdemo This program points out subproofs that are so simple that you canreplace them with a single by justification. It’s surprising how often this turns
out to be the case!
chklab This program points out all labels that are not referred to. They canbe safely removed from your article.
inacc This program points out the parts of the proofs that are not referred
to. They can be safely removed from your article.
irrvoc This program points out all vocabularies that are not used. They canbe safely removed from your article.
irrths This program points out the articles in the theorem directive that are
not used for references in the proofs. They can be safely removed from yourarticle.
Cleaning your article is fun! It really feels like polishing something after it isfinished and making it beautiful.
Remember to check your article once more with mizf after you have finishedoptimizing it, to make sure that you haven’t accidentally introduced any new
errors.

46

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPS

Exercise 1.8.1 Take the proof that you made in exercise 1.7.3 and run the
programs that are discussed in this section on it. Which of the programs advise
you to change your proof?
Exercise 1.8.2 Consider the statements in a Mizar proof to be points in agraph and references to the statements to be the edges. What are the relprem
and relinfer optimizations when you consider them as transformations of thesegraphs? Draw a picture!

1.9

Step 9: submitting to the library

So now your article is finished and clean. You should consider submitting it to
the MML.
There are two rules that articles for the MML have to satisfy:• It is mathematics that’s not yet in the MML.

There should not be alternate formalizations of the same concepts in the
MML. There’s too much double work in the MML already.

• It is significant.

As a rule of thumb the article should be at least a 1000 lines long. If it’s
too short consider extending your article until it’s long enough.

There are many reasons to submit your article to the MML:
• People will be able to use your work and build on it.
• Your definitions will be the standard for your subject in later Mizar articles.
• When the Mizar system changes your article will be kept compatible by
the people of the Mizar group.
• An automatically generated TEX version of your article will be publishedin a journal called Formalized Mathematics.
To find the details of how to submit an article to the MML go to the web pageof the Mizar project and click on the appropriate link. Be aware that to submit
your article to the MML you need to sign a form that gives the Mizar people
the right to change it as they see fit.
If your article is not suitable for submission to the MML but you still want
to use it to write further articles, you can put it in a local library of your own.
Currently this kind of local library will only support a few articles before it
becomes rather inefficient. The MML has been optimized such that library
files don’t grow too much. You can’t do this optimization for your local libraryyourself, because the tool for it is not distributed. So it’s really better to submit
your work to the MML if possible.

1.9. STEP 9: SUBMITTING TO THE LIBRARY47

If you want a local library of your own there need to be a third directory
called prel next to the already existing dict directory. To put the files for yourarticle in this directory you need to run the command:miz2prel text\my_mizar
outside your text and prel directories (it will put some files in your prel
directory.) After you have run miz2prel you can then use your article in further
articles.
Exercise 1.9.1
you be one?

How many Mizar authors are there in the MML? Shouldn’t

48

CHAPTER 1. WRITING A MIZAR ARTICLE IN NINE EASY STEPSChapter 2

Some advanced features
Now that you know how to write a Mizar article, let’s take a look at some moreadvanced features of Mizar that you haven’t seen yet.
To show these features we use a small proof by Grzegorz Bancerek fromthe article quantal1.miz. This article is about the mathematical notion ofquantales. It is not important that you know what quantales are. We just use
this proof to show some of Mizar’s features.
reserve
Q for left-distributive right-distributive complete Lattice-like(non empty QuantaleStr),a, b, c, d for Element of Q;
theorem Th5:for Q for X,Y being set holds "\/"(X,Q) [*] "\/"(Y,Q) = "\/"({a[*]b: a in X & b in Y}, Q)
proof let Q; let X,Y be set;deffunc F(Element of Q) = $1[*]"\/"(Y,Q);
deffunc G(Element of Q) = "\/"({$1[*]b: b in Y}, Q);
defpred P[set] means $1 in X;
deffunc H(Element of Q,Element of Q) = $1[*]$2;
A1: for a holds F(a) = G(a) by Def5;{F(c): P[c]} = {G(a): P[a]} from FRAENKEL:sch 5(A1);hence"\/"(X,Q) [*] "\/"(Y,Q) ="\/"({"\/"({H(a,b) where b is Element of Q: b in Y}, Q)
where a is Element of Q: a in X}, Q) by Def6 .="\/"({H(c,d) where c is Element of Q,
d is Element of Q: c in X & d in Y}, Q)
from LUBFraenkelDistr;
end;This proof is about a more abstract kind of mathematics than the example
49

50

CHAPTER 2. SOME ADVANCED FEATURES

from the previous chapter. Mizar is especially good at formalizing abstract
mathematics.

2.1

Set comprehension: the Fränkel operator

The proof of theorem Th5 from quantal1.miz contains expressions like:{ H(a,b) where b is Element of Q: b in Y }This corresponds to:{H(a, b) | b ∈ Y }where a is a fixed parameter and b is allowed to range over the elements of Q
that satisfy b ∈ Y .
In Mizar this style of set comprehension is called the Fränkel operator. It
corresponds to the axiom of replacement in set theory, which was first proposedby Adolf Fränkel, the F in ZF.
The general form of the Fränkel operator is:{ term where declaration of the variables: formula }As you can see in some of the other Fränkel operator terms in the proof, if all
variables in the term occur in a reserve statement their declarations can beleft implicit.
To be allowed to write a Fränkel operator, the types of the variables involved
need to widen to a Mizar type that has the form Element of A. Only then can
Mizar know that the defined set is really a set. Because else you could write
proper classes like:{ X where X is set: not X in X }But in Mizar this expression is illegal because set doesn’t widen to a type ofthe form Element of.
Exercise 2.1.1 Write in Mizar syntax the statement that the set of prime
numbers is infinite. Prove it.

2.2

Beyond first order: schemes

The proof of theorem Th5 from quantal1.miz uses the from justification.
Mizar is based on first order predicate logic. However first order logic isslightly too weak to do ZF-style set theory. With first order logic ZF-style set
theory needs infinitely many axioms. That’s because ZF set theory contains anaxiom scheme, the axiom of replacement.
Here is a table that shows how scheme and from is similar to theorem and
by:

51

2.2. BEYOND FIRST ORDER: SCHEMES
order

item

used

first orderhigher ordertheoremschemebyfrom

Schemes are higher order but only in a very weak sense. It has been said that
Mizar schemes are not second order but 1.001th order.
Let’s study the first from that occurs in the proof. It justifies an equality:{F(c): P[c]} = {G(a): P[a]} from FRAENKEL:sch 5(A1);
The justification refers to the statement:
A1: for a holds F(a) = G(a);The scheme that is used here is:scheme :: FRAENKEL:sch 5
FraenkelF’ { B() -> non empty set,
F(set) -> set, G(set) -> set, P[set] } :{ F(v1) where v1 is Element of B() : P[v1] }= { G(v2) where v2 is Element of B() : P[v2] }providedfor v being Element of B() holds F(v) = G(v);The statement that this scheme proves has been underlined. It clearly is thesame statement as the one that is being justified in the example. The general
structure of a scheme definition is:
scheme label { parameters } :statement
providedstatements
proof
...
end;
In the case of the FRAENKEL:sch 5 scheme, the parameters are B, F, G and P.
The first three are functions (those are written with round brackets), and thelast is a predicate (written with square brackets).
To use a scheme you have to define macros with deffunc and defpred, thatmatch the parameters of the scheme. In macro definitions the arguments to themacro are written as $1, $2, . . . In this specific case the macros that are definedare:deffunc F(Element of Q) = $1[*]"\/"(Y,Q);
deffunc G(Element of Q) = "\/"({$1[*]b: b in Y}, Q);
defpred P[set] means $1 in X;

52

CHAPTER 2. SOME ADVANCED FEATURES(Apparently B() there doesn’t need to be a macro. So Mizar can figure out byitself that in this specific example B() has to be instantiated with carrier ofQ.)
For another example of a scheme let’s look at the most commonly used
scheme, which is NAT_1:sch 1. It allows one to do induction over the natural
numbers. This scheme is:scheme :: NAT_1:sch 1
Ind { P[Nat] } :for k being Nat holds P[k]providedP[0]andfor k being Nat st P[k] holds P[k + 1];
So let’s show how to use this scheme to prove some statement about the natural
nummbers. For example consider the non-negativity of the natural numbers:
for n being Nat holds n >= 0;
Clearly to prove this using the induction scheme, we need to define the following
macro:
defpred P[Nat] means $1 >= 0;
And then, the structure of the proof will be:
defpred P[Nat] means $1 >= 0;
A1: P[0] by . . . ;A2: for k being Nat st P[k] holds P[k + 1]
proof
let k be Nat;assume k >= 0;...
thus k + 1 >= 0 by . . . ;end;for n being Nat holds P[n] from NAT_1:sch 1(A1,A2);
In the statement that is justified and the arguments to the scheme, the macros
really have to be present (else Mizar won’t know how to match things to thestatements in the scheme), so you cannot write 0 >= 0 after A1, but everywhere else it doesn’t matter whether you write P[k] or k >= 0, because almost
immediately the macro P[k] will be expanded to its definition.
Exercise 2.2.1 Write the natural deduction rules as Mizar schemes and provethem. For instance the rule of implication elimination (‘modus ponens’) becomes:

2.3. STRUCTURES

53

scheme implication_elimination { P[], Q[] } : Q[]
provided
A1: P[] implies Q[] andA2: P[]by A1,A2;
Exercise 2.2.2 The axioms of the Mizar set theory are in the article calledTARSKI. It’s called that way because it contains the axioms of a theory called
Tarski-Grothendieck set theory, which is ZF set theory with an axiom about theexistence of big cardinal numbers. The TARSKI article contains one scheme:
scheme :: TARSKI:sch 1
Fraenkel { A()-> set, P[set, set] }:ex X st for x holds x in X iff ex y st y in A() & P[y,x]providedfor x,y,z st P[x,y] & P[x,z] holds y = z;
Is it possible to prove this scheme using the Fränkel operator from the previous
section (and without using other schemes from the MML)?
Conversely, is it possible to eliminate the use of the Fränkel operator from
Mizar proofs by using the TARSKI:sch 1 scheme?

2.3

Structures

The proof of theorem Th5 from quantal1.miz uses the exciting type:left-distributive right-distributive complete Lattice-like(non empty QuantaleStr)
In this type left-distributive, right-distributive, complete, Latticelike and empty are just attributes like before, but the mode QuantaleStr issomething new.
The mode QuantaleStr is a structure. Structures are the records of Mizar.
They contain fields that you can select using the construction:
the field of structure
An example is the expression:
the carrier of Q
In this the structure is Q and the field name is carrier. Many Mizar structures
have the carrier field.
The definition of the QuantaleStr structure is:struct (LattStr, HGrStr) QuantaleStr(# carrier -> set,
L_join, L_meet, mult -> BinOp of the carrier #);54

CHAPTER 2. SOME ADVANCED FEATURES

Apparently it has four fields: carrier, L_join, L_meet and mult.
The modes LattStr and HGrStr are called the ancestors of the structure.
They are structures that have a subset of the fields of the structure that isdefined. Any term that has type QuantaleStr will automatically also get thetypes LattStr and HGrStr.
The definitions of the ancestors of QuantaleStr are:struct(/\-SemiLattStr,\/-SemiLattStr) LattStr(# carrier -> set, L_join, L_meet -> BinOp of the carrier #);and:struct(1-sorted) HGrStr (# carrier -> set,
mult -> BinOp of the carrier #);Structures are a powerful concept. They give the MML its abstract flavor.
Exercise 2.3.1 Find the definition of the mode Field in VECTSP_1. What is
the structure it is based on? Recursively trace all ancestors of that structure.
Draw a graph of the widening relation between those ancestors.
Exercise 2.3.2

The most basic structure in the MML is from STRUCT_0:

definition
struct 1-sorted (# carrier -> set #);end;
Is an object of type 1-sorted uniquely determined by its carrier? Why or
why not?
Exercise 2.3.3

You can construct an object of type 1-sorted as:

1-sorted (# A #)Use this notation to define functors in and out that map objects of type set
to their natural counterparts in 1-sorted and back. Prove in Mizar that out isa left inverse to in.
Exercise 2.3.4 Are structures ZF sets or not? More specifically: if Q is a
structure, can there be an x with x in Q?
If not, why not?
If so, can you prove the following?
ex Q being 1-sorted, x being set st x in Q
If a structure has elements: is it uniquely determined by its elements?
Exercise 2.3.5 Because of Gödel’s theorems we know that Mizar’s set theory
is incomplete. That is, there has to be a Mizar formula φ without free variables,
for which no Mizar proof exists of φ, and also no Mizar proof exists of not φ.
Can you think of a non-Gödelian φ that is provable nor disprovable in Mizar?