The Mizar Article is written as a text file which could be written in any editor. This provides great flexibility from the user point of view. The user is not restricted to any editor and can use his own preferable editor.
environ Environment declaration begin Text-Proper . . . . . .
Figure 3.2: The Mizar article structure.
The Mizar Articles consists of two parts: the Environment declaration and the Text-Proper , as presented in Figure 3.2. The following two sections will aim to describe the structure of the Mizar article.
3.3.1
The Environment declaration
The Environment-Declaration begins with environ and consists of Directives, where each Directive 3.2 is composed of names of Mizar Articles imported from the MML. Each of these imported articles contains the knowledge required for verifying the correctness of the Text-Proper . Below is a short explanation of each Directive from the Environment [Ret05a]:
• vocabularies: This directive is used by the Mizar system for the lexical anal- ysis of the Text-Proper . In the article one can only find reserved words and symbols that are given in the vocabulary files in this directive. The author can use the existing vocabularies and also is free to introduce a new one. • notations: Articles placed in this directive are used to recognise the syntax of
the Text-Proper part of the article. It contains articles in which the notations (definiendas) that are used in the Text-Proper part are defined.
• constructors: The articles written here are used by the Mizar system to interpret the meaning of the expressions in the Text-Proper part.
• registrations: Mizar has the possibility to cluster an adjective with an ex- pression. For example the type “set” gets the adjective “non empty” in the
article XBOOLE 0. The registrations directive has to contain the articles in which clusters are defined that occur in the text proper.
• requirements: This directive contains articles the content of which is to be known automatically by the Mizar system during the processing of the article. Only five articles can be placed in this section: BOOLE, SUBSET, NUMERALS, REAL, ARITHM[NB04]
• theorems: The theorems directive holds the names of the MML articles that contain theorems and definitions that are used as references of reasoning steps.
• definitions: The definitions of predicates in the MML can be automatically unfolded. The names of the MML articles in which they occur have to be placed in this directive in order to recognise those definitions structure while verifying the article. This directive is mainly used if we use proofs by defini- tion expansion.
• schemes: This directive contains names of the MML articles in which we introduced schemes that are used in the reasoning in the article. A scheme is a proposition that can take predicates as an argument, e.g., the mathematical Induction.
For instance, Listing 3.3 presents the Mizar Environment for the article regarding the properties of binary relations [Ret05b] formalised by K. Retel.
v o c a b u l a r i e s RELSET_2 , TARSKI , RELAT_1 , CANTOR_1 , SETFAM_1 , BOOLE , FUNCT_1 , PUA2MSS1 , EQREL_1 , FUNCT_5 , SUBSET_1 , C O M P L E X 1; n o t a t i o n s TARSKI , XBOOLE_0 , ZFMISC_1 , SUBSET_1 , SETFAM_1 , RELAT_1 ,
FUNCT_1 , RELSET_1 , FUNCT_2 , E Q R E L _ 1; c o n s t r u c t o r s SETFAM_1 , FUNCT_2 , E Q R E L _ 1;
r e g i s t r a t i o n s XBOOLE_0 , SUBSET_1 , RELAT_1 , P A R T F U N 1; r e q u i r e m e n t s SUBSET , BOOLE ;
d e f i n i t i o n s XBOOLE_0 , TARSKI , EQREL_1 , SUBSET_1 , R E L A T _ 1;
t h e o r e m s RELAT_1 , TARSKI , SETFAM_1 , ZFMISC_1 , XBOOLE_1 , SUBSET_1 , RELSET_1 , XBOOLE_0 , FUNCT_1 , FUNCT_2 , MSSUBFAM , EQREL_1 , SYSREL , O R D E R S _ 1;
s c h e m e s FUNCT_1 , D O M A I N _ 1 ;
Listing 3.3: The environment for the article regarding properties of Binary Rela- tions [Ret05b].
The most difficult part of writing a Mizar article is identifying the existing knowledge in the MML and placing it in the proper Directive in the Environment
declaration. If we can’t find in the MML the symbol or notation required for our theory, we have the possibility to create our new notation in the local vocabulary file. This local vocabulary file, with the extension “.voc”, contains lines introduc- ing new symbols, one line – one symbol. Each line begins with a capital letter which determines the kind of new symbol (see the Mizar homepage3 and Table 3.3)
followed by the name of the symbol. The constructor functor 3.5.3 may have ad- ditional information indicating the priority of the symbol, expressed as a number between 0 and 255, where the default is 64.
For instance, the following listing introduces a new adjective (annotated as attr in Mizar) for a binary relation, as seen in the source file NECKLA_2.MIZ of the Mizar article [Ret03b]:
d e f i n i t i o n
let G be non empty RelStr ; attr G is N - free means : Def1 :
not G embeds N e c k l a c e 4; end ;
The the vocabulary file NECKLA 2.voc has to contain the following line: ON-free, where O indicates the attribute constructor (i.e., adjective).
3.3.2
The Text-Proper
The Text-Proper is a sequence of Sections, where each Section starts with begin and consists of a sequence of theorems and definitions together with their proofs. The division of the Text-Proper into Sections has no impact on the correctness of the Article.
The current approach of the Mizar language does not support any meta-data assignment to a section, theorem or definition. However, Mizar users tend to write meta-data information as comments added after some important theorems or section. For instance, the following listing shows how we can provide some additional meta-data information to a section. The example is taken from [Ret05b] and provides a short description of the first section of the article.
begin : : P r e l i m i n a r i e s
: : F o r m a l i s a t i o n o f f i r s t p a r a g r a p h from t h e a r t i c l e :
: : ” R e l a t i o n s b i n a r i e s , f e r m e t u r e s , c o r r e s p o n d a n c e s de G a l o i s ” ( 1 9 4 8 ) ,
3
: : Prof . J a c q u e s R igu et ,
: : B u l e t t i n de l a S .M. F . , tome 76 ( 1 9 4 8 ) , p .114−155. . . .
The main work that needs to be done to encode a text in the Mizar language is to reveal the reasoning structure of a CML text. All terms, objects and their types used in the original document need to be identified and their MML counterpart simultaneously needs to be found. We encode the body of the original text in the main part – Text-Proper – of a Mizar document using the Mizar syntax and symbols found in the MML. At the same time we have to create the Environment which is an inseparable part of a Mizar article in the sense that we can’t check, using the Mizar system, the correctness of the article without an Environment. The process of generating an appropriate Environment for a Mizar document consists in composing the Directives of the Environment with names of articles from the MML, that contain definitions of symbols, notations, constructors, theorems and definitions that are used in the main Text-Proper part of the Mizar encoding.
When proving a theorem in the Mizar language, the first thing to do is to check if the notions of that theorem are already formalised in the MML. If so, we need to include the articles from the MML in the appropriate Directive of the environment. If the notion is unknown to the Mizar system, the user has to adjust the environment. The notion has to be defined before stating the theorem in which this is used. The Mizar user has to also add the given name of this notion to the vocabulary file as well.
When the theorem is well written one can usually start with the proof. A line is well written, i.e., syntactically correct, in the Mizar language when the checker re- turns only justification errors: i.e., *1 and *4 errors, which mean: “It is not true” and “This inference is not accepted”, respectively.
For example if we want to prove that 4 = {0, 1, 2, 3}, the skeleton of the proof would look like as the one presented in Listing 3.4 If at this stage the Environment is created properly the Mizar checker should return only the *4 errors. At this stage, the author has to remove the reasoning errors, and to provide full justification for each reasoning step. Listing 3.10 presents the fully formalised version of the above skeleton of the document and particularly the proof. The formalisation can now be processed by the Mizar system. If the Mizar system at this stage does not return any errors, we can be sure that the theorem is properly fully formalised.
theorem Th2 : 4 = { 0 , 1 , 2 , 3 } proof
s e t x = { i where i i s Element of NAT: i < 4 } ; A1 : x c= { 0 , 1 , 2 , 3 } proof l e t y be s et ; assume y i n x ; thus t h e s i s; end; A2 : { 0 , 1 , 2 , 3 } c= x proof l e t y be s et ; assume y i n { 0 , 1 , 2 , 3 } ; thus t h e s i s; end; thus t h e s i s; end;
Listing 3.4: The skeleton of the theorem from the article NECKLACE.MIZ [Ret03a]