Construction method of approximate specification mining model and software behavior verification system

By combining the generation of linear temporal logic (LTL) formulas with the neural network FSAccept, the problem of search space explosion and overgeneralization is alleviated, solving the problem of efficiently mining high-quality FSAs and realizing automated software behavior verification and vulnerability discovery.

CN120909554AInactive Publication Date: 2025-11-07SUN YAT SEN UNIV

Patent Information

Application Number
CN202511445398.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-11
Publication Date
2025-11-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently discover high-quality finite state automata (FSAs). Due to the search space explosion and overgeneralization problems, software specification creation is costly, time-consuming, and difficult to verify its effectiveness.

Method used

By generating linear temporal logic (LTL) formulas and combining them with the neural network FSAccept, the gradient descent algorithm is used to train the neural network, which alleviates overgeneralization and discovers high-quality FSAs.

Benefits of technology

It enables efficient mining of high-quality FSAs, automates the verification of software behavior, discovers potential vulnerabilities, and reduces the cost and time of software specification creation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909554A_ABST
    Figure CN120909554A_ABST
Patent Text Reader

Abstract

The invention belongs to a specification mining technology of software engineering, and relates to a construction method of an approximate specification mining model and a software behavior verification system. The construction method comprises the following steps: generating a group of linear temporal logic LTL formulas for describing positive example time sequence attributes according to a positive example set; using an LTL formula to generate a potential negative example for evaluation and training; designing and constructing a neural network for analyzing the finite state automaton from the parameter assignment so as to simulate an acceptance behavior of the finite state automaton; and iteratively searching the neural network through a gradient descent algorithm until the maximum number of iterations is reached, and mining to obtain the finite state automaton. The neural network can simulate acceptance of the finite state automaton in the reasoning process, the finite state automaton can be explained at low cost, and the problem of search space explosion is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the specification mining technology of software engineering, and particularly relates to a construction method of an approximate specification mining model and a software behavior verification system. BACKGROUND

[0002] Software specification can depict high-level software behavior, thereby improving the maintainability and reliability of software. Conversely, the lack of software specification often leads to difficulty in understanding the program and increases the risk of errors. For example, unreasonable, unsafe or non-standard use of an Application Programming Interface (API) (i.e., API misuse) has been recognized as one of the main reasons for causing vulnerabilities and defects. In addition, developers cannot use tools that rely on software specifications as input for vulnerability discovery and testing. In practice, due to the high cost, time-consuming nature of software specification creation and the characteristics of rapid evolution of software, software specifications are often unavailable. Therefore, an automated method is needed to mine high-quality specifications for software.

[0003] Generally speaking, the mining of software specification is studied only from positive examples, because negative examples are often difficult to obtain in practice, where the positive examples are the required software behavior (such as software execution traces), and the negative examples are the non-required software behavior. And the Finite State Automata (FSA) can be used as the specification due to its expressiveness in capturing temporal properties, where the positive examples are the strings accepted by the FSA, and the negative examples are the strings rejected by the FSA. A high-quality FSA needs to not only accept known positive examples, but also accept unknown positive examples and reject unknown negative examples. However, mining such FSA from positive examples only faces major challenges: (1) there is a serious search space explosion problem due to the NP-Hard complexity; (2) there is an overgeneralization problem due to the lack of mechanisms to penalize overgeneralization assumptions.

[0004] In order to obtain high-quality FSA at low cost, FSA mining has been widely studied. Most existing methods adopt carefully designed state abstraction heuristics (referred to as state abstraction-based methods). These methods update the FSA structure by abstracting states, so the quality of the mined FSA highly depends on the heuristics used for state abstraction. However, it is very difficult to design good heuristics, and it is difficult to verify their universal effectiveness. Alternative methods based on constraint optimization model FSA mining as an optimization problem with anti-overgeneralization constraints, although theoretically attractive, these methods face two key limitations: (1) their effectiveness is limited by the expressiveness of the coded anti-overgeneralization properties; (2) their scalability depends on the performance of the underlying constraint solver.

