A program processing method for reducing difficulty of data structure formal verification

By using nested shape graph splitting and splitting and splicing of universal quantization assertions, the problem of high complexity in formal verification of data structures is solved, and verification efficiency is improved.

CN116501633BActive Publication Date: 2026-02-13ANHUI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310457358.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-25
Publication Date
2026-02-13
Estimated Expiration
2043-04-25

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively reduce the complexity of formal verification of data structures, especially for complex data structures with universal quantization assertions.

Method used

Nested shape diagrams are used to decompose and analyze complex data structures. Combining the shape definitions of the main data structure and the secondary data structure, deductive reasoning is used to decompose and splice universal quantization assertions, thereby reducing the difficulty of verification.

Benefits of technology

By splitting and splicing the data structures, the formal verification difficulty of the data structure program is significantly reduced, and the verification efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116501633B_ABST
    Figure CN116501633B_ABST
Patent Text Reader

Abstract

The application provides a program processing method for reducing the difficulty of data structure formal verification, which comprises the following steps: firstly, the complex data structure is described by a nested shape graph; then, the shape definition of the final nested shape graph is obtained by analyzing the shape definition of the main data structure and the secondary data structure; then, the predicate and macro definition containing the universal quantification assertion in the assertion are expanded, all the assertions are traversed and matched based on the deductive reasoning, and the new assertion is obtained by splitting and splicing according to the matching result. The application adopts the splitting and splicing mode for the complex data structure program with the universal quantification assertion, greatly reduces the complexity of the formal verification, effectively reduces the difficulty of the data structure program verification, and improves the verification efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of formal verification of data structure, and particularly relates to a program processing method for reducing the difficulty of formal verification of data structure. BACKGROUND

[0002] In recent years, the rapid development of computer technology brings great changes to all walks of life, and with the coverage of various software becoming wider and wider, people's requirements for software security are also becoming more and more strict. The reliability of software system has a direct or indirect impact on the safety of the country, the stability of production and people's life, so the errors hidden in the software system may bring immeasurable consequences.

[0003] Data structure refers to a set of data elements that have one or more specific relationships with each other, and in general, a well-chosen data structure can bring higher running or storage efficiency. Therefore, data structure is the basis for constructing complex software system and is the way of computer storage and organization of data.

[0004] Under the prior art, formal verification is an important method to improve the high reliability of software program, and efficient automatic proof based on deductive reasoning for software program is a current hot issue, but it cannot be widely used in the industry at present, one of the main reasons is that the complexity of data structure program is high, especially the complex data structure program with universal quantification assertion. SUMMARY

[0005] The purpose of the present application is to provide a program processing method for reducing the difficulty of formal verification of data structure to solve the problems in the background art.

[0006] To achieve the above purpose, the present application adopts the following technical solutions:

[0007] 1. A program processing method for reducing the difficulty of formal verification of data structure, comprising the following steps:

[0008] S1, describing the complex data structure program with universal quantification assertion by nested shape graph: the complex data structure program with universal quantification assertion in verification is split, analyzed and judged by the nested shape graph coupled by multiple basic shapes, and simplified as multiple basic shape graphs;

[0009] S2, splitting and splicing the universal quantification assertion corresponding to the basic shape graph to obtain a new assertion: performing predicate and macro definition expansion of the universal quantification assertion on the implication containing the universal quantification assertion, traversing and matching all assertions based on deductive reasoning, and performing splitting and splicing processing according to the matching result.

[0010] Further, in the splitting process of the nested shape graph, the separation of the main data structure and the secondary data structure is also included; and the shape characteristics of the main data structure are analyzed to determine the category of the corresponding shape definition; and the pointer pointing relationship of the secondary data structure is saved in the corresponding shape graph information in the form of a set.

[0011] Further, the set adopts a five-tuple of <T, F, L, S, D>, where T represents the shape definition declared by the complex data structure program, F represents the starting node set of the main data structure shape domain, L represents the target node set of the main data structure shape domain, S represents the starting node set of the secondary data structure shape domain, and D represents the target node set of the secondary data structure shape domain.

