CINXE.COM

Can LLMs Enable Verification in Mainstream Programming?

<!DOCTYPE html> <html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="content-type"/> <title>Can LLMs Enable Verification in Mainstream Programming?</title> <!--Generated on Tue Mar 18 11:56:05 2025 by LaTeXML (version 0.8.8) http://dlmf.nist.gov/LaTeXML/.--> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"/> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <link href="/static/browse/0.3.4/css/ar5iv.0.7.9.min.css" rel="stylesheet" type="text/css"/> <link href="/static/browse/0.3.4/css/ar5iv-fonts.0.7.9.min.css" rel="stylesheet" type="text/css"/> <link href="/static/browse/0.3.4/css/latexml_styles.css" rel="stylesheet" type="text/css"/> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.3/html2canvas.min.js"></script> <script src="/static/browse/0.3.4/js/addons_new.js"></script> <script src="/static/browse/0.3.4/js/feedbackOverlay.js"></script> <base href="/html/2503.14183v1/"/></head> <body> <nav class="ltx_page_navbar"> <nav class="ltx_TOC"> <ol class="ltx_toclist"> <li class="ltx_tocentry ltx_tocentry_section"><a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S1" title="In Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">1 </span>Introduction</span></a></li> <li class="ltx_tocentry ltx_tocentry_section"> <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2" title="In Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">2 </span>Method</span></a> <ol class="ltx_toclist ltx_toclist_section"> <li class="ltx_tocentry ltx_tocentry_subsection"><a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.SS1" title="In 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">2.1 </span>Task Preparation for Different Modes</span></a></li> <li class="ltx_tocentry ltx_tocentry_subsection"><a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.SS2" title="In 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">2.2 </span>Interaction with an LLM</span></a></li> <li class="ltx_tocentry ltx_tocentry_subsection"><a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.SS3" title="In 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">2.3 </span>Validation</span></a></li> <li class="ltx_tocentry ltx_tocentry_subsection"><a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.SS4" title="In 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">2.4 </span>Benchmarks</span></a></li> </ol> </li> <li class="ltx_tocentry ltx_tocentry_section"> <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S3" title="In Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">3 </span>Evaluation</span></a> <ol class="ltx_toclist ltx_toclist_section"> <li class="ltx_tocentry ltx_tocentry_subsection"><a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S3.SS1" title="In 3 Evaluation ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">3.1 </span>Understanding Common Pitfalls</span></a></li> </ol> </li> <li class="ltx_tocentry ltx_tocentry_section"><a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S4" title="In Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_title"><span class="ltx_tag ltx_tag_ref">4 </span>Conclusion</span></a></li> </ol></nav> </nav> <div class="ltx_page_main"> <div class="ltx_page_content"> <article class="ltx_document ltx_authors_1line"><span class="ltx_note ltx_role_institutetext" id="id1"><sup class="ltx_note_mark">1</sup><span class="ltx_note_outer"><span class="ltx_note_content"><sup class="ltx_note_mark">1</sup><span class="ltx_note_type">institutetext: </span>JetBrains Research, Amsterdam, the Netherlands </span></span></span><span class="ltx_note ltx_role_institutetext" id="id2"><sup class="ltx_note_mark">2</sup><span class="ltx_note_outer"><span class="ltx_note_content"><sup class="ltx_note_mark">2</sup><span class="ltx_note_type">institutetext: </span>Constructor University, Bremen, Germany </span></span></span><span class="ltx_note ltx_role_institutetext" id="id3"><sup class="ltx_note_mark">3</sup><span class="ltx_note_outer"><span class="ltx_note_content"><sup class="ltx_note_mark">3</sup><span class="ltx_note_type">institutetext: </span>Neapolis University, Pafos, Cyprus </span></span></span> <h1 class="ltx_title ltx_title_document">Can LLMs Enable Verification in Mainstream Programming?</h1> <div class="ltx_authors"> <span class="ltx_creator ltx_role_author"> <span class="ltx_personname"> </span></span> <span class="ltx_author_before">  </span><span class="ltx_creator ltx_role_author"> <span class="ltx_personname">Aleksandr Shefer </span><span class="ltx_author_notes">1122</span></span> <span class="ltx_author_before">  </span><span class="ltx_creator ltx_role_author"> <span class="ltx_personname">Igor Engel </span><span class="ltx_author_notes">1122</span></span> <span class="ltx_author_before">  </span><span class="ltx_creator ltx_role_author"> <span class="ltx_personname">Stanislav Alekseev </span><span class="ltx_author_notes">1133</span></span> <span class="ltx_author_before">  </span><span class="ltx_creator ltx_role_author"> <span class="ltx_personname">Daniil Berezun </span><span class="ltx_author_notes">11</span></span> <span class="ltx_author_before">  </span><span class="ltx_creator ltx_role_author"> <span class="ltx_personname">Ekaterina Verbitskaia </span><span class="ltx_author_notes">1122</span></span> <span class="ltx_author_before">  </span><span class="ltx_creator ltx_role_author"> <span class="ltx_personname">Anton Podkopaev </span><span class="ltx_author_notes">1122</span></span> </div> <div class="ltx_abstract"> <h6 class="ltx_title ltx_title_abstract">Abstract</h6> <p class="ltx_p" id="id1.id1">Although formal methods are capable of producing reliable software, they have seen minimal adoption in everyday programming. Automatic code generation using large language models is becoming increasingly widespread, but it rarely considers producing strong correctness guarantees. In this study, we explore the ability of LLMs to produce verified code in three verification languages (Dafny, Nagini, and Verus). To do so, we use manually curated datasets derived from the state-of-the-art Python benchmark, HumanEval. We also assess what types of information are sufficient to achieve good-quality results.</p> </div> <section class="ltx_section" id="S1"> <h2 class="ltx_title ltx_title_section"> <span class="ltx_tag ltx_tag_section">1 </span>Introduction</h2> <div class="ltx_para" id="S1.p1"> <p class="ltx_p" id="S1.p1.1">The cost of software failures only in the US is estimated to reach trillions of dollars a year <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib16" title="">16</a>]</cite>. Ever since the advent of large language models, a multitude of code generators have been developed. With people slowly beginning to trust these systems, significantly less time is spent critically evaluating the produced code. As a result, errors are more likely to find their way into codebases, leading to unintended consequences. Thus, it is of paramount importance to ensure the correctness of the generated code.</p> </div> <div class="ltx_para" id="S1.p2"> <p class="ltx_p" id="S1.p2.1">Formal methods help programmers prevent avoidable mistakes by offering tools to analyse and prove the correctness of their code. It is most well-adopted in the areas where a mistake can have severe consequences, such as cryptography <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib33" title="">33</a>]</cite>, finance <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib4" title="">4</a>]</cite>, and aerospace <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib28" title="">28</a>]</cite>. Unfortunately, verification requires extensive expertise and extends the time necessary to create programs, which prevents its use in less safety-critical domains.</p> </div> <div class="ltx_para" id="S1.p3"> <p class="ltx_p" id="S1.p3.1">Systems such as Dafny and F* automate proof search through the use of Satisfiability Modulo Theories (SMT) solvers, lowering the amount of effort needed for verification of complex properties. However, these verifiers feature specialized programming languages for both implementation and proofs. In order to introduce certified code into a software project, one has to commit to using a new language, which frequently entails less mature developer environments, limited interoperability with mainstream languages, and a steeper learning curve for the engineers.</p> </div> <div class="ltx_para" id="S1.p4"> <p class="ltx_p" id="S1.p4.1">A promising solution to this problem comes in a form of intermediate verification languages such as Viper <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib23" title="">23</a>]</cite>. With this approach, an algorithm can be implemented in a restricted subset of a popular programming language directly and then supplemented with formal specification and proofs. This helps bridge the gap between mainstream programming and formal methods, reducing the barriers for adoption. The key challenge is then ensuring that reasoning about the program remains as straightforward as possible.</p> </div> <div class="ltx_para" id="S1.p5"> <p class="ltx_p" id="S1.p5.1">A lot of effort has been put into solving this challenge over the years. There are many obstacles to the problem of automated software verification and synthesis. The most crucial stems from the undecidability of automatic loop invariant synthesis. There are many classical approaches to tackle the problem, including dynamic detection of likely invariants <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib18" title="">18</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib11" title="">11</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib3" title="">3</a>]</cite>, inductive invariant synthesis <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib26" title="">26</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib2" title="">2</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib8" title="">8</a>]</cite>, data-driven approaches <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib20" title="">20</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib19" title="">19</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib13" title="">13</a>]</cite>, deductive synthesis <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib32" title="">32</a>]</cite>, and non-linear reasoning <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib15" title="">15</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib29" title="">29</a>]</cite>. Most state-of-the-art tools, which provide any guarantees of soundness and correctness, rely on SMT-solvers to infer invariants for recursion and iteration. This is notably true for intermediate verification languages like Viper and Verus, as well as F* and Dafny. In this research, we do not focus on improving the underlined theory neither do we attempt to refine solvers’ results, leaving this important task to the designers and researches of SMT-solvers and verification languages. Instead, we aim to determine the extent to which modern LLMs are capable of bridging the existing gap and generate invariants for these languages that can be successfully verified by solvers.</p> </div> <div class="ltx_para" id="S1.p6"> <p class="ltx_p" id="S1.p6.1">Generative AI solutions have been able to achieve rather high success rates in producing partial <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib22" title="">22</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib27" title="">27</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib14" title="">14</a>]</cite> and complete <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib31" title="">31</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib25" title="">25</a>, <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib7" title="">7</a>]</cite> proofs for existing code, as well as inferring postconditions based on textual descriptions <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib10" title="">10</a>]</cite> and complete verified code in Dafny <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib30" title="">30</a>]</cite>, Rust <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib1" title="">1</a>]</cite>, and F* <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib5" title="">5</a>]</cite>. The ability of large language models to make progress towards automating formal verification for specialized systems suggests it may be possible to integrate formal methods into mainstream programming.</p> </div> <div class="ltx_para" id="S1.p7"> <p class="ltx_p" id="S1.p7.1">In this paper, we explore the capability of LLMs in generating formally verified code across three different systems. Our focus lies on Nagini <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib9" title="">9</a>]</cite> and Verus <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib17" title="">17</a>]</cite> — the verifiers of subsets of popular programming languages Python and Rust. We also include Dafny into consideration, which serves as a baseline. In addition to this, we investigate what kind of problem specification is enough for the model to produce verified code by exposing different amounts of information to it. Finally, we prepare three datasets based on HumanEval <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib6" title="">6</a>]</cite> of high-quality, manually implemented, verified programs to function as reference solutions.</p> </div> </section> <section class="ltx_section" id="S2"> <h2 class="ltx_title ltx_title_section"> <span class="ltx_tag ltx_tag_section">2 </span>Method</h2> <div class="ltx_para" id="S2.p1"> <p class="ltx_p" id="S2.p1.1">Our overarching goal of simplifying the lives of programmers who may not be used to formal verification poses the following question: how much information do we have to expose to an LLM in order to successfully produce correct-by-construction code? Can AI only help with the inferring simple loop invariants and assertions to finish the proof based on the existing codebase? Would it be possible to also generate implementations and high-level specifications from a natural language description? As we have found out, the answer lies somewhere in between. In pursuit of this research goal, we designed a universal framework that prepares prompts and validates programs generated in several scenarios. In this section, we discuss the framework, the benchmarks, and the experiments conducted.</p> </div> <figure class="ltx_figure" id="S2.F1"><svg class="ltx_picture ltx_centering" height="411.17" id="S2.F1.pic1" overflow="visible" version="1.1" width="343.51"><g fill="#000000" stroke="#000000" transform="translate(0,411.17) matrix(1 0 0 -1 0 0) translate(144.94,0) translate(0,408.24)"><g stroke-width="0.4pt"><path d="M 2.94 0 C 2.94 1.62 1.62 2.94 0 2.94 C -1.62 2.94 -2.94 1.62 -2.94 0 C -2.94 -1.62 -1.62 -2.94 0 -2.94 C 1.62 -2.94 2.94 -1.62 2.94 0 Z M 0 0" style="stroke:none"></path><g stroke="#000000"><path d="M -59.06 -98.43 h 118.11 v 39.37 h -118.11 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -41.53 -82.12)"><foreignobject height="12.15" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="83.06"><span class="ltx_text" id="S2.F1.pic1.1.1.1.1.1.1">Preprocessing</span></foreignobject></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 7.51 -42.83)"><foreignobject height="12.3" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="158.59"><span class="ltx_text" id="S2.F1.pic1.2.2.2.2.1.1">Reference Implementation</span></foreignobject></g><g stroke="#000000"><path d="M -82.66 -177.17 h 165.31 v 39.37 h -165.31 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -78.04 -162.28)"><foreignobject height="9.61" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="156.47"><span class="ltx_text" id="S2.F1.pic1.3.3.3.3.1.1">Interaction with the LLM</span></foreignobject></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 6.99 -121.57)"><foreignobject height="12.3" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="112"><span class="ltx_text" id="S2.F1.pic1.4.4.4.4.1.1">Prepared Program</span></foreignobject></g><g stroke="#000000"><path d="M -59.06 -255.91 h 118.11 v 39.37 h -118.11 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -34.8 -241.02)"><foreignobject height="9.61" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="69.61"><span class="ltx_text" id="S2.F1.pic1.5.5.5.5.1.1">Verification</span></foreignobject></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 8.24 -201.65)"><foreignobject height="9.61" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="62.27"><span class="ltx_text" id="S2.F1.pic1.6.6.6.6.1.1">Candidate</span></foreignobject></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 121 -201.58)"><foreignobject height="9.46" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="72.95"><span class="ltx_text" id="S2.F1.pic1.7.7.7.7.1.1">Minor Fixes</span></foreignobject></g><g stroke="#000000"><path d="M -59.06 -334.65 h 118.11 v 39.37 h -118.11 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -31.13 -319.77)"><foreignobject height="9.61" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="62.27"><span class="ltx_text" id="S2.F1.pic1.8.8.8.8.1.1">Validation</span></foreignobject></g><g stroke="#00E000" stroke-width="0.8pt"><path d="M 13.98 -393.7 C 13.98 -385.98 7.72 -379.72 0 -379.72 C -7.72 -379.72 -13.98 -385.98 -13.98 -393.7 C -13.98 -401.42 -7.72 -407.68 0 -407.68 C 7.72 -407.68 13.98 -401.42 13.98 -393.7 Z M 0 -393.7" style="fill:none"></path></g><g fill="#000000" stroke="#000000" stroke-width="0.8pt" transform="matrix(1.0 0.0 0.0 1.0 -5.77 -398.49)"><foreignobject height="9.58" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="11.53"><span class="ltx_text" id="S2.F1.pic1.9.9.9.9.1.1" style="color:#00E000;">✓</span></foreignobject></g><g stroke-width="0.8pt"><path d="M 0 -3.21 L 0 -55.18" style="fill:none"></path><g transform="matrix(0.0 -1.0 1.0 0.0 0 -55.18)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g><g stroke-width="0.8pt"><path d="M 0 -98.7 L 0 -133.92" style="fill:none"></path><g transform="matrix(0.0 -1.0 1.0 0.0 0 -133.92)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g><g stroke-width="0.8pt"><path d="M 0 -177.44 L 0 -212.66" style="fill:none"></path><g transform="matrix(0.0 -1.0 1.0 0.0 0 -212.66)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -91.33 -240.95)"><foreignobject height="9.46" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="17.3"><span class="ltx_text" id="S2.F1.pic1.10.10.10.10.1.1">No</span></foreignobject></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 68.69 -252.76)"><foreignobject height="9.46" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="75.22"><span class="ltx_text" id="S2.F1.pic1.11.11.11.11.1.1">Minor issues</span></foreignobject></g><g stroke-width="0.8pt"><path d="M -59.33 -236.22 C -90.06 -245.43 -113.66 -166.69 -86.38 -158.51" style="fill:none"></path><g transform="matrix(0.95789 0.28712 -0.28712 0.95789 -86.38 -158.51)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 9.27 -280.32)"><foreignobject height="9.46" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="20.83"><span class="ltx_text" id="S2.F1.pic1.12.12.12.12.1.1">Yes</span></foreignobject></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 9.27 -359.06)"><foreignobject height="9.46" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="20.83"><span class="ltx_text" id="S2.F1.pic1.13.13.13.13.1.1">Yes</span></foreignobject></g><g stroke-width="0.8pt"><path d="M 0 -256.18 L 0 -291.4" style="fill:none"></path><g transform="matrix(0.0 -1.0 1.0 0.0 0 -291.4)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g><g stroke-dasharray="0.8pt,1.0pt" stroke-dashoffset="0.0pt" stroke-width="0.8pt"><path d="M 59.33 -236.22 C 99.48 -236.22 157.48 -246.62 157.48 -210.06" style="fill:none"></path><g transform="matrix(0.0 1.0 -1.0 0.0 157.48 -210.06)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g><g stroke-dasharray="0.8pt,1.0pt" stroke-dashoffset="0.0pt" stroke-width="0.8pt"><path d="M 157.48 -187.23 C 157.48 -155.84 114.33 -157.48 86.53 -157.48" style="fill:none"></path><g transform="matrix(-1.0 0.0 0.0 -1.0 86.53 -157.48)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -103.14 -319.69)"><foreignobject height="9.46" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="17.3"><span class="ltx_text" id="S2.F1.pic1.14.14.14.14.1.1">No</span></foreignobject></g></g><g stroke-width="0.8pt"><path d="M -59.33 -314.96 C -120.78 -324.17 -144.38 -166.69 -86.49 -158.01" style="fill:none"></path><g transform="matrix(0.98895 0.14821 -0.14821 0.98895 -86.49 -158.01)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g><g stroke-width="0.8pt"><path d="M 0 -334.92 L 0 -375.57" style="fill:none"></path><g transform="matrix(0.0 -1.0 1.0 0.0 0 -375.57)"><path d="M 3.6 0 L -2.16 2.88 L 0 0 L -2.16 -2.88" style="stroke:none"></path></g></g></g></svg> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F1.2.1.1" style="font-size:90%;">Figure 1</span>: </span><span class="ltx_text" id="S2.F1.3.2" style="font-size:90%;">The overview of evaluating an LLM on a benchmark problem</span></figcaption> </figure> <div class="ltx_para" id="S2.p2"> <p class="ltx_p" id="S2.p2.1">The overall pipeline consists of four key parts, see Figure <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.F1" title="Figure 1 ‣ 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">1</span></a>. First, task preparation involves populating prompts with the task description and specification formed from the reference implementation in the dataset. Next, interaction with the large language model takes place, where the input is fed into it to generate a candidate solution. Following this, we attempt verification of the code produced and if any issues are detected, the feedback is passed back to the LLM to refine its suggestion. An optional step may be conducted to post-process the generated code with the aim of fixing common minor issues. Finally, we validate whether the verified code meets the reference specification. The last step is important to ensure that the generated preconditions are not too weak and postconditions are not too strong. Now, let us describe the steps in more details.</p> </div> <section class="ltx_subsection" id="S2.SS1"> <h3 class="ltx_title ltx_title_subsection"> <span class="ltx_tag ltx_tag_subsection">2.1 </span>Task Preparation for Different Modes</h3> <div class="ltx_para" id="S2.SS1.p1"> <p class="ltx_p" id="S2.SS1.p1.1">The benchmarks we use for evaluation contain ground truth, namely complete verified code that solves tasks from the original HumanEval dataset along with their natural language descriptions. A solution to a problem may be as small as a single function accompanied by its formal specification, if it is enough for the verifier to establish correctness. However, the majority of the programs include multiple functions and methods, as well as additional lemmas, loop invariants, and assertions needed for verification. Depending on the program synthesis task, only certain parts of a program need to be exposed. To simplify experiments, we annotated these components and used the annotations in the preparation of the input data.</p> </div> <div class="ltx_para" id="S2.SS1.p2"> <p class="ltx_p" id="S2.SS1.p2.1">Experiment <em class="ltx_emph ltx_font_italic" id="S2.SS1.p2.1.1">modes</em> describe various scenarios for which generation can be applied. In some of them, a model is expected to only finish the correctness proof of the existing code, while in the others it generates code from scratch. In different situations, we can assume either the presence of textual description of the problem or its absence. Naturally, the complexity of the task varies from one mode to another. To estimate the ability of LLMs to cope with different cases, we describe six modes, each of which requires appropriate preprocessing and a set of prompts.</p> </div> <figure class="ltx_figure" id="S2.F2"> <div class="ltx_flex_figure"> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_figure ltx_figure_panel ltx_minipage ltx_align_top" id="S2.F2.sf1" style="width:195.1pt;"> <div class="ltx_listing ltx_lst_language_Dafny ltx_lstlisting ltx_listing" id="S2.F2.sf1.2"> <div class="ltx_listing_data"><a download="" href="data:text/plain;base64,ZnVuY3Rpb24gcHJvZChzOiBzZXE8aW50PikgOiBpbnQgewogIGlmIHxzfCA9PSAwIHRoZW4gMQogIGVsc2Ugc1swXSAqIHByb2Qoc1sxLi5dKQp9Cm1ldGhvZCBzdW1fcHJvZHVjdChudW1zOiBzZXE8aW50PikKICByZXR1cm5zIChzIDogaW50LCBwIDogaW50KQogIGVuc3VyZXMgcyA9PSBzdW0obnVtcykKICBlbnN1cmVzIHAgPT0gcHJvZChudW1zKQp7CiFcVmVydXNCRyEgIGFzc2VydCBudW1zWy4ufG51bXN8XSA9PSBudW1zOwogIHMgOj0gMCwgcCA6PSAxOwogIGZvciBpIDo9IDAgdG8gfG51bXN8CiFcVmVydXNCRyEgICAgaW52YXJpYW50IHMgPT0gc3VtKG51bXNbLi5pXSkKIVxWZXJ1c0JHISAgICBpbnZhcmlhbnQgcCA9PSBwcm9kKG51bXNbLi5pXSkKICAgIHsgcyA6PSBzICsgbnVtc1tpXTsKICAgICAgcCA6PSBwICogbnVtc1tpXTsgfSAuLi4gfQo=">⬇</a></div> <div class="ltx_listingline" id="lstnumberx1"> <span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx1.1" style="font-size:70%;color:#FF0000;">function</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx1.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx1.3" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx1.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx1.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx1.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx1.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx1.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx1.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx1.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx1.11" style="font-size:70%;">&gt;)</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx1.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx1.13" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx1.14" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx1.15" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx1.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx1.17" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx2"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx2.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx2.2" style="font-size:70%;color:#9400D1;">if</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx2.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx2.4" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx2.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx2.6" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx2.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx2.8" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx2.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx2.10" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx2.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx2.12" style="font-size:70%;color:#9400D1;">then</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx2.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx2.14" style="font-size:70%;">1</span> </div> <div class="ltx_listingline" id="lstnumberx3"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx3.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx3.2" style="font-size:70%;color:#9400D1;">else</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx3.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx3.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx3.5" style="font-size:70%;">[0]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx3.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx3.7" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx3.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx3.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx3.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx3.11" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx3.12" style="font-size:70%;">[1..])</span> </div> <div class="ltx_listingline" id="lstnumberx4"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx4.1" style="font-size:70%;">}</span> </div> <div class="ltx_listingline" id="lstnumberx5"> <span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx5.1" style="font-size:70%;color:#9400D1;">method</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx5.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx5.3" style="font-size:70%;color:#000000;">sum_product</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx5.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx5.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx5.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx5.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx5.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx5.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx5.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx5.11" style="font-size:70%;">&gt;)</span> </div> <div class="ltx_listingline" id="lstnumberx6"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx6.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx6.2" style="font-size:70%;color:#9400D1;">returns</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx6.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx6.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx6.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx6.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx6.7" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx6.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx6.9" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx6.10" style="font-size:70%;">,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx6.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx6.12" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx6.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx6.14" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx6.15" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx6.16" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx6.17" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx7"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx7.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx7.2" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx7.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx7.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx7.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx7.6" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx7.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx7.8" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx7.9" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx7.10" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx7.11" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx8"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx8.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx8.2" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx8.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx8.4" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx8.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx8.6" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx8.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx8.8" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx8.9" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx8.10" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx8.11" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx9"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx9.1" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx10"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx10.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx10.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx10.3" style="font-size:70%;color:#FF0000;">assert</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx10.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx10.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx10.6" style="font-size:70%;">[..|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx10.7" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx10.8" style="font-size:70%;">|]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx10.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx10.10" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx10.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx10.12" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx10.13" style="font-size:70%;">;</span> </div> <div class="ltx_listingline" id="lstnumberx11"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx11.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx11.2" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx11.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx11.4" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx11.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx11.6" style="font-size:70%;">0,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx11.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx11.8" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx11.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx11.10" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx11.11" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx11.12" style="font-size:70%;">1;</span> </div> <div class="ltx_listingline" id="lstnumberx12"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx12.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx12.2" style="font-size:70%;color:#9400D1;">for</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx12.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx12.4" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx12.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx12.6" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx12.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx12.8" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx12.9" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx12.10" style="font-size:70%;color:#9400D1;">to</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx12.11" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx12.12" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx12.13" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx12.14" style="font-size:70%;">|</span> </div> <div class="ltx_listingline" id="lstnumberx13"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx13.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx13.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx13.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx13.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx13.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx13.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx13.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx13.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx13.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx13.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx13.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx13.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx13.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx13.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx14"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx14.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx14.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx14.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx14.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx14.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx14.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx14.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx14.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx14.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx14.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx14.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx14.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx14.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx14.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx15"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx15.1" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx15.2" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx15.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx15.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx15.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx15.6" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx15.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx15.8" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx15.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx15.10" style="font-size:70%;">+</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx15.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx15.12" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx15.13" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx15.14" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx15.15" style="font-size:70%;">];</span> </div> <div class="ltx_listingline" id="lstnumberx16"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx16.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx16.2" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx16.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx16.4" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx16.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx16.6" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx16.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx16.8" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx16.9" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx16.10" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx16.11" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx16.12" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx16.13" style="font-size:70%;">];</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx16.14" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx16.15" style="font-size:70%;">}</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx16.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx16.17" style="font-size:70%;">...</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx16.18" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx16.19" style="font-size:70%;">}</span> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F2.sf1.3.1.1" style="font-size:90%;">(a)</span> </span><span class="ltx_text" id="S2.F2.sf1.4.2" style="font-size:90%;">Mode 1</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_figure ltx_figure_panel ltx_minipage ltx_align_top" id="S2.F2.sf2" style="width:195.1pt;"> <div class="ltx_listing ltx_lst_language_Dafny ltx_lstlisting ltx_listing" id="S2.F2.sf2.2"> <div class="ltx_listing_data"><a download="" href="data:text/plain;base64,ZnVuY3Rpb24gcHJvZChzOiBzZXE8aW50PikgOiBpbnQgewogIGlmIHxzfCA9PSAwIHRoZW4gMQogIGVsc2Ugc1swXSAqIHByb2Qoc1sxLi5dKQp9Cm1ldGhvZCBzdW1fcHJvZHVjdChudW1zOiBzZXE8aW50PikKICByZXR1cm5zIChzIDogaW50LCBwIDogaW50KQohXFZlcnVzQkchICBlbnN1cmVzIHMgPT0gc3VtKG51bXMpCiFcVmVydXNCRyEgIGVuc3VyZXMgcCA9PSBwcm9kKG51bXMpCnsKIVxWZXJ1c0JHISAgYXNzZXJ0IG51bXNbLi58bnVtc3xdID09IG51bXM7CiAgcyA6PSAwLCBwIDo9IDE7CiAgZm9yIGkgOj0gMCB0byB8bnVtc3wKIVxWZXJ1c0JHISAgICBpbnZhcmlhbnQgcyA9PSBzdW0obnVtc1suLmldKQohXFZlcnVzQkchICAgIGludmFyaWFudCBwID09IHByb2QobnVtc1suLmldKQogICAgeyBzIDo9IHMgKyBudW1zW2ldOwogICAgICBwIDo9IHAgKiBudW1zW2ldOyB9IC4uLiB9">⬇</a></div> <div class="ltx_listingline" id="lstnumberx17"> <span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx17.1" style="font-size:70%;color:#FF0000;">function</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx17.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx17.3" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx17.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx17.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx17.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx17.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx17.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx17.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx17.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx17.11" style="font-size:70%;">&gt;)</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx17.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx17.13" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx17.14" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx17.15" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx17.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx17.17" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx18"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx18.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx18.2" style="font-size:70%;color:#9400D1;">if</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx18.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx18.4" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx18.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx18.6" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx18.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx18.8" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx18.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx18.10" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx18.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx18.12" style="font-size:70%;color:#9400D1;">then</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx18.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx18.14" style="font-size:70%;">1</span> </div> <div class="ltx_listingline" id="lstnumberx19"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx19.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx19.2" style="font-size:70%;color:#9400D1;">else</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx19.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx19.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx19.5" style="font-size:70%;">[0]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx19.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx19.7" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx19.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx19.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx19.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx19.11" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx19.12" style="font-size:70%;">[1..])</span> </div> <div class="ltx_listingline" id="lstnumberx20"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx20.1" style="font-size:70%;">}</span> </div> <div class="ltx_listingline" id="lstnumberx21"> <span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx21.1" style="font-size:70%;color:#9400D1;">method</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx21.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx21.3" style="font-size:70%;color:#000000;">sum_product</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx21.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx21.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx21.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx21.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx21.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx21.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx21.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx21.11" style="font-size:70%;">&gt;)</span> </div> <div class="ltx_listingline" id="lstnumberx22"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx22.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx22.2" style="font-size:70%;color:#9400D1;">returns</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx22.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx22.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx22.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx22.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx22.7" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx22.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx22.9" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx22.10" style="font-size:70%;">,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx22.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx22.12" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx22.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx22.14" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx22.15" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx22.16" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx22.17" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx23"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx23.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx23.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx23.3" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx23.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx23.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx23.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx23.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx23.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx23.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx23.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx23.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx23.12" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx24"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx24.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx24.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx24.3" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx24.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx24.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx24.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx24.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx24.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx24.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx24.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx24.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx24.12" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx25"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx25.1" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx26"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx26.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx26.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx26.3" style="font-size:70%;color:#FF0000;">assert</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx26.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx26.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx26.6" style="font-size:70%;">[..|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx26.7" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx26.8" style="font-size:70%;">|]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx26.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx26.10" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx26.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx26.12" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx26.13" style="font-size:70%;">;</span> </div> <div class="ltx_listingline" id="lstnumberx27"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx27.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx27.2" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx27.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx27.4" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx27.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx27.6" style="font-size:70%;">0,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx27.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx27.8" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx27.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx27.10" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx27.11" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx27.12" style="font-size:70%;">1;</span> </div> <div class="ltx_listingline" id="lstnumberx28"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx28.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx28.2" style="font-size:70%;color:#9400D1;">for</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx28.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx28.4" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx28.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx28.6" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx28.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx28.8" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx28.9" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx28.10" style="font-size:70%;color:#9400D1;">to</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx28.11" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx28.12" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx28.13" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx28.14" style="font-size:70%;">|</span> </div> <div class="ltx_listingline" id="lstnumberx29"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx29.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx29.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx29.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx29.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx29.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx29.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx29.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx29.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx29.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx29.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx29.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx29.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx29.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx29.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx30"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx30.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx30.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx30.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx30.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx30.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx30.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx30.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx30.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx30.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx30.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx30.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx30.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx30.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx30.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx31"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx31.1" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx31.2" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx31.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx31.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx31.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx31.6" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx31.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx31.8" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx31.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx31.10" style="font-size:70%;">+</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx31.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx31.12" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx31.13" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx31.14" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx31.15" style="font-size:70%;">];</span> </div> <div class="ltx_listingline" id="lstnumberx32"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx32.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx32.2" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx32.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx32.4" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx32.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx32.6" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx32.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx32.8" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx32.9" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx32.10" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx32.11" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx32.12" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx32.13" style="font-size:70%;">];</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx32.14" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx32.15" style="font-size:70%;">}</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx32.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx32.17" style="font-size:70%;">...</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx32.18" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx32.19" style="font-size:70%;">}</span> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F2.sf2.3.1.1" style="font-size:90%;">(b)</span> </span><span class="ltx_text" id="S2.F2.sf2.4.2" style="font-size:90%;">Mode 2</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_figure ltx_figure_panel ltx_minipage ltx_align_top" id="S2.F2.sf3" style="width:195.1pt;"> <div class="ltx_listing ltx_lst_language_Dafny ltx_lstlisting ltx_listing" id="S2.F2.sf3.2"> <div class="ltx_listing_data"><a download="" href="data:text/plain;base64,ZnVuY3Rpb24gcHJvZChzOiBzZXE8aW50PikgOiBpbnQgewogIGlmIHxzfCA9PSAwIHRoZW4gMQogIGVsc2Ugc1swXSAqIHByb2Qoc1sxLi5dKQp9Cm1ldGhvZCBzdW1fcHJvZHVjdChudW1zOiBzZXE8aW50PikKICByZXR1cm5zIChzIDogaW50LCBwIDogaW50KQogIGVuc3VyZXMgcyA9PSBzdW0obnVtcykKICBlbnN1cmVzIHAgPT0gcHJvZChudW1zKQp7CiFcVmVydXNCRyEgIGFzc2VydCBudW1zWy4ufG51bXN8XSA9PSBudW1zOwohXFZlcnVzQkchICBzIDo9IDAsIHAgOj0gMTsKIVxWZXJ1c0JHISAgZm9yIGkgOj0gMCB0byB8bnVtc3wKIVxWZXJ1c0JHISAgICBpbnZhcmlhbnQgcyA9PSBzdW0obnVtc1suLmldKQohXFZlcnVzQkchICAgIGludmFyaWFudCBwID09IHByb2QobnVtc1suLmldKQohXFZlcnVzQkchICAgIHsgcyA6PSBzICsgbnVtc1tpXTsKIVxWZXJ1c0JHISAgICAgIHAgOj0gcCAqIG51bXNbaV07IH0gLi4uIH0=">⬇</a></div> <div class="ltx_listingline" id="lstnumberx33"> <span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx33.1" style="font-size:70%;color:#FF0000;">function</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx33.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx33.3" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx33.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx33.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx33.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx33.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx33.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx33.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx33.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx33.11" style="font-size:70%;">&gt;)</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx33.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx33.13" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx33.14" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx33.15" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx33.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx33.17" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx34"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx34.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx34.2" style="font-size:70%;color:#9400D1;">if</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx34.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx34.4" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx34.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx34.6" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx34.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx34.8" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx34.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx34.10" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx34.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx34.12" style="font-size:70%;color:#9400D1;">then</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx34.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx34.14" style="font-size:70%;">1</span> </div> <div class="ltx_listingline" id="lstnumberx35"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx35.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx35.2" style="font-size:70%;color:#9400D1;">else</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx35.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx35.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx35.5" style="font-size:70%;">[0]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx35.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx35.7" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx35.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx35.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx35.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx35.11" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx35.12" style="font-size:70%;">[1..])</span> </div> <div class="ltx_listingline" id="lstnumberx36"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx36.1" style="font-size:70%;">}</span> </div> <div class="ltx_listingline" id="lstnumberx37"> <span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx37.1" style="font-size:70%;color:#9400D1;">method</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx37.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx37.3" style="font-size:70%;color:#000000;">sum_product</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx37.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx37.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx37.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx37.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx37.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx37.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx37.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx37.11" style="font-size:70%;">&gt;)</span> </div> <div class="ltx_listingline" id="lstnumberx38"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx38.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx38.2" style="font-size:70%;color:#9400D1;">returns</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx38.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx38.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx38.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx38.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx38.7" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx38.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx38.9" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx38.10" style="font-size:70%;">,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx38.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx38.12" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx38.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx38.14" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx38.15" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx38.16" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx38.17" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx39"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx39.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx39.2" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx39.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx39.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx39.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx39.6" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx39.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx39.8" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx39.9" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx39.10" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx39.11" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx40"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx40.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx40.2" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx40.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx40.4" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx40.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx40.6" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx40.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx40.8" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx40.9" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx40.10" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx40.11" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx41"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx41.1" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx42"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx42.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx42.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx42.3" style="font-size:70%;color:#FF0000;">assert</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx42.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx42.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx42.6" style="font-size:70%;">[..|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx42.7" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx42.8" style="font-size:70%;">|]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx42.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx42.10" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx42.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx42.12" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx42.13" style="font-size:70%;">;</span> </div> <div class="ltx_listingline" id="lstnumberx43"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx43.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx43.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx43.3" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx43.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx43.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx43.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx43.7" style="font-size:70%;">0,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx43.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx43.9" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx43.10" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx43.11" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx43.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx43.13" style="font-size:70%;">1;</span> </div> <div class="ltx_listingline" id="lstnumberx44"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx44.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx44.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx44.3" style="font-size:70%;color:#9400D1;">for</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx44.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx44.5" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx44.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx44.7" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx44.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx44.9" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx44.10" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx44.11" style="font-size:70%;color:#9400D1;">to</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx44.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx44.13" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx44.14" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx44.15" style="font-size:70%;">|</span> </div> <div class="ltx_listingline" id="lstnumberx45"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx45.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx45.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx45.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx45.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx45.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx45.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx45.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx45.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx45.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx45.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx45.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx45.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx45.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx45.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx46"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx46.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx46.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx46.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx46.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx46.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx46.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx46.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx46.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx46.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx46.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx46.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx46.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx46.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx46.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx47"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx47.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx47.2" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx47.3" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx47.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx47.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx47.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx47.7" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx47.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx47.9" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx47.10" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx47.11" style="font-size:70%;">+</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx47.12" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx47.13" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx47.14" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx47.15" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx47.16" style="font-size:70%;">];</span> </div> <div class="ltx_listingline" id="lstnumberx48"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx48.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx48.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx48.3" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx48.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx48.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx48.6" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx48.7" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx48.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx48.9" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx48.10" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx48.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx48.12" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx48.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx48.14" style="font-size:70%;">];</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx48.15" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx48.16" style="font-size:70%;">}</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx48.17" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx48.18" style="font-size:70%;">...</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx48.19" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx48.20" style="font-size:70%;">}</span> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F2.sf3.3.1.1" style="font-size:90%;">(c)</span> </span><span class="ltx_text" id="S2.F2.sf3.4.2" style="font-size:90%;">Mode 3</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_figure ltx_figure_panel ltx_minipage ltx_align_top" id="S2.F2.sf4" style="width:195.1pt;"> <div class="ltx_listing ltx_lst_language_Dafny ltx_lstlisting ltx_listing" id="S2.F2.sf4.2"> <div class="ltx_listing_data"><a download="" href="data:text/plain;base64,ZnVuY3Rpb24gcHJvZChzOiBzZXE8aW50PikgOiBpbnQgewogIGlmIHxzfCA9PSAwIHRoZW4gMQogIGVsc2Ugc1swXSAqIHByb2Qoc1sxLi5dKQp9Cm1ldGhvZCBzdW1fcHJvZHVjdChudW1zOiBzZXE8aW50PikKICByZXR1cm5zIChzIDogaW50LCBwIDogaW50KQogIGVuc3VyZXMgcyA9PSBzdW0obnVtcykKICBlbnN1cmVzIHAgPT0gcHJvZChudW1zKQp7CiFcVmVydXNCRyEgIGFzc2VydCBudW1zWy4ufG51bXN8XSA9PSBudW1zOwohXFZlcnVzQkchICBzIDo9IDAsIHAgOj0gMTsKIVxWZXJ1c0JHISAgZm9yIGkgOj0gMCB0byB8bnVtc3wKIVxWZXJ1c0JHISAgICBpbnZhcmlhbnQgcyA9PSBzdW0obnVtc1suLmldKQohXFZlcnVzQkchICAgIGludmFyaWFudCBwID09IHByb2QobnVtc1suLmldKQohXFZlcnVzQkchICAgIHsgcyA6PSBzICsgbnVtc1tpXTsKIVxWZXJ1c0JHISAgICAgIHAgOj0gcCAqIG51bXNbaV07IH0gLi4uIH0=">⬇</a></div> <div class="ltx_listingline" id="lstnumberx49"> <span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx49.1" style="font-size:70%;color:#FF0000;">function</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx49.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx49.3" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx49.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx49.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx49.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx49.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx49.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx49.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx49.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx49.11" style="font-size:70%;">&gt;)</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx49.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx49.13" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx49.14" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx49.15" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx49.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx49.17" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx50"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx50.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx50.2" style="font-size:70%;color:#9400D1;">if</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx50.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx50.4" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx50.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx50.6" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx50.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx50.8" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx50.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx50.10" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx50.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx50.12" style="font-size:70%;color:#9400D1;">then</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx50.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx50.14" style="font-size:70%;">1</span> </div> <div class="ltx_listingline" id="lstnumberx51"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx51.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx51.2" style="font-size:70%;color:#9400D1;">else</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx51.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx51.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx51.5" style="font-size:70%;">[0]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx51.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx51.7" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx51.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx51.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx51.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx51.11" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx51.12" style="font-size:70%;">[1..])</span> </div> <div class="ltx_listingline" id="lstnumberx52"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx52.1" style="font-size:70%;">}</span> </div> <div class="ltx_listingline" id="lstnumberx53"> <span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx53.1" style="font-size:70%;color:#9400D1;">method</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx53.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx53.3" style="font-size:70%;color:#000000;">sum_product</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx53.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx53.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx53.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx53.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx53.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx53.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx53.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx53.11" style="font-size:70%;">&gt;)</span> </div> <div class="ltx_listingline" id="lstnumberx54"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx54.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx54.2" style="font-size:70%;color:#9400D1;">returns</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx54.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx54.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx54.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx54.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx54.7" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx54.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx54.9" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx54.10" style="font-size:70%;">,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx54.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx54.12" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx54.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx54.14" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx54.15" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx54.16" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx54.17" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx55"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx55.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx55.2" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx55.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx55.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx55.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx55.6" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx55.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx55.8" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx55.9" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx55.10" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx55.11" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx56"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx56.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx56.2" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx56.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx56.4" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx56.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx56.6" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx56.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx56.8" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx56.9" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx56.10" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx56.11" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx57"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx57.1" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx58"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx58.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx58.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx58.3" style="font-size:70%;color:#FF0000;">assert</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx58.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx58.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx58.6" style="font-size:70%;">[..|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx58.7" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx58.8" style="font-size:70%;">|]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx58.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx58.10" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx58.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx58.12" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx58.13" style="font-size:70%;">;</span> </div> <div class="ltx_listingline" id="lstnumberx59"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx59.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx59.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx59.3" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx59.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx59.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx59.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx59.7" style="font-size:70%;">0,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx59.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx59.9" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx59.10" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx59.11" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx59.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx59.13" style="font-size:70%;">1;</span> </div> <div class="ltx_listingline" id="lstnumberx60"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx60.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx60.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx60.3" style="font-size:70%;color:#9400D1;">for</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx60.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx60.5" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx60.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx60.7" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx60.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx60.9" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx60.10" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx60.11" style="font-size:70%;color:#9400D1;">to</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx60.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx60.13" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx60.14" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx60.15" style="font-size:70%;">|</span> </div> <div class="ltx_listingline" id="lstnumberx61"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx61.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx61.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx61.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx61.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx61.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx61.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx61.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx61.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx61.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx61.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx61.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx61.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx61.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx61.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx62"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx62.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx62.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx62.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx62.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx62.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx62.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx62.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx62.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx62.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx62.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx62.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx62.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx62.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx62.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx63"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx63.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx63.2" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx63.3" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx63.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx63.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx63.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx63.7" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx63.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx63.9" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx63.10" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx63.11" style="font-size:70%;">+</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx63.12" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx63.13" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx63.14" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx63.15" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx63.16" style="font-size:70%;">];</span> </div> <div class="ltx_listingline" id="lstnumberx64"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx64.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx64.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx64.3" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx64.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx64.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx64.6" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx64.7" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx64.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx64.9" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx64.10" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx64.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx64.12" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx64.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx64.14" style="font-size:70%;">];</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx64.15" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx64.16" style="font-size:70%;">}</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx64.17" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx64.18" style="font-size:70%;">...</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx64.19" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx64.20" style="font-size:70%;">}</span> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F2.sf4.3.1.1" style="font-size:90%;">(d)</span> </span><span class="ltx_text" id="S2.F2.sf4.4.2" style="font-size:90%;">Mode 4</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_figure ltx_figure_panel ltx_minipage ltx_align_top" id="S2.F2.sf5" style="width:195.1pt;"> <div class="ltx_listing ltx_lst_language_Dafny ltx_lstlisting ltx_listing" id="S2.F2.sf5.2"> <div class="ltx_listing_data"><a download="" href="data:text/plain;base64,ZnVuY3Rpb24gcHJvZChzOiBzZXE8aW50PikgOiBpbnQgewogIGlmIHxzfCA9PSAwIHRoZW4gMQogIGVsc2Ugc1swXSAqIHByb2Qoc1sxLi5dKQp9Cm1ldGhvZCBzdW1fcHJvZHVjdChudW1zOiBzZXE8aW50PikKICByZXR1cm5zIChzIDogaW50LCBwIDogaW50KQohXFZlcnVzQkchICBlbnN1cmVzIHMgPT0gc3VtKG51bXMpCiFcVmVydXNCRyEgIGVuc3VyZXMgcCA9PSBwcm9kKG51bXMpCnsKIVxWZXJ1c0JHISAgYXNzZXJ0IG51bXNbLi58bnVtc3xdID09IG51bXM7CiFcVmVydXNCRyEgIHMgOj0gMDsKIVxWZXJ1c0JHISAgcCA6PSAxOwohXFZlcnVzQkchICBmb3IgaSA6PSAwIHRvIHxudW1zfAohXFZlcnVzQkchICAgIGludmFyaWFudCBzID09IHN1bShudW1zWy4uaV0pCiFcVmVydXNCRyEgICAgaW52YXJpYW50IHAgPT0gcHJvZChudW1zWy4uaV0pCiFcVmVydXNCRyEgICAgeyBzIDo9IHMgKyBudW1zW2ldOwohXFZlcnVzQkchICAgICAgcCA6PSBwICogbnVtc1tpXTsgfSAuLi4gfQ==">⬇</a></div> <div class="ltx_listingline" id="lstnumberx65"> <span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx65.1" style="font-size:70%;color:#FF0000;">function</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx65.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx65.3" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx65.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx65.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx65.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx65.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx65.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx65.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx65.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx65.11" style="font-size:70%;">&gt;)</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx65.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx65.13" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx65.14" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx65.15" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx65.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx65.17" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx66"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx66.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx66.2" style="font-size:70%;color:#9400D1;">if</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx66.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx66.4" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx66.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx66.6" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx66.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx66.8" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx66.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx66.10" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx66.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx66.12" style="font-size:70%;color:#9400D1;">then</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx66.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx66.14" style="font-size:70%;">1</span> </div> <div class="ltx_listingline" id="lstnumberx67"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx67.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx67.2" style="font-size:70%;color:#9400D1;">else</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx67.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx67.4" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx67.5" style="font-size:70%;">[0]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx67.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx67.7" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx67.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx67.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx67.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx67.11" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx67.12" style="font-size:70%;">[1..])</span> </div> <div class="ltx_listingline" id="lstnumberx68"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx68.1" style="font-size:70%;">}</span> </div> <div class="ltx_listingline" id="lstnumberx69"> <span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx69.1" style="font-size:70%;color:#9400D1;">method</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx69.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx69.3" style="font-size:70%;color:#000000;">sum_product</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx69.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx69.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx69.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx69.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx69.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx69.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx69.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx69.11" style="font-size:70%;">&gt;)</span> </div> <div class="ltx_listingline" id="lstnumberx70"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx70.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx70.2" style="font-size:70%;color:#9400D1;">returns</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx70.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx70.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx70.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx70.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx70.7" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx70.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx70.9" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx70.10" style="font-size:70%;">,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx70.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx70.12" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx70.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx70.14" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx70.15" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx70.16" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx70.17" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx71"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx71.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx71.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx71.3" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx71.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx71.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx71.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx71.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx71.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx71.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx71.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx71.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx71.12" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx72"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx72.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx72.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx72.3" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx72.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx72.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx72.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx72.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx72.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx72.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx72.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx72.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx72.12" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx73"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx73.1" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx74"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx74.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx74.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx74.3" style="font-size:70%;color:#FF0000;">assert</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx74.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx74.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx74.6" style="font-size:70%;">[..|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx74.7" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx74.8" style="font-size:70%;">|]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx74.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx74.10" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx74.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx74.12" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx74.13" style="font-size:70%;">;</span> </div> <div class="ltx_listingline" id="lstnumberx75"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx75.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx75.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx75.3" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx75.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx75.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx75.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx75.7" style="font-size:70%;">0;</span> </div> <div class="ltx_listingline" id="lstnumberx76"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx76.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx76.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx76.3" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx76.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx76.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx76.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx76.7" style="font-size:70%;">1;</span> </div> <div class="ltx_listingline" id="lstnumberx77"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx77.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx77.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx77.3" style="font-size:70%;color:#9400D1;">for</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx77.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx77.5" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx77.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx77.7" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx77.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx77.9" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx77.10" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx77.11" style="font-size:70%;color:#9400D1;">to</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx77.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx77.13" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx77.14" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx77.15" style="font-size:70%;">|</span> </div> <div class="ltx_listingline" id="lstnumberx78"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx78.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx78.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx78.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx78.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx78.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx78.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx78.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx78.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx78.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx78.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx78.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx78.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx78.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx78.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx79"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx79.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx79.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx79.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx79.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx79.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx79.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx79.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx79.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx79.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx79.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx79.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx79.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx79.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx79.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx80"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx80.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx80.2" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx80.3" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx80.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx80.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx80.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx80.7" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx80.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx80.9" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx80.10" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx80.11" style="font-size:70%;">+</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx80.12" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx80.13" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx80.14" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx80.15" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx80.16" style="font-size:70%;">];</span> </div> <div class="ltx_listingline" id="lstnumberx81"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx81.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx81.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx81.3" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx81.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx81.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx81.6" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx81.7" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx81.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx81.9" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx81.10" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx81.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx81.12" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx81.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx81.14" style="font-size:70%;">];</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx81.15" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx81.16" style="font-size:70%;">}</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx81.17" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx81.18" style="font-size:70%;">...</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx81.19" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx81.20" style="font-size:70%;">}</span> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F2.sf5.3.1.1" style="font-size:90%;">(e)</span> </span><span class="ltx_text" id="S2.F2.sf5.4.2" style="font-size:90%;">Mode 5</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_figure ltx_figure_panel ltx_minipage ltx_align_top" id="S2.F2.sf6" style="width:195.1pt;"> <div class="ltx_listing ltx_lst_language_Dafny ltx_lstlisting ltx_listing" id="S2.F2.sf6.2"> <div class="ltx_listing_data"><a download="" href="data:text/plain;base64,IVxWZXJ1c0JHIWZ1bmN0aW9uIHByb2Qoczogc2VxPGludD4pIDogaW50IHsKIVxWZXJ1c0JHISAgaWYgfHN8ID09IDAgdGhlbiAxCiFcVmVydXNCRyEgIGVsc2Ugc1swXSAqIHByb2Qoc1sxLi5dKQohXFZlcnVzQkchfQptZXRob2Qgc3VtX3Byb2R1Y3QobnVtczogc2VxPGludD4pCiAgcmV0dXJucyAocyA6IGludCwgcCA6IGludCkKIVxWZXJ1c0JHISAgZW5zdXJlcyBzID09IHN1bShudW1zKQohXFZlcnVzQkchICBlbnN1cmVzIHAgPT0gcHJvZChudW1zKQp7CiFcVmVydXNCRyEgIGFzc2VydCBudW1zWy4ufG51bXN8XSA9PSBudW1zOwohXFZlcnVzQkchICBzIDo9IDA7CiFcVmVydXNCRyEgIHAgOj0gMTsKIVxWZXJ1c0JHISAgZm9yIGkgOj0gMCB0byB8bnVtc3wKIVxWZXJ1c0JHISAgICBpbnZhcmlhbnQgcyA9PSBzdW0obnVtc1suLmldKQohXFZlcnVzQkchICAgIGludmFyaWFudCBwID09IHByb2QobnVtc1suLmldKQohXFZlcnVzQkchICAgIHsgcyA6PSBzICsgbnVtc1tpXTsKIVxWZXJ1c0JHISAgICAgIHAgOj0gcCAqIG51bXNbaV07IH0gLi4uIH0=">⬇</a></div> <div class="ltx_listingline" id="lstnumberx82"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx82.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx82.2" style="font-size:70%;color:#FF0000;">function</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx82.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx82.4" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx82.5" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx82.6" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx82.7" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx82.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx82.9" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx82.10" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx82.11" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx82.12" style="font-size:70%;">&gt;)</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx82.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx82.14" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx82.15" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx82.16" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx82.17" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx82.18" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx83"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx83.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx83.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx83.3" style="font-size:70%;color:#9400D1;">if</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx83.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx83.5" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx83.6" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx83.7" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx83.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx83.9" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx83.10" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx83.11" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx83.12" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx83.13" style="font-size:70%;color:#9400D1;">then</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx83.14" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx83.15" style="font-size:70%;">1</span> </div> <div class="ltx_listingline" id="lstnumberx84"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx84.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx84.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx84.3" style="font-size:70%;color:#9400D1;">else</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx84.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx84.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx84.6" style="font-size:70%;">[0]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx84.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx84.8" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx84.9" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx84.10" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx84.11" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx84.12" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx84.13" style="font-size:70%;">[1..])</span> </div> <div class="ltx_listingline" id="lstnumberx85"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx85.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_font_typewriter" id="lstnumberx85.2" style="font-size:70%;">}</span> </div> <div class="ltx_listingline" id="lstnumberx86"> <span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx86.1" style="font-size:70%;color:#9400D1;">method</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx86.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx86.3" style="font-size:70%;color:#000000;">sum_product</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx86.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx86.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx86.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx86.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx86.8" style="font-size:70%;color:#000000;">seq</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx86.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx86.10" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx86.11" style="font-size:70%;">&gt;)</span> </div> <div class="ltx_listingline" id="lstnumberx87"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx87.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx87.2" style="font-size:70%;color:#9400D1;">returns</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx87.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx87.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx87.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx87.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx87.7" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx87.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx87.9" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx87.10" style="font-size:70%;">,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx87.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx87.12" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx87.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx87.14" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx87.15" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx87.16" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx87.17" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx88"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx88.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx88.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx88.3" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx88.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx88.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx88.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx88.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx88.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx88.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx88.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx88.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx88.12" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx89"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx89.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx89.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx89.3" style="font-size:70%;color:#FF0000;">ensures</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx89.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx89.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx89.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx89.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx89.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx89.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx89.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx89.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx89.12" style="font-size:70%;">)</span> </div> <div class="ltx_listingline" id="lstnumberx90"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx90.1" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx91"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx91.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx91.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx91.3" style="font-size:70%;color:#FF0000;">assert</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx91.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx91.5" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx91.6" style="font-size:70%;">[..|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx91.7" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx91.8" style="font-size:70%;">|]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx91.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx91.10" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx91.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx91.12" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx91.13" style="font-size:70%;">;</span> </div> <div class="ltx_listingline" id="lstnumberx92"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx92.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx92.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx92.3" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx92.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx92.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx92.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx92.7" style="font-size:70%;">0;</span> </div> <div class="ltx_listingline" id="lstnumberx93"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx93.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx93.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx93.3" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx93.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx93.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx93.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx93.7" style="font-size:70%;">1;</span> </div> <div class="ltx_listingline" id="lstnumberx94"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx94.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx94.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx94.3" style="font-size:70%;color:#9400D1;">for</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx94.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx94.5" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx94.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx94.7" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx94.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx94.9" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx94.10" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx94.11" style="font-size:70%;color:#9400D1;">to</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx94.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx94.13" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx94.14" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx94.15" style="font-size:70%;">|</span> </div> <div class="ltx_listingline" id="lstnumberx95"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx95.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx95.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx95.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx95.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx95.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx95.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx95.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx95.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx95.9" style="font-size:70%;color:#000000;">sum</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx95.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx95.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx95.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx95.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx95.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx96"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx96.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx96.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx96.3" style="font-size:70%;color:#FF0000;">invariant</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx96.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx96.5" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx96.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx96.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx96.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx96.9" style="font-size:70%;color:#000000;">prod</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx96.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx96.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx96.12" style="font-size:70%;">[..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx96.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx96.14" style="font-size:70%;">])</span> </div> <div class="ltx_listingline" id="lstnumberx97"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx97.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx97.2" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx97.3" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx97.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx97.5" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx97.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx97.7" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx97.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx97.9" style="font-size:70%;color:#000000;">s</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx97.10" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx97.11" style="font-size:70%;">+</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx97.12" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx97.13" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx97.14" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx97.15" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx97.16" style="font-size:70%;">];</span> </div> <div class="ltx_listingline" id="lstnumberx98"> <span class="ltx_text ltx_font_typewriter ltx_align_left ltx_inline-block" id="lstnumberx98.1" style="font-size:70%;width:0.0pt;"><span class="ltx_rule" style="width:433.6pt;height:7.0pt;position:relative; bottom:-1.8pt;background:black;display:inline-block;"> </span></span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx98.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx98.3" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx98.4" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx98.5" style="font-size:70%;">:=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx98.6" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx98.7" style="font-size:70%;color:#000000;">p</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx98.8" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx98.9" style="font-size:70%;">*</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx98.10" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx98.11" style="font-size:70%;color:#000000;">nums</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx98.12" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx98.13" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx98.14" style="font-size:70%;">];</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx98.15" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx98.16" style="font-size:70%;">}</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx98.17" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx98.18" style="font-size:70%;">...</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx98.19" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx98.20" style="font-size:70%;">}</span> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F2.sf6.3.1.1" style="font-size:90%;">(f)</span> </span><span class="ltx_text" id="S2.F2.sf6.4.2" style="font-size:90%;">Mode 6</span></figcaption> </figure> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F2.3.1.1" style="font-size:90%;">Figure 2</span>: </span><span class="ltx_text" id="S2.F2.4.2" style="font-size:90%;">The <span class="ltx_text" id="S2.F2.4.2.1" style="background-color:#FFC980;">dark-yellow</span> background highlights the parts of Dafny code required to be filled by an LLM in different modes.</span></figcaption> </figure> <div class="ltx_para" id="S2.SS1.p3"> <p class="ltx_p" id="S2.SS1.p3.1">Figure <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.F2" title="Figure 2 ‣ 2.1 Task Preparation for Different Modes ‣ 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">2</span></a> illustrates the different artifacts used in prompts distilled from the ground truth in Dafny. The method in the figure computes the sum and the product of the numbers in the given sequence by iterating in a for-loop. The function <span class="ltx_text ltx_lst_identifier ltx_lst_language_BigDafny ltx_lstlisting ltx_font_typewriter" id="S2.SS1.p3.1.1">prod</span> is an example of a specification function which is not allowed to be used in the implementation. Notice that we have omitted some details, such as assertions, due to space constraints. In the figure, we highlight those lines that are not included into prompts.</p> </div> <div class="ltx_para" id="S2.SS1.p4"> <p class="ltx_p" id="S2.SS1.p4.1"><em class="ltx_emph ltx_font_italic" id="S2.SS1.p4.1.1">Mode 1</em> is the least demanding scenario and represents the basic case of generating only the proof by the given specification and code. While preprocessing, we erase all invariants, assertions and lemma calls from the target methods. What is left are pre- and postconditions, specification functions, method signatures and implementations, see Figure <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.F2.sf1" title="In Figure 2 ‣ 2.1 Task Preparation for Different Modes ‣ 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">2(a)</span></a>.</p> </div> <div class="ltx_para" id="S2.SS1.p5"> <p class="ltx_p" id="S2.SS1.p5.1"><em class="ltx_emph ltx_font_italic" id="S2.SS1.p5.1.1">Mode 2</em> tests generation of both a specification and a proof solely from code. Thus, models are given complete implementations along with specification functions, but not verification primitives.</p> </div> <div class="ltx_para" id="S2.SS1.p6"> <p class="ltx_p" id="S2.SS1.p6.1"><em class="ltx_emph ltx_font_italic" id="S2.SS1.p6.1.1">Mode 3</em> targets a situation when a developer knows exactly how a method is supposed to work and can provide the exact specification of its behavior. The task of an AI-assistant is to fill in the implementation and the necessary hints enabling the verifier to finish the proof.</p> </div> <div class="ltx_para" id="S2.SS1.p7"> <p class="ltx_p" id="S2.SS1.p7.1"><em class="ltx_emph ltx_font_italic" id="S2.SS1.p7.1.1">Mode 4</em> differs from Mode 3 only by requiring a text description of the program. We believe this mode to be the most realistic and helpful use case of a tool like ours.</p> </div> <div class="ltx_para" id="S2.SS1.p8"> <p class="ltx_p" id="S2.SS1.p8.1">The last two modes assess the capabilities of LLMs to generate everything from the implementation to a proof given only natural language specifications and method signatures. In <em class="ltx_emph ltx_font_italic" id="S2.SS1.p8.1.1">Mode 5</em>, we provide the additional context by including specification functions in the prompt. However, it can be easier to guess the user intent with these functions, so we omit them in <em class="ltx_emph ltx_font_italic" id="S2.SS1.p8.1.2">Mode 6</em>.</p> </div> </section> <section class="ltx_subsection" id="S2.SS2"> <h3 class="ltx_title ltx_title_subsection"> <span class="ltx_tag ltx_tag_subsection">2.2 </span>Interaction with an LLM</h3> <div class="ltx_para" id="S2.SS2.p1"> <p class="ltx_p" id="S2.SS2.p1.1">We start interacting with an LLM by sending a system and a user prompt. The former primes the LLM to act as an expert in a particular verification system (Dafny, Nagini, or Verus) and defines the expected output format. The user prompt details the task to be performed and offers guidance on code structure, examples in a chosen language, and optional tips on relevant constructs. Figure <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.F3" title="Figure 3 ‣ 2.2 Interaction with an LLM ‣ 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">3</span></a> sketches the structure of the user prompt.</p> </div> <figure class="ltx_figure" id="S2.F3"><svg class="ltx_picture ltx_centering" height="228.9" id="S2.F3.pic1" overflow="visible" version="1.1" width="295.83"><g fill="#000000" stroke="#000000" stroke-width="0.4pt" transform="translate(0,228.9) matrix(1 0 0 -1 0 0) translate(147.91,0) translate(0,208.94)"><g stroke="#000000"><path d="M -147.64 -19.69 h 295.28 v 39.37 h -295.28 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -127.95 -3.54)"><foreignobject height="12.3" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="255.91"> <span class="ltx_inline-block ltx_minipage ltx_align_top" id="S2.F3.pic1.1.1.1.1.1" style="width:184.9pt;"> <span class="ltx_p" id="S2.F3.pic1.1.1.1.1.1.1"></span> <span class="ltx_p ltx_align_left" id="S2.F3.pic1.1.1.1.1.1.2">Mode description</span> </span></foreignobject></g><g stroke="#000000"><path d="M -147.64 -66.93 h 295.28 v 39.37 h -295.28 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -127.95 -50.78)"><foreignobject height="12.3" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="255.91"> <span class="ltx_inline-block ltx_minipage ltx_align_top" id="S2.F3.pic1.2.2.2.1.1" style="width:184.9pt;"> <span class="ltx_p" id="S2.F3.pic1.2.2.2.1.1.1"></span> <span class="ltx_p ltx_align_left" id="S2.F3.pic1.2.2.2.1.1.2"><span class="ltx_text" id="S2.F3.pic1.2.2.2.1.1.2.1" style="color:#00E000;">Optional</span>: Language hints</span> </span></foreignobject></g><g stroke="#000000"><path d="M -147.64 -114.17 h 295.28 v 39.37 h -295.28 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -127.95 -98.02)"><foreignobject height="12.3" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="255.91"> <span class="ltx_inline-block ltx_minipage ltx_align_top" id="S2.F3.pic1.3.3.3.1.1" style="width:184.9pt;"> <span class="ltx_p" id="S2.F3.pic1.3.3.3.1.1.1"></span> <span class="ltx_p ltx_align_left" id="S2.F3.pic1.3.3.3.1.1.2"><span class="ltx_text" id="S2.F3.pic1.3.3.3.1.1.2.1" style="color:#00E000;">Optional</span>: Verified code sample</span> </span></foreignobject></g><g stroke="#000000"><path d="M -147.64 -161.42 h 295.28 v 39.37 h -295.28 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -127.95 -140.14)"><foreignobject height="22.56" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="255.91"> <span class="ltx_inline-block ltx_minipage ltx_align_top" id="S2.F3.pic1.4.4.4.1.1" style="width:184.9pt;"> <span class="ltx_p" id="S2.F3.pic1.4.4.4.1.1.1"></span> <span class="ltx_p ltx_align_left" id="S2.F3.pic1.4.4.4.1.1.2"><span class="ltx_text" id="S2.F3.pic1.4.4.4.1.1.2.1" style="color:#00E000;">Optional</span>: Textual description of the problem</span> </span></foreignobject></g><g stroke="#000000"><path d="M -147.64 -208.66 h 295.28 v 39.37 h -295.28 Z" style="fill:none"></path></g><g fill="#000000" stroke="#000000" transform="matrix(1.0 0.0 0.0 1.0 -127.95 -192.51)"><foreignobject height="12.3" overflow="visible" transform="matrix(1 0 0 -1 0 16.6)" width="255.91"> <span class="ltx_inline-block ltx_minipage ltx_align_top" id="S2.F3.pic1.5.5.5.1.1" style="width:184.9pt;"> <span class="ltx_p" id="S2.F3.pic1.5.5.5.1.1.1"></span> <span class="ltx_p ltx_align_left" id="S2.F3.pic1.5.5.5.1.1.2">Input code, prepared from ground truth</span> </span></foreignobject></g></g></svg> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S2.F3.2.1.1" style="font-size:90%;">Figure 3</span>: </span><span class="ltx_text" id="S2.F3.3.2" style="font-size:90%;">The general structure of a prompt</span></figcaption> </figure> <div class="ltx_para" id="S2.SS2.p2"> <p class="ltx_p" id="S2.SS2.p2.1">After the LLM has produced a candidate solution, its verification is attempted. Whenever any issues are detected in the generated code, the feedback is collected and then used in a prompt to correct them. This request is repeated a few times until the failure has been successfully addressed, or a limit is reached.</p> </div> <div class="ltx_para" id="S2.SS2.p3"> <p class="ltx_p" id="S2.SS2.p3.1">We have noticed that models tend to make minor mistakes when working on Nagini, mostly mixing up keywords and syntax structures. For example, double negations such as <span class="ltx_text ltx_lst_language_BigDafny ltx_lstlisting" id="S2.SS2.p3.1.1"><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="S2.SS2.p3.1.1.1">a</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="S2.SS2.p3.1.1.2"> </span><span class="ltx_text ltx_font_typewriter" id="S2.SS2.p3.1.1.3">&lt;<span class="ltx_text ltx_lst_space" id="S2.SS2.p3.1.1.3.1"> </span><span class="ltx_text ltx_lst_identifier" id="S2.SS2.p3.1.1.3.2">b</span><span class="ltx_text ltx_lst_space" id="S2.SS2.p3.1.1.3.3"> </span>&lt;<span class="ltx_text ltx_lst_space" id="S2.SS2.p3.1.1.3.4"> </span><span class="ltx_text ltx_lst_identifier" id="S2.SS2.p3.1.1.3.5">c</span></span></span> are often produced even though they are not allowed in the system, likely because they are legal in Python. These kinds of errors can be fixed through non-ML means, which is both cheaper and faster than the counterpart. Thus, we implemented several simple syntactic converters to resolve such issues in Nagini and employ them prior to passing the incorrect candidate back to the LLM.</p> </div> <div class="ltx_para" id="S2.SS2.p4"> <p class="ltx_p" id="S2.SS2.p4.1">It may seem to be sufficient to stop after verifiable code is produced. Unfortunately, it may not be the case, as models can misinterpret user intent, break the rules by erasing function definitions or simplifying pre- and postconditions. Because it was our intention not to admit such poor-quality responses, we employed additional validation state. For scenarios that do not require producing a specification, the validation helps to check that the original code has not been modified. For modes aimed at generating code along with a specification, it ensures it to be sufficiently complex and expressive.</p> </div> </section> <section class="ltx_subsection" id="S2.SS3"> <h3 class="ltx_title ltx_title_subsection"> <span class="ltx_tag ltx_tag_subsection">2.3 </span>Validation</h3> <div class="ltx_para" id="S2.SS3.p1"> <p class="ltx_p" id="S2.SS3.p1.1">When an LLM is tasked to determine formal properties that the code must satisfy, we need to ensure that generated pre- and postconditions correctly express user intentions. Prior research either manually checks the correctness and completeness of specifications <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib21" title="">21</a>]</cite> or exploits other LLMs to compare the specification and the natural language description <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib1" title="">1</a>]</cite>. Unfortunately, the former approach takes too much human effort, while the latter runs the risk of incorrectly assessing the quality due to the limitations of an LLM. Another strategy, introduced in the Clover framework <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib30" title="">30</a>]</cite>, involves a formal proof of equality between annotations.</p> </div> <div class="ltx_para" id="S2.SS3.p2"> <p class="ltx_p" id="S2.SS3.p2.1">Inspired by Clover, we check specifications by utilizing SMT-solvers. However, instead of requiring equivalence, which may be too strict in practice, we check if the generated specification implies the specification as written in the reference solution in the data set. This way, we do not expect the LLM to guess the exact solution, giving it more freedom. In particular, the generated preconditions can be weaker and the postconditions can be stronger than the original.</p> </div> <div class="ltx_para" id="S2.SS3.p3"> <p class="ltx_p" id="S2.SS3.p3.1">To achieve this goal, we perform validation after the LLM has generated code. Having a list of target methods from the initial template, we construct a wrapper for each of them, that has the same specification as the original method. In its body, the wrapper calls the original method and propagates the return value. For example, for the method <span class="ltx_text ltx_lst_identifier ltx_lst_language_BigDafny ltx_lstlisting ltx_font_typewriter" id="S2.SS3.p3.1.1">sum_product</span> from Figure <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S2.F2" title="Figure 2 ‣ 2.1 Task Preparation for Different Modes ‣ 2 Method ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">2</span></a>, we add a validator <span class="ltx_text ltx_lst_identifier ltx_lst_language_BigDafny ltx_lstlisting ltx_font_typewriter" id="S2.SS3.p3.1.2">sum_product_valid</span> that checks the pre- and postconditions.</p> </div> <div class="ltx_para" id="S2.SS3.p4"> <p class="ltx_p" id="S2.SS3.p4.1">Despite this approach being automatic and reliable due to its deterministic nature, it has some drawbacks. Firstly, there are some limitations on which language features can be used. For example, functions must be used instead of predicates in Dafny, classes are disallowed, as well as <span class="ltx_text ltx_lst_language_BigDafny ltx_lstlisting" id="S2.SS3.p4.1.1"><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="S2.SS3.p4.1.1.1">open</span><span class="ltx_text ltx_font_typewriter" id="S2.SS3.p4.1.1.2">/<span class="ltx_text ltx_lst_identifier" id="S2.SS3.p4.1.1.2.1">closed</span></span></span> in Verus. In addition to this, the validation comes with an additional verification overhead. Sometimes, when helpers are present, a verifier gives up trying to prove equality of the validation and the generated helpers, despite their indistinguishability. Finally, there might be multiple ways to specify the same user intent with sufficient accuracy. However, we always compare the code to the ground truth in our benchmarks, which might not scale well if more complicated tasks are considered.</p> </div> </section> <section class="ltx_subsection" id="S2.SS4"> <h3 class="ltx_title ltx_title_subsection"> <span class="ltx_tag ltx_tag_subsection">2.4 </span>Benchmarks</h3> <div class="ltx_para" id="S2.SS4.p1"> <p class="ltx_p" id="S2.SS4.p1.1">HumanEval <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib6" title="">6</a>]</cite> is a widely used benchmark for evaluating the code generation capabilities of LLMs. Evaluation on HumanEval is a convenient way to showcase the results of verified code generation to a community unfamiliar with it. For this reason, we translated the majority of the original dataset into Dafny<span class="ltx_note ltx_role_footnote" id="footnote1"><sup class="ltx_note_mark">1</sup><span class="ltx_note_outer"><span class="ltx_note_content"><sup class="ltx_note_mark">1</sup><span class="ltx_tag ltx_tag_note">1</span>HumanEval dataset in Dafny: <a class="ltx_ref ltx_url" href="https://github.com/JetBrains-Research/HumanEval-Dafny/" title="">https://github.com/JetBrains-Research/HumanEval-Dafny/</a></span></span></span> and Nagini<span class="ltx_note ltx_role_footnote" id="footnote2"><sup class="ltx_note_mark">2</sup><span class="ltx_note_outer"><span class="ltx_note_content"><sup class="ltx_note_mark">2</sup><span class="ltx_tag ltx_tag_note">2</span>HumanEval dataset in Nagini: <a class="ltx_ref ltx_url" href="https://github.com/JetBrains-Research/HumanEval-Nagini/" title="">https://github.com/JetBrains-Research/HumanEval-Nagini/</a></span></span></span>, 132 and 106 programs respectively. We have also contributed to a similar initiative for Verus<span class="ltx_note ltx_role_footnote" id="footnote3"><sup class="ltx_note_mark">3</sup><span class="ltx_note_outer"><span class="ltx_note_content"><sup class="ltx_note_mark">3</sup><span class="ltx_tag ltx_tag_note">3</span>HumanEval-based dataset in Verus: <a class="ltx_ref ltx_url" href="https://github.com/secure-foundations/human-eval-verus" title="">https://github.com/secure-foundations/human-eval-verus</a></span></span></span>, which contains 55 programs as of the time of writing this paper. Not all problems from the original benchmark have been included into the datasets, partially because of time constraints, and partially because not every task is suitable for verification. For some of them, the specification duplicates the implementation (e.g. task 67), while unsupported language features are needed for others (e.g. task 2 in Dafny and task 4 in Verus).</p> </div> <div class="ltx_para" id="S2.SS4.p2"> <p class="ltx_p" id="S2.SS4.p2.1">The Dafny and Verus benchmarks were created manually, with multiple people collaborating over several weeks. Some automation was possible at the initial stage of creating the benchmark in Nagini. For this, we modified the Dafny compiler to automatically convert the Dafny files into Nagini. Even though the verification systems resemble each other, Nagini has lower expressiveness compared with Dafny. As a result, we had to manually inspect every program and add additional invariants or adjust specifications to finish correctness proofs.</p> </div> </section> </section> <section class="ltx_section" id="S3"> <h2 class="ltx_title ltx_title_section"> <span class="ltx_tag ltx_tag_section">3 </span>Evaluation</h2> <div class="ltx_para" id="S3.p1"> <p class="ltx_p" id="S3.p1.1">In the early stages of our project, we experimented with multiple LLMs, including GPT-3.5, GPT-4o, and Claude 3 Opus. However, the quality achieved by Claude 3.5 Sonnet massively surpassed the others, leading us to rely exclusively on it since its release. Unfortunately, we have not yet run the experiments on the o1 model because of its prohibitively strict limits. Neither have we had a chance to set up the newest DeepSeek-R1 <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib12" title="">12</a>]</cite> and o3-mini <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib24" title="">24</a>]</cite> models, which promise even higher quality compared with the earlier models. In this study, we only provide the results achieved using Claude 3.5 Sonnet since it consistently demonstrated superior performance while not being too expensive in terms of time and cost.</p> </div> <figure class="ltx_table" id="S3.T1"> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_table"><span class="ltx_text" id="S3.T1.2.1.1" style="font-size:90%;">Table 1</span>: </span><span class="ltx_text" id="S3.T1.3.2" style="font-size:90%;">Percentage of verified examples for different modes and languages </span></figcaption> <table class="ltx_tabular ltx_centering ltx_guessed_headers ltx_align_middle" id="S3.T1.4"> <thead class="ltx_thead"> <tr class="ltx_tr" id="S3.T1.4.1.1"> <th class="ltx_td ltx_th ltx_th_column ltx_th_row ltx_border_rr" id="S3.T1.4.1.1.1"></th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column ltx_th_row ltx_border_r" id="S3.T1.4.1.1.2"> <table class="ltx_tabular ltx_align_middle" id="S3.T1.4.1.1.2.1"> <tr class="ltx_tr" id="S3.T1.4.1.1.2.1.1"> <td class="ltx_td ltx_nopad_r ltx_align_center" id="S3.T1.4.1.1.2.1.1.1">Number of</td> </tr> <tr class="ltx_tr" id="S3.T1.4.1.1.2.1.2"> <td class="ltx_td ltx_nopad_r ltx_align_center" id="S3.T1.4.1.1.2.1.2.1">programs</td> </tr> </table> </th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column" id="S3.T1.4.1.1.3">Mode 1</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column ltx_border_l ltx_border_r" id="S3.T1.4.1.1.4">Mode 2</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column" id="S3.T1.4.1.1.5">Mode 3</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column ltx_border_l ltx_border_r" id="S3.T1.4.1.1.6">Mode 4</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column" id="S3.T1.4.1.1.7">Mode 5</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column ltx_border_l" id="S3.T1.4.1.1.8">Mode 6</th> </tr> </thead> <tbody class="ltx_tbody"> <tr class="ltx_tr" id="S3.T1.4.2.1"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_tt" id="S3.T1.4.2.1.1">Dafny</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_row ltx_border_r ltx_border_tt" id="S3.T1.4.2.1.2">132</th> <td class="ltx_td ltx_align_right ltx_border_r ltx_border_tt" id="S3.T1.4.2.1.3">113 (86%)</td> <td class="ltx_td ltx_align_right ltx_border_r ltx_border_tt" id="S3.T1.4.2.1.4">104 (79%)</td> <td class="ltx_td ltx_align_right ltx_border_r ltx_border_tt" id="S3.T1.4.2.1.5">114 (86%)</td> <td class="ltx_td ltx_align_right ltx_border_r ltx_border_tt" id="S3.T1.4.2.1.6">108 (82%)</td> <td class="ltx_td ltx_align_right ltx_border_r ltx_border_tt" id="S3.T1.4.2.1.7">80 (61%)</td> <td class="ltx_td ltx_align_right ltx_border_tt" id="S3.T1.4.2.1.8">38 (29%)</td> </tr> <tr class="ltx_tr" id="S3.T1.4.3.2"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr" id="S3.T1.4.3.2.1">Nagini</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_row ltx_border_r" id="S3.T1.4.3.2.2">106</th> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.3.2.3">70 (66%)</td> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.3.2.4">57 (54%)</td> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.3.2.5">67 (63%)</td> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.3.2.6">67 (63%)</td> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.3.2.7">44 (42%)</td> <td class="ltx_td ltx_align_right" id="S3.T1.4.3.2.8">16 (15%)</td> </tr> <tr class="ltx_tr" id="S3.T1.4.4.3"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr" id="S3.T1.4.4.3.1">Verus</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_row ltx_border_r" id="S3.T1.4.4.3.2">55</th> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.4.3.3">25 (45%)</td> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.4.3.4">17 (31%)</td> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.4.3.5">20 (36%)</td> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.4.3.6">22 (40%)</td> <td class="ltx_td ltx_align_right ltx_border_r" id="S3.T1.4.4.3.7">13 (24%)</td> <td class="ltx_td ltx_align_right" id="S3.T1.4.4.3.8">8 (15%)</td> </tr> </tbody> </table> </figure> <div class="ltx_para" id="S3.p2"> <p class="ltx_p" id="S3.p2.1">In the evaluation, we allowed for five iterations to be done when trying to fix verification issues. The described experiment was run on HumanEval benchmarks using Claude Sonnet 3.5 five times. We then computed the number of unique problems, verified in at least one of the runs, and gathered the statistics in Table <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S3.T1" title="Table 1 ‣ 3 Evaluation ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">1</span></a>.</p> </div> <div class="ltx_para" id="S3.p3"> <p class="ltx_p" id="S3.p3.1">We can see that the performance of program synthesis in Dafny is higher than in either Nagini or Verus. This is expected given that this system is more popular than the others and there is significantly more code available among the training data. Nevertheless, the first four modes demonstrate decent results in the case of Nagini with over half of the programs successfully verified. This is not the case for Verus which is the least expressive and the newest among the three. Note that results which are not significantly higher were achieved in the AlphaVerus project <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib1" title="">1</a>]</cite> even though it features an advanced treefinement search and massively more calls to a model.</p> </div> <div class="ltx_para" id="S3.p4"> <p class="ltx_p" id="S3.p4.1">The worst results were achieved in Mode 6, with less than 30% success rate for Dafny and 15% success rate for Nagini and Verus. We attribute this to our validation, which expects the specifications to match the ground truth.</p> </div> <div class="ltx_para" id="S3.p5"> <p class="ltx_p" id="S3.p5.1">Finally, since our benchmarks contained different subsets of tasks from the initial dataset, we also explored the distribution of problems successfully verified in each of the languages: see Figure <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S3.F4" title="Figure 4 ‣ 3 Evaluation ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">4</span></a>. Notably, only a miniscule number of problems were verified only by the systems other than Dafny. This may signify that the models use their knowledge of Dafny when dealing with the others.</p> </div> <figure class="ltx_figure" id="S3.F4"> <div class="ltx_flex_figure"> <div class="ltx_flex_cell ltx_flex_size_2"> <figure class="ltx_figure ltx_figure_panel ltx_align_center" id="S3.F4.sf1"><img alt="Refer to caption" class="ltx_graphics ltx_centering ltx_img_square" height="830" id="S3.F4.sf1.g1" src="x1.png" width="830"/> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F4.sf1.2.1.1" style="font-size:90%;">(a)</span> </span><span class="ltx_text" id="S3.F4.sf1.3.2" style="font-size:90%;">Mode 1</span></figcaption> </figure> </div> <div class="ltx_flex_cell ltx_flex_size_2"> <figure class="ltx_figure ltx_figure_panel ltx_align_center" id="S3.F4.sf2"><img alt="Refer to caption" class="ltx_graphics ltx_centering ltx_img_square" height="830" id="S3.F4.sf2.g1" src="x2.png" width="830"/> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F4.sf2.2.1.1" style="font-size:90%;">(b)</span> </span><span class="ltx_text" id="S3.F4.sf2.3.2" style="font-size:90%;">Mode 2</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_2"> <figure class="ltx_figure ltx_figure_panel ltx_align_center" id="S3.F4.sf3"><img alt="Refer to caption" class="ltx_graphics ltx_centering ltx_img_square" height="830" id="S3.F4.sf3.g1" src="x3.png" width="830"/> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F4.sf3.2.1.1" style="font-size:90%;">(c)</span> </span><span class="ltx_text" id="S3.F4.sf3.3.2" style="font-size:90%;">Mode 3</span></figcaption> </figure> </div> <div class="ltx_flex_cell ltx_flex_size_2"> <figure class="ltx_figure ltx_figure_panel ltx_align_center" id="S3.F4.sf4"><img alt="Refer to caption" class="ltx_graphics ltx_centering ltx_img_square" height="830" id="S3.F4.sf4.g1" src="x4.png" width="830"/> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F4.sf4.2.1.1" style="font-size:90%;">(d)</span> </span><span class="ltx_text" id="S3.F4.sf4.3.2" style="font-size:90%;">Mode 4</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_2"> <figure class="ltx_figure ltx_figure_panel ltx_align_center" id="S3.F4.sf5"><img alt="Refer to caption" class="ltx_graphics ltx_centering ltx_img_square" height="830" id="S3.F4.sf5.g1" src="x5.png" width="830"/> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F4.sf5.2.1.1" style="font-size:90%;">(e)</span> </span><span class="ltx_text" id="S3.F4.sf5.3.2" style="font-size:90%;">Mode 5</span></figcaption> </figure> </div> <div class="ltx_flex_cell ltx_flex_size_2"> <figure class="ltx_figure ltx_figure_panel ltx_align_center" id="S3.F4.sf6"><img alt="Refer to caption" class="ltx_graphics ltx_centering ltx_img_square" height="830" id="S3.F4.sf6.g1" src="x6.png" width="830"/> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F4.sf6.2.1.1" style="font-size:90%;">(f)</span> </span><span class="ltx_text" id="S3.F4.sf6.3.2" style="font-size:90%;">Mode 6</span></figcaption> </figure> </div> </div> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F4.2.1.1" style="font-size:90%;">Figure 4</span>: </span><span class="ltx_text" id="S3.F4.3.2" style="font-size:90%;">Venn Diagrams showing the intersection of unique programs successfully generated in at least one of five attempts</span></figcaption> </figure> <figure class="ltx_table" id="S3.T2"> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_table"><span class="ltx_text" id="S3.T2.2.1.1" style="font-size:90%;">Table 2</span>: </span><span class="ltx_text" id="S3.T2.3.2" style="font-size:90%;">Most common errors for different languages</span></figcaption><div class="ltx_flex_figure"> <div class="ltx_flex_cell ltx_flex_size_2"> <figure class="ltx_table ltx_figure_panel ltx_align_center" id="S3.T2.st1"> <table class="ltx_tabular ltx_centering ltx_guessed_headers ltx_align_middle" id="S3.T2.st1.2"> <thead class="ltx_thead"> <tr class="ltx_tr" id="S3.T2.st1.2.1.1"> <th class="ltx_td ltx_align_left ltx_th ltx_th_column ltx_th_row ltx_border_rr" id="S3.T2.st1.2.1.1.1">Error type</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column" id="S3.T2.st1.2.1.1.2"> <table class="ltx_tabular ltx_align_middle" id="S3.T2.st1.2.1.1.2.1"> <tr class="ltx_tr" id="S3.T2.st1.2.1.1.2.1.1"> <td class="ltx_td ltx_nopad_r ltx_align_center" id="S3.T2.st1.2.1.1.2.1.1.1">Number of</td> </tr> <tr class="ltx_tr" id="S3.T2.st1.2.1.1.2.1.2"> <td class="ltx_td ltx_nopad_r ltx_align_center" id="S3.T2.st1.2.1.1.2.1.2.1">occurrences</td> </tr> </table> </th> </tr> </thead> <tbody class="ltx_tbody"> <tr class="ltx_tr" id="S3.T2.st1.2.2.1"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_tt" id="S3.T2.st1.2.2.1.1">Invariant (maintain)</th> <td class="ltx_td ltx_align_center ltx_border_tt" id="S3.T2.st1.2.2.1.2">175</td> </tr> <tr class="ltx_tr" id="S3.T2.st1.2.3.2"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st1.2.3.2.1">Postcondition not proved</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st1.2.3.2.2">91</td> </tr> <tr class="ltx_tr" id="S3.T2.st1.2.4.3"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st1.2.4.3.1">Assertion failed</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st1.2.4.3.2">69</td> </tr> <tr class="ltx_tr" id="S3.T2.st1.2.5.4"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st1.2.5.4.1">Unresolved identifier</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st1.2.5.4.2">32</td> </tr> <tr class="ltx_tr" id="S3.T2.st1.2.6.5"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st1.2.6.5.1">Syntax error</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st1.2.6.5.2">27</td> </tr> <tr class="ltx_tr" id="S3.T2.st1.2.7.6"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st1.2.7.6.1">Invariant (entry)</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st1.2.7.6.2">17</td> </tr> </tbody> </table> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_table"><span class="ltx_text" id="S3.T2.st1.3.1.1" style="font-size:90%;">(a)</span> </span><span class="ltx_text" id="S3.T2.st1.4.2" style="font-size:90%;">Dafny</span></figcaption> </figure> </div> <div class="ltx_flex_cell ltx_flex_size_2"> <figure class="ltx_table ltx_figure_panel ltx_align_center" id="S3.T2.st2"> <table class="ltx_tabular ltx_centering ltx_guessed_headers ltx_align_middle" id="S3.T2.st2.2"> <thead class="ltx_thead"> <tr class="ltx_tr" id="S3.T2.st2.2.1.1"> <th class="ltx_td ltx_align_left ltx_th ltx_th_column ltx_th_row ltx_border_rr" id="S3.T2.st2.2.1.1.1">Error type</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column" id="S3.T2.st2.2.1.1.2"> <table class="ltx_tabular ltx_align_middle" id="S3.T2.st2.2.1.1.2.1"> <tr class="ltx_tr" id="S3.T2.st2.2.1.1.2.1.1"> <td class="ltx_td ltx_nopad_r ltx_align_center" id="S3.T2.st2.2.1.1.2.1.1.1">Number of</td> </tr> <tr class="ltx_tr" id="S3.T2.st2.2.1.1.2.1.2"> <td class="ltx_td ltx_nopad_r ltx_align_center" id="S3.T2.st2.2.1.1.2.1.2.1">occurrences</td> </tr> </table> </th> </tr> </thead> <tbody class="ltx_tbody"> <tr class="ltx_tr" id="S3.T2.st2.2.2.1"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_tt" id="S3.T2.st2.2.2.1.1">Timeout</th> <td class="ltx_td ltx_align_center ltx_border_tt" id="S3.T2.st2.2.2.1.2">468</td> </tr> <tr class="ltx_tr" id="S3.T2.st2.2.3.2"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st2.2.3.2.1">Invariant (maintain)</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st2.2.3.2.2">259</td> </tr> <tr class="ltx_tr" id="S3.T2.st2.2.4.3"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st2.2.4.3.1">Precondition not satisfied</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st2.2.4.3.2">237</td> </tr> <tr class="ltx_tr" id="S3.T2.st2.2.5.4"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st2.2.5.4.1">Postcondition not proved</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st2.2.5.4.2">214</td> </tr> <tr class="ltx_tr" id="S3.T2.st2.2.6.5"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st2.2.6.5.1">Invariant (entry)</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st2.2.6.5.2">103</td> </tr> <tr class="ltx_tr" id="S3.T2.st2.2.7.6"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st2.2.7.6.1">Unresolved identifier</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st2.2.7.6.2">53</td> </tr> </tbody> </table> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_table"><span class="ltx_text" id="S3.T2.st2.3.1.1" style="font-size:90%;">(b)</span> </span><span class="ltx_text" id="S3.T2.st2.4.2" style="font-size:90%;">Nagini</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_table ltx_figure_panel ltx_align_center" id="S3.T2.st3"> <table class="ltx_tabular ltx_centering ltx_guessed_headers ltx_align_middle" id="S3.T2.st3.2"> <thead class="ltx_thead"> <tr class="ltx_tr" id="S3.T2.st3.2.1.1"> <th class="ltx_td ltx_align_left ltx_th ltx_th_column ltx_th_row ltx_border_rr" id="S3.T2.st3.2.1.1.1">Error type</th> <th class="ltx_td ltx_align_center ltx_th ltx_th_column" id="S3.T2.st3.2.1.1.2"> <table class="ltx_tabular ltx_align_middle" id="S3.T2.st3.2.1.1.2.1"> <tr class="ltx_tr" id="S3.T2.st3.2.1.1.2.1.1"> <td class="ltx_td ltx_nopad_r ltx_align_center" id="S3.T2.st3.2.1.1.2.1.1.1">Number of</td> </tr> <tr class="ltx_tr" id="S3.T2.st3.2.1.1.2.1.2"> <td class="ltx_td ltx_nopad_r ltx_align_center" id="S3.T2.st3.2.1.1.2.1.2.1">occurrences</td> </tr> </table> </th> </tr> </thead> <tbody class="ltx_tbody"> <tr class="ltx_tr" id="S3.T2.st3.2.2.1"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_tt" id="S3.T2.st3.2.2.1.1">Type error</th> <td class="ltx_td ltx_align_center ltx_border_tt" id="S3.T2.st3.2.2.1.2">192</td> </tr> <tr class="ltx_tr" id="S3.T2.st3.2.3.2"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st3.2.3.2.1">Assertion failed</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st3.2.3.2.2">46</td> </tr> <tr class="ltx_tr" id="S3.T2.st3.2.4.3"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st3.2.4.3.1">Invariant (maintain)</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st3.2.4.3.2">28</td> </tr> <tr class="ltx_tr" id="S3.T2.st3.2.5.4"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st3.2.5.4.1">Invariant (entry)</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st3.2.5.4.2">22</td> </tr> <tr class="ltx_tr" id="S3.T2.st3.2.6.5"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st3.2.6.5.1">Syntax error</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st3.2.6.5.2">17</td> </tr> <tr class="ltx_tr" id="S3.T2.st3.2.7.6"> <th class="ltx_td ltx_align_left ltx_th ltx_th_row ltx_border_rr ltx_border_t" id="S3.T2.st3.2.7.6.1">Arithmetic underflow/overflow</th> <td class="ltx_td ltx_align_center ltx_border_t" id="S3.T2.st3.2.7.6.2">14</td> </tr> </tbody> </table> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_table"><span class="ltx_text" id="S3.T2.st3.3.1.1" style="font-size:90%;">(c)</span> </span><span class="ltx_text" id="S3.T2.st3.4.2" style="font-size:90%;">Verus</span></figcaption> </figure> </div> </div> </figure> <section class="ltx_subsection" id="S3.SS1"> <h3 class="ltx_title ltx_title_subsection"> <span class="ltx_tag ltx_tag_subsection">3.1 </span>Understanding Common Pitfalls</h3> <div class="ltx_para" id="S3.SS1.p1"> <p class="ltx_p" id="S3.SS1.p1.1">To better understand the problems that models face when generating code in different languages, we collected statistics about the errors reported by the verifier during 5 runs of the mode 1 on HumanEval benchmarks. We classified errors into a few groups, including syntax and type errors, unresolved identifiers, and inability to prove an invariant or a postcondition. Among all errors, timeout stands out: it does not occur as often in Dafny or Verus, since these languages are aimed at delivering results of verification quickly. Nevertheless, it is the most frequent error in the case of Nagini. As this error does not convey any meaningful information about the actual problem in the proof, LLMs rarely manage to resolve the issue.</p> </div> <div class="ltx_para" id="S3.SS1.p2"> <p class="ltx_p" id="S3.SS1.p2.1">While the most common errors for Dafny and Nagini are caused by incomplete proofs, Verus generation suffers from type errors. Incompatible types, wrong arguments, missing type annotations are most prevalent. Such a frequent occurrence of this type of error is due to a complex type system and the fact that different types are allowed in code and in invariants. As a result, the fragment of the code in Figure <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S3.F5.sf1" title="In Figure 5 ‣ 3.1 Understanding Common Pitfalls ‣ 3 Evaluation ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">5(a)</span></a> leads to the error featured in Figure <a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#S3.F5.sf2" title="In Figure 5 ‣ 3.1 Understanding Common Pitfalls ‣ 3 Evaluation ‣ Can LLMs Enable Verification in Mainstream Programming?"><span class="ltx_text ltx_ref_tag">5(b)</span></a>. This error can be solved by adding explicit cast to int: <span class="ltx_text ltx_lst_language_BigDafny ltx_lstlisting" id="S3.SS1.p2.1.1"><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="S3.SS1.p2.1.1.1">pos</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="S3.SS1.p2.1.1.2"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="S3.SS1.p2.1.1.3">as</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="S3.SS1.p2.1.1.4"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="S3.SS1.p2.1.1.5">int</span></span>, but it is not often that a model is capable of it.</p> </div> <figure class="ltx_figure" id="S3.F5"> <div class="ltx_flex_figure"> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_figure ltx_figure_panel ltx_minipage ltx_align_center ltx_align_top" id="S3.F5.sf1" style="width:433.6pt;"> <div class="ltx_listing ltx_lst_language_Dafny ltx_lstlisting ltx_listing" id="S3.F5.sf1.2"> <div class="ltx_listing_data"><a download="" href="data:text/plain;base64,Li4uCmZuIHJvbGxpbmdfbWF4KG51bWJlcnM6IFZlYzxpMzI+KSAtPiAocmVzdWx0OiBWZWM8aTMyPikKICAgIGVuc3VyZXMKICAgICAgICByZXN1bHQubGVuKCkgPT0gbnVtYmVycy5sZW4oKSwKICAgICAgICBmb3JhbGx8aTogaW50fCAwIDw9IGkgPCBudW1iZXJzLmxlbigpID09PgogICAgICAgICAgICByZXN1bHRbaV0gPT0gc2VxX21heChudW1iZXJzQC50YWtlKGkgKyAxKSksCnsKICAgIGxldCBtdXQgbWF4X3NvX2ZhciA9IGkzMjo6TUlOOwogICAgbGV0IG11dCByZXN1bHQgPSBWZWM6OndpdGhfY2FwYWNpdHkobnVtYmVycy5sZW4oKSk7CiAgICBmb3IgcG9zIGluIDAuLm51bWJlcnMubGVuKCkKICAgICAgICBpbnZhcmlhbnQKICAgICAgICAgICAgbWF4X3NvX2ZhciA9PSBpZiBwb3MgPT0gMCB7IGkzMjo6TUlOIH0KICAgICAgICAgICAgICAgIGVsc2UgeyBzZXFfbWF4KG51bWJlcnNALnRha2UocG9zKSkgfSwKICAgICAgICAgICAgcmVzdWx0LmxlbigpID09IHBvcywKICAgICAgICAgICAgZm9yYWxsfGk6IGludHwgMCA8PSBpIDwgcG9zID09PgogICAgICAgICAgICAgICAgcmVzdWx0W2ldID09IHNlcV9tYXgobnVtYmVyc0AudGFrZShpICsgMSkpLAouLi4=">⬇</a></div> <div class="ltx_listingline" id="lstnumberx99"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx99.1" style="font-size:70%;">...</span> </div> <div class="ltx_listingline" id="lstnumberx100"> <span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx100.1" style="font-size:70%;color:#9400D1;">fn</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx100.2" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx100.3" style="font-size:70%;color:#000000;">rolling_max</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.4" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx100.5" style="font-size:70%;color:#000000;">numbers</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.6" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx100.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx100.8" style="font-size:70%;color:#000000;">Vec</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.9" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx100.10" style="font-size:70%;color:#000000;">i32</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.11" style="font-size:70%;">&gt;)</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx100.12" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.13" style="font-size:70%;">-&gt;</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx100.14" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.15" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx100.16" style="font-size:70%;color:#000000;">result</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.17" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx100.18" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx100.19" style="font-size:70%;color:#000000;">Vec</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.20" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx100.21" style="font-size:70%;color:#000000;">i32</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx100.22" style="font-size:70%;">&gt;)</span> </div> <div class="ltx_listingline" id="lstnumberx101"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx101.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx101.2" style="font-size:70%;color:#FF0000;">ensures</span> </div> <div class="ltx_listingline" id="lstnumberx102"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx102.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx102.2" style="font-size:70%;color:#000000;">result</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx102.3" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx102.4" style="font-size:70%;color:#000000;">len</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx102.5" style="font-size:70%;">()</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx102.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx102.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx102.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx102.9" style="font-size:70%;color:#000000;">numbers</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx102.10" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx102.11" style="font-size:70%;color:#000000;">len</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx102.12" style="font-size:70%;">(),</span> </div> <div class="ltx_listingline" id="lstnumberx103"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx103.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx103.2" style="font-size:70%;color:#000000;">forall</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.3" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx103.4" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.5" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx103.6" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx103.7" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.8" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx103.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.10" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx103.11" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.12" style="font-size:70%;">&lt;=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx103.13" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx103.14" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx103.15" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.16" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx103.17" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx103.18" style="font-size:70%;color:#000000;">numbers</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.19" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx103.20" style="font-size:70%;color:#000000;">len</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.21" style="font-size:70%;">()</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx103.22" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx103.23" style="font-size:70%;">==&gt;</span> </div> <div class="ltx_listingline" id="lstnumberx104"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx104.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx104.2" style="font-size:70%;color:#000000;">result</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx104.3" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx104.4" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx104.5" style="font-size:70%;">]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx104.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx104.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx104.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx104.9" style="font-size:70%;color:#000000;">seq_max</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx104.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx104.11" style="font-size:70%;color:#000000;">numbers@</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx104.12" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx104.13" style="font-size:70%;color:#000000;">take</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx104.14" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx104.15" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx104.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx104.17" style="font-size:70%;">+</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx104.18" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx104.19" style="font-size:70%;">1)),</span> </div> <div class="ltx_listingline" id="lstnumberx105"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx105.1" style="font-size:70%;">{</span> </div> <div class="ltx_listingline" id="lstnumberx106"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx106.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx106.2" style="font-size:70%;color:#9400D1;">let</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx106.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx106.4" style="font-size:70%;color:#9400D1;">mut</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx106.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx106.6" style="font-size:70%;color:#000000;">max_so_far</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx106.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx106.8" style="font-size:70%;">=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx106.9" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx106.10" style="font-size:70%;color:#000000;">i32</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx106.11" style="font-size:70%;">::</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx106.12" style="font-size:70%;color:#000000;">MIN</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx106.13" style="font-size:70%;">;</span> </div> <div class="ltx_listingline" id="lstnumberx107"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx107.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx107.2" style="font-size:70%;color:#9400D1;">let</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx107.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx107.4" style="font-size:70%;color:#9400D1;">mut</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx107.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx107.6" style="font-size:70%;color:#000000;">result</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx107.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx107.8" style="font-size:70%;">=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx107.9" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx107.10" style="font-size:70%;color:#000000;">Vec</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx107.11" style="font-size:70%;">::</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx107.12" style="font-size:70%;color:#000000;">with_capacity</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx107.13" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx107.14" style="font-size:70%;color:#000000;">numbers</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx107.15" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx107.16" style="font-size:70%;color:#000000;">len</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx107.17" style="font-size:70%;">());</span> </div> <div class="ltx_listingline" id="lstnumberx108"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx108.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx108.2" style="font-size:70%;color:#9400D1;">for</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx108.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx108.4" style="font-size:70%;color:#000000;">pos</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx108.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx108.6" style="font-size:70%;color:#9400D1;">in</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx108.7" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx108.8" style="font-size:70%;">0..</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx108.9" style="font-size:70%;color:#000000;">numbers</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx108.10" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx108.11" style="font-size:70%;color:#000000;">len</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx108.12" style="font-size:70%;">()</span> </div> <div class="ltx_listingline" id="lstnumberx109"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx109.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keywords2 ltx_font_typewriter" id="lstnumberx109.2" style="font-size:70%;color:#FF0000;">invariant</span> </div> <div class="ltx_listingline" id="lstnumberx110"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx110.2" style="font-size:70%;color:#000000;">max_so_far</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx110.4" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx110.6" style="font-size:70%;color:#9400D1;">if</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx110.8" style="font-size:70%;color:#000000;">pos</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx110.10" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.11" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx110.12" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.13" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx110.14" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.15" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx110.16" style="font-size:70%;color:#000000;">i32</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx110.17" style="font-size:70%;">::</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx110.18" style="font-size:70%;color:#000000;">MIN</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx110.19" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx110.20" style="font-size:70%;">}</span> </div> <div class="ltx_listingline" id="lstnumberx111"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx111.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_keyword ltx_font_typewriter" id="lstnumberx111.2" style="font-size:70%;color:#9400D1;">else</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx111.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx111.4" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx111.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx111.6" style="font-size:70%;color:#000000;">seq_max</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx111.7" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx111.8" style="font-size:70%;color:#000000;">numbers@</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx111.9" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx111.10" style="font-size:70%;color:#000000;">take</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx111.11" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx111.12" style="font-size:70%;color:#000000;">pos</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx111.13" style="font-size:70%;">))</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx111.14" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx111.15" style="font-size:70%;">},</span> </div> <div class="ltx_listingline" id="lstnumberx112"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx112.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx112.2" style="font-size:70%;color:#000000;">result</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx112.3" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx112.4" style="font-size:70%;color:#000000;">len</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx112.5" style="font-size:70%;">()</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx112.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx112.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx112.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx112.9" style="font-size:70%;color:#000000;">pos</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx112.10" style="font-size:70%;">,</span> </div> <div class="ltx_listingline" id="lstnumberx113"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx113.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx113.2" style="font-size:70%;color:#000000;">forall</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx113.3" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx113.4" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx113.5" style="font-size:70%;">:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx113.6" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx113.7" style="font-size:70%;color:#000000;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx113.8" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx113.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx113.10" style="font-size:70%;">0</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx113.11" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx113.12" style="font-size:70%;">&lt;=</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx113.13" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx113.14" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx113.15" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx113.16" style="font-size:70%;">&lt;</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx113.17" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx113.18" style="font-size:70%;color:#000000;">pos</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx113.19" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx113.20" style="font-size:70%;">==&gt;</span> </div> <div class="ltx_listingline" id="lstnumberx114"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx114.1" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx114.2" style="font-size:70%;color:#000000;">result</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx114.3" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx114.4" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx114.5" style="font-size:70%;">]</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx114.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx114.7" style="font-size:70%;">==</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx114.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx114.9" style="font-size:70%;color:#000000;">seq_max</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx114.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx114.11" style="font-size:70%;color:#000000;">numbers@</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx114.12" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx114.13" style="font-size:70%;color:#000000;">take</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx114.14" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx114.15" style="font-size:70%;color:#000000;">i</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx114.16" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx114.17" style="font-size:70%;">+</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx114.18" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx114.19" style="font-size:70%;">1)),</span> </div> <div class="ltx_listingline" id="lstnumberx115"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx115.1" style="font-size:70%;">...</span> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F5.sf1.3.1.1" style="font-size:90%;">(a)</span> </span><span class="ltx_text" id="S3.F5.sf1.4.2" style="font-size:90%;">Implementation</span></figcaption> </figure> </div> <div class="ltx_flex_break"></div> <div class="ltx_flex_cell ltx_flex_size_1"> <figure class="ltx_figure ltx_figure_panel ltx_minipage ltx_align_center ltx_align_top" id="S3.F5.sf2" style="width:433.6pt;"> <div class="ltx_listing ltx_lst_language_BigDafny ltx_lstlisting ltx_listing" id="S3.F5.sf2.2"> <div class="ltx_listing_data"><a download="" href="data:text/plain;base64,ZXJyb3JbRTAzMDhdOiBtaXNtYXRjaGVkIHR5cGVzCiAgLS0+IDAwOS1yb2xsaW5nX21heF8xLnJzOjI0OjgxCiAgIHwKMjYgfCBlbHNlIHsgc2VxX21heChudW1iZXJzQC50YWtlKHBvcykpIH0sCiAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgLS0tLSBeXl4gZXhwZWN0ZWQgYGludGAsIGZvdW5kIGB1c2l6ZWAKICAgfCAgICAgICAgICAgICAgICAgICAgICAgICB8CiAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgYXJndW1lbnRzIHRvIHRoaXMgbWV0aG9kIGFyZSBpbmNvcnJlY3QKICAgfA==">⬇</a></div> <div class="ltx_listingline" id="lstnumberx116"> <span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx116.1" style="font-size:70%;">error</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx116.2" style="font-size:70%;">[</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx116.3" style="font-size:70%;">E0308</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx116.4" style="font-size:70%;">]:</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx116.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx116.6" style="font-size:70%;">mismatched</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx116.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx116.8" style="font-size:70%;">types</span> </div> <div class="ltx_listingline" id="lstnumberx117"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx117.1" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx117.2" style="font-size:70%;">--&gt;</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx117.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx117.4" style="font-size:70%;">009-</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx117.5" style="font-size:70%;">rolling_max_1</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx117.6" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx117.7" style="font-size:70%;">rs</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx117.8" style="font-size:70%;">:24:81</span> </div> <div class="ltx_listingline" id="lstnumberx118"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx118.1" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx118.2" style="font-size:70%;">|</span> </div> <div class="ltx_listingline" id="lstnumberx119"> <span class="ltx_text ltx_font_typewriter" id="lstnumberx119.1" style="font-size:70%;">26</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx119.2" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx119.3" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx119.4" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx119.5" style="font-size:70%;">else</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx119.6" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx119.7" style="font-size:70%;">{</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx119.8" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx119.9" style="font-size:70%;">seq_max</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx119.10" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx119.11" style="font-size:70%;">numbers@</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx119.12" style="font-size:70%;">.</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx119.13" style="font-size:70%;">take</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx119.14" style="font-size:70%;">(</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx119.15" style="font-size:70%;">pos</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx119.16" style="font-size:70%;">))</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx119.17" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx119.18" style="font-size:70%;">},</span> </div> <div class="ltx_listingline" id="lstnumberx120"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx120.1" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx120.2" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx120.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx120.4" style="font-size:70%;">----</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx120.5" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx120.6" style="font-size:70%;">^^^</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx120.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx120.8" style="font-size:70%;">expected</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx120.9" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx120.10" style="font-size:70%;">‘</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx120.11" style="font-size:70%;">int</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx120.12" style="font-size:70%;">‘,</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx120.13" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx120.14" style="font-size:70%;">found</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx120.15" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx120.16" style="font-size:70%;">‘</span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx120.17" style="font-size:70%;">usize</span><span class="ltx_text ltx_font_typewriter" id="lstnumberx120.18" style="font-size:70%;">‘</span> </div> <div class="ltx_listingline" id="lstnumberx121"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx121.1" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx121.2" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx121.3" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx121.4" style="font-size:70%;">|</span> </div> <div class="ltx_listingline" id="lstnumberx122"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx122.1" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx122.2" style="font-size:70%;">|</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx122.3" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx122.4" style="font-size:70%;">arguments</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx122.5" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx122.6" style="font-size:70%;">to</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx122.7" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx122.8" style="font-size:70%;">this</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx122.9" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx122.10" style="font-size:70%;">method</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx122.11" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx122.12" style="font-size:70%;">are</span><span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx122.13" style="font-size:70%;"> </span><span class="ltx_text ltx_lst_identifier ltx_font_typewriter" id="lstnumberx122.14" style="font-size:70%;">incorrect</span> </div> <div class="ltx_listingline" id="lstnumberx123"> <span class="ltx_text ltx_lst_space ltx_font_typewriter" id="lstnumberx123.1" style="font-size:70%;"> </span><span class="ltx_text ltx_font_typewriter" id="lstnumberx123.2" style="font-size:70%;">|</span> </div> </div> <figcaption class="ltx_caption"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F5.sf2.3.1.1" style="font-size:90%;">(b)</span> </span><span class="ltx_text" id="S3.F5.sf2.4.2" style="font-size:90%;">Type error</span></figcaption> </figure> </div> </div> <figcaption class="ltx_caption ltx_centering"><span class="ltx_tag ltx_tag_figure"><span class="ltx_text" id="S3.F5.2.1.1" style="font-size:90%;">Figure 5</span>: </span><span class="ltx_text" id="S3.F5.3.2" style="font-size:90%;">The example of Verus code, causing the type error</span></figcaption> </figure> <div class="ltx_para" id="S3.SS1.p3"> <p class="ltx_p" id="S3.SS1.p3.1">A more personalized approach for each types of errors could improve the quality of generated code. For instance, one can provide few-shot examples of typical errors and possible fixes for them. The Laurel project <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib22" title="">22</a>]</cite> intends to address the problem by modifying Dafny’s error messages to include more details. AutoVerus <cite class="ltx_cite ltx_citemacro_cite">[<a class="ltx_ref" href="https://arxiv.org/html/2503.14183v1#bib.bib7" title="">7</a>]</cite> proposes a rather complicated process in which unsuccessful attempts to generate proofs are collected along with the eventual correct solution to the problem. This information is then utilized in a self-debugging procedure, thus improving the quality considerably. We plan to employ these or similar methods as future work.</p> </div> </section> </section> <section class="ltx_section" id="S4"> <h2 class="ltx_title ltx_title_section"> <span class="ltx_tag ltx_tag_section">4 </span>Conclusion</h2> <div class="ltx_para" id="S4.p1"> <p class="ltx_p" id="S4.p1.1">Our study demonstrates the ability of LLMs to generate formally verified code, lowering the barriers to adoption of formal methods in mainstream programming. The high success rate in the context of Dafny motivates further research into less-explored verification systems, such as Nagini and Verus. Mistakes that LLMs tend to make for these systems likely stem from the models’ unfamiliarity with them, which we plan to address in future work by fine-tuning. This will require significantly larger datasets, the collection of which is complicated by the insufficient amount of source code published online, but can be approached through synthetic means. Another research direction can leverage specialized error-correction mechanisms and self-improving frameworks. Finally, striking the right balance between automation and human involvement can be key to making verification accessible to the wider programming community.</p> </div> </section> <section class="ltx_bibliography" id="bib"> <h2 class="ltx_title ltx_title_bibliography">References</h2> <ul class="ltx_biblist"> <li class="ltx_bibitem" id="bib.bib1"> <span class="ltx_tag ltx_tag_bibitem">[1]</span> <span class="ltx_bibblock"> Pranjal Aggarwal, Bryan Parno, and Sean Welleck. </span> <span class="ltx_bibblock">Alphaverus: Bootstrapping formally verified code generation through self-improving translation and treefinement. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib1.1.1">arXiv preprint arXiv:2412.06176</span>, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib2"> <span class="ltx_tag ltx_tag_bibitem">[2]</span> <span class="ltx_bibblock"> Dirk Beyer, Thomas A Henzinger, Rupak Majumdar, and Andrey Rybalchenko. </span> <span class="ltx_bibblock">Path invariants. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib2.1.1">Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation</span>, pages 300–309, 2007. </span> </li> <li class="ltx_bibitem" id="bib.bib3"> <span class="ltx_tag ltx_tag_bibitem">[3]</span> <span class="ltx_bibblock"> Marat Boshernitsan, Roongko Doong, and Alberto Savoia. </span> <span class="ltx_bibblock">From daikon to agitator: lessons and challenges in building a commercial tool for developer testing. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib3.1.1">Proceedings of the 2006 international symposium on Software testing and analysis</span>, pages 169–180, 2006. </span> </li> <li class="ltx_bibitem" id="bib.bib4"> <span class="ltx_tag ltx_tag_bibitem">[4]</span> <span class="ltx_bibblock"> Franck Cassez, Joanne Fuller, and Aditya Asgaonkar. </span> <span class="ltx_bibblock">Formal verification of the ethereum 2.0 beacon chain. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib4.1.1">International Conference on Tools and Algorithms for the Construction and Analysis of Systems</span>, pages 167–182. Springer, 2022. </span> </li> <li class="ltx_bibitem" id="bib.bib5"> <span class="ltx_tag ltx_tag_bibitem">[5]</span> <span class="ltx_bibblock"> Saikat Chakraborty, Gabriel Ebner, Siddharth Bhat, Sarah Fakhoury, Sakina Fatima, Shuvendu Lahiri, and Nikhil Swamy. </span> <span class="ltx_bibblock">Towards neural synthesis for smt-assisted proof-oriented programming. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib5.1.1">arXiv preprint arXiv:2405.01787</span>, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib6"> <span class="ltx_tag ltx_tag_bibitem">[6]</span> <span class="ltx_bibblock"> Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde De Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. </span> <span class="ltx_bibblock">Evaluating large language models trained on code. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib6.1.1">arXiv preprint arXiv:2107.03374</span>, 2021. </span> </li> <li class="ltx_bibitem" id="bib.bib7"> <span class="ltx_tag ltx_tag_bibitem">[7]</span> <span class="ltx_bibblock"> Tianyu Chen, Shuai Lu, Shan Lu, Yeyun Gong, Chenyuan Yang, Xuheng Li, Md Rakib Hossain Misu, Hao Yu, Nan Duan, Peng Cheng, et al. </span> <span class="ltx_bibblock">Automated proof generation for rust code via self-evolution. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib7.1.1">arXiv preprint arXiv:2410.15756</span>, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib8"> <span class="ltx_tag ltx_tag_bibitem">[8]</span> <span class="ltx_bibblock"> Isil Dillig, Thomas Dillig, Boyang Li, and Ken McMillan. </span> <span class="ltx_bibblock">Inductive invariant generation via abductive inference. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib8.1.1">Acm Sigplan Notices</span>, 48(10):443–456, 2013. </span> </li> <li class="ltx_bibitem" id="bib.bib9"> <span class="ltx_tag ltx_tag_bibitem">[9]</span> <span class="ltx_bibblock"> Marco Eilers and Peter Müller. </span> <span class="ltx_bibblock">Nagini: a static verifier for python. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib9.1.1">Computer Aided Verification: 30th International Conference, CAV 2018, Held as Part of the Federated Logic Conference, FloC 2018, Oxford, UK, July 14-17, 2018, Proceedings, Part I 30</span>, pages 596–603. Springer, 2018. </span> </li> <li class="ltx_bibitem" id="bib.bib10"> <span class="ltx_tag ltx_tag_bibitem">[10]</span> <span class="ltx_bibblock"> Madeline Endres, Sarah Fakhoury, Saikat Chakraborty, and Shuvendu K Lahiri. </span> <span class="ltx_bibblock">Can large language models transform natural language intent into formal method postconditions? </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib10.1.1">Proceedings of the ACM on Software Engineering</span>, 1(FSE):1889–1912, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib11"> <span class="ltx_tag ltx_tag_bibitem">[11]</span> <span class="ltx_bibblock"> Michael D Ernst, Jeff H Perkins, Philip J Guo, Stephen McCamant, Carlos Pacheco, Matthew S Tschantz, and Chen Xiao. </span> <span class="ltx_bibblock">The daikon system for dynamic detection of likely invariants. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib11.1.1">Science of computer programming</span>, 69(1-3):35–45, 2007. </span> </li> <li class="ltx_bibitem" id="bib.bib12"> <span class="ltx_tag ltx_tag_bibitem">[12]</span> <span class="ltx_bibblock"> Daya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Ruoyu Zhang, Runxin Xu, Qihao Zhu, Shirong Ma, Peiyi Wang, Xiao Bi, et al. </span> <span class="ltx_bibblock">Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib12.1.1">arXiv preprint arXiv:2501.12948</span>, 2025. </span> </li> <li class="ltx_bibitem" id="bib.bib13"> <span class="ltx_tag ltx_tag_bibitem">[13]</span> <span class="ltx_bibblock"> Hong Hu, Zheng Leong Chua, Sendroiu Adrian, Prateek Saxena, and Zhenkai Liang. </span> <span class="ltx_bibblock">Automatic generation of <math alttext="\{" class="ltx_Math" display="inline" id="bib.bib13.1.m1.1"><semantics id="bib.bib13.1.m1.1a"><mo id="bib.bib13.1.m1.1.1" stretchy="false" xref="bib.bib13.1.m1.1.1.cmml">{</mo><annotation-xml encoding="MathML-Content" id="bib.bib13.1.m1.1b"><ci id="bib.bib13.1.m1.1.1.cmml" xref="bib.bib13.1.m1.1.1">{</ci></annotation-xml><annotation encoding="application/x-tex" id="bib.bib13.1.m1.1c">\{</annotation><annotation encoding="application/x-llamapun" id="bib.bib13.1.m1.1d">{</annotation></semantics></math>Data-Oriented<math alttext="\}" class="ltx_Math" display="inline" id="bib.bib13.2.m2.1"><semantics id="bib.bib13.2.m2.1a"><mo id="bib.bib13.2.m2.1.1" stretchy="false" xref="bib.bib13.2.m2.1.1.cmml">}</mo><annotation-xml encoding="MathML-Content" id="bib.bib13.2.m2.1b"><ci id="bib.bib13.2.m2.1.1.cmml" xref="bib.bib13.2.m2.1.1">}</ci></annotation-xml><annotation encoding="application/x-tex" id="bib.bib13.2.m2.1c">\}</annotation><annotation encoding="application/x-llamapun" id="bib.bib13.2.m2.1d">}</annotation></semantics></math> exploits. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib13.3.1">24th USENIX Security Symposium (USENIX Security 15)</span>, pages 177–192, 2015. </span> </li> <li class="ltx_bibitem" id="bib.bib14"> <span class="ltx_tag ltx_tag_bibitem">[14]</span> <span class="ltx_bibblock"> Adharsh Kamath, Aditya Senthilnathan, Saikat Chakraborty, Pantazis Deligiannis, Shuvendu K Lahiri, Akash Lal, Aseem Rastogi, Subhajit Roy, and Rahul Sharma. </span> <span class="ltx_bibblock">Finding inductive loop invariants using large language models. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib14.1.1">arXiv preprint arXiv:2311.07948</span>, 2023. </span> </li> <li class="ltx_bibitem" id="bib.bib15"> <span class="ltx_tag ltx_tag_bibitem">[15]</span> <span class="ltx_bibblock"> Zachary Kincaid, John Cyphert, Jason Breck, and Thomas Reps. </span> <span class="ltx_bibblock">Non-linear reasoning for invariant synthesis. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib15.1.1">Proceedings of the ACM on Programming Languages</span>, 2(POPL):1–33, 2017. </span> </li> <li class="ltx_bibitem" id="bib.bib16"> <span class="ltx_tag ltx_tag_bibitem">[16]</span> <span class="ltx_bibblock"> Herb Krasner. </span> <span class="ltx_bibblock">The cost of poor software quality in the us: A 2022 report. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib16.1.1">Proc. Consortium Inf. Softw. QualityTM (CISQTM)</span>, 2022. </span> </li> <li class="ltx_bibitem" id="bib.bib17"> <span class="ltx_tag ltx_tag_bibitem">[17]</span> <span class="ltx_bibblock"> Andrea Lattuada, Travis Hance, Chanhee Cho, Matthias Brun, Isitha Subasinghe, Yi Zhou, Jon Howell, Bryan Parno, and Chris Hawblitzel. </span> <span class="ltx_bibblock">Verus: Verifying rust programs using linear ghost types. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib17.1.1">Proceedings of the ACM on Programming Languages</span>, 7(OOPSLA1):286–315, 2023. </span> </li> <li class="ltx_bibitem" id="bib.bib18"> <span class="ltx_tag ltx_tag_bibitem">[18]</span> <span class="ltx_bibblock"> Ton Chanh Le, Guolong Zheng, and ThanhVu Nguyen. </span> <span class="ltx_bibblock">Sling: using dynamic analysis to infer program invariants in separation logic. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib18.1.1">Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation</span>, pages 788–801, 2019. </span> </li> <li class="ltx_bibitem" id="bib.bib19"> <span class="ltx_tag ltx_tag_bibitem">[19]</span> <span class="ltx_bibblock"> Yuxi Ling, Gokul Rajiv, Kiran Gopinathan, and Ilya Sergey. </span> <span class="ltx_bibblock">Sound and efficient generation of data-oriented exploits via programming language synthesis. </span> </li> <li class="ltx_bibitem" id="bib.bib20"> <span class="ltx_tag ltx_tag_bibitem">[20]</span> <span class="ltx_bibblock"> Hong Lu, Jiacheng Gui, Chengyi Wang, and Hao Huang. </span> <span class="ltx_bibblock">A novel data-driven approach for generating verified loop invariants. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib20.1.1">2020 International Symposium on Theoretical Aspects of Software Engineering (TASE)</span>, pages 9–16. IEEE, 2020. </span> </li> <li class="ltx_bibitem" id="bib.bib21"> <span class="ltx_tag ltx_tag_bibitem">[21]</span> <span class="ltx_bibblock"> Md Rakib Hossain Misu, Cristina V Lopes, Iris Ma, and James Noble. </span> <span class="ltx_bibblock">Towards ai-assisted synthesis of verified dafny methods. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib21.1.1">Proceedings of the ACM on Software Engineering</span>, 1(FSE):812–835, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib22"> <span class="ltx_tag ltx_tag_bibitem">[22]</span> <span class="ltx_bibblock"> Eric Mugnier, Emmanuel Anaya Gonzalez, Ranjit Jhala, Nadia Polikarpova, and Yuanyuan Zhou. </span> <span class="ltx_bibblock">Laurel: Generating dafny assertions using large language models. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib22.1.1">arXiv preprint arXiv:2405.16792</span>, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib23"> <span class="ltx_tag ltx_tag_bibitem">[23]</span> <span class="ltx_bibblock"> Peter Müller, Malte Schwerhoff, and Alexander J Summers. </span> <span class="ltx_bibblock">Viper: A verification infrastructure for permission-based reasoning. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib23.1.1">Verification, Model Checking, and Abstract Interpretation: 17th International Conference, VMCAI 2016, St. Petersburg, FL, USA, January 17-19, 2016. Proceedings 17</span>, pages 41–62. Springer, 2016. </span> </li> <li class="ltx_bibitem" id="bib.bib24"> <span class="ltx_tag ltx_tag_bibitem">[24]</span> <span class="ltx_bibblock"> OpenAI. </span> <span class="ltx_bibblock">Openai o3-mini system card. </span> <span class="ltx_bibblock">2025. </span> </li> <li class="ltx_bibitem" id="bib.bib25"> <span class="ltx_tag ltx_tag_bibitem">[25]</span> <span class="ltx_bibblock"> Gabriel Poesia, Chloe Loughridge, and Nada Amin. </span> <span class="ltx_bibblock">dafny-annotator: Ai-assisted verification of dafny programs. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib25.1.1">arXiv preprint arXiv:2411.15143</span>, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib26"> <span class="ltx_tag ltx_tag_bibitem">[26]</span> <span class="ltx_bibblock"> Daniel Riley and Grigory Fedyukovich. </span> <span class="ltx_bibblock">Multi-phase invariant synthesis. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib26.1.1">Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering</span>, pages 607–619, 2022. </span> </li> <li class="ltx_bibitem" id="bib.bib27"> <span class="ltx_tag ltx_tag_bibitem">[27]</span> <span class="ltx_bibblock"> Álvaro F Silva, Alexandra Mendes, and João F Ferreira. </span> <span class="ltx_bibblock">Leveraging large language models to boost dafny’s developers productivity. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib27.1.1">Proceedings of the 2024 IEEE/ACM 12th International Conference on Formal Methods in Software Engineering (FormaliSE)</span>, pages 138–142, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib28"> <span class="ltx_tag ltx_tag_bibitem">[28]</span> <span class="ltx_bibblock"> Jean Souyris. </span> <span class="ltx_bibblock">Industrial use of compcert on a safety-critical software product. </span> <span class="ltx_bibblock"><a class="ltx_ref ltx_url" href="https://projects.laas.fr/IFSE/FMF/J3/slides/P05_Jean_Souyiris.pdf" title="">https://projects.laas.fr/IFSE/FMF/J3/slides/P05_Jean_Souyiris.pdf</a>, 2014. </span> </li> <li class="ltx_bibitem" id="bib.bib29"> <span class="ltx_tag ltx_tag_bibitem">[29]</span> <span class="ltx_bibblock"> Akhilesh Srikanth, Burak Sahin, and William R Harris. </span> <span class="ltx_bibblock">Complexity verification using guided theorem enumeration. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib29.1.1">ACM SIGPLAN Notices</span>, 52(1):639–652, 2017. </span> </li> <li class="ltx_bibitem" id="bib.bib30"> <span class="ltx_tag ltx_tag_bibitem">[30]</span> <span class="ltx_bibblock"> Chuyue Sun, Ying Sheng, Oded Padon, and Clark Barrett. </span> <span class="ltx_bibblock">Clover: Closed-loop verifiable code generation. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib30.1.1">International Symposium on AI Verification</span>, pages 134–155. Springer, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib31"> <span class="ltx_tag ltx_tag_bibitem">[31]</span> <span class="ltx_bibblock"> Jianan Yao, Ziqiao Zhou, Weiteng Chen, and Weidong Cui. </span> <span class="ltx_bibblock">Leveraging large language models for automated proof synthesis in rust. </span> <span class="ltx_bibblock"><span class="ltx_text ltx_font_italic" id="bib.bib31.1.1">arXiv preprint arXiv:2311.03739</span>, 2023. </span> </li> <li class="ltx_bibitem" id="bib.bib32"> <span class="ltx_tag ltx_tag_bibitem">[32]</span> <span class="ltx_bibblock"> David Young, Ziyi Yang, Ilya Sergey, and Alex Potanin. </span> <span class="ltx_bibblock">Higher-order specifications for deductive synthesis of programs with pointers. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib32.1.1">38th European Conference on Object-Oriented Programming (ECOOP 2024)</span>. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2024. </span> </li> <li class="ltx_bibitem" id="bib.bib33"> <span class="ltx_tag ltx_tag_bibitem">[33]</span> <span class="ltx_bibblock"> Jean-Karim Zinzindohoué, Karthikeyan Bhargavan, Jonathan Protzenko, and Benjamin Beurdouche. </span> <span class="ltx_bibblock">Hacl*: A verified modern cryptographic library. </span> <span class="ltx_bibblock">In <span class="ltx_text ltx_font_italic" id="bib.bib33.1.1">Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security</span>, pages 1789–1806, 2017. </span> </li> </ul> </section> <div class="ltx_pagination ltx_role_newpage"></div> </article> </div> <footer class="ltx_page_footer"> <div class="ltx_page_logo">Generated on Tue Mar 18 11:56:05 2025 by <a class="ltx_LaTeXML_logo" href="http://dlmf.nist.gov/LaTeXML/"><span style="letter-spacing:-0.2em; margin-right:0.1em;">L<span class="ltx_font_smallcaps" style="position:relative; bottom:2.2pt;">a</span>T<span class="ltx_font_smallcaps" style="font-size:120%;position:relative; bottom:-0.2ex;">e</span></span><span style="font-size:90%; position:relative; bottom:-0.2ex;">XML</span><img alt="Mascot Sammy" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAOCAYAAAD5YeaVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wKExQZLWTEaOUAAAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAdpJREFUKM9tkL+L2nAARz9fPZNCKFapUn8kyI0e4iRHSR1Kb8ng0lJw6FYHFwv2LwhOpcWxTjeUunYqOmqd6hEoRDhtDWdA8ApRYsSUCDHNt5ul13vz4w0vWCgUnnEc975arX6ORqN3VqtVZbfbTQC4uEHANM3jSqXymFI6yWazP2KxWAXAL9zCUa1Wy2tXVxheKA9YNoR8Pt+aTqe4FVVVvz05O6MBhqUIBGk8Hn8HAOVy+T+XLJfLS4ZhTiRJgqIoVBRFIoric47jPnmeB1mW/9rr9ZpSSn3Lsmir1fJZlqWlUonKsvwWwD8ymc/nXwVBeLjf7xEKhdBut9Hr9WgmkyGEkJwsy5eHG5vN5g0AKIoCAEgkEkin0wQAfN9/cXPdheu6P33fBwB4ngcAcByHJpPJl+fn54mD3Gg0NrquXxeLRQAAwzAYj8cwTZPwPH9/sVg8PXweDAauqqr2cDjEer1GJBLBZDJBs9mE4zjwfZ85lAGg2+06hmGgXq+j3+/DsixYlgVN03a9Xu8jgCNCyIegIAgx13Vfd7vdu+FweG8YRkjXdWy329+dTgeSJD3ieZ7RNO0VAXAPwDEAO5VKndi2fWrb9jWl9Esul6PZbDY9Go1OZ7PZ9z/lyuD3OozU2wAAAABJRU5ErkJggg=="/></a> </div></footer> </div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10