[0005] Recently, the representational power of neural networks has also driven the development of FSA mining: methods based on neural network learning partially shift from hand-designed heuristics to data-driven heuristics to improve the quality of heuristics; in addition, a large number of works adopt a two-stage process: first, train a recurrent neural network (RNN) to classify behaviors, and then extract an FSA to model the behavior of the RNN. However, the above-mentioned methods based on neural network learning all have the problem of error propagation, that is, they do not directly train a neural network to mine an FSA, but first learn positive example features, and then use the positive example features as heuristics for state abstraction, or only faithfully follow the trained RNN, rather than the original data. Therefore, despite these advances, mining high-quality FSA remains an unsolved challenge. SUMMARY

[0006] In order to solve the problem of search space explosion in the specification mining of existing software behaviors, the present application provides a construction method of an approximate specification mining model, a software behavior verification method and a software behavior verification system.

[0007] In one aspect, the present application provides a construction method of an approximate specification mining model, comprising the following steps: S1, generating a set of linear temporal logic LTL formulas for characterizing the temporal properties of the positive examples according to the positive example set S2, using the generated linear temporal logic LTL formulas to generate potential negative examples for evaluating the quality of the learned finite state automaton FSA and potential negative examples for training a neural network; wherein the potential negative examples and the positive example set form a training data set D; S3, designing and constructing a neural network FSAaccept for parsing the finite state automaton FSA from the parameter assignment to simulate the acceptance behavior of the finite state automaton FSA; iteratively searching the neural network FSAaccept by the gradient descent algorithm until the maximum number of iterations is reached, and finally mining the finite state automaton FSA.

[0008] Preferably, step S1 comprises: S11, predefining three groups of LTL formula templates, each group of LTL formula templates including a general formula and a corresponding specific formula; ​S12. Given an alphabet and a set of positive examples, enumerate all possible symbol pairs in the alphabet and instantiate three sets of LTL formula templates. Define a partial order based on the implication relation of the LTL formulas and prioritize evaluating more specific formulas. For each set of LTL formula templates, if a specific LTL formula is satisfied by all positive examples, skip evaluating its generalization formula. Finally, select the set of LTL formulas that are satisfied by all positive examples as a set of generated linear temporal logic LTL formulas used to characterize the temporal properties of positive examples. In step S11, the generalized formula of the first set of LTL formula templates represents the atomic proposition. Atomic propositions will inevitably emerge afterward. The corresponding specific formula represents the atomic proposition. The atomic proposition immediately followed. ; The second set of LTL formula templates generalizes to represent atomic propositions. The atomic proposition does not appear immediately afterwards. The corresponding specific formula represents the atomic proposition. The atomic proposition will never appear again. ; The third set of LTL formula templates generalizes atomic propositions. The atomic proposition must have appeared before. The corresponding specific formula represents the atomic proposition. The atomic proposition appeared immediately before .

[0009] Preferably, in step S2, during the generation of the potential negative example set, for each positive example set... Positive examples Randomly select positive examples from the LTL formula set. LTL formulas that satisfy timing properties Through positive examples of mutation Obtaining LTL formulas that do not satisfy the timing properties Potential negative examples .

[0010] On the other hand, embodiments of the present invention also provide a software behavior verification method, including the above-described construction method, and including the following steps: S4. Use the finite state automaton (FSA) obtained from the mining process to verify the software behavior.

[0011] Furthermore, embodiments of the present invention also provide a software behavior verification system, comprising the following modules: The construction module is used to construct an approximate canonical mining model based on neural automata inference according to the above construction method, and to mine a finite state automaton (FSA). The verification module verifies software behavior by using the finite state automaton (FSA) obtained through mining, so as to verify whether the software meets the software requirement specification.