[0012] Further, the splitting of the nested shape graph is specifically implemented through the following loop: first, the category of the shape definition of the node is obtained; then, it is judged whether the current node exists in the main data structure shape domain; if the node exists, it is respectively put into the starting node set F and the target node set L of the main data structure shape domain; then, it is judged whether the current node exists in the secondary data structure shape domain through a function; if the node exists, the information of the secondary data structure shape domain is saved, and is respectively put into the starting node set S and the target node set D. The loop will be iterated until the queue is empty.

[0013] Further, the analysis of the nested shape graph includes judging the in-degree and out-degree of the table head node, the table tail node and other nodes; at the same time, the main data structure nodes are operated in a loop traversal manner, and the nodes are taken out one by one by using a queue for analysis, and the loop is terminated at the end.

[0014] Further, the determination of the nested shape graph includes determining the shape definition of the main data structure shape definition corresponding to the shape graph information; if it is determined that the shape definition is an unsafe shape, it is not necessary to continue to infer the shape definition of the secondary data structure; if it is determined that the category of the shape definition of the main data structure is not an unsafe shape, the secondary data structure needs to be obtained, and the function is recursively called to obtain the shape definition of the secondary data structure; and the shape definitions of the main data structure and the secondary data structure are combined to obtain the final shape definition of the nested shape graph.

[0015] Further, the splitting and splicing of the universal quantified assertion based on the basic shape graph to obtain a new assertion are specifically implemented through the following method:

[0016] All universal quantified assertions of the antecedent and the consequent of the implication formula are obtained respectively, and all universal quantified assertions in the antecedent and the consequent are defined as sets E1 and E2 respectively, and each universal quantified assertion in the antecedent and the consequent is traversed in turn, and all assertions matching the universal quantified assertion set of the consequent are found in the universal quantified assertion set of the antecedent, and all matching assertions are defined as a set match.

[0017] When the number of elements in the set match is greater than 1, the universal quantification assertion in the antecedent is spliced: first, declare an empty maximum continuous interval set N, insert the first element of the universal quantification assertion E1 in the antecedent into the set N; further traverse the set E1 and the set N, the elements in the set are represented as E1[i] (i∈2...n) and N[j], N[k] (j, k∈1..n, k≠j) respectively; if two elements intersect, get their union, update the set N[j]=N[j]∪E1[i]; if two elements do not intersect, get their union, directly put E1[i] into the set N; traverse N[j] and N[k] in the set N, if N[k]=N[k]∪N[j] can be obtained, delete the set N[j] and return the set.

[0018] When the number of elements in the set match is equal to 1, the universal quantification assertion in the consequent is split: according to the only one element in the matching set match, the element interval range corresponding to the set E1 and the set E2 can be obtained, and then the interval range is split; finally, the interval before splitting is deleted, and the split interval set is returned.

[0019] According to the above technical scheme, the complex data structure is described by the nested shape graph, and the shape definition of the final nested shape graph is obtained by combining the analysis of the shape definition of the main data structure and the secondary data structure. Secondly, the predicate and macro definition containing the universal quantification assertion in the assertion are expanded, all assertions are traversed and matched based on deductive reasoning, and the new assertion is obtained according to the matching result. The complex data structure program with universal quantification assertion is split and spliced in the present application, which greatly reduces the complexity of formal verification, thereby effectively reducing the difficulty of data structure program verification and improving the verification efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 The step flow chart of the program processing method for reducing the difficulty of data structure formal verification of the present application;

[0021] Figure 2 The flowchart of the nested shape graph splitting verification method of the present application;

[0022] Figure 3 The flowchart of the universal quantification assertion splitting and splicing verification method of the present application. DETAILED DESCRIPTION

[0023] A preferred embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0024] AsFigure 1 The program processing method for reducing the formal verification difficulty of the data structure, specifically includes the following steps:

[0025] S1, the complex data structure program is described by the nested shape graph: the complex data structure program with universal quantification assertion in the verification is split, analyzed and judged by the nested shape graph coupled by multiple basic shapes, and is simplified as verifying multiple basic shape graphs.

[0026] As Figure 2 As shown in the preferred embodiment, the separation of the main data structure and the secondary data structure is also included in the splitting process of the nested shape graph; in the specific operation, the shape characteristics of the main data structure need to be analyzed, and the category of the corresponding shape definition is determined in combination with the corresponding rules; at the same time, the pointer pointing relationship of the secondary data structure is saved in the corresponding shape graph information in the form of a set.

