[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-85038-en":3,"doc-seo-85038-105":30,"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":21,"is_downloadable":21,"audit_status":21,"page_count":22,"language":23,"language_code":24,"site_id":25,"html_lang":24,"table_of_contents":26,"faqs":27,"seo_title":13,"seo_description":14,"update_tm":28,"read_time":29},85038,1374391975076,"Riley","https://ap-avatar.wpscdn.com/avatar/14000253ca4ec9f6853?x-image-process=image/resize,m_fixed,w_180,h_180&k=1783305029341752051",8,"Research & Report","On the Correctness of Software Merge","Three-way merge tools are central to pull-based software development, yet their merge outputs have long been accepted without rigorous correctness checks. This paper introduces a structural merge tool evaluated via syntactic criteria: the merge result must be parsable and universal. Parsable means syntactic validity under the programming-language grammar, while universality ensures all and only branch edits are reflected, with common edits applied once, formalized using pushouts in category theory. Large-scale experiments find existing tools report incorrect results, while the proposed tool reports none.","On the Correctness of Software Merge  \nAkira Mori  \nNational Institute of  \nAdvanced Industrial Science and Technology Ikeda, Osaka, JAPAN ORCID: 0000-0002-3122-3931  \nMasatomo Hashimoto  \nChiba Institute of Technology Narashino, Chiba, JAPAN ORCID: 0000-0003-2317-3812  \narXiv :2607 .07987v 1 [ cs . SE] 8 Jul 2026  \nAbstract—Three-way merge tools play crucial roles in modern software development, where a developer forks a branch to make local modifications and requests it to be merged into the main branch via a ”pull request.” Despite its importance, the task has traditionally been defined in an intuitive manner, and the results of merge tools are often accepted without scrutiny. In this paper, we present a new structural merge tool in comparison with existing tools based on the syntactic criteria we propose for evaluating the merge results. We require the merge result to be both parsable and universal. Being parsable means that the result is syntactically valid according to the grammar of the programming language. Being universal means that the result incorporates all and only the edit operations occurring in each branch while ensuring that edits common to both branches are applied only once. This requirement can be precisely defined using the notion of pushouts in category theory. In a largescale experiment involving 43,774 file merge scenarios from 76 open-source Java projects, we found a number of incorrect results reported by existing tools such as the Git companion merge tool, whereas our tool reports none. We further compared d3j’s results with 2,582 developer-resolved merges and with 2,459 merge scenarios involving 21 refactoring types. These experiments revealed both the strengths and current limitations of structural merge, and underscore the importance of clear correctness criteria. We expect that the proposed criterion will provide a foundation for developing more reliable and principled merge tools.  \nIndex Terms—three-way merge, abstract syntax tree (AST), AST comparison, correctness criterion, pushouts, category theory, universal property, partial inclusion map  \nI. INTRODUCTION  \nThree-way program merge is a task to integrate two program versions derived from the same ancestry and has become important due to the widespread use of distributed version control systems (DVCSs) . A DVCS facilitates a distributed workflow in which developers fork branches to work locally and contribute changes by submitting pull requests to project maintainers. The maintainer processes the “pull request (PR)”and incorporates changes into the main branch after evaluating  \nThis is the final accepted manuscript of the following published paper:  \nA. Mori and M. Hashimoto,“On the Correctness of Software Merge,” in Proc. 40thACM/IEEE Int. Conf. on Autom. Softw. Eng. (ASE), 2025, pp. 2338–2349, doi: 10 . 1109/ASE63991 .2025.00193.  \n© 2025 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works.  \nthe validity of the contribution. This so-called pull-based software development model has become a major force since it allows developers to work on new code changes in amore efficient and timely manner [1] . Figure 1 illustrates this concept.  \nThe task can be complex if the same part of the code is modified in different ways, which may lead to conflicts when divergent changes cannot be resolved. Various tools have been developed that alert users to conflicts and merge the code when it is safe to do so. The textual line-oriented tools have been widely used since the diff3 command incorporated threeway merging capability in 1988 . The Git system includes an automated merge tool, which we refer to as git-merge, to streamline tasks ","cbCairnMJdQSwSR7","https://ap.wps.com/l/cbCairnMJdQSwSR7","pdf",2399874,2,1,12,"English","en",105,"# Introduction\n# Correctness Criteria for Merge Results\n## Parsability\n## Universality and Pushouts\n# Experimental Evaluation\n## Large-Scale File Merge Scenarios\n## Developer-Resolved and Refactoring-Based Comparisons","[{\"question\":\"What correctness criteria does the paper require for a merge result?\",\"answer\":\"The merge result must be parsable and universal. Parsable means syntactically valid according to the language grammar, and universal means it includes all and only edits from each branch while applying shared edits exactly once.\"},{\"question\":\"How is universality formalized in the proposed approach?\",\"answer\":\"Universality is defined using pushouts in category theory. The paper links the edit-derived mappings on AST nodes to a universal property that captures correct combination of branch edits.\"},{\"question\":\"What do the experiments show about existing merge tools versus the proposed tool?\",\"answer\":\"In a large experiment with 43,774 merge scenarios from 76 open-source Java projects, existing tools reported incorrect merge results, while the proposed tool reported none. Additional comparisons include developer-resolved merges and merges involving refactoring types, revealing both strengths and limitations.\"}]",1784200549,30,{"code":4,"msg":31,"data":32},"ok",{"site_id":25,"language":24,"slug":33,"title":13,"keywords":34,"description":14,"schema_data":35,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":28},"on-the-correctness-of-software-merge","",{"@graph":36,"@context":85},[37,53,68],{"@type":38,"itemListElement":39},"BreadcrumbList",[40,44,47,50],{"item":41,"name":42,"@type":43,"position":21},"https://docshare.wps.com","Home","ListItem",{"item":45,"name":46,"@type":43,"position":20},"https://docshare.wps.com/document/","Document",{"item":48,"name":12,"@type":43,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":43,"position":52},"https://docshare.wps.com/document/on-the-correctness-of-software-merge/85038/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":24,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":41,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-24","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 correctness criteria does the paper require for a merge result?","Question",{"text":75,"@type":76},"The merge result must be parsable and universal. Parsable means syntactically valid according to the language grammar, and universal means it includes all and only edits from each branch while applying shared edits exactly once.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"How is universality formalized in the proposed approach?",{"text":80,"@type":76},"Universality is defined using pushouts in category theory. The paper links the edit-derived mappings on AST nodes to a universal property that captures correct combination of branch edits.",{"name":82,"@type":73,"acceptedAnswer":83},"What do the experiments show about existing merge tools versus the proposed tool?",{"text":84,"@type":76},"In a large experiment with 43,774 merge scenarios from 76 open-source Java projects, existing tools reported incorrect merge results, while the proposed tool reported none. Additional comparisons include developer-resolved merges and merges involving refactoring types, revealing both strengths and limitations.","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":25},{"code":4,"msg":5,"data":92},[93,97,101,105,110,115,120,122,127,130,134],{"id":21,"doc_module":4,"doc_module_name":46,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":20,"doc_module":4,"doc_module_name":46,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":46,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":46,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":111,"doc_module":4,"doc_module_name":46,"category_name":112,"show_sort_weight":113,"slug":114},6,"Technology",50,"technology",{"id":116,"doc_module":4,"doc_module_name":46,"category_name":117,"show_sort_weight":118,"slug":119},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":46,"category_name":12,"show_sort_weight":29,"slug":121},"research-report",{"id":123,"doc_module":4,"doc_module_name":46,"category_name":124,"show_sort_weight":125,"slug":126},9,"Religion & Spirituality",20,"religion-spirituality",{"id":125,"doc_module":4,"doc_module_name":46,"category_name":128,"show_sort_weight":125,"slug":129},"World Cup","world-cup",{"id":131,"doc_module":4,"doc_module_name":46,"category_name":132,"show_sort_weight":131,"slug":133},10,"Lifestyle","lifestyle",{"id":135,"doc_module":4,"doc_module_name":46,"category_name":136,"show_sort_weight":106,"slug":137},19,"General","general"]