Code Conditional Truth Table Analysis for Unreachable Logic

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Complex software systems with convoluted conditional logic pose challenges in identifying unreachable or redundant code, as existing static code analysis tools are inadequate for concurrently coded, re-coded, and redesigned systems, leading to potential logical errors and programmer intent loss.

Innovation Solution

The method generates an abstract syntax tree (AST) from code, populates a truth table for each conditional statement with all possible outcomes, and assesses these tables to identify overlapping conditions, flagging issues such as unreachable code and redundancies by determining the order of instructions and their logical intersections.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If existing static code analysis tools are used to analyze complex software systems with convoluted conditional logic, then the analysis process is simple, but the tools are inadequate for concurrently coded, re-coded, and redesigned systems, leading to potential logical errors and programmer intent loss

Engineering Contradiction:
Improvecode analysis accuracyVSAvoidcode structure complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent segments the code analysis process into distinct phases: generating an abstract syntax tree (AST) from the source code, identifying conditional statements within the AST, constructing truth tables for each conditional statement, and analyzing the truth tables for logical errors. This segmentation allows each phase to be handled independently and systematically, improving reliability without being overwhelmed by the overall complexity of the codebase.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an abstract syntax tree (AST) as an intermediary representation between the source code and the truth table analysis. The AST serves as a structured intermediate form that captures the logical structure of conditional statements, making it easier to systematically generate truth tables and identify logical errors without directly parsing the complex source code structure.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If truth tables are constructed for all conditional statements to identify logical errors, then code quality improves, but the time and computational resources required increase

Engineering Contradiction:
Improvelogical error detectionVSAvoidanalysis time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies partial action by focusing truth table construction only on conditional statements within the code, rather than analyzing all code elements. By selectively identifying and analyzing only the conditional statements (if-else, switch cases, etc.) that contribute to logical flow decisions, the method achieves effective logical error detection without the excessive time cost of comprehensive code analysis.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The patent changes the parameter of analysis from examining entire code blocks to examining specific logical parameters of conditional statements. By extracting boolean conditions and their outcomes as discrete parameters for truth table construction, the method efficiently captures the essential logical structure without being bogged down by syntactic details, reducing analysis time while maintaining detection accuracy.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS11656869B2Using big code to construct code conditional truth tables
Publication Date: 2023.05.23 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11656869B2 patent drawing
  • US11656869B2 patent drawing
  • US11656869B2 patent drawing

AI summary

A method of analyzing code is provided. The method includes generating an abstract representation of the code, identifying conditional statements in the abstract representation, populating a truth table for each conditional statement that has been identified with all possible outcomes of the conditional statement and assessing the truth table for each conditional statement to identify issues.