Journal of Formalized Mathematics
Volume 11, 1999
University of Bialystok
Copyright (c) 1999 Association of Mizar Users

## Insert Sort on \SCMFSA

Jing-Chao Chen
Shanghai Jiaotong University

### Summary.

This article describes the insert sorting algorithm using macro instructions such as if-Macro (conditional branch macro instructions), for-loop macro instructions and While-Macro instructions etc. From the viewpoint of initialization, we generalize the halting and computing problem of the While-Macro. Generally speaking, it is difficult to judge whether the While-Macro is halting or not by way of loop inspection. For this reason, we introduce a practical and simple method, called body-inspection. That is, in many cases, we can prove the halting problem of the While-Macro by only verifying the nature of the body of the While-Macro, rather than the While-Macro itself. In fact, we have used this method in justifying the halting of the insert sorting algorithm. Finally, we prove that the insert sorting algorithm given in the article is autonomic and its computing result is correct.

This research is supported by the National Natural Science Foundation of China Grant No. 69873033.

#### MML Identifier: SCMISORT

The terminology and notation used in this paper have been introduced in the following articles [25] [24] [35] [26] [8] [15] [36] [13] [14] [16] [12] [7] [10] [9] [21] [28] [11] [23] [31] [29] [30] [22] [5] [6] [3] [1] [17] [2] [32] [34] [18] [27] [4] [20] [19] [33]

#### Contents (PDF format)

1. Preliminaries
2. Basic Property of {\bf while} Macro
3. Insert Sort Algorithm

#### Bibliography

[1] Noriko Asamoto. Conditional branch macro instructions of \SCMFSA. Part I. Journal of Formalized Mathematics, 8, 1996.
[2] Noriko Asamoto. Conditional branch macro instructions of \SCMFSA. Part II. Journal of Formalized Mathematics, 8, 1996.
[3] Noriko Asamoto. Constant assignment macro instructions of \SCMFSA. Part II. Journal of Formalized Mathematics, 8, 1996.
[4] Noriko Asamoto. The \tt loop and \tt times macroinstruction for \SCMFSA. Journal of Formalized Mathematics, 9, 1997.
[5] Noriko Asamoto, Yatsuka Nakamura, Piotr Rudnicki, and Andrzej Trybulec. On the composition of macro instructions. Part II. Journal of Formalized Mathematics, 8, 1996.
[6] Noriko Asamoto, Yatsuka Nakamura, Piotr Rudnicki, and Andrzej Trybulec. On the composition of macro instructions. Part III. Journal of Formalized Mathematics, 8, 1996.
[7] Grzegorz Bancerek. Cardinal numbers. Journal of Formalized Mathematics, 1, 1989.
[8] Grzegorz Bancerek. The fundamental properties of natural numbers. Journal of Formalized Mathematics, 1, 1989.
[9] Grzegorz Bancerek. K\"onig's theorem. Journal of Formalized Mathematics, 2, 1990.
[10] Grzegorz Bancerek and Krzysztof Hryniewiecki. Segments of natural numbers and finite sequences. Journal of Formalized Mathematics, 1, 1989.
[11] Grzegorz Bancerek and Piotr Rudnicki. Development of terminology for \bf scm. Journal of Formalized Mathematics, 5, 1993.
[12] Grzegorz Bancerek and Andrzej Trybulec. Miscellaneous facts about functions. Journal of Formalized Mathematics, 8, 1996.
[13] Czeslaw Bylinski. Functions and their basic properties. Journal of Formalized Mathematics, 1, 1989.
[14] Czeslaw Bylinski. Functions from a set to a set. Journal of Formalized Mathematics, 1, 1989.
[15] Czeslaw Bylinski. A classical first order language. Journal of Formalized Mathematics, 2, 1990.
[16] Czeslaw Bylinski. The modification of a function by a function and the iteration of the composition of a function. Journal of Formalized Mathematics, 2, 1990.
[17] Jing-Chao Chen. While macro instructions of \SCMFSA. Journal of Formalized Mathematics, 9, 1997.
[18] Jing-Chao Chen and Yatsuka Nakamura. Bubble sort on \SCMFSA. Journal of Formalized Mathematics, 10, 1998.
[19] Jing-Chao Chen and Yatsuka Nakamura. Initialization halting concepts and their basic properties of \SCMFSA. Journal of Formalized Mathematics, 10, 1998.
[20] Jaroslaw Kotowicz. Functions and finite sequences of real numbers. Journal of Formalized Mathematics, 5, 1993.
[21] Yatsuka Nakamura and Andrzej Trybulec. A mathematical model of CPU. Journal of Formalized Mathematics, 4, 1992.
[22] Piotr Rudnicki and Andrzej Trybulec. Memory handling for \SCMFSA. Journal of Formalized Mathematics, 8, 1996.
[23] Yasushi Tanaka. On the decomposition of the states of SCM. Journal of Formalized Mathematics, 5, 1993.
[24] Andrzej Trybulec. Enumerated sets. Journal of Formalized Mathematics, 1, 1989.
[25] Andrzej Trybulec. Tarski Grothendieck set theory. Journal of Formalized Mathematics, Axiomatics, 1989.
[26] Andrzej Trybulec. Subsets of real numbers. Journal of Formalized Mathematics, Addenda, 2003.
[27] Andrzej Trybulec and Agata Darmochwal. Boolean domains. Journal of Formalized Mathematics, 1, 1989.
[28] Andrzej Trybulec and Yatsuka Nakamura. Some remarks on the simple concrete model of computer. Journal of Formalized Mathematics, 5, 1993.
[29] Andrzej Trybulec and Yatsuka Nakamura. Modifying addresses of instructions of \SCMFSA. Journal of Formalized Mathematics, 8, 1996.
[30] Andrzej Trybulec, Yatsuka Nakamura, and Noriko Asamoto. On the compositions of macro instructions. Part I. Journal of Formalized Mathematics, 8, 1996.
[31] Andrzej Trybulec, Yatsuka Nakamura, and Piotr Rudnicki. The \SCMFSA computer. Journal of Formalized Mathematics, 8, 1996.
[32] Michal J. Trybulec. Integers. Journal of Formalized Mathematics, 2, 1990.
[33] Wojciech A. Trybulec. Groups. Journal of Formalized Mathematics, 2, 1990.
[34] Wojciech A. Trybulec. Pigeon hole principle. Journal of Formalized Mathematics, 2, 1990.
[35] Zinaida Trybulec. Properties of subsets. Journal of Formalized Mathematics, 1, 1989.
[36] Edmund Woronowicz. Relations and their basic properties. Journal of Formalized Mathematics, 1, 1989.