Content area

Abstract

The increasing interest in automated code conversion and transcompilation—driven by the need to support multiple platforms efficiently—has raised new challenges in verifying that translated codes preserve the intended behaviors of the originals. Although it has not yet been widely adopted, transcompilation offers promising applications in software reuse and cross-platform migration. With the growing use of Large Language Models (LLMs) in code translation, where internal reasoning remains inaccessible, verifying the equivalence of their generated outputs has become increasingly essential. However, existing evaluation metrics—such as BLEU and CodeBLEU, which are commonly used as baselines in transcompiler evaluation—primarily measure syntactic similarity, even though this does not guarantee semantic correctness. This syntactic bias often leads to misleading evaluations where structurally different but semantically equivalent code is penalized. This syntactic bias often leads to misleading evaluations, where structurally different but semantically equivalent code is penalized. To address this limitation, we propose a formal verification framework based on equivalence checking using First-Order Logic (FOL). The approach models core programming constructs—such as loops, conditionals, and function calls—that function as logical axioms, enabling equivalence to be assessed at the behavioral level rather than simply by their textual similarity. We initially used the Z3 solver to manually encode Swift and Java code into FOL. To improve scalability and automation, we later integrated ANTLR to parse and translate both the source and transcompiled codes into logical representations. Although the framework is language-agnostic, we demonstrate its effectiveness through a case study of Swift-to-Java transcompilation. The experimental results demonstrated that our method effectively identifies semantic equivalence, even when syntax differs significantly. Our method achieves an average semantic accuracy of 86.1%, compared to BLEU’s syntactic accuracy of 64.45%. This framework bridges the gap between code translation and formal semantic verification. These results highlight the potential for formal equivalence checking to serve as a more reliable validation method in code translation tasks, enabling more trustworthy cross-language code conversion.

Details

1009240
Title
Formal Verification of Transcompiled Mobile Applications Using First-Order Logic
Author
Muhammad Ahmad Ahmad 1   VIAFID ORCID Logo  ; Mahitap, Ayman 1   VIAFID ORCID Logo  ; Elhossany, Samer A 1 ; Walaa, Medhat 2   VIAFID ORCID Logo  ; Selim Sahar 1   VIAFID ORCID Logo  ; Zayed Hala 3   VIAFID ORCID Logo  ; Yousef, Ahmed H 4 ; Jantsch Axel 5   VIAFID ORCID Logo  ; Elaraby Nahla 6   VIAFID ORCID Logo 

 Center for Informatics Science (CIS), School of Information Technology and Computer Science, Nile University, 26th of July Corridor, Sheikh Zayed City 12588, Egypt; [email protected] (A.A.M.); [email protected] (M.A.); [email protected] (S.A.E.); [email protected] (W.M.); [email protected] (S.S.) 
 Center for Informatics Science (CIS), School of Information Technology and Computer Science, Nile University, 26th of July Corridor, Sheikh Zayed City 12588, Egypt; [email protected] (A.A.M.); [email protected] (M.A.); [email protected] (S.A.E.); [email protected] (W.M.); [email protected] (S.S.), Faculty of Computer and Artificial Intelligence, Department of Information Systems, Benha University, Banha 13511, Egypt; [email protected] 
 Faculty of Computer and Artificial Intelligence, Department of Information Systems, Benha University, Banha 13511, Egypt; [email protected], Faculty of Engineering, Egypt University of Informatics (EUI), Cairo 11865, Egypt 
 El Sewedy University of Technology, Kilo 51 Cairo Ismailia Road, Cairo 44629, Egypt; [email protected], Faculty of Engineering, Computers & Systems Department, Ain Shams University, Cairo 11517, Egypt 
 Institute of Computer Technology, Technical University of Vienna (TU Wien), Gusshausstrasse 27–29, 1040 Vienna, Austria; [email protected] 
 Institute of Computer Technology, Technical University of Vienna (TU Wien), Gusshausstrasse 27–29, 1040 Vienna, Austria; [email protected], Electrical and Electronics Engineering Department, Canadian International College (CIC), Cairo 11835, Egypt 
Publication title
Volume
13
Issue
12
First page
580
Number of pages
20
Publication year
2025
Publication date
2025
Publisher
MDPI AG
Place of publication
Basel
Country of publication
Switzerland
e-ISSN
22277080
Source type
Scholarly Journal
Language of publication
English
Document type
Journal Article
Publication history
 
 
Online publication date
2025-12-10
Milestone dates
2025-10-07 (Received); 2025-12-01 (Accepted)
Publication history
 
 
   First posting date
10 Dec 2025
ProQuest document ID
3286357355
Document URL
https://www.proquest.com/scholarly-journals/formal-verification-transcompiled-mobile/docview/3286357355/se-2?accountid=208611
Copyright
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). Notwithstanding the ProQuest Terms and Conditions, you may use this content in accordance with the terms of the License.
Last updated
2025-12-24
Database
ProQuest One Academic