[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-84838-en":3,"doc-seo-84838-105":29,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},84838,8796095462418,"Noah","https://ap-avatar.wpscdn.com/avatar/80000253c1241d02b47?x-image-process=image/resize,m_fixed,w_180,h_180&k=1778826106357471780",8,"Research & Report","INVWEAVER Deductive Feedback for Invariant Synthesis in Interacting Loop Programs","Loop invariant inference is a core yet difficult problem in program verification because the task is undecidable and practical programs introduce complex control flow. While LLM-aided guess-and-check methods work well for single-loop code, they often fail on multi-loop programs with nested and sequential loops due to missing inter-loop context and weak, misleading invariants. INVWEAVER proposes a neuro-symbolic framework that exposes loop dependencies via a loop-level call graph and propagates proof obligations using weakest-precondition guided deductive feedback, improving global correctness and performance.","INVWEAVER: Deductive Feedback for Invariant Synthesis in Interacting-Loop Programs  \nGuangyuan Wu  \nNanjing University  \nNanjing, China [guangyuanwu@smail.nju.edu.cn](guangyuanwu@smail.nju.edu.cn)  \nWeining Cao  \nNanjing University Nanjing, China [weiningcao@smail.nju.edu.cn](weiningcao@smail.nju.edu.cn)  \nZehui Tan  \nNanjing University Nanjing, China [zehuitan@smail.nju.edu.cn](zehuitan@smail.nju.edu.cn)  \nYuan Yao  \nNanjing University Nanjing, China [y.yao@nju.edu.cn](y.yao@nju.edu.cn)  \nHengfeng Wei Hunan University Changsha, China [hfwei@hnu.edu.cn](hfwei@hnu.edu.cn)  \nTaolue Chen  \nBirkbeck, University of London London, United Kingdom [t.chen@bbk.ac.uk](t.chen@bbk.ac.uk)  \nXiaoxing Ma Nanjing University  \nNanjing, China [xxm@nju.edu.cn](xxm@nju.edu.cn)  \narXiv :2607 .05478v 1 [ cs .LG] 6 Jul 2026  \nAbstract—Loop invariant inference is a fundamental yet challenging problem in program verification. Recent LLM-aided guess-and-check techniques have demonstrated strong performance on single-loop programs, but struggle with multi-loop programs (e.g., multiple nested and/or sequential loops), which are prevalent in classic algorithms and real-world programs. In this paper, we present INVWEAVER, a novel neuro-symbolic framework that synthesizes invariants for multi-loop programs. The key insight is to explicitly expose inter-loop dependencies and systematically propagate proof obligations through a principled combination of abstraction and deductive reasoning. We evaluate INVWEAVER on a comprehensive benchmark suite, including a newly curated dataset derived from classic algorithms. Experimental results show that INVWEAVER substantially outperforms the existing methods. In particular, INVWEAVER solves 72 out of 82 multi-loop benchmark problems, exceeding the strongest competitor by 32 problems, while maintaining superior performance on single-loop tasks.  \nIndex Terms—program verification, loop invariant, multiple loops, large language models  \nI. INTRODUCTION  \nLoop invariants are central to program verification, serving as the inductive backbone for proving correctness and safety properties. A loop invariant is a property that holds before and after every iteration of a loop, forming the inductive bridge in Hoare-style reasoning and related verification frameworks. However, automatically inferring such invariants remains along-standing challenge, due to the inherent undecidability of the problem and the complexity of real-world programs.  \nRecently, the field has adopted a guess-and-check framework, where candidate invariants are iteratively generated and verified. Although heuristic and incomplete, this framework offers superior scalability and flexibility by allowing datadriven inference to complement symbolic reasoning. Diverse learning techniques have been instantiated in this framework, including decision trees [1]–[3], reinforcement learning [4],[5], continuous logic networks [6], [7], and, most recently, large language models (LLMs) [8]–[11] .  \nSpecifically, the LLM-aided guess-and-check methods have shown remarkable performance for programs containing a  \nsingle loop. However, real-world programs frequently feature complex (multiple nested and/or sequential) loop structures, where computations must iterate over multiple dimensions, stages, or interacting entities. Some representative examples include array and matrix processing, sorting algorithms, graph algorithms, and dynamic programming, to name a few. When applied to such complex loops, existing methods often suffer from local under-specification. Namely, inner or intermediate loops typically lack explicit contextual information (e.g., precise pre-conditions or post-conditions) during reasoning, causing LLMs to hallucinate “weak invariants” that are syntactically valid but fail to capture the essential semantic dependencies between adjacent loops. As a result, these invariants are insufficient to support global correctness proofs, eventhough they may appear locally","cbCaivMasvdBr6BR","https://ap.wps.com/l/cbCaivMasvdBr6BR","pdf",404444,1,12,"English","en",105,"# Introduction\n## Loop invariants and the guess-and-check paradigm\n## Challenges in multi-loop programs\n## INVWEAVER: loop-level call graph and obligation-guided feedback\n## Robustness via delayed filtering","[{\"question\":\"What problem does INVWEAVER address?\",\"answer\":\"INVWEAVER targets automatic inference of loop invariants for multi-loop programs, where existing LLM-aided methods often produce weak invariants that do not support global correctness proofs.\"},{\"question\":\"How does INVWEAVER handle dependencies between loops?\",\"answer\":\"It builds a loop-level call graph to expose inter-loop dependencies and provides a structured verification context to guide LLM reasoning across loop boundaries.\"},{\"question\":\"What deductive feedback mechanism does INVWEAVER use?\",\"answer\":\"INVWEAVER extracts weakest-precondition-derived verification conditions as explicit repair targets and propagates them over the call graph so that invariants for adjacent loops are jointly refined toward a consistent inductive proof chain.\"}]",1784198640,30,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":27},"invweaver-deductive-feedback-for-invariant-synthesis-in-interacting-loop-programs","",{"@graph":35,"@context":85},[36,53,68],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/invweaver-deductive-feedback-for-invariant-synthesis-in-interacting-loop-programs/84838/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-17","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"What problem does INVWEAVER address?","Question",{"text":75,"@type":76},"INVWEAVER targets automatic inference of loop invariants for multi-loop programs, where existing LLM-aided methods often produce weak invariants that do not support global correctness proofs.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How does INVWEAVER handle dependencies between loops?",{"text":80,"@type":76},"It builds a loop-level call graph to expose inter-loop dependencies and provides a structured verification context to guide LLM reasoning across loop boundaries.",{"name":82,"@type":73,"acceptedAnswer":83},"What deductive feedback mechanism does INVWEAVER use?",{"text":84,"@type":76},"INVWEAVER extracts weakest-precondition-derived verification conditions as explicit repair targets and propagates them over the call graph so that invariants for adjacent loops are jointly refined toward a consistent inductive proof chain.","https://schema.org",{"og:url":51,"og:type":87,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":89,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,115,120,122,127,130,134],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":45,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":111,"doc_module":4,"doc_module_name":45,"category_name":112,"show_sort_weight":113,"slug":114},6,"Technology",50,"technology",{"id":116,"doc_module":4,"doc_module_name":45,"category_name":117,"show_sort_weight":118,"slug":119},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":28,"slug":121},"research-report",{"id":123,"doc_module":4,"doc_module_name":45,"category_name":124,"show_sort_weight":125,"slug":126},9,"Religion & Spirituality",20,"religion-spirituality",{"id":125,"doc_module":4,"doc_module_name":45,"category_name":128,"show_sort_weight":125,"slug":129},"World Cup","world-cup",{"id":131,"doc_module":4,"doc_module_name":45,"category_name":132,"show_sort_weight":131,"slug":133},10,"Lifestyle","lifestyle",{"id":135,"doc_module":4,"doc_module_name":45,"category_name":136,"show_sort_weight":106,"slug":137},19,"General","general"]