A software design method and system based on unsupervised satisfiability detection of finite linear temporal logic
The finite linear temporal logic is pre-trained and designed by neural symbol methods and graph neural networks, which solves the problem of finite linear temporal logic satisfying the complexity of detection in industrial software design, and realizes efficient and accurate design requirements Test.
Patent Information
- Application Number
- CN202411272960.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-12
AI Technical Summary
In the industrial software design process, the satisfactory detection of finite linear temporal logic has extremely high complexity, which makes the process of detecting whether the design requirements can be met by time and inefficient.
Unsupervised satisfactory detection method based on neural symbol method is adopted, and finite linear temporal logic formulas are pre-trained through graph neural networks, design schemes are generated and self-iteration updates are performed. Gradient optimization prediction can satisfy traces and ensure stability of detection Sex and efficiency.
It realizes whether the detection design requirements can be met in relatively stable and less time, ensuring high accuracy and efficiency, and reducing detection complexity.
Smart Images

Figure CN118796163B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software design and software testing, and in particular relates to a software design method and system based on unsupervised satisfiability detection of finite linear temporal logic. Background Art
[0002] In the design process of industrial software, in order to detect whether a design requirement can be met, it is necessary to determine whether there is a design solution that can satisfy the constraints that the design requirement needs to meet within a certain time period. This problem is actually a satisfiability detection problem of finite linear temporal logic.
[0003] In order to better describe the satisfiability detection problem of finite linear temporal logic, the following basic concepts are first explained: Linear temporal logic (LTL) is a modal logic involving time. In addition to the logical operators and ( ),or( ),No( ), implies ( ), double implication ( ), Boolean false (False), and Boolean true (True), linear temporal logic also contains time modal operators such as "next moment" (X), "eventually" (F), "always" (G), and "until" (U) for describing the temporal properties of logical propositions. The basic semantics and symbolic representations are shown in Table 1. The trace of a linear temporal logic formula refers to a sequence of states that satisfies the specified properties of the formula. It represents the behavior of the system over time and can be used to verify whether the system meets the specified properties. Finite linear temporal logic (LTLf) is a variant of LTL. The main difference is that finite linear temporal logic is used to model abstraction of finite time tasks in practical applications. It describes the temporal properties of logical propositions in a finite time. Its logical propositions are defined in a finite time period, and the corresponding trace is finite. In the design process of industrial software, finite linear temporal logic can be used to describe the constraint relationships that design requirements need to meet within a certain time period.
[0004] Table 1 Symbolic representation and meaning of linear temporal logic
[0005]
[0006] in, and are respectively a finite linear temporal logic formula. "Not", "and", "next moment", and "until" are called the basic operators of finite linear temporal logic. The inductive definition of the LTLf formula on the finite set P of atomic proposition variables is as follows:
[0007] (1) If , then p is a LTLf formula;
[0008] (2) If is the LTLf formula, then It is also the LTLf formula;
[0009] (3) If is the LTLf formula, then It is also the LTLf formula.
[0010] Similar to the subformulas of logical formulas, the inductive definition of the set of subformulas sub(f) of an LTLf formula f on a finite set P of atomic propositional variables is as follows:
[0011] (1) If f = p, then sub(f) = p;
[0012] (2) If is a unary operator, ,but ;
[0013] (3) If is a binary operator, ,but .
[0014] Assume that on a finite set P of atomic propositional variables, the finite time state is [0,n], then the trace w defined on the finite set and finite time state satisfies:
[0015] ;
[0016] in, , Contains every atomic proposition The logical truth state at time t .
[0017] If the trace of the LTLf formula is , record w from time The starting subtrace is:
[0018] ;
[0019] The relation function between the trace w on the finite set P of atomic proposition variables and the LTLf formula f is defined as follows:
[0020] (1) If f is an atomic proposition variable, then ;
[0021] (2) If ,but ;
[0022] (3) If ,but ;
[0023] (4) If ,but ;
[0024] (5) If ,but .
[0025] For additional LTLf operators beyond the basic operators, the following equivalence relations are used for definition, so that an LTLf formula containing additional LTLf operators can be converted into an equivalent LTLf formula consisting only of LTLf basic operators:
[0026] (1) ;
[0027] (2) ;
[0028] (3) ;
[0029] (4) ,in ;
[0030] (5) ;
[0031] (6) ;
[0032] (7) ;
[0033] (8) .
[0034] When there exists a trace w such that an LTLf formula f is true, that is , then the formula f is said to be satisfiable, indicating that there is a design solution that can satisfy the design requirements of industrial software; when there is no trace w that can make an LTLf formula true, that is, , then the formula f is said to be unsatisfiable, indicating that the design requirements of industrial software cannot be met. Therefore, detecting whether a design requirement of industrial software can be met can be described as the satisfiability detection problem of LTLf, that is, detecting whether an LTLf formula is satisfiable (SAT) or unsatisfiable (UNSAT). The satisfiability detection problem of LTLf has been theoretically proven to be a polynomial space complete problem (PSPACE-Complete Problem), which means that in the worst case of the logic detection method, the space state of the problem is polynomial, and the search time complexity reaches the exponential level of the number of space states. Therefore, the logic detection method has extremely high complexity in the worst case.
[0035] In solving classic combinatorial optimization problems in computer science, neuro-symbolic methods are a new type of computational method that combines neural network computation with symbolic rule reasoning. In practice, deep neural networks are often used as the main framework to find solutions to problems through training.
[0036] There are two existing methods for satisfiability detection. The first is to reduce the problem to related problems for solution, and the second is to directly solve the problem by referring to the solution ideas of related problems. The first method links the satisfiability detection problem with other complex problems. After using reduction to transform the original problem into the representation of another problem, the existing algorithm and solver of the new problem are used to solve the representation, and finally mapped back to the solution of the original problem. This requires that the framework or algorithm used to solve more generalized problems can solve all such generalized problems, not just the generalized problems obtained by the transformation of the original problem, which is equivalent to ignoring some properties of the original problem to a certain extent, resulting in a certain degree of performance degradation; the second method directly solves the satisfiability of the LTLf formula that describes the constraints that the design requirements need to meet. For example, the LTLf satisfiability detection framework CDLSC based on the Boolean satisfiability problem uses Boolean satisfiability solution technology to construct a transformation system, and then simplifies the satisfiability check to a path search problem on the transformation system. However, the solution speed of the solver is greatly affected by the structure of the problem instance. Summary of the invention
[0037] The present invention aims to solve the problem that in the design process of industrial software, the logic detection method for detecting whether a design requirement can be met has extremely high complexity in the worst case. A software design method based on unsupervised satisfiability detection of finite linear temporal logic is provided, which can detect whether a design requirement can be met in a relatively stable and short time and ensure high accuracy.
[0038] A software design method based on unsupervised satisfiability detection of finite linear temporal logic provided in an embodiment of the present invention comprises the following steps:
[0039] S1. Give the design requirements that the industrial software needs to meet, and the constraints that the design requirements need to meet within a certain time period;
[0040] A finite linear temporal logic formula is used to describe the constraint condition, and a one-step expansion diagram representation of the finite linear temporal logic formula is obtained. , where V represents the node set of the one-step expansion graph, and E represents the undirected edge set of the one-step expansion graph; the one-step expansion graph is a graphical description of the formula based on the linear temporal logic semantics, and uses the graph structure to describe the constraints that the formula needs to satisfy at the current moment and the next moment;
[0041] S2. Given a finite linear temporal logic formula training set, each finite linear temporal logic formula in the training set is regarded as a constraint condition that needs to be followed by each design requirement of industrial software, and the graph neural network is pre-trained;
[0042] S3. Take the design requirements that the industrial software needs to meet as input and obtain a design solution given by the pre-trained graph neural network;
[0043] S4, detecting whether the design solution given by the pre-trained graph neural network can meet the design requirements; if it can meet the design requirements, then the detection is ended; otherwise, proceeding to step S5;
[0044] S5. Use the original design solution to randomly generate multiple new solutions to obtain a design solution set, where the design solution set includes the original solution and the generated multiple new solutions;
[0045] S6. Perform self-iterative update on each design solution in the design solution set;
[0046] S7. Check whether there is at least one design solution in the design solution set so that the design requirements of the industrial software can be met; if so, end the test; otherwise, consider that the design requirement cannot be met and abandon the design requirement.
[0047] A software design system based on unsupervised satisfiability detection of finite linear temporal logic provided in an embodiment of the present invention includes the following modules:
[0048] The module for describing design requirements and constraints is used to give the design requirements that industrial software needs to meet, as well as the constraints that the design requirements need to meet within a certain time period; and use a finite linear temporal logic formula to describe the constraints, and obtain a one-step expansion diagram representation of the finite linear temporal logic formula , where V represents the node set of the one-step expansion graph, and E represents the undirected edge set of the one-step expansion graph;
[0049] The pre-training module is used to pre-train the graph neural network given a finite linear temporal logic formula training set, treating each finite linear temporal logic formula in the training set as a constraint condition that needs to be followed by each design requirement of the industrial software;
[0050] The design solution generation module takes the design requirements that the industrial software needs to meet as input and obtains a design solution given by the pre-trained graph neural network;
[0051] The first detection module is used to detect whether the design solution given by the pre-trained graph neural network can meet the design requirements; if it can meet the design requirements, the detection is ended; otherwise, the design solution expansion module is entered;
[0052] The design scheme expansion module uses the original design scheme to randomly generate multiple new schemes to obtain a design scheme set, which includes the original scheme and the generated multiple new schemes; and performs self-iterative update on each design scheme in the design scheme set;
[0053] The second detection module is used to detect whether there is at least one design solution in the design solution set so that the design requirements of the industrial software can be met; if so, the detection is terminated; otherwise, it is considered that the design requirement cannot be met and the design requirement is abandoned.
[0054] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0055] The present invention uses a neural symbolic method to solve the satisfiability detection problem of finite linear temporal logic LTLf formulas, including the prediction of satisfiable traces by self-iterative updating of traces with gradient optimization, and the prediction of satisfiable traces by pre-training the graph representation of LTLf formulas using the GNN deep neural network structure. The method can perform detection in a relatively stable and short time, and ensure high accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is an overall flow chart of the software design method based on unsupervised satisfiability detection of finite linear temporal logic of the present invention;
[0057] Figure 2 is a finite linear temporal logic formula Schematic diagram of the syntax tree;
[0058] Figure 3 is a finite linear temporal logic formula Schematic diagram of a one-step expansion diagram. DETAILED DESCRIPTION
[0059] Here, some LTLf representation methods and network structures used in the present invention are first introduced:
[0060] (1) For an LTLf formula f defined on a finite set P of atomic propositional variables, its prefix representation pre(f) is defined as:
[0061] ;
[0062] (2) Since LTLf has only unary and binary operators, three tree attributes are defined to represent the tree structure: the root node type (type), the type refers to the corresponding atomic proposition or operator; the left subtree of the node (lson); the right subtree of the node (rson). For an LTLf formula f defined on a finite set P of atomic proposition variables, its syntax tree Tree(f) is defined as:
[0063] ;
[0064] in Represents the empty set.
[0065] (3) Three matrices are used to represent the syntax tree of a finite linear temporal logic formula, specifically:
[0066] Atomic proposition type matrix (i.e., response action matrix): If the ith node of the syntax tree represented by the prefix is the jth atomic proposition, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0;
[0067] Operator type matrix: If the ith node of the syntax tree represented by the prefix is the jth operator, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0;
[0068] Node right subtree matrix: If the right subtree of the ith node in the syntax tree represented by the prefix is the jth node, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0.
[0069] More specifically, for a LTLf formula f defined on a finite set P of atomic propositional variables, let its prefix represent Corresponding to the nodes on their syntax trees , where m is the number of nodes in the syntax tree Tree(f) of f. The syntax tree Tree(f) is defined to correspond to the atomic proposition types. , Operator Type , node right subtree The three matrices are as follows:
[0070] ;
[0071] ;
[0072] .
[0073] in represents the ith node of the syntax tree, Represents the j-th node of the syntax tree.
[0074] (4) For a LTLf formula f defined on a finite set P of atomic propositional variables, let is a subformula of formula f Corresponding nodes, let the one-step unfolded graph (OSUG) of formula f be represented as , where V represents the node set of OSUG and E represents the undirected edge set of OSUG.
[0075] (5) The computational functions of a graph neural network (GNN) layer usually include three functions: an information transfer function, which is used to obtain the representations of adjacent nodes; an aggregation function, which aggregates the received node representations into a single, fixed-length representation; and a nonlinear activation function, which uses the representations of the previous layer and the aggregated representation to generate a new node representation. , where V represents the node set of G, E represents the edge set of G, and in Layer, each node of G There is an initialization representation ,in is the dimension of the initialization representation (such as the dimension of node labels or features). For a K-layer graph neural network GNN, let the kth layer ( ) is , the aggregation function is ,in are some trainable parameters, then the computational function of the graph neural network is It can be expressed as:
[0076] ;
[0077] in , is the set of neighbor nodes of node v, that is The graph neural network GNN first obtains the representation of adjacent nodes based on the neighbor node set, and then uses the obtained representation set as the aggregation function Finally, the representation of the previous layer of the current node and the representation after aggregation are used as the activation function The input of is used to get the current layer representation of the current node.
[0078] Graph convolutional network (GCN) is a type of GNN architecture, and its computation function can be expressed as:
[0079] ;
[0080] in and are the trainable weights of the kth layer, is a nonlinear activation function such as ReLU or sigmoid, the number of neighbor nodes of node v is the factor used for normalization, Indicates The output corresponding to layer node u, is the set of neighbor nodes of node v, that is .
[0081] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto. Example
[0082] This embodiment provides a software design method based on unsupervised satisfiability detection of finite linear temporal logic. In the design process of industrial software, the design requirements of the software within a certain time period are given, a finite linear temporal logic formula is used to describe the design requirements, and the detection process of the design requirements is described in detail, so as to determine whether there is a design solution in which the design requirements can be satisfied. The specific process is as follows: Figure 1 As shown. This method detects whether the design requirements of industrial software can be met in a relatively stable and short time, and ensures high accuracy. It has the advantages of short average solution time, intuitive method, and better scalability. The following is a detailed introduction to the content of each step:
[0083] S1. Give the design requirements that the industrial software needs to meet, as well as the constraints that the design requirements need to meet within a certain time period.
[0084] In this embodiment, one of the design requirements of industrial software is that the first-time user must fully read the instructions before the software function is running. This design requirement requires that the user interface must always display the instructions until the software function is not suspended at the next moment. Indicates the display of software instructions and response actions Indicates that the software function is suspended, then let the finite set of atomic proposition variables , a finite linear temporal logic (LTLf) formula used on a finite set P To describe the design requirement, its prefix is expressed as , its prefix indicates a length of 5, and its syntax tree is as follows Figure 2 As shown, its one-step expansion diagram is shown as Figure 3 shown.
[0085] This embodiment uses a finite linear temporal logic (LTLf) formula f to describe the constraint condition, and obtains a one-step expansion diagram representation of the finite linear temporal logic formula: , where V represents the node set of the one-step expansion graph, and E represents the undirected edge set of the one-step expansion graph. The one-step expansion graph is a graphical description of the formula based on the linear temporal logic semantics, and uses the graph structure to characterize the constraints that the formula needs to satisfy at the current moment and the next moment. The inductive definition of the one-step expansion graph is as follows:
[0086] 1) If formula f is an atomic proposition variable, then ;
[0087] That is: if the formula is an atomic proposition variable, then its one-step expansion graph has only one node representing "the formula itself" and no edges.
[0088] 2) If or ,but ;
[0089] That is, if the formula is a "not" operation, the nodes of its one-step expansion graph include the nodes of the one-step expansion graph of the sub-formula of the "not" operation and the node representing "the formula itself"; the edges of its one-step expansion graph include the edges of the one-step expansion graph of the sub-formula of the "not" operation and an edge connecting the node representing "the formula itself" and the node representing "the sub-formula of the 'not' operation";
[0090] If the formula is a "next moment" operation, the nodes of its one-step expansion graph include the nodes of the one-step expansion graph of the sub-formula of the "next moment" operation, and the node representing "the formula itself"; the edges of its one-step expansion graph include the edges of the one-step expansion graph of the sub-formula of the "next moment" operation, and an edge connecting the node representing "the formula itself" and the node representing the "sub-formula of the 'next moment' operation".
[0091] 3) If ,but ;
[0092] That is: if the formula is an "AND" operation, the nodes of its one-step expansion graph include the nodes of the one-step expansion graph of the sub-formula of the "AND" operation, and the node representing "the formula itself"; the edges of its one-step expansion graph include the edges of the one-step expansion graph of the two sub-formulas of the "AND" operation, as well as an edge connecting the node representing "the formula itself" and the node representing "the left sub-formula of the 'AND' operation", and an edge connecting the node representing "the formula itself" and the node representing "the right sub-formula of the 'AND' operation".
[0093] 4) If ,but:
[0094] .
[0095] That is, if the formula is an "until" operation, the nodes of its one-step expansion graph include the nodes of the one-step expansion graph of the sub-formula of the "until" operation, as well as the node representing "the formula itself", the node representing "the 'next moment' of the formula", and the node representing "the 'next moment' of the formula and the 'and' operation of the left sub-formula of the 'until' operation"; the edges of its one-step expansion graph include the edges of the one-step expansion graph of the two sub-formulas of the "until" operation, as well as an edge connecting the node representing "the formula itself" and the node representing "the right sub-formula of the 'until' operation", and an edge connecting the node representing "the formula itself" and the node representing "the right sub-formula of the 'until' operation", and an edge connecting the node representing "the formula itself". " and the node representing "the 'AND' operation of the left subformula of the 'next moment' and 'until' operation of the formula", an edge connecting the node representing "the 'AND' operation of the left subformula of the 'next moment' and 'until' operation of the formula" and the node representing "the left subformula of the 'until' operation", an edge connecting the node representing "the 'next moment' and 'AND' operation of the left subformula of the 'next moment' and 'until' operation of the formula" and the node representing "the 'next moment' of the formula", and an edge connecting the node representing "the 'next moment' of the formula" and the node representing "the formula itself".
[0096] in and are respectively a finite linear temporal logic formula, Represents a connection formula Corresponding nodes and formulas The edge corresponding to the node. Representation formula The node set of the one-step expansion graph, Representation formula The edge set of the one-step expansion graph; Representation formula The node set of the one-step expansion graph, Representation formula The edge set of the one-step expansion graph; Representation formula The corresponding node, Representation formula The corresponding node.
[0097] S2. Given a finite linear temporal logic formula training set, each finite linear temporal logic formula in the training set is regarded as a constraint condition that needs to be followed by each design requirement of industrial software, and the graph neural network is pre-trained.
[0098] In this embodiment, this step specifically includes:
[0099] S21. Given a finite time upper limit and a graph neural network, the number of modules included in the graph neural network is the given finite time upper limit plus 1, and each module contains the same number (for example, all After the last graph convolutional network layer of each module, a multi-layer perceptron (MLP) layer is added, and the node representation representing the atomic proposition variable (i.e., representing the software response action) in the last layer of the multi-layer perceptron layer is used to predict the design scheme at the corresponding moment. The predicted design scheme gives the possibility of the industrial software executing each corresponding action. In addition, except for the last module, the last graph convolutional network layer of each module is connected to the first graph convolutional network layer of the next module by a conversion layer.
[0100] In this embodiment, the limited time upper limit is set to 2, and the graph neural network includes 3 modules.
[0101] S22. Given a parameter initialization method, initialize the parameters of the graph neural network.
[0102] S23. A training sample of a given training set includes three matrix representations corresponding to a syntax tree of a finite linear temporal logic formula, namely, a response action matrix, an operator type matrix, and a node right subtree matrix, as well as a one-step expansion graph representation of the finite linear temporal logic formula, a prefix representation length, and a finite set P of response actions of industrial software.
[0103] Among them, the finite linear temporal logic formula is interpreted as the overall design requirements of industrial software.
[0104] To simplify the description, To describe the response action matrix ,use To describe the operator type matrix ,use To describe the node right subtree matrix :
[0105] ;
[0106] ;
[0107] ;
[0108] Then the matrix representation of design requirements is , respectively:
[0109] , a prefix representation of a finite linear temporal logic formula used to express design requirements The second element is the response action , the fifth element is the response action , other elements are not response actions; “-” means the corresponding position of the matrix is 0;
[0110] , the first element of the prefix representation of the finite linear temporal logic formula representing the design requirement is the "until" operator, the third element is the "next moment" operator, the fourth element is the "not" operator, and the other elements are not operators;
[0111] , which means that the prefix of the finite linear temporal logic formula for the design requirement represents the first element (that is, the "until" operator), and its corresponding syntax tree node has a right node, and its right node is the node corresponding to the third element (that is, the "next moment" operator), and the nodes corresponding to other elements have no right nodes.
[0112] S24. Take the one-step expansion diagram of the finite linear temporal logic formula as the input of the neural network, and obtain the design scheme represented by the trace given by the neural network ,in The possibility of industrial software executing various response actions at time t is given, and n represents the given finite time upper limit.
[0113] S25. According to the design scheme represented by the trace given by the neural network, use The value of reflects the prefix of the total design requirement (i.e., the finite linear temporal logic formula). item( ) corresponding sub-requirements From the time t( ) will not create the possibility of conflict at the beginning.
[0114] In this embodiment, the possibility The dependencies of the derivation process are as follows:
[0115] ;
[0116] in:
[0117] ;
[0118] ;
[0119] ;
[0120] ;
[0121] ;
[0122] ;
[0123] In the above formula, Indicates that the industrial software in the design performs a response action at time t The possibility of The prefix representing the total design requirement (i.e., finite linear temporal logic formula) The possibility that the sub-demand corresponding to the item will not conflict from time t, Indicates The possibility that the sub-demand corresponding to the item will not conflict starting from time t+1, represents the possibility that the sub-demand corresponding to the jth item will not cause conflict starting from time t, Indicates There is a possibility that the sub-demand corresponding to the item will not conflict starting from time t+1.
[0124] S26. By enumerating the prefix representation and time state in reverse order, calculate the possibility that the design solution represented by the trace given by the neural network meets the design requirements (that is, the possibility that the sub-requirement corresponding to the first item represented by the prefix of the total design requirement can be satisfied starting from time 0), and the opposite of the value of the possibility is used as the loss, and the gradient descent function OptFunc is given to update the parameter r of the neural network:
[0125] ;
[0126] S27. Repeat steps S23-S26 until a given number of iterations is reached, and in each iteration, the parameters of the neural network are updated using the training samples in the given finite linear temporal logic formula training set to obtain a pre-trained graph neural network.
[0127] S3. Take the design requirements that the industrial software needs to meet as input and obtain a design solution given by the pre-trained graph neural network.
[0128] In this step, a finite time upper limit and a pre-trained graph neural network are given, and the one-step expansion graph representation of a finite linear temporal logic formula is used as the input of the pre-trained graph neural network to obtain a design scheme represented by a trace given by the pre-trained graph neural network. The design scheme gives the possibility for the industrial software to execute each response action at each moment.
[0129] In this embodiment, the design solution w given by the pre-trained graph neural network is assumed to be:
[0130] ;
[0131] At time 0, this design has a 0.4 probability of displaying the software's instructions and a 0.6 probability of suspending the software function; at time 1, there is a 0.4 probability of displaying the software's instructions and a 0.6 probability of suspending the software function; at time 2, there is a 0.4 probability of displaying the software's instructions and a 0.4 probability of suspending the software function.
[0132] S4, check whether the design solution given by the pre-trained graph neural network can meet the design requirements. If the design solution can meet the design requirements, a design solution that can meet the design requirements is found and the test ends; otherwise, continue to step S5.
[0133] S41. Based on a design scheme represented by a trace given by a pre-trained graph neural network, for the possibility that the software in the design scheme executes a certain response action at a certain moment, if the possibility is greater than a preset threshold (for example, 0.5), the software is allowed to execute the corresponding response action at the corresponding moment; otherwise, the software is not allowed to execute the corresponding response action at the corresponding moment.
[0134] In this embodiment, given a design solution w given by a pre-trained graph neural network with a limited time upper limit, for the industrial software in the design solution w at time t ( ) Execute response action Possibility If the possibility If it is greater than 0.5, the industrial software will execute the response action at time t Otherwise, the industrial software will not perform the response action at time t .
[0135] The design solution w is:
[0136] ;
[0137] According to this design, at time 0, the software instructions are not displayed and the software functions are suspended; at time 1, the software instructions are not displayed and the software functions are suspended; at time 2, the software instructions are not displayed and the software functions are running.
[0138] S42, by enumerating the prefix representation and time state of the total design requirement in reverse order, calculate the possibility that the sub-requirement corresponding to the first item of the prefix representation can be satisfied starting from time 0, that is, the possibility that the design requirement can be satisfied. If the value of the possibility is 1, the design solution can meet the design requirement, and a design solution that can meet the design requirement is found, and the detection ends; otherwise, continue to S5.
[0139] In this embodiment, the possibility The value of reflects the total demand f prefix indicated by the Sub-requirements corresponding to the item Whether it can be satisfied from time t, the possibility The dependency relationship of the derivation process is detailed in step S25.
[0140] In this embodiment, the probability that the total design requirements can be met starting from time 0 is calculated. , that is, the design scheme cannot meet the design requirements from time 0, and the design scheme cannot meet the design requirements. Intuitively, the design scheme does not display the instructions for use of the software at time 0, and the software function is still suspended at the next time. Therefore, the user interface does not display the instructions for use until the software function is not suspended at the next time, that is, the design scheme cannot meet the design requirements, and step S5 is continued.
[0141] S5. Use the original design solution to randomly generate multiple new solutions to obtain a design solution set, which includes the original solution and the generated multiple new solutions.
[0142] S51. Given an original design represented by a trace, a given number of multiple new plans are randomly generated based on the original design, and the average value of the probability of executing the same response action at the same time is exactly the value of the probability of executing the corresponding time and the corresponding response action in the original design.
[0143] This embodiment uses the original design to randomly generate two new solutions, and the average value of the execution probability of the same response action at the same time is exactly the value of the execution probability of the corresponding time and response action in the original design. Suppose the two generated new solutions are:
[0144] .
[0145] S52: Based on the original design scheme and the multiple new schemes randomly generated therefrom, a design scheme set W is obtained, where the design scheme set includes the original design scheme and the multiple new schemes randomly generated therefrom.
[0146] In this embodiment, the design solution set W includes the original design solution and two generated new solutions, specifically:
[0147] .
[0148] S6. Perform self-iterative update on each design solution in the design solution set.
[0149] S61. For a design solution w in the set of design solutions, use The value reflects the total design requirements. Sub-requirements corresponding to the item The possibility that can be satisfied starting from time t.
[0150] S62. By enumerating the prefix representation and time status of the total design requirements in reverse order, the possibility of the design solution w being able to meet the design requirements of the industrial software is calculated. The value of , takes its opposite as the loss, and gives the gradient descent function OptFunc, the industrial software in the design solution w performs the response action at time t Possibility Perform self-iterative update:
[0151] .
[0152] S63. Repeat steps S61-S62 for each design solution in the design solution set W until a given number of iterations is reached.
[0153] In this embodiment, the updated solution set W is assumed to be:
[0154] .
[0155] S7. Check whether there is at least one design solution in the design solution set, so that the design requirement of the industrial software can be met. If so, a design solution that can meet the design requirement is found, and the test ends; otherwise, it is considered that the design requirement cannot be met, and the design requirement is abandoned. This software design method ends.
[0156] S71, for each design solution in the design solution set W, the industrial software executes a response action at time t If the probability is greater than a preset threshold (e.g. 0.5), the industrial software is made to perform a response action at time t. Otherwise, the industrial software will not perform the response action at time t :
[0157] ;
[0158] S72, given a design solution w, use The value reflects the total design requirement. item( ) corresponding sub-requirements Whether it can be satisfied starting from time t.
[0159] By enumerating the prefix representation and time state in reverse order, the possibility of the design solution w given by the pre-trained graph neural network meeting the design requirements is calculated. If If the value of is 1, the design solution can meet the design requirements; otherwise, the design solution cannot meet the design requirements.
[0160] In this embodiment, for the design solutions in the design solution set W, At time 0, the design scheme displays the software instructions and the software function is suspended; at time 1, the software instructions are displayed and the software function is suspended; at time 2, the software instructions are not displayed and the software function is running.
[0161] This embodiment calculates the possibility that demand f can be satisfied starting from time 0 , that is, the design scheme given by the pre-trained graph neural network can meet the actual needs from time 0, and the design scheme can meet the design requirements. Intuitively, under this design scheme, the user interface always displays the instructions until the software function does not suspend operation at the next moment, that is, the design scheme can meet the design requirements of industrial software, and thus a design scheme that can meet the design requirements is found. This software design method ends.
[0162] S73. Given a design solution set W, perform steps S71-S72 for each design solution w in the design solution set to detect whether there is at least one design solution in the design solution set such that the design requirements of the industrial software can be met. If so, a design solution that can meet the design requirements is found and the detection ends; otherwise, it is considered that the design requirements cannot be met and the design requirements are abandoned. This software design method ends.
[0163] In addition, this embodiment also provides a software design system based on finite linear temporal logic unsupervised satisfiability detection, including the following modules:
[0164] The module for describing design requirements and constraints is used to give the design requirements that industrial software needs to meet, as well as the constraints that the design requirements need to meet within a certain time period; and use a finite linear temporal logic formula to describe the constraints, and obtain a one-step expansion diagram representation of the finite linear temporal logic formula , where V represents the node set of the one-step expansion graph, and E represents the undirected edge set of the one-step expansion graph;
[0165] The pre-training module is used to pre-train the graph neural network given a finite linear temporal logic formula training set, treating each finite linear temporal logic formula in the training set as a constraint condition that needs to be followed by each design requirement of the industrial software;
[0166] The design solution generation module takes the design requirements that the industrial software needs to meet as input and obtains a design solution given by the pre-trained graph neural network;
[0167] The first detection module is used to detect whether the design solution given by the pre-trained graph neural network can meet the design requirements; if it can meet the design requirements, the detection is ended; otherwise, the design solution expansion module is entered;
[0168] The design scheme expansion module uses the original design scheme to randomly generate multiple new schemes to obtain a design scheme set, which includes the original scheme and the generated multiple new schemes; and performs self-iterative update on each design scheme in the design scheme set;
[0169] The second detection module is used to detect whether there is at least one design solution in the design solution set so that the design requirements of the industrial software can be met; if so, the detection is terminated; otherwise, it is considered that the design requirement cannot be met and the design requirement is abandoned.
[0170] The above modules are respectively used to implement steps S1-S7 of the above software design method, and the detailed implementation process thereof refers to the above steps.
[0171] The experiment conducted in this embodiment has the following parameter settings as shown in Table 2. The experiment was run on a Linux system; the CPU attribute is Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz, 80 cores; the GPU used for pre-training GNN is NVIDIA GeForce RTX 3090, with a video memory of 24G. The model hyperparameters of this embodiment set in the experiment are: the GCN module is implemented based on the graph convolution network structure SAGEConv of the geometric library in PyTorch; a single module contains GCN_layers GCN layers; the feature dimension of each GCN layer node in the GNN is set to hidden_channels; embedding and prod are trainable parameter matrices for dimension conversion; the MLP layer includes MLP_layers linear layers, and the dimension of the middle layer is set to MLP_hiddden_channels; the input of the MLP layer is the feature dimension (hiddden_channels), and the output is the classification dimension (out_channels); softmax transformation (instead of sigmoid transformation) is used and argmax is taken to obtain the classification, and the adjacent linear layers are connected using the ReLU activation function. In addition, the experiment sets a finite time length 𝑛; the number of pre-training iterations is pretrain_epochs; the number of randomly generated real number traces is RandomTimes; the number of fine-tuning iterations is finetune_epochs; Adam is used as the gradient descent optimizer, and the learning rates of GNN pre-training and fine-tuning are GNN_lr and finetune_lr respectively.
[0172] Table 2 Experimental parameter settings
[0173]
[0174] The experimental results are shown in Table 3. The design method of this embodiment has a high accuracy rate for satisfiability prediction.
[0175] Table 3 Experimental results
[0176]
[0177] In terms of the detection efficiency of LTLf formulas, the detection time of the CDLSC logic detection framework is greatly affected by the problem instance. The experiment tested the detection efficiency of the CDLSC logic detection framework on the CPU by adding labels to the test set. The experiment found that for LTLf formulas with relatively simple syntax trees, the CDLSC logic detection framework can detect 2 to 3 LTLf formulas per second, and such data accounts for about 60% − 75% of the data set; for more complex LTLf formulas, it takes an average of 20 seconds to 1 minute to complete the detection of an LTLf formula; and for some extreme cases, the detection time of a single formula reaches several hours (about 5% of the data). Since it takes a lot of time and technical problems to add labels to these data, these samples have to be regarded as unlabeled samples during the experiment.
[0178] For this embodiment, under the 𝑣1 hyperparameter in Table 2, the process of pre-training GNN on the GPU can perform a gradient descent iteration update every 15.37 minutes. Fine-tuning on a single real number trace takes about 10 seconds on the CPU, and because the fine-tuning of different real number traces can be parallelized on the CPU, it takes 17.07 seconds to complete the fine-tuning of all 64 random real number traces of a problem instance. However, since the detection time difference between each problem instance of the CDLSC logic detection framework is very large, although parallel detection between problem instances is also used, its running time often depends on several problem instances with extremely high time costs, so the average time cost of the problem instance is very large. It can be seen that although the CDLSC logic detection framework can correctly perform satisfiability detection, the detection efficiency is greatly affected by the input LTLf formula, and this embodiment can give a satisfiability prediction within a solution time that does not change much, thereby detecting whether a design requirement can be met, and has the advantages of shorter average solution time, intuitive method, and better scalability.
[0179] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A software design method based on unsupervised satisfiability detection of finite linear temporal logic, characterized in that: The steps include: S1. Give the design requirements that the industrial software needs to meet, and the constraints that the design requirements need to meet within a certain time period; A finite linear temporal logic formula is used to describe the constraint condition, and a one-step expansion diagram representation of the finite linear temporal logic formula is obtained. , where V represents the node set of the one-step expansion graph, and E represents the undirected edge set of the one-step expansion graph; the one-step expansion graph is a graphical description of the formula based on the linear temporal logic semantics, and uses the graph structure to describe the constraints that the formula needs to satisfy at the current time and the next time; S2. Given a finite linear temporal logic formula training set, each finite linear temporal logic formula in the training set is regarded as a constraint condition that needs to be followed by each design requirement of industrial software, and the graph neural network is pre-trained; S3. Take the design requirements that the industrial software needs to meet as input and obtain a design solution given by the pre-trained graph neural network; S4, detecting whether the design solution given by the pre-trained graph neural network can meet the design requirements; if it can meet the design requirements, then ending the detection; Otherwise, continue to step S5; S5. Use the original design solution to randomly generate multiple new solutions to obtain a design solution set, where the design solution set includes the original solution and the generated multiple new solutions; S6. Perform self-iterative update on each design solution in the design solution set; S7. Check whether there is at least one design solution in the set of design solutions, so that the design requirement of the industrial software can be met; if so, the test is terminated; otherwise, it is considered that the design requirement cannot be met and the design requirement is abandoned; In step S1, set the response action Indicates the display of software instructions and response actions Indicates that the software function is suspended, then let the finite set of atomic proposition variables , a finite linear temporal logic formula used on a finite set P To describe the design requirements, the prefix of the finite linear temporal logic formula is expressed as ; where U is the "until" operator and X is the "next moment" operator. is the "not" operator; Step S2 includes: S21. Given a finite time upper limit and a graph neural network, the number of modules included in the graph neural network is the given finite time upper limit plus 1, and each module contains the same number of graph convolutional network layers; after the last graph convolutional network layer of each module, add a multi-layer perceptron layer, and use the nodes representing the software response actions in the last layer of the multi-layer perceptron layer to predict the design scheme at the corresponding time, and the predicted design scheme gives the possibility of the industrial software executing each corresponding action; S22, initializing parameters of the graph neural network; S23, a training sample of a given training set, the training sample including a response action matrix, an operator type matrix, a node right subtree matrix corresponding to a syntax tree of a finite linear temporal logic formula, and a one-step expansion graph representation of the finite linear temporal logic formula, a prefix representation length, and a finite set P of response actions of industrial software; Among them, the finite linear temporal logic formula is interpreted as the overall design requirements of industrial software; In the response action matrix, if the ith node of the syntax tree represented by the prefix is the jth atomic proposition, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0; In the operator type matrix, if the ith node of the syntax tree represented by the prefix is the jth operator, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0; In the node right subtree matrix, if the right subtree of the ith node represented by the prefix of the syntax tree is the jth node, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0; S24. Take the one-step expansion diagram of the finite linear temporal logic formula as the input of the neural network, and obtain the design scheme represented by the trace given by the neural network ,in It represents the possibility of industrial software executing each response action at time t, and n represents the upper limit of the given finite time; S25. According to the design scheme given by the neural network, The value reflects the total design requirements. Sub-requirements corresponding to the item The probability that there will be no conflict starting from time t, , , m is the number of nodes in the syntax tree of the finite linear temporal logic formula; S26. By enumerating the prefix representation and the time state in reverse order, calculate the possibility that the sub-requirement corresponding to the first item of the prefix representation reflecting the total design requirement can be satisfied starting from time 0. The value of , and the opposite of the value of the possibility is used as the loss, given the gradient descent function, to update the parameters of the neural network; S27, repeating steps S23-S26 until a given number of iterations is reached, and in each iteration, the parameters of the neural network are updated using the training samples in the given finite linear temporal logic formula training set, thereby obtaining a pre-trained graph neural network; Step S5 includes: S51. Given an original design represented by a trace, a given number of multiple new plans are randomly generated according to the original design, and the average value of the execution probability of the same response action at the same time is exactly the value of the execution probability of the corresponding time and the corresponding response action in the original design; S52, obtaining a design solution set based on the original design solution and the multiple new solutions randomly generated therefrom, wherein the design solution set includes the original design solution and the multiple new solutions randomly generated; Step S6 includes: S61. For a design w in the set of design solutions, use the probability The value reflects the total design requirements. Sub-requirements corresponding to the item The possibility that can be satisfied starting from time t; S62. By enumerating the prefix representation and time status of the total design requirements in reverse order, the possibility of the design solution w being able to meet the design requirements of the industrial software is calculated. The value of The opposite number of is taken as the loss, given the gradient descent function, the industrial software in the design solution w performs the response action at time t Possibility Perform self-iterative updates; S63, repeating steps S61-S62 for each design solution in the design solution set until a given number of iterations is reached; Step S7 includes: S71, for each design solution in the design solution set, the industrial software executes a response action at time t If the probability is greater than the preset threshold, the industrial software is made to perform a response action at time t Otherwise, the industrial software will not perform the response action at time t ; S72. Given a design solution w, use the possibility The value reflects the total design requirement. Sub-requirements corresponding to the item Whether it can be satisfied starting from time t; S73. Given a set of design solutions, execute steps S71-S72 for each design solution w in the set of design solutions to detect whether there is at least one design solution in the set of design solutions so that the design requirements of the industrial software can be met; if so, end the detection; otherwise, consider that the design requirement cannot be met and abandon the design requirement.
2. The software design method according to claim 1, characterized in that: In step S23, Describing the Response Action Matrix ,use Describing the operator type matrix ,use Describe the node right subtree matrix : ; ; ; Matrix representation of design requirements , respectively: , a prefix representation of a finite linear temporal logic formula used to express design requirements The second element is the response action , the fifth element is the response action , other elements are not response actions; , the first element of the prefix representation of the finite linear temporal logic formula representing the design requirement is the "until" operator, the third element is the "next moment" operator, the fourth element is the "not" operator, and the other elements are not operators; , indicating that the prefix of the finite linear temporal logic formula for the design requirement represents the first element, and its corresponding syntax tree node has a right node, and its right node is the node corresponding to the third element, and the nodes corresponding to other elements have no right nodes; Among them, "-" means that the corresponding position of the matrix is 0.
3. The software design method according to claim 1, characterized in that: In step S25, the possibility The dependencies of the derivation process are: ; in: ; ; ; ; ; ; in, is the "and" operator, Indicates that the industrial software in the design performs a response action at time t The possibility of The prefix indicating the total design requirements indicates the The possibility that the sub-demand corresponding to the item will not conflict from time t, The prefix indicating the total design requirements indicates the The possibility that the sub-demand corresponding to the item will not conflict starting from time t+1, The possibility that the sub-requirement corresponding to the j-th item represented by the prefix of the total design requirement will not conflict starting from time t, The prefix indicating the total design requirements indicates the There is a possibility that the sub-demand corresponding to the item will not conflict starting from time t+1.
4. The software design method according to claim 1, characterized in that: Step S3 includes: given a finite time upper limit and a pre-trained graph neural network, taking a one-step expansion graph representation of a finite linear temporal logic formula as an input of the pre-trained graph neural network, and obtaining a design scheme represented by a trace given by the pre-trained graph neural network, wherein the design scheme provides the possibility for the industrial software to execute each response action at each moment; Step S4 includes: S41. According to a design scheme represented by a trace given by the pre-trained graph neural network, for the possibility of the software in the design scheme executing a certain response action at a certain time, if the possibility is greater than a preset threshold, the software is made to execute the corresponding response action at the corresponding time; otherwise, the software is made not to execute the corresponding response action at the corresponding time; S42. By enumerating the prefix representation and time status of the total design requirement in reverse order, calculate the possibility that the sub-requirement corresponding to the first item of the prefix representation can be met starting from time 0; if the value of the possibility is 1, the design scheme meets the design requirement, and the detection is ended; otherwise, continue with step S5.
5. A software design system based on unsupervised satisfiability detection of finite linear temporal logic, based on the software design method of claim 1, characterized in that: Includes the following modules: The module for describing design requirements and constraints is used to give the design requirements that industrial software needs to meet, as well as the constraints that the design requirements need to meet within a certain time period; and use a finite linear temporal logic formula to describe the constraints, and obtain a one-step expansion diagram representation of the finite linear temporal logic formula , where V represents the node set of the one-step expansion graph, and E represents the undirected edge set of the one-step expansion graph; The pre-training module is used to pre-train the graph neural network given a finite linear temporal logic formula training set, treating each finite linear temporal logic formula in the training set as a constraint condition that needs to be followed by each design requirement of the industrial software; The design solution generation module takes the design requirements that the industrial software needs to meet as input and obtains a design solution given by the pre-trained graph neural network; The first detection module is used to detect whether the design solution given by the pre-trained graph neural network can meet the design requirements; If the design requirements can be met, the test ends; Otherwise, go to the design expansion module; A design solution expansion module randomly generates multiple new solutions using the original design solution to obtain a design solution set, which includes the original solution and the generated multiple new solutions; And perform self-iterative update on each design solution in the design solution set; The second detection module is used to detect whether there is at least one design solution in the design solution set so that the design requirements of the industrial software can be met; if so, the detection is terminated; otherwise, it is considered that the design requirement cannot be met and the design requirement is abandoned.
6. The software design system according to claim 5, characterized in that: In the description module of design requirements and constraints, set the response action Indicates the display of software instructions and response actions Indicates that the software function is suspended, then let the finite set of atomic proposition variables , a finite linear temporal logic formula used on a finite set P To describe the design requirements, the prefix of the finite linear temporal logic formula is expressed as ; where U is the "until" operator and X is the "next moment" operator. is the "not" operator; The training process of the pre-training module includes: (1) Given a finite time upper limit and a graph neural network, the number of modules included in the graph neural network is the given finite time upper limit plus 1, and each module contains the same number of graph convolutional network layers; after the last graph convolutional network layer of each module, a multi-layer perceptron layer is added, and the nodes representing the software response actions in the last layer of the multi-layer perceptron layer are used to predict the design scheme at the corresponding time. The predicted design scheme gives the possibility of the industrial software executing each corresponding action; (2) Initialize the parameters of the graph neural network; (3) Given a training sample of a training set, the training sample includes a response action matrix, an operator type matrix, a node right subtree matrix corresponding to a syntax tree of a finite linear temporal logic formula, and a one-step expansion graph representation of the finite linear temporal logic formula, a prefix representation length, and a finite set P of response actions of industrial software; Among them, the finite linear temporal logic formula is interpreted as the overall design requirements of industrial software; In the response action matrix, if the ith node of the syntax tree represented by the prefix is the jth atomic proposition, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0; In the operator type matrix, if the ith node of the syntax tree represented by the prefix is the jth operator, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0; In the node right subtree matrix, if the right subtree of the ith node represented by the prefix of the syntax tree is the jth node, then the value of the ith row and jth column of the matrix is 1, otherwise it is 0; (4) The one-step expansion diagram of the finite linear temporal logic formula is used as the input of the neural network to obtain the design solution represented by the trace given by the neural network. ,in It represents the possibility of industrial software executing each response action at time t, and n represents the upper limit of the given finite time; (5) According to the design scheme given by the neural network, use The value reflects the total design requirements. Sub-requirements corresponding to the item The probability that there will be no conflict starting from time t, , , m is the number of nodes in the syntax tree of the finite linear temporal logic formula; (6) By enumerating the prefix representation and time state in reverse order, the probability that the sub-requirement corresponding to the first item of the prefix representation reflecting the total design requirement can be satisfied starting from time 0 is calculated. The value of , and the opposite of the value of the possibility is used as the loss, given the gradient descent function, to update the parameters of the neural network; (7) Repeat (3)-(6) until a given number of iterations is reached. In each iteration, the parameters of the neural network are updated using the training samples in the given finite linear temporal logic formula training set to obtain a pre-trained graph neural network.
7. The software design system according to claim 6, characterized in that: In (3), use Describing the Response Action Matrix ,use Describing the operator type matrix ,use Describe the node right subtree matrix : ; ; ; Matrix representation of design requirements , respectively: , a prefix representation of a finite linear temporal logic formula used to express design requirements The second element is the response action , the fifth element is the response action , other elements are not response actions; , the first element of the prefix representation of the finite linear temporal logic formula representing the design requirement is the "until" operator, the third element is the "next moment" operator, the fourth element is the "not" operator, and the other elements are not operators; , indicating that the prefix of the finite linear temporal logic formula for the design requirement represents the first element, and its corresponding syntax tree node has a right node, and its right node is the node corresponding to the third element, and the nodes corresponding to other elements have no right nodes; Among them, "-" means that the corresponding position of the matrix is 0.
8. The software design system according to claim 6, characterized in that: The generation process of the design scheme generation module includes: given a finite time upper limit and a pre-trained graph neural network, taking a one-step expansion graph representation of a finite linear temporal logic formula as an input of the pre-trained graph neural network, and obtaining a design scheme represented by a trace given by the pre-trained graph neural network, wherein the design scheme gives the possibility of the industrial software executing each response action at each moment; The detection process of the first detection module includes: According to a design scheme represented by a trace given by the pre-trained graph neural network, for the possibility of the software in the design scheme executing a certain response action at a certain time, if the possibility is greater than a preset threshold, the software is made to execute the corresponding response action at the corresponding time; otherwise, the software is made not to execute the corresponding response action at the corresponding time; By enumerating the prefix representation and time status of the total design requirement in reverse order, calculate the possibility that the sub-requirement corresponding to the first item of the prefix representation can be met starting from time 0; if the value of the possibility is 1, the design scheme meets the design requirement, and the detection is ended; otherwise, enter the design scheme expansion module.