[0012] Compared with the prior art, the technical effects achieved by the present application include: The present application proposes a brand-new software behavior mining paradigm: by modeling FSA mining in discrete domains as parameter learning in continuous domains, an approximate specification mining model based on neural automata acceptance inference is constructed to mine high-quality FSA. The core idea is to connect FSA acceptance with neural automata acceptance inference through FSA encoding methods, which is the basis for designing neural networks simulating FSA acceptance. And through gradient descent-based neural network training, FSA can be efficiently searched, and potential negative examples can be conveniently combined to alleviate overfitting. Through the automatic FSA mining of the present application, software developers can verify software behavior through FSA and find potential vulnerabilities of the software. BRIEF DESCRIPTION OF DRAWINGS

[0013] Figure 1 The figure is a whole flowchart of the construction method of the approximate specification mining model in the embodiment of the present application. Figure 2 The figure is a schematic diagram of the real finite state automaton (FSA) corresponding to the target library class in the embodiment of the present application. Figure 3 The figure is a schematic diagram of the finite state automaton (FSA) obtained through mining in the embodiment of the present application. DETAILED DESCRIPTION

[0014] The construction method of the approximate specification mining model in the present application can be applied to the specification mining of finite state automata of software behavior and can be used for verifying software behavior by using the finite state automaton obtained through automatic mining.

[0015] The present application proposes to model the problem as searching approximate FSA from positive examples with noise and negative examples. The noise refers to mislabeled data (false positive or false negative) contradicting the real label, and reducing the noise in negative examples is conducive to rejecting overfitting FSA. The present application refers to the samples highly confident as real negative examples as potential negative examples, and synthesizes potential negative examples based on the timing properties of the approximate positive-negative example boundary, and the core idea is to quickly abstract all positive examples through the "specificity first" timing property generation method.

[0016] The technical solutions of the present application will be further described in detail below with reference to the embodiments and the accompanying drawings, but the implementation manner of the present application is not limited thereto.

[0017] EMBODIMENT The embodiment provides a construction method of an approximate norm mining model, and an approximate norm mining model based on neural automata acceptance inference is constructed through the method, and the embodiment refers to the neural network FSAccept as a neural network FSAccept.

[0018] To alleviate the search space explosion problem, the embodiment develops an FSA encoding method to parameterize the constructed neural network FSAccept, so that the inference process of the neural network FSAccept (referred to as neural automata acceptance inference in the embodiment) can simulate FSA acceptance, and the FSA can be explained from the parameter distribution of the neural network FSAccept at low cost. Intuitively, the neural automata acceptance inference can approximately quantify the fitting degree of the explained FSA to data.

[0019] The core idea of the neural network FSAccept is based on continuous relaxation of discrete structure representation, so that the search space is differentiable, so that the embodiment can use the gradient descent algorithm for efficient structure optimization, and approximate calculation is used to alleviate the error search deviation caused by noise.

[0020] In the embodiment, the related terms used are introduced one by one as follows: 1. Finite state automaton: a finite state automaton (FSA) is a five-tuple , where is a finite non-empty symbol set, referred to as an alphabet; is a finite non-empty state set; is an initial state; is a state transition function; is a set of accepting states.

[0021] For any trace and an FSA , the function represents that the specific finite state automaton accepts the trace .

[0022] 2. Linear temporal logic (LTL): linear temporal logic (LTL) is widely used to describe temporal properties. For a finite atomic proposition set , the operators of linear temporal logic LTL are divided into basic operators and non-basic operators, the basic operators include logical operation conjunction, logical operator negation, temporal modal operator Next (next), and temporal modal operator Until (until), and in a specific linear temporal logic LTL formula, the logical operation conjunction is represented as " ", and the logical operator negation is represented as " Next is denoted as "X" and Until is denoted as "U". The non-basic operators include disjunction, Release, Eventually, Always, Weak-Until, and implication , all of which can be defined by the above four basic operators, wherein the denotation symbols of disjunction, Release, Eventually, Always, Weak-Until, and implication are , , , , , , respectively. The meanings and definitions of some operators are described as follows: (1) The meaning of the temporal modal operator Next (X) is that the formula is true at the next time instant, i.e., the formula is true at the next time instant.