[0027] The set in the preferred embodiment adopts a five-tuple of <T, F, L, S, D>, wherein T represents the shape definition declared by the complex data structure program, F represents the starting node set of the main data structure shape domain, L represents the target node set of the main data structure shape domain, S represents the starting node set of the secondary data structure shape domain, and D represents the target node set of the secondary data structure shape domain.

[0028] Further, the splitting of the nested shape graph is specifically implemented through the following loop: firstly, the category of the shape definition of the node is obtained; then, it is judged whether the current node exists in the main data structure shape domain: if the node exists, it is respectively put into the starting node set F and the target node set L of the main data structure shape domain; then, it is judged whether the current node exists in the secondary data structure shape domain through a function: if the node exists, the information of the secondary data structure shape domain is saved, and is respectively put into the starting node set S and the target node set D. The loop will be iterated until the queue is empty.

[0029] Specifically, the analysis of the nested shape graph includes: judging the in-degree and out-degree of the table head node, the table tail node and other nodes; at the same time, the main data structure node is operated in a loop traversal manner, and the nodes are taken out in turn by using a queue for analysis, and the loop is terminated at the end.

[0030] The judgment of the nested shape graph in the preferred embodiment includes judging the shape definition of the main data structure shape corresponding to the shape graph information: if the shape definition is judged as an unsafe shape, it is not necessary to continue to infer the shape definition of the secondary data structure; if the category of the shape definition of the main data structure is not an unsafe shape, the secondary data structure needs to be obtained, and the function is recursively called to obtain the shape definition of the secondary data structure. The shape definition of the final nested shape graph is obtained by combining the analysis of the shape definitions of the main data structure and the secondary data structure.

[0031] S2, splitting and splicing the universal quantification assertion corresponding to the basic shape graph to obtain a new assertion: performing predicate and macro definition expansion of the universal quantification assertion on the implication formula containing the universal quantification assertion, traversing and matching all assertions based on deductive reasoning, and performing splitting and splicing processing according to the matching result.

[0032] As shown in the specific operation, the splitting and splicing of the universal quantification assertion based on the basic shape graph to obtain a new assertion is specifically implemented by the following method: Figure 3

[0033] All universal quantification assertions of the antecedent and the consequent of the implication formula are obtained respectively, and all universal quantification assertions in the antecedent and the consequent are defined as sets E1 and E2 respectively, each universal quantification assertion in the antecedent and the consequent is traversed in turn, and all assertions matching the set of universal quantification assertions of the consequent are found in the set of universal quantification assertions of the antecedent, and all matching assertions are defined as a set match;

[0034] When the number of elements in the set match is greater than 1, the universal quantification assertion in the antecedent is spliced: first declare an empty maximum continuous interval set N, insert the first element of the universal quantification assertion E1 in the antecedent into the set N; further traverse the set E1 and the set N, and denote the elements in the set as E1[i] (i∈2...n) and N[j], N[k] (j, k∈1..n, k≠j) respectively; if two elements intersect, get their union set, update the set N[j] = N[j]∪E1[i]; if two elements do not intersect, get their union set, and directly put E1[i] into the set N; traverse N[j] and N[k] in the set N, if then N[k] = N[k]∪N[j] can be obtained, the set N[j] is deleted and the set is returned.

[0035] When the number of elements in the set match is equal to 1, the universal quantification assertion in the consequent is split: according to the only one element in the matching set match, the element interval range corresponding to the set E1 and the set E2 can be obtained, and then the interval range is split; finally, the interval before splitting is deleted, and the split interval set is returned.

[0036] Thus, the splitting and splicing processing of the complex data structure program with universal quantification assertion greatly reduces the verification difficulty of the complex data structure program with universal quantification assertion.

[0037] ​The above described embodiments are merely intended to describe the preferred embodiments of the present application, and are not intended to limit the scope of the present application, and various modifications and improvements made by those skilled in the art to the technical solutions of the present application without departing from the design spirit of the present application shall fall within the protection scope of the present application as defined by the claims.

Claims

