Abstract

In the article, we consider verification of programs with mutual recursion in the data driven functional parallel language Pifagor. In this language the program could be represented as a data flow graph, that has no control connections, and has only data relations. Under these conditions it is possible to simplify the process of formal verification, since there is no need to analyse resource conflicts, which are present in the systems with ordinary architectures. The proof of programs correctness is based on the elimination of mutual recursions by program transformation. The universal method of mutual recursion of an arbitrary number of functions elimination consists in constructing the universal recursive function that simulates all the functions in the mutual recursion. A natural number is assigned to each function in mutual recursion. The universal recursive function takes as its argument the number of a function to be simulated and the arguments of this function. In some cases of the indirect recursion it is possible to use a simpler method of program transformation, namely, the merging of the functions code into a single function. To remove mutual recursion of an arbitrary number of functions, it is suggested to construct a graph of all connected functions and transform this graph by removing functions that are not connected with the target function, then by merging functions with indirect recursion and finally by constructing the universal recursive function. It is proved that in the Pifagor language such transformations of functions as code merging and universal recursive function construction do not change the correctness of the initial program. An example of partial correctness proof is given for the program that parses a simple arithmetic expression. We construct the graph of all connected functions and demonstrate two methods of proofs: by means of code merging and by means of the universal recursive function.

Highlights

  • In this language the program could be represented as a data flow graph

  • possible to simplify the process of formal verification

  • which are present in the systems with ordinary architectures

Read more

Summary

Определения

В работе термин «функция» используется в нескольких смыслах. В математическом смысле — это однозначное отображение множества допустимых значений аргумента на множество значений функции. Прямая рекурсия — это рекурсивная функция, в теле которой присутствует вызов самой себя. Косвенная рекурсия — это рекурсивная функция, в теле которой нет вызовов самой себя, но эта функция вызывается вновь через цепочку вызовов других функций [14]. Обозначим через Ω(A) множество всех связанных функций — функций, которые вызываются из A, как непосредственно в её теле, так и через цепочку вызовов других функций. Запись вида Ω(A) = {A(B, D), B(A, B, C), C(A), D()} означает, что рассматриваемая функция A является косвенной рекурсией, в её теле присутствует вызов функции B и D; B — смешанная рекурсия, вызывающая себя и функции A, C; C — косвенная рекурсия, вызывающая функцию A; D — нерекурсивная функция, независимая от других функций. Что отношение взаимной рекурсии рефлексивно (A ↔ A), то отношение ↔ будет отношением эквивалентности, которое разделяет множество всех связанных функций на непересекающиеся классы. На графе всех связанных функций эти классы будут соответствовать компонентам сильной связности [10]

Универсальная рекурсивная функция
Объединение функций
Алгоритм преобразования произвольной рекурсии в прямую
Преобразование рекурсивных функций на языке Пифагор
Объединение кода функций
В общем случае исходный код функций A и B на языке Пифагор будет следующим:
Пример доказательства корректности рекурсивной функции на языке Пифагор
Преобразование рекурсии parse в прямую при объединении кода
Заключение
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call