[0023] (2) The meaning of the temporal modal operator Until (U) is that the formula is true at every time instant until the time instant at which the formula is true, i.e., the formula is true at every time instant until the time instant at which the formula is true.

[0024] (3) The definitions and meanings of several non-basic operators are as follows: Disjunction ( ): ; the formula is true or the formula is true; Release ( ): , the meaning of which is that the formula is true at every time instant until the time instant at which the formula is true; if the formula is never true, then the formula is always true; Eventually ( ): , the meaning of which is that the formula will eventually be true at some time instant; Always ( ): , the meaning of which is that the formula is always true; Weak-Until ( ):​ , means that the formula is true at every moment until the moment when the formula is true; if the formula is never true, then the formula is always true; implies ( ): , means that if the formula is true, then the formula is true; wherein are LTL formulas, denotes logical true.

[0025] In this embodiment, the specific definition of LTL formulas by operators and atomic propositions is illustrated as follows: , is an LTL formula, , denotes an atomic proposition, denotes a set of atomic propositions, denotes logical true, denotes a specific LTL formula, denotes the assignment symbol.

[0026] This embodiment models the problem of mining finite state automata (FSA) as searching for an approximate FSA from a set of positive examples and a set of potential negative examples by updating the FSA , with the goal of minimizing the following function: .

[0027] This embodiment designs and constructs an approximate canonical mining model, namely the neural network FSAccept, which can parse finite state automata FSA from parameter assignments to simulate the acceptance behavior of finite state automata FSA. Given an alphabet and the number of states , the trainable parameters of the neural network FSAccept , wherein is the transition matrix of the finite state automaton FSA, denotes the acceptance state vector of the finite state automaton FSA, denotes a symbol in the alphabet .

[0028] In this embodiment, the construction method of the approximate canonical mining model based on neural automaton acceptance inference is as shown in Figure 1 , and specifically includes the following steps: S1, generating a linear temporal logic (LTL) formula: generating a set of linear temporal logic (LTL) formulas for characterizing the temporal properties of the positive examples according to the input positive example set , generating a set of linear temporal logic (LTL) formulas for characterizing the temporal properties of the positive examples according to the input positive example set

[0029] In this embodiment, step S1 includes: S11, predefining six LTL formula templates containing two symbols, including three groups, each group including a generalized formula and a corresponding specific formula. In the same group of LTL formula templates, if the specific formula is true, the generalized formula must be true.

[0030] The first group of LTL formula templates has a generalized formula , indicating that the atomic proposition must be followed by the atomic proposition ; the corresponding specific formula is , indicating that the atomic proposition is immediately followed by the atomic proposition ; The second group of LTL formula templates has a generalized formula , indicating that the atomic proposition is immediately followed by the atomic proposition ; the corresponding specific formula is , indicating that the atomic proposition is never followed by the atomic proposition ; The third group of LTL formula templates has a generalized formula , indicating that the atomic proposition must be followed by the atomic proposition ; the corresponding specific formula is , indicating that the atomic proposition is immediately followed by the atomic proposition . In this embodiment, the meaning of the third group of LTL formula templates is that one atomic proposition before the atomic proposition must be ; thus, the first atomic proposition in the positive example must not be the atomic proposition .

[0031] S12, given the alphabet and the positive example set, each pair of different symbols in the alphabet forms a symbol pair, all possible symbol pairs in the alphabet are enumerated, and the three groups of LTL formula templates are instantiated, the partial order is defined through the implication relationship of the LTL formulas, and the more specific formulas are evaluated preferentially; for each group of LTL formula templates, if the specific LTL formula has been satisfied by all positive examples, the evaluation of the generalized formula is skipped; finally, the set of LTL formulas that are satisfied by all positive examples is screened out a set of linear temporal logic LTL formulas generated to characterize the temporal properties of the positive examples.

