This paper presents the development of a software tool that enables the translation of first-order predicate logic into relation algebra. The tool was developed using the Z3 theorem prover, by leveraging its capabilities to enhance reliability, generate code, and expedite the development process. The resulting standalone Python program allows users to translate first-order logic expressions into relation algebra, eliminating the need to work with relation algebra explicitly. This paper outlines the theoretical background of first-order logic, relation algebra, and the translation process. It also describes the implementation details, including validation of the tool using Z3 for testing correctness, and discusses deviations from the original translation procedure. By demonstrating the feasibility of utilizing first-order logic as an alternative language for expressing relation algebra, this tool paves the way for integrating first-order logic into tools that traditionally rely on relation algebra as their input language.
翻译:本文介绍了一款能够将一阶谓词逻辑翻译为关系代数的软件工具的开发过程。该工具通过利用Z3定理证明器的能力来增强可靠性、生成代码并加速开发流程。最终生成的独立Python程序允许用户将一阶逻辑表达式转换为关系代数,从而无需显式地处理关系代数。本文阐述了一阶逻辑、关系代数及翻译过程的理论背景,同时描述了实现细节(包括利用Z3进行正确性验证的测试),并讨论了与原始翻译流程的差异。通过证明将一阶逻辑作为表达关系代数的替代语言的可行性,该工具为将一阶逻辑集成到传统上以关系代数为输入语言的工具中铺平了道路。