<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article article-type="research-article" dtd-version="1.3" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="ru"><front><journal-meta><journal-id journal-id-type="publisher-id">cheb</journal-id><journal-title-group><journal-title xml:lang="ru">Чебышевский сборник</journal-title><trans-title-group xml:lang="en"><trans-title>Chebyshevskii Sbornik</trans-title></trans-title-group></journal-title-group><issn pub-type="ppub">2226-8383</issn><publisher><publisher-name>Tula State Lev Tolstoy  Pedagogical University</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.22405/2226-8383-2025-26-3-113-124</article-id><article-id custom-type="elpub" pub-id-type="custom">cheb-2009</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="ru"><subject>Статьи</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="en"><subject>Article</subject></subj-group></article-categories><title-group><article-title>Логика Хоара для императивного языка, учитывающего некоторые аппаратные ограничения</article-title><trans-title-group xml:lang="en"><trans-title>Hoare logic for an imperative language considering some hardware limitations</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Ковалев</surname><given-names>Даниил Юрьевич</given-names></name><name name-style="western" xml:lang="en"><surname>Kovalev</surname><given-names>Daniil Yur’evich</given-names></name></name-alternatives><bio xml:lang="ru"><p>аспирант</p></bio><bio xml:lang="en"><p>postgraduate student</p></bio><email xlink:type="simple">dyukovalev@hse.ru</email><xref ref-type="aff" rid="aff-1"/></contrib></contrib-group><aff-alternatives id="aff-1"><aff xml:lang="ru"><institution>Национальный исследовательский университет «Высшая школа экономики»</institution><country>Россия</country></aff><aff xml:lang="en"><institution>HSE University</institution><country>Russian Federation</country></aff></aff-alternatives><pub-date pub-type="collection"><year>2025</year></pub-date><pub-date pub-type="epub"><day>01</day><month>11</month><year>2025</year></pub-date><volume>26</volume><issue>3</issue><fpage>113</fpage><lpage>124</lpage><permissions><copyright-statement>Copyright &amp;#x00A9; Ковалев Д.Ю., 2025</copyright-statement><copyright-year>2025</copyright-year><copyright-holder xml:lang="ru">Ковалев Д.Ю.</copyright-holder><copyright-holder xml:lang="en">Kovalev D.Y.</copyright-holder><license xml:lang="ru" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>Данная работа распространяется под лицензией Creative Commons Attribution 4.0.</license-p></license><license xml:lang="en" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>This work is licensed under a Creative Commons Attribution 4.0 License.</license-p></license></permissions><self-uri xlink:href="https://www.chebsbornik.ru/jour/article/view/2009">https://www.chebsbornik.ru/jour/article/view/2009</self-uri><abstract><p>В статье определен императивный язык программирования, учитывающий аппаратные ограничения вычислителя с набором инструкций RV32I, заданы его синтаксис и аксиоматическая семантика в виде логики Хоара. Необходимость подобного языка определяется невозможностью напрямую применять формальные доказательства, проведенные для программ на языках, не учитывающих аппаратные ограничения, к транслированному коду, исполняющемуся на реальном аппаратном вычислителе. В то же время проведение доказательств для программ, написанных напрямую в кодах вычислителя, чрезвычайно трудоемко. Описанный язык учитывает такие аппаратные ограничения, как конечная ширина регистра, конечный объем памяти и использование арифметики по модулю вместо классической арифметики. В статье приведен пример программы вычисления НОД двух неотрицательных целых чисел, написанной на этом языке, а также доказательство ее корректности. Таким образом, продемонстрировано, что можно строить формальные доказательства для программ на языке, учитывающем некоторые аппаратные ограничения, и эти доказательства будут сопоставимы по сложности с теми, что построены для аналогичных программ на не учитывающих эти ограничения императивных языках. Одним из направлений развития работы является построение алгоритма трансляции из определенного в статье языка в коды вычислителя и доказательство корректности этого алгоритма.</p></abstract><trans-abstract xml:lang="en"><p>In this paper, an imperative programming language considering some hardware limitations of a computer based on the RV32I instruction set is defined, including its syntax and semantics in a form of Hoare logic. The need for such language comes from the fact that formal proofsconducted for programs in languages not considering hardware limitations cannot be directly applied to translated code running on real hardware. At the same time, conducting proofs for programs written directly in machine code is extremely laborious. The language defined in the paper takes into account such hardware limitations as finite register width, finite memory capacity and the usage of modulo arithmetic instead of regular arithmetic. The paper containsan example of a program computing GCD of two non-negative integers, which is written in the proposed language. A proof of the program correctness is also included. Thus, the paper demonstrates that formal proofs could be conducted for programs in the language considering some hardware limitations, and the complexity of the proofs would be comparable to ones conducted for equivalent programs written in regular imperative languages, which do not takehardware limitations into account. Directions for future work include composing an algorithm for translation of the proposed language to machine code and proving the algorithm’s correctness.</p></trans-abstract><kwd-group xml:lang="ru"><kwd>логика Хоара</kwd><kwd>формальные методы</kwd><kwd>аксиоматическая семантика.</kwd></kwd-group><kwd-group xml:lang="en"><kwd>Hoare logic</kwd><kwd>formal methods</kwd><kwd>axiomatic semantics.</kwd></kwd-group></article-meta></front><back><ref-list><title>References</title><ref id="cit1"><label>1</label><citation-alternatives><mixed-citation xml:lang="ru">Winskel G. The Formal Semantics of Programming Languages. The MIT Press, Massachusetts. P. 11–26. ISBN 0262231697.</mixed-citation><mixed-citation xml:lang="en">Winskel G 1993, The Formal Semantics of Programming Languages, The MIT Press, Massachusetts, pp. 11–26. ISBN 0262231697.</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">RISC-V Foundation, The RISC-V Instruction Set Manual Volume I Unprivileged Architecture Version 20240411. 2024. URL: https://github.com/riscv/riscv-isa-manual/releases/download/20240411/unpriv-isa-asciidoc.pdf (дата обращения: 23 февраля 2025).</mixed-citation><mixed-citation xml:lang="en">RISC-V Foundation, The RISC-V Instruction Set Manual Volume I Unprivileged Architecture Version 20240411 (2024) Available at: https://github.com/riscv/riscv-isa-manual/releases/download/20240411/unpriv-isa-asciidoc.pdf (accessed 23 February 2025).</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">RISC-V Foundation, RISC-V ABIs Specification Version 1.0: Ratified. 2022. URL: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/releases/download/v1.0/riscv-abi.pdf (дата обращения: 23 февраля 2025).</mixed-citation><mixed-citation xml:lang="en">RISC-V Foundation, RISC-V ABIs Specification Version 1.0: Ratified (2022), Available at: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/releases/download/v1.0/riscv-abi.pdf (accessed 23 February 2025).</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">Hoare C. А. R. An axiomatic basis for computer programming // Communications of the ACM. 1969. vol. 12, issue 10. P. 576–580. doi: 10.1145/363235.363259. URL: https://dl.acm.org/doi/pdf/10.1145/363235.363259 (дата обращения: 23 февраля 2025).</mixed-citation><mixed-citation xml:lang="en">Hoare C А R 1969, “An axiomatic basis for computer programming”, Communications of the ACM, vol. 12, issue 10. pp. 576–580. doi: 10.1145/363235.363259. Available at: https://dl.acm.org/doi/pdf/10.1145/363235.363259 (accessed 23 February 2025).</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">Myreen M. O., Gordon M. J. C. Hoare Logic for Realistically Modelled Machine Code // Proceedings of the 13th International Conference on Tools and Algorithms for the Construction and Analysis of Systems. 2007. Springer-Verlag, Berlin, Heidelberg. P.568–582. doi: 10.1007/978-3-540-71209-1_44. URL: https://link.springer.com/content/pdf/10.1007/978-3-540-71209-1_44.pdf (дата обращения: 23 февраля 2025).</mixed-citation><mixed-citation xml:lang="en">Myreen M O, Gordon M J C “Hoare Logic for Realistically Modelled Machine Code” Proceedings of the 13th International Conference on Tools and Algorithms for the Construction and Analysis of Systems. Springer-Verlag, Berlin, Heidelberg, 2007, pp.568–582. doi: 10.1007/978-3-540-71209-1_44. Available at: https://link.springer.com/content/pdf/10.1007/978-3-540-71209-1_44.pdf (accessed 23 February 2025).</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">McCracken D. D., Reilly E. D. Backus-Naur form (BNF) // In Encyclopedia of Computer Science. 2003. John Wiley and Sons Ltd. P. 129–131. ISBN 0470864125. URL: https://dl.acm.org/doi/pdf/10.5555/1074100.1074155 (дата обращения: 23 февраля 2025).</mixed-citation><mixed-citation xml:lang="en">McCracken D D, Reilly E D 2003, “Backus-Naur form (BNF)” In Encyclopedia of Computer Science. John Wiley and Sons Ltd. pp. 129–131. ISBN 0470864125. Available at: https://dl.acm.org/doi/pdf/10.5555/1074100.1074155 (accessed 23 February 2025).</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">Войшвилло Е. К., Дегтярев М. Г. Логика. 2001. ВЛАДОСС-ПРЕСС, Москва, С. 91–99. ISBN 5-305-00001-7.</mixed-citation><mixed-citation xml:lang="en">Voishvillo E K, Degtyarev M G 2001 Logika [Logic]. Vladoss-Press, Moscow, pp. 91–99. ISBN 5-305-00001-7.</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">Jacobs D., Gries D. General correctness: a unification of partial and total correctness // Acta Inf. 1985. vol. 22, num. 1, P. 67–83. doi: 10.1007/BF00290146.</mixed-citation><mixed-citation xml:lang="en">Jacobs D, Gries D 1985, “General correctness: a unification of partial and total correctness” Acta Inf., vol. 22, num. 1, pp. 67–83. doi: 10.1007/BF00290146.</mixed-citation></citation-alternatives></ref></ref-list><fn-group><fn fn-type="conflict"><p>The authors declare that there are no conflicts of interest present.</p></fn></fn-group></back></article>