[0032] An example of defining a partial order by the implication relation of LTL formulas is: , which means that the LTL formula is more specific than the LTL formula .

[0033] S2, using the generated linear temporal logic LTL formulas, generating a set of potential negative examples, specifically including potential negative examples for evaluating the quality of the learned finite state automaton FSA , and potential negative examples for training the neural network .

[0034] wherein the potential negative examples and the positive example set constitute a training data set D, i.e., a training set .

[0035] Step S2 traverses the positive example set, randomly selects an LTL formula, and generates a potential negative example by mutation. In the specific process of generating a set of potential negative examples, for each positive example in the positive example set , i.e., for each positive example trace , i.e., for each positive example , randomly select an LTL formula from the set of LTL formulas that satisfies the temporal property of the positive example , i.e., randomly select an LTL formula that satisfies the temporal property of the positive example , and obtain a potential negative example that does not satisfy the temporal property of the LTL formula by mutating the positive example In this embodiment, the mutation rule from the positive example to the potential negative example is as follows: S21, if the LTL formula corresponds to a generalized formula of the first set of LTL formula templates in terms of expression form, then randomly select an atomic proposition from the positive example , i.e., randomly select an atomic proposition , and delete all atomic propositions after the atomic proposition S22, if the LTL formula corresponds to a specific formula of the second set of LTL formula templates in terms of expression form, then randomly select an atomic proposition from the positive example i.e., randomly select an atomic proposition , and the first appearing atomic proposition before the atomic proposition ; S23, if the LTL formula corresponds to a generalized formula of the third group of LTL formula templates in the expression form , then randomly select an atomic proposition from the positive example and the first appearing atomic proposition before the atomic proposition , i.e., randomly select an atomic proposition and the first appearing atomic proposition before the atomic proposition , exchange the positions of the atomic proposition and the atomic proposition in the positive example ; S24, if the LTL formula corresponds to a specific formula of the first group of LTL formula templates in the expression form , then randomly select an atomic proposition from the positive example , i.e., randomly select an atomic proposition , delete all atomic propositions immediately after the atomic proposition ; S25, if the LTL formula corresponds to a generalized formula of the second group of LTL formula templates in the expression form , then randomly select an atomic proposition from the positive example , i.e., randomly select an atomic proposition , insert an atomic proposition immediately after the atomic proposition ; S26, if the LTL formula corresponds to a specific formula of the third group of LTL formula templates in the expression form , then select the first appearing atomic proposition from the positive example and the atomic proposition immediately before the atomic proposition , i.e., select the first appearing atomic proposition and the atomic proposition immediately before the atomic proposition , exchange the positions of the atomic proposition and the atomic proposition in the positive examples .

[0036] S3, design and build a neural network FSAccept for parsing a finite state automaton FSA from a parameter assignment to simulate the acceptance behavior of the finite state automaton FSA; search the neural network FSAccept by gradient descent algorithm iteration until the maximum iteration number is reached, and finally mine the finite state automaton FSA.

[0037] In each iteration, the positive example set and the potential negative example constitute the training data set to train the neural network FSAccept, and the potential negative example is used as a validation set to evaluate the quality of the finite state automaton FSA learned by the current neural network during the training process, calculate the loss function, and retain the optimal finite state automaton FSA; the finally trained neural network FSAccept is interpreted as a specific optimal finite state automaton FSA.

[0038] Step S3 specifically includes the following steps: S31, given an alphabet and the number of states , randomly initialize the parameters of the neural network FSAccept , where is the transition matrix of the finite state automaton FSA, represents the acceptance state vector of the finite state automaton FSA, represents a symbol in the alphabet ; S32, for each trace in the training data set D, i.e. for each positive example in the training data set D, , calculate the neural network acceptance vector: ; where is an activation function, is the intermediate result calculated in the th step, represents the length of the positive example ; and are calculated as follows: ; ; ; where is the intermediate result calculated in the th step, Indicates the first Intermediate results of the calculation steps; This represents the transition matrix of a finite state automaton (FSA). Indicates the initial value for the calculation. Let I represent the transpose of the initial vector, and N be the number of states in the finite state automaton (FSA). Indicates the activation function; This represents a hyperparameter, typically set to 0.001.