1. A program processing method for reducing the difficulty of formal verification of a data structure, characterized by, Specifically comprising the following steps: S1, describing the complex data structure program by nested shape graph: for the complex data structure program with universal quantification assertion, the nested shape graph is used to split it into multiple basic shape graphs which are convenient for separate verification; S2, splitting and splicing the universal quantification assertion corresponding to the basic shape graph to obtain a new assertion: performing predicate and macro definition expansion of the universal quantification assertion on the implication formula containing the universal quantification assertion, traversing and matching all assertions based on deductive reasoning, and performing splitting and splicing processing according to the matching result; specifically comprising: S21, respectively acquiring all universal quantification assertions of the antecedent and the consequent of the implication formula, and defining all universal quantification assertions in the antecedent and the consequent as sets E1 and E2 respectively; S22, traversing each universal quantification assertion in the sets E1 and E2 in turn, and finding all assertions in the universal quantification assertion set E1 of the antecedent that match the universal quantification assertion set E2 of the consequent to obtain a matching assertion set Match; S23, when the number of elements in the matching assertion set Match is greater than 1, the universal quantification assertions in the antecedent assertion set E1 are spliced; S24, when the number of elements in the matching assertion set Match is equal to 1, the universal quantification assertions in the consequent assertion set E2 are split.

2. The program processing method of claim 1, wherein, In the splitting process of the nested shape graph, the separation of the main data structure and the secondary data structure is also included; and the shape characteristics of the main data structure are analyzed to determine the category of the corresponding shape definition; at the same time, the pointer pointing relationship of the secondary data structure is saved in the corresponding shape graph information in the form of a set.

3. The program processing method of claim 2, wherein, The set uses a five-tuple of <T, F, L, S, D>, wherein T represents the shape definition declared by the complex data structure program, F represents the starting node set of the main data structure shape domain, L represents the target node set of the main data structure shape domain, S represents the starting node set of the secondary data structure shape domain, and D represents the target node set of the secondary data structure shape domain.

4. The program processing method of claim 3, wherein, The splitting of the nested shape graph is specifically realized by the following loop: first, the category of the node shape definition is acquired; then it is judged whether the current node exists in the main data structure shape domain: if the node exists, it is respectively put into the starting node set F and the target node set L of the main data structure shape domain; then it is judged whether the current node exists in the secondary data structure shape domain by a function: if the node exists, the information of the secondary data structure shape domain is saved, and is respectively put into the starting node set S and the target node set D; the loop will be iterated until the queue is empty.

5. The program processing method of claim 3, wherein, The analysis of the nested shape graph includes: judging the in-degree and out-degree of the table head node, the table tail node and other nodes; at the same time, the main data structure nodes are operated in a loop, and the nodes are taken out one by one by a queue for analysis, and the loop is terminated at the end.

6. The program processing method of claim 4, wherein, The judgment of the nested shape graph includes judging the main data structure shape definition corresponding to the shape graph information: if the shape definition is judged as an unsafe shape, there is no need to continue to infer the shape definition of the secondary data structure; If the shape definition category of the main data structure is not unsafe shape, the secondary data structure needs to be obtained, and the function is called recursively to obtain the shape definition of the secondary data structure; the shape definitions of the main data structure and the secondary data structure are combined and analyzed to obtain the shape definition of the final nested shape graph.

7. The program processing method for reducing the difficulty of data structure formal verification according to claim 1, characterized in that: The operation of splicing the universal quantification assertions in the antecedent set E1 includes the following operations: firstly, declaring an empty maximum continuous interval set N, and inserting the first element of the universal quantification assertion E1 in the antecedent into the set N; further, traversing the set E1 and the set N, and representing the elements in the sets as E1 [i] (i∈2...n) and N[j], N[k] (j,k∈1..n, k≠j) respectively; if two elements intersect, obtaining their union set, updating the set N[j]=N[j]∪E1 [i]; if two elements do not intersect, obtaining their union set, and directly putting E1[i] into the set N; traversing N[j] and N[k] in the set N, if N[k]=N[k]∪N[j], deleting the set N[j] and returning the set. The splitting of the universal quantification assertion in the set of consequent assertions E2 includes the following operations: according to the unique element in the matching set match, the corresponding element interval range of the set E1 and the set E2 can be obtained, and then the interval range is split; finally, the interval before splitting is deleted, and the split interval set is returned.

Citation Information

Patent Citations

  • Test file generation method and system, server and storage medium

    CN111078555A

  • System and method for program verification and optimization

    US6343376B1