Partial Equivalence Verification for Source Code Refactoring

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing equivalence verification methods, such as those described in Non-Patent Literature 1, fail to accurately judge function equivalence due to requiring identical output values for all input values, leading to wide ranges of inequivalence judgments and increased manual bug analysis time, and are limited by complex variable expressions and large numbers, as seen in Patent Literature 1.

Innovation Solution

An equivalence verification apparatus that includes a unit to judge function equivalence through partial verification by excluding inequivalent paths and performing equivalence verification on corresponding combinations of functions in pre-change and post-change source code, allowing for partial equivalence judgment.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If exhaustive equivalence verification is performed for every input value, then verification completeness is improved, but verification time and analysis scope increase significantly

Engineering Contradiction:
Improveverification completenessVSAvoidverification time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent segments the verification process by dividing functions into equivalence classes based on their behavior characteristics. Instead of verifying every function individually against all input values, functions are grouped into classes (e.g., linear functions, constant functions, identity functions) and verified representativeatively. This segmentation reduces the verification scope while maintaining completeness for each class.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent changes the verification parameter from individual input values to function behavior patterns. By analyzing the mathematical properties and transformation patterns of functions (such as whether they preserve equality, reverse equality, or transform values in specific ways), the verification shifts from exhaustive input testing to pattern-based classification, significantly reducing time while maintaining reliability.

Inventive Principle:
Principle #35Parameter changes

2Measurement precision

If strict equivalence judgment is applied requiring identical output values for all input values, then verification accuracy is improved, but the judgment range becomes too narrow and rejects partially equivalent functions

Engineering Contradiction:
Improveequivalence judgment accuracyVSAvoidequivalence judgment range
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The patent applies local quality by allowing different equivalence criteria for different function types. Instead of a uniform strict equivalence standard, the system defines multiple equivalence relations tailored to specific function categories (e.g., strict equality preservation for some functions, reverse equality for others, or equivalence under specific transformations). This enables partially equivalent functions to be recognized while maintaining high accuracy for each function type.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent introduces dynamic equivalence judgment that adapts the equivalence criteria based on the function's behavior pattern. The equivalence relation is not fixed but determined dynamically through analysis of the function's mathematical properties and transformation characteristics. This allows the verification system to flexibly adjust the equivalence standard to match the function's actual behavior, expanding the judgment range while preserving accuracy.

Inventive Principle:
Principle #15Dynamics

3Ease of manufacture

If refactoring is performed to improve software quality, then software maintainability is improved, but the substance of logical operations may be unintentionally changed

Engineering Contradiction:
Improvesoftware maintainabilityVSAvoidlogical operation correctness
Core Design Contradiction:
Ease of manufactureVSReliability

Solution Approach 1:

The patent implements feedback-based verification where the equivalence verification results are fed back to validate whether refactoring preserved the original logical operations. The system automatically compares the refactored code against the original code using the defined equivalence relations, providing feedback on whether the refactoring was successful or introduced unintended changes. This feedback mechanism ensures maintainability improvements do not compromise logical correctness.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS10915427B2Equivalence verification apparatus and computer readable medium
Publication Date: 2021.02.09 MITSUBISHI ELECTRIC CORP
  • US10915427B2 patent drawing
  • US10915427B2 patent drawing
  • US10915427B2 patent drawing

AI summary

An equivalence verification unit (130) judges through equivalence verification, for each of corresponding combinations which are each a combination of a function included in pre-change source code and a function included in post-change source code, whether the functions included in the corresponding combination are equivalent to each other. A partial verification judgment unit (150) judges, for each of inequivalent ones of the corresponding combinations, whether the corresponding combination is a partial verification combination including a function where an inequivalent path, in which an inequivalent function is called, and a non-inequivalent path, in which a non-inequivalent function is called, are both included. A partial verification unit (160) judges, for each of the partial verification combinations, whether the functions included in the partial verification combination are partially equivalent to each other by excluding the inequivalent path and performing the equivalence verification.