[0039] With the first Taking step-by-step calculation as an example, the intermediate results of the calculation This indicates starting from the initial state, based on the positive example. The former A vector of elements, representing the probability of reaching each state.

[0040] S33, Calculate the training dataset The neural network accepts vectors with positive examples Authentic Labels The mean squared error between the two values ​​is used as the loss function to train the parameters of the FSAccept neural network. ; S34. Interpreting neural network parameters as specific optimal finite state automata (FSA): for parameters Each item If the activation function but ,otherwise Finally, the transition matrix and accepting state vector of the specific optimal finite state automaton (FSA) are obtained.

[0041] Furthermore, this embodiment also provides a software behavior verification method, which includes the steps S1-S3 described above in this embodiment, as well as the following steps: S4. Use the finite state automata (FSA) obtained from the mining process to verify the software behavior and whether the software meets the software requirements specification.

[0042] The specific verification process includes: comparing with the software requirements specification, identifying abnormal nodes or migrations, thereby verifying whether the software meets the software requirements specification and discovering potential vulnerabilities in the software.

[0043] Furthermore, this embodiment also provides a software behavior verification system, including the following modules: The construction module is used to construct an approximate canonical mining model based on neural automata inference according to the construction method of this embodiment, and to mine a finite state automaton (FSA). The verification module uses the finite state automaton FSA obtained by mining to perform software behavior verification to verify whether the software conforms to the software requirement specification.

[0044] The following uses the Java class StringTokenizer as the target library class to further illustrate the entire process of mining the finite state automaton FSA describing the application program interface API behavior of the target library class. Figure 2 The real finite state automaton FSA corresponding to the StringTokenizer class is shown, including the interaction of four APIs: STN, HMTT, HMTF, and NT. Among them, the alphabet , the number of states The target of the present embodiment is to learn the finite state automaton FSA consistent with the one shown in FIG. 1 from the given positive example set, which specifically includes the following steps. Figure 2 Step one, traverse the positive example set, enumerate all symbol pairs and instantiate for the predefined six formula templates, and find the LTL formula set describing the timing properties of the positive examples.

[0045] For the StringTokenizer class, the alphabet size is 4, the number of instantiated formulas for each formula template is 12, and the total number of formulas is 72. Traverse all the formulas to obtain the LTL formula set that is satisfied by all positive examples.

[0046] For example, given the positive example set {(STN, HMTF), (STN, NT, HMTF), (STN, HMTT), (STN, NT, HMTT), (STN, HMTT, NT, HMTF)}, enumerate all formulas to find the formulas that are satisfied by all positive examples; for example, the formula represents that HMTF never appears after HMTT, and all positive examples in the positive example set satisfy this formula, so this formula is added to the LTL formula set.

[0047] In order to improve the running efficiency, the formula templates are divided into three groups, each group including specific formulas and generalized formulas, and the specific formulas are enumerated first when enumerating the formulas, and if all positive examples satisfy the specific formulas, the evaluation of the generalized formulas is skipped. For example, assume that the specific formula obtained by traversing is The generalized formula corresponding to this formula is Since all positive examples satisfy this specific formula, the evaluation of the above generalized formula is skipped.

[0048] Step two, traverse the positive example set, randomly select an LTL formula , and obtain a potential negative example that does not satisfy the LTL formula by mutation. ​

[0049] For example, for a positive trace (STN, NT, HMTF), and LTL formula The corresponding formula template is According to the rules described in step two, one HMTF in the trace is selected, and an HMTT is inserted at a random position after the HMTF, thus generating a potential negative example (STN, NT, HMTF, HMTT).

[0050] This step traverses the entire positive example set to generate a negative example set for training and a negative example set for evaluation, which are combined with the positive example set to form a training set and a validation set, respectively, for the neural network training process in step three.

[0051] Step three, based on the training set and validation set obtained in step two, construct and train the approximate specification mining model based on neural automata acceptance inference.

[0052] Based on the training set and validation set obtained in step two, for each trace in the training set , calculate its neural network acceptance vector , and calculate the mean square error with the true label of the trace to obtain the loss function, and thus train the neural network parameters by gradient descent algorithm.

[0053] For the trained neural network parameters , calculate the function value of the activation function sigmoid, and according to the rules described in step three, obtain a 0-1 value transition matrix and acceptance state vector, and convert the transition matrix and acceptance state vector into the form of transition function and acceptance state set to obtain the final finite state automaton FSA.

[0054] Step four, based on the approximate specification mining model based on neural automata acceptance inference constructed in step three, perform software behavior verification.

[0055] After obtaining the final FSA based on the approximate specification mining model proposed in this embodiment, software developers can use the FSA to verify software behavior. For example, assume Figure 3 is an FSA obtained by mining according to this embodiment. Software developers can find abnormal transitions in the mined FSA by comparing software requirement specifications, such as the red edges in Figure 3 If there are abnormal transitions in the mined FSA, it means that the software does not meet the software requirement specifications, and thus potential vulnerabilities in the software are found.

[0056] The above embodiments are the preferred embodiments of the present application, but the embodiments of the present application are not limited to the above embodiments, and any changes, modifications, substitutions, combinations, simplifications, etc. made without departing from the spirit and principles of the present application should be equivalent replacement manners and should be included in the protection scope of the present application.

Claims

1. A method for constructing an approximate canonical mining model, characterized in that, The method comprises the following steps: S1, based on the set of positive examples Generate a set of linear temporal logic (LTL) formulas to characterize the timing properties of positive examples; S2, using the generated linear temporal logic LTL formula, generating potential counterexamples for evaluating the quality of the learned finite state automaton FSA and potential counterexamples for training the neural network ; wherein the potential counterexamples and the set of positive examples comprise a training dataset D; S3, designing and constructing a neural network FSAccept for parsing a finite state automaton FSA from parameter assignments to simulate the acceptance behavior of the finite state automaton FSA; the neural network FSAccept is iteratively searched through a gradient descent algorithm until a maximum iteration number is reached, and finally the finite state automaton FSA is mined.

2. The construction method of claim 1, wherein, Step S1 comprises: S11, predefining three groups of LTL formula templates, each group of LTL formula templates comprising a generalized formula and a corresponding specific formula; S12, given an alphabet and a set of positive examples, enumerating all possible symbol pairs in the alphabet, instantiating the three groups of LTL formula templates, defining a partial order through the implication relationship of LTL formulas, and preferentially evaluating more specific formulas; for each group of LTL formula templates, if the specific LTL formula has been satisfied by all positive examples, skip the evaluation of the generalized formula thereof; finally, screen out a set of LTL formulas that are satisfied by all positive examples, as a group of linear temporal logic LTL formulas generated for characterizing the temporal properties of the positive examples; The generalized formula of the first set of LTL formula templates in step S11 represents an atomic proposition The atomic proposition must occur after The corresponding concrete formula represents an atomic proposition The atomic proposition must occur immediately after ; Generalized formula representation of atomic propositions for the second set of LTL formula templates Immediately after the atomic proposition does not appear again Corresponding concrete formula representation of atomic propositions The atomic proposition never appears after ; The third group of LTL formula templates generalizes the formula representation of atomic propositions The atomic proposition must appear before The corresponding concrete formula represents the atomic proposition The atomic proposition must appear immediately before .

3. The construction method of claim 2, wherein, In step S2, during the generation of the potential negative example set, for each positive example set... Positive examples Randomly select positive examples from the LTL formula set. LTL formulas that satisfy timing properties Through positive examples of mutation Obtaining LTL formulas that do not satisfy the timing properties Potential negative examples .

4. The construction method according to claim 3, characterized in that, The mutation rule from the positive examples to the potential negative examples in step S2 comprises the following steps: S21, if LTL formula In the expression form corresponding to the first set of LTL formula templates, the generalized formula is obtained from the positive examples A random atomic proposition , delete all atomic propositions After the atomic proposition ; S22, if the LTL formula In the expression form corresponding to the specific formula of the second group of LTL formula templates, a positive example Randomly select an atomic proposition , Insert the atomic proposition After a random position ; S23, If the LTL formula In terms of expression, it corresponds to the generalization formula of the third group of LTL formula templates. Therefore, starting from the positive example... Randomly select an atomic proposition and located in atomic propositions The first atomic proposition that appeared before The proposition of commutation of atoms and atomic propositions In positive examples The position in the middle; S24, if the LTL formula In the expression form corresponding to the specific formula of the first group of LTL formula templates, then from the positive examples Randomly select an atomic proposition , delete all atomic propositions Immediately after the atomic proposition ; S25, if the LTL formula corresponding to the generalization of the second set of LTL formula templates in the expression form, then from the positive examples a random atomic proposition , the atomic proposition is inserted at the position immediately after the atomic proposition ; S26. If the LTL formula In the case of a concrete formula corresponding to the third group of LTL formula templates in the expression form, the first occurring atomic proposition is selected from the positive example and the atomic proposition immediately preceding the atomic proposition are exchanged in the positive example and the atomic proposition is exchanged in the positive example .

5. The construction method of claim 1, wherein, In each iteration of step S3, the neural network FSAccept is trained using the training dataset D and the latent negative examples are used during the training process To evaluate the quality of the finite state automaton FSA learned by the current neural network, a loss function is calculated, and the optimal finite state automaton FSA is retained; the finally trained neural network FSAccept is interpreted as a specific optimal finite state automaton FSA.

6. The construction method of claim 5, wherein, Step S3 comprises: S31, given alphabet with the number of states , randomly initializing parameters of the neural network FSAccept wherein is a transition matrix of the finite state automaton FSA, denotes an acceptance state vector of the finite state automaton FSA, denotes an alphabet a symbol from the alphabet S32, for each positive example in the training data set D , compute a neural network acceptance vector ; S33. Calculate the neural network acceptance vector on the training dataset D. with positive examples Authentic Labels The mean squared error between the two values ​​is used as the loss function to train the parameters of the FSAccept neural network. ; S34, interpreting the neural network parameters as a concrete optimal finite state automaton FSA: for each parameter if the activation function then , else resulting in a concrete optimal finite state automaton FSA's transition matrix and acceptance state vector.​ 7. The construction method of claim 6, wherein, Step S32 computes a vector of features for each positive example in the training data set D , , the neural network accepts a vector of computations ; wherein, represents an activation function, represents the i-th intermediate result of the step calculation, represents the length of the positive example ; and are calculated as follows: ; ; ; wherein represents the intermediate results of step represents the intermediate results of step represents a transition matrix of a finite state automaton FSA, represents an initial value of the computation, represents the transpose of the initial vector I, N is the number of states of the finite state automaton FSA, represents an activation function; represents a hyperparameter.

8. A software behavior verification method characterized by comprising: The construction method comprises any one of claims 1-7, and comprises the steps of: S4, using the mined finite state automaton FSA to perform software behavior verification.

9. A software behavior verification system, characterized by, The method comprises the following modules: The construction module is configured to implement the construction of an approximate specification mining model based on neural automaton acceptance inference according to the construction method in any one of claims 1-7, and mine the finite state automaton FSA; The verification module is configured to use the mined finite state automaton FSA to perform software behavior verification to verify whether the software conforms to the software requirement specification.

Citation Information

Patent Citations

  • Declarative EFSA inference algorithm and kTails and Synotic declaration method thereof

    CN112925560A

Cited By

  • Multi-level protocol software dangerous behavior detection method

    CN121859332A

  • A multi-level protocol software dangerous behavior detection method

    CN121859332B