Formalized proving device and method based on large language model
By using a formal proof device based on a large language model, model description and attribute reduction description codes are generated, and multiple model verification tools are integrated, the problem of low efficiency in formal proof in the prior art is solved, and more comprehensive formal proof and higher efficiency are achieved.
Patent Information
- Application Number
- CN202411246636.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, software models have complex logic and numerous state parameters. Manually writing code makes it difficult to fully and accurately describe the model logic and attribute specifications, resulting in inefficient formal proofs and a lack of widely applicable model verification tools.
A formal proof apparatus based on a large language model is adopted. The formal modeling module generates model description code and attribute reduction description code, and integrates multiple model verification tools to achieve the integration of various formal proof methods.
It improves the capabilities and efficiency of model and attribute descriptions, enables more comprehensive formal proofs, reduces the risk of errors, and enhances the reliability and efficiency of formal proofs.
Smart Images

Figure CN121635856A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to a formal verification apparatus, method, electronic device and readable medium based on a large language model. BACKGROUND
[0002] Formal verification is to establish a model of requirements, schemes, codes, etc., describe property specifications, and prove whether the property specifications conform to the model based on axiomatic formal semantics, models and property specification languages, and pre-defined symbolic systems. The formal verification method can reveal inconsistencies hidden in software systems and find potential errors, and thus is a software quality testing and verification method adopted by many important information systems.
[0003] In the prior art, due to the logical complexity of the software model itself and the existence of many state parameters, the model logic and property specifications cannot be accurately and comprehensively described by manually writing code for formal verification. SUMMARY
[0004] The embodiments of the present disclosure provide a formal verification apparatus, method, electronic device and readable medium based on a large language model, which can improve the ability and efficiency of model description and property description in the formal verification model verification process.
[0005] To achieve the above technical purposes, the embodiments of the present disclosure adopt the following technical solutions:
[0006] In a first aspect, the embodiments of the present disclosure provide a formal verification apparatus based on a large language model, which comprises a formal modeling module, a code editing module and a formal verification module, the formal modeling module comprises a modeling expert model obtained by fine-tuning training based on a large language model, and wherein:
[0007] The formal modeling module is configured to generate model description code and property specification description code based on the modeling expert model in response to a model verification request of formal verification;
[0008] The code editing module is configured to generate model verification code based on the model description code and the property specification description code according to the code format requirements of the formal verification module;
[0009] The formal verification module is configured to perform formal verification based on the model verification code.
[0010] In some possible implementation manners, the formal modeling module comprises one or more modeling expert models, the formal verification module comprises one or more model verification tools, and the modeling expert model and the model verification tool are one-to-one corresponding through a model identifier.
[0011] In some possible implementation manners, the model verification request comprises a model identifier;
[0012] The formal modeling module is further configured to determine an adopted modeling expert model according to the model identification, to generate model description code and property specification description code;
[0013] The formal proof module is further configured to perform formal proof based on a model checking verification tool corresponding to the model identification.
[0014] In some possible implementation manners, the data set for fine-tuning training includes one or more of the following: a model checking tool coding modeling data set, a model checking property specification data set, a model checking example data set, and an abstract and refinement advanced modeling technology data set.
[0015] In some possible implementation manners, the model checking request includes formal proof requirements and keywords of property descriptions;
[0016] The keywords of the formal proof requirements and the property descriptions are selected from a keyword library of the formal proof requirements and the property descriptions.
[0017] In some possible implementation manners, the model checking request further includes property description heuristic hints to generate property specification description code through an emergent ability of the modeling expert model;
[0018] and / or;
[0019] The model checking request further includes path quantifier and timing modal words of the property descriptions;
[0020] and / or;
[0021] The keywords in the model checking request are keyword-protected.
[0022] In some possible implementation manners, the code editing module further includes a model checking tool plug-in to check the model description code, the property specification description code, and / or the model checking code.
[0023] In a second aspect, the embodiments of the present disclosure provide a formal proof method based on a large language model, and the method comprises the following steps:
[0024] In response to a model checking request for formal proof, model description code and property specification description code are generated based on a modeling expert model, wherein the formal modeling module includes a modeling expert model obtained through fine-tuning training based on a large language model;
[0025] Model checking code is generated based on the model description code and the property specification description code according to a code format requirement of the formal proof module;
[0026] Formal proof is performed based on the model checking code.
[0027] In a third aspect, an electronic device is provided, including: one or more processors; and a storage device storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the formal verification method based on a large language model according to the second aspect.
[0028] In a fourth aspect, a computer readable medium is provided, and the computer readable medium stores a computer program, when the computer program is executed by a processor, the processor implements the formal verification method based on a large language model according to the second aspect.
[0029] The first aspect provided by the embodiments of the present disclosure at least brings the following beneficial effects: the modeling expert model is obtained based on the fine-tuning training of the large language model, the formalization modeling module generates the model description code and the property specification description code based on the modeling expert model in response to the model checking request of the formal verification, the code editing module generates the model checking code based on the model description code and the property specification description code according to the code format requirement of the formalization proving module, and the formalization proving module performs the formal verification based on the model checking code. The embodiments of the present disclosure obtain the modeling expert model based on the fine-tuning training of the large language model, and generate the model description code and the property specification description code relying on the modeling expert model, which improves the capability and efficiency of the model description and the property description. In addition to the above effects, since different detection objects involve different model checking and verification tools, the integration of multiple formal verification methods can be realized through the large language model, which further improves the capability and efficiency of the formal verification.
[0030] It should be noted that the technical effects brought by any one of the implementation manners of the second aspect to the fourth aspect can refer to the technical effects brought by the corresponding implementation manners in the first aspect, which will not be described here again.
[0031] The further effects of the above-mentioned non-conventional optional manners will be described in combination with the specific embodiments below. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments of the present disclosure will be briefly introduced below. Obviously, the drawings described below only relate to some embodiments of the present disclosure, but not limit the present disclosure.
[0033] Figure 1 A system architecture diagram of the formal verification device based on a large language model according to at least one embodiment of the present disclosure is shown;
[0034] Figure 2 A modeling expert model training principle illustration diagram of the formal verification method based on a large language model according to at least one embodiment of the present disclosure is shown;
[0035] Figure 3 A main step schematic diagram of the formal verification method based on a large language model is shown according to at least one embodiment of the present disclosure;
[0036] Figure 4 A model description code and property reduction description code generation step schematic diagram of the formal verification method based on a large language model is shown according to at least one embodiment of the present disclosure;
[0037] Figure 5 A model checking code generation step schematic diagram of the formal verification method based on a large language model is shown according to at least one embodiment of the present disclosure;
[0038] Figure 6 A model checking code execution step schematic diagram of the formal verification method based on a large language model is shown according to at least one embodiment of the present disclosure;
[0039] Figure 7 A schematic diagram of an electronic device is shown according to at least one embodiment of the present disclosure;
[0040] Figure 8 A schematic diagram of a readable storage medium is shown according to at least one embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure. Based on the described embodiments of the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without any inventive effort fall within the scope of protection of the present disclosure.
[0042] In the following, any method, device, example and content that does not completely correspond to the scope defined by the claims is not obtained according to the present disclosure, and these methods, devices, examples and content and all subsequent descriptions only serve the purpose of illustration or highlight specific aspects or features of the claims.
[0043] Note that the examples to be introduced next are only specific examples, and are not as limitations on the embodiments of the present disclosure, which must be specific shapes, hardware, connection relationships, operations, values, conditions, data, sequences, etc. shown and described. A person skilled in the art can use the concept of the present disclosure to construct more embodiments not mentioned in the present specification by reading the present specification.
[0044] The terms used in the present disclosure are those general terms currently widely used in the art in consideration of the functions related to the present disclosure, but the terms can vary according to the intention of those of ordinary skill in the art, precedents, or new technology in the art. Also, specific terms can be selected by the applicant, and in this case, the detailed meanings thereof will be described in the detailed description of the present disclosure. Therefore, the terms used in the specification should not be understood as simple names, but based on the meanings of the terms and the overall description of the present disclosure.
[0045] In order to better understand the embodiments of the present disclosure, first, the related terms related to the present disclosure are defined and explained.
[0046] Formal verification refers to establishing a model for requirements, schemes, code, etc., describing property specifications based on axiomatic formal semantics, models, and property specification languages, and a predefined symbolic system, and proving whether the property specifications conform to the model. The objects of formal verification include software systems, schemes, code, etc., and the formal verification method can reveal inconsistencies hidden in software systems and find potential errors, so it is a software quality testing and verification method that many important information systems will adopt.
[0047] The formal verification method includes model checking, symbolic execution, constraint solving, theorem proving, etc. Among various formal verification technology routes, model checking is a relatively mature formal verification method in the industry, and many implementation tools have been introduced in the industry.
[0048] Model checking is a technology for automatically verifying finite state concurrent systems, which generally describes system behavior in an automaton mechanism and describes system properties in mathematical logic such as temporal logic, and then the model checking tool determines whether the system satisfies the given properties by traversing all states or execution paths of the system model.
[0049] Large language models are a class of highly parameterized artificial intelligence systems that use deep learning techniques, especially neural networks based on the Transformer architecture, to process and generate natural language text. These models learn the complex patterns and structures of language by training on large-scale text datasets, and integrate various techniques such as unsupervised learning, supervised learning, and reinforcement learning, with strong inductive and reasoning capabilities.
[0050] It should be noted that in the technical solutions of the embodiments of the present disclosure, the collection, collection, updating, analysis, processing, use, transmission, storage, etc. of user personal information involved in the technical solutions comply with the relevant legal regulations, are used for legal purposes, and do not violate public order and good customs. Necessary measures are taken for user personal information to prevent illegal access to user personal information data, and to maintain user personal information security, network security and national security.
[0051] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to assist in understanding them. These should be considered as merely exemplary. Thus, those of ordinary skill in the art will recognize various changes, modifications, and implementations of the embodiments described herein to be within the scope and spirit of the present disclosure. Also, for the sake of brevity and clarity, descriptions of well-known functions and constructions are omitted from the following description.
[0052] The model checking process of formal verification includes the following main steps: the first step is to describe the model with the code language of a specific symbolic system; the second step is to describe the property specification with the language of a specific symbolic system; and the third step is to use the model checking tool (automatic tool) corresponding to the symbolic system to quickly verify whether the property specification conforms to the model. In the current model checking method, the work of describing the model and the property specification with the code language of a specific symbolic system in the first step and the second step is usually done manually. Formal verification method is a discipline based on mathematical logic, automata, graph theory and other mathematical theories, and talents with comprehensive background of applied mathematics, program development and the like are needed to carry out formal verification; meanwhile, the objects of model checking include requirements, schemes, codes, systems and the like. In actual work, the software model can be very large and complex, there are many state parameters, and the number of paths is huge, so the modeling link requires the program to have strong reasoning and analysis ability, and the comprehensive ability of the person is extremely high, therefore, it is difficult to comprehensively and accurately describe the model logic and the property specification in the way of manually writing code to describe the model and the property specification; meanwhile, there are problems such as huge workload and low efficiency.
[0053] In addition, the current mainstream single model checking tool has its applicability for specific fields and specific capability verification, and it is difficult to give a comprehensive proof for a system or a requirement; moreover, the use threshold of each tool is extremely high, and the difference is great, and the developers need to have comprehensive ability of programming, mathematical logic, automata, graph theory and the like to master one tool, and it is more difficult to conveniently master and use multiple model checking tools. Therefore, there is currently a lack of widely applicable and general-purpose model checking tools or platforms.
[0054] The modeling expert model is obtained based on the fine-tuning training of the large language model, and the model description code and the property specification description code are generated relying on the modeling expert model, which improves the capability and efficiency of model description and property description. Meanwhile, a feedback optimization mechanism is introduced to further improve the efficiency and accuracy of the model description and property description in the model checking process of formal verification. In addition to the above functions, since different detection objects involve different model checking verification tools, the integration of various formal verification methods can be realized through the large language model, which further improves the capability and efficiency of formal verification, and a general-purpose model checking solution can be obtained.
[0055] Figure 1 A system architecture diagram of a formal proof apparatus based on a large language model according to at least one embodiment of the present disclosure is shown. Figure 1 The device includes a formal modeling module 110, a code editing module 120, and a formal proof module 130. The three modules are connected via API. The formal modeling module 110 includes one or more modeling expert models obtained by fine-tuning training based on a large language model 111. The code editing module 120 includes a code editor 121. The formal proof module 130 includes one or more model verification tools.
[0056] The formal modeling module 110, based on the large language model 111, can generate code based on user requirements. Its main function is to understand the formal proof requirements (model verification requests) input by the user and generate corresponding formal proof code (including model description code and attribute reduction description code). Simultaneously, based on feedback from the user, the code editing module 120, or the formal proof module 130, it can adjust, modify, and optimize the previously generated model description code and attribute reduction description code, and regenerate the code. Specifically, in response to the user's input formal proof model verification request, the formal modeling module 110 generates model description code and attribute reduction description code based on one or more modeling expert models and imports them into the code editing module 120.
[0057] The function of the code editing module 120 is to generate corresponding code file formats for the code generated by the formal modeling module 110 according to the requirements of the model verification tool; and to check the code based on the model verification tool plugin. Specifically, the code editing module 120 generates model verification code based on the model description code and attribute specification description code according to the code format requirements of the formal proof module, and imports it into the formal proof module 130.
[0058] The formal proof module 130 imports the code generated by the code editing module 120, runs the code to perform model verification, and if the model verification code runs successfully, the tool will display the result, such as the rule being True or False; if the model verification code runs unsuccessfully, the tool will return an error message. Specifically, the formal proof module 130 performs formal proof based on the model verification code.
[0059] The code editing module 120 checks the model description code and attribute specification description code generated by the formal modeling module 110. When an error is found, it will be fed back to the formal modeling module 110 for revision. The formal proof module 130 performs formal proof on the model verification code generated by the code editing module 120. When the verification fails, it will feed back the error to the formal modeling module 110 or the code editing module 120 for code revision, depending on the situation.
[0060] It is understandable that formal proof model verification is based on mathematical theories such as mathematical logic, automata, and graph theory, thus offering numerous implementation paths and approaches. Currently, the industry offers many open-source or commercial model verification tools, such as Nusmv, TLA, SPIN, CBMC, and UPPAAL. Each tool uses a different symbol system (development language), employs different mathematical reduction logic, possesses different system attribute proof capabilities, and is suitable for different system objects. For example, among different model verification tools, some are suitable for verifying chips, while others are suitable for verifying cryptographic protocols. Therefore, optionally, when different model verification tools are needed to execute formal proofs, a corresponding modeling expert model can be selected in the formal modeling module 110; that is, the formal modeling module 110 can integrate one or more modeling expert models, each corresponding one-to-one with a model verification tool in the formal proof module 130. For example, the formal proof code generated by modeling expert model 1 can be executed and verified by model verification tool 1, but cannot be verified by other model verification tools. Compared to using a single model verification tool for formal proof, integrating multiple tools allows for a more comprehensive model description of the object being proven, broader attribute definitions, and more layers of proof. Furthermore, cross-validation through multiple model verification tools enhances the reliability of the formal proof.
[0061] Specifically, when the formal modeling module 110 integrates multiple modeling expert models and the formal proof module 130 integrates multiple model verification tools, a correspondence can be established through model identifiers, meaning that the modeling expert models and model verification tools are one-to-one corresponded through model identifiers. Thus, the model verification request issued by the user can further include the model identifier; the formal modeling module 110 determines the modeling expert model to be used based on the model identifier to generate model description code and attribute reduction description code; the code editing module 120 may include an integrated industry-standard code editor 121, supporting editing of multiple programming languages. After importing the code, it performs format conversion according to the model verification tool corresponding to the model identifier, creating a code file to ensure that subsequent model verification tools can read and execute it (each model verification tool supports different code file formats and syntax rules); and the formal proof module 130 also performs formal proof based on the model verification tool corresponding to the model identifier.
[0062] From the perspective of large language model applications, each modeling expert model is a customized model obtained by fine-tuning the large language model 111 on the training dataset. The modeling expert model can understand a formal requirement and, with the support of the general large language model, generate formal proof code, which is then proven by the corresponding model verification tool of the formal proof module 130. The fine-tuning training is carried out in the background of the large language model 111 system via API interface. Figure 2 A diagram illustrating the training principle of a modeling expert model based on a formal proof method using a large language model, according to at least one embodiment of this disclosure, is provided. Since many formal proof model verification tools exist in the industry, each with its corresponding symbolic language and encoding rules, fine-tuning training based on the large language model 111 is required for different model verification tool training datasets to obtain different modeling expert models. This work requires constructing a training dataset, which includes one or more of the following: a model verification tool encoding modeling dataset, a model verification attribute reduction dataset, a model verification example dataset, and an abstraction and refinement advanced modeling technique dataset.
[0063] For different model validation tools, the steps for generating expert model X, based on a prepared training dataset, include:
[0064] The large language model 111 was trained on the model validation tool's coding modeling dataset, mainly learning the symbolic language, syntax rules, coding logic, and expressions of the model validation tool.
[0065] The large language model 111 is trained on the model validation attribute reduction dataset. The main purpose is to learn the semantics of the relevant attribute reductions and the reduction expression methods, such as linear temporal logic (LTL) and CTL (computation tree logic) and other temporal logic reductions.
[0066] The large language model 111 was trained on the model validation example dataset, which consists of model validation cases that were previously implemented and validated using manual coding methods.
[0067] We learn formal proof-based advanced modeling methods such as abstraction and refinement on a dataset of advanced modeling techniques for abstraction and refinement using a large language model 111.
[0068] Figure 3 A schematic diagram illustrating the main steps of a formal proof method 300 based on a large language model according to at least one embodiment of the present disclosure is shown. The specific method includes:
[0069] In step S301, the formal modeling module 110, in response to the model verification request for formal proof, generates model description code and attribute reduction description code based on the modeling expert model. The formal modeling module includes a modeling expert model obtained through fine-tuning training of a large language model. Specifically, Figure 4 A schematic diagram illustrating the steps for generating model description code and attribute reduction description code in a formal proof method based on a large language model according to at least one embodiment of the present disclosure.
[0070] Step S3011: Submit a formal proof model verification request, including a description of the formal proof content and hints for attribute requirements. Specifically, the user submits a description of the content requiring formal proof and hints for attribute requirements to the modeling expert model of the formal modeling module 110.
[0071] To mitigate the illusion problem of the large language model 111 and facilitate its better understanding of formal proof requirements, at least one embodiment of this disclosure employs a keyword library method. Specifically, a keyword library is established, and the model verification request includes keywords related to formal proof requirements and attribute descriptions; these keywords are selected from the keyword library.
[0072] Specifically, firstly, a keyword library for formal proof requirements and attribute descriptions is established to standardize the description of formal proof requirements. These keywords can include technical terms, custom functions / parameters, attribute features, and quantifiers and modal terms related to attribute features. When generating a model verification request, the request includes the keywords for formal proof requirements and attribute descriptions, and these keywords are generated based on the keyword library.
[0073] Optionally, when users input suggestion words, certain keyword rules can also be used, for example:
[0074] Keyword Input Protection Rules. Large language models 111 typically split user-input natural language descriptions into multiple tokens. To prevent important keywords from being mistakenly split into multiple tokens and to reduce the large language model 111's misunderstanding of formal proof requirements and attributes, at least one embodiment of this disclosure will, depending on the specific circumstances, take protection measures for keywords in user-input formal proof requirements, including subjects, objects, attribute features, quantifiers, modal words, etc., including:
[0075] 1) Use double quotes to indicate keywords, indicating that the large language model 111 will no longer split keywords during natural language processing. For example, descriptions such as "process", "activity", "fairness", and "never" are "Tokens" that will no longer be split.
[0076] 2) Add supplementary explanations for keywords. For example, if the input includes the keyword "process", add a similar explanation: "A thread is the smallest unit of CPU scheduling".
[0077] Alternatively, formal proof of attribute keyword description rules can be used. To enhance the large language model's (111) correct understanding of the system attribute keywords to be proven, some attribute keyword description rules can optionally include, for example:
[0078] 1) The attribute description includes keywords such as path quantifiers and temporal modal words, and keyword input protection is implemented. Some path quantifiers are such as "all" and "exist"; some temporal modal words are such as "next", "future", "all future", and "until". The role of these keywords is to help the large language model 111 to map the attributes to be proved to the corresponding mathematical logic methods.
[0079] 2) When describing categorical attributes such as security, activity, and fairness, relevant keywords can be included, and keyword input protection can be implemented. For example, when describing security attributes, keywords can include "never" and "always"; for example, keywords in describing activity attributes can include "eventually". These keywords can help the large language model111 to match them with the attribute categories to be proven.
[0080] Table 1 uses the formal proof of a commonly used process deadlock scenario in software development systems as an example. Users can input the following prompts into the formal modeling module 110.
[0081]
[0082] In some embodiments of this disclosure, the formal modeling module 110 and the formal proof module 130 can simultaneously support different model verification tools. The formal proof module 130 includes multiple model verification tools, forming a toolset, and includes tool scheduling functions. Optionally, multiple model verification tools can be selected simultaneously for formal proof. In this case, the prompts input to the formal modeling module 110 specify the selection of two or more model verification tools to perform formal proof from different perspectives. The prompts are shown in Table 2.
[0083]
[0084]
[0085] In Table 2, when multiple model verification tools 1 and 2 are selected simultaneously for formal proof, the formal modeling module 110 will generate formal proof code for model verification tools 1 and 2 respectively based on its understanding of the formal proof requirements. The formal proof module 130 can then import the formal proof code into model verification tools 1 and 2 respectively through scheduling, and carry out model verification work at the same time.
[0086] Using multiple tools for formal proof has certain technical advantages, including more comprehensive proof of system properties, cross-validation and comparison of multiple tools to improve the reliability of proof results, and parallel operation of multiple tools to improve proof efficiency.
[0087] In step S3012, the formal modeling module 110 generates model description code and attribute specification description code based on the model verification request. Examples of code generation based on prompts are shown in Table 3.
[0088]
[0089]
[0090] In some possible implementations, the model validation request also includes attribute description heuristics to generate attribute reduction description codes through the emergent capabilities of the modeling expert model. Specifically, since attribute descriptions can be very rich, heuristics often struggle to cover all attributes. Therefore, the emergent capabilities of the modeling expert model can be used to mine more system attributes and generate attribute reduction description codes. For example, interaction can be performed using the attribute description heuristics examples in Table 4:
[0091] Table 4: Examples of attribute description heuristic cue words Please provide more "attributes" for the above scheme and describe the code with time sequence logic.
[0092] The modeling expert model will propose more attributes based on the attribute description heuristics words and provide code descriptions for the attributes. Table 5 shows examples of attribute codes generated based on the attribute description heuristics words in Table 4.
[0093]
[0094]
[0095] Since the attributes of the objects to be formally proven are countless, humans can only define a limited number of attributes, making it impossible to comprehensively describe and prove the system's attributes. However, in the process of attribute reduction description based on large language models, the emergent nature of the large model can proactively propose many new attributes that are not easily thought of by technical personnel, thereby improving the attribute reduction description capability.
[0096] Step S3013: Check the code to determine if it meets the formal proof requirements. If it meets the formal proof requirements, further import the model description code and attribute reduction description into the code editing module 120 via the API interface (step S3014); if it does not meet the formal proof requirements, continuous optimization can be achieved by adjusting the prompt words (step S3015). That is, for the generated model description code and attribute reduction description code, the user can use the prompt words to ask the model to optimize and modify according to the problems, forming a continuous optimization feedback process.
[0097] In step S302, the code editing module 120 generates model verification code based on the generated model description code and attribute reduction description code, according to the code format requirements of the formal proof module. Specifically, Figure 5 A schematic diagram illustrating the model verification code generation steps of a formal proof method based on a large language model according to at least one embodiment of the present disclosure is shown.
[0098] Step S3021: Merge the model description code and the attribute specification description code, and import them into the workspace file. Specifically, the user creates a corresponding workspace in the code editor 121, creates a file in the workspace, and imports the model description code and attribute specification description code generated by the formal modeling module 110 into the workspace file of the code editor 121 through the API interface.
[0099] Step S3022: Generate model verification code according to the code requirements of the model verification tool. Specifically, the corresponding model verification tool plugin can be installed in advance in the code editor 121, and a code file that the model verification tool can recognize and run can be generated according to the code file format requirements of the model verification tool. It can be understood that when the model verification request includes model identifiers of multiple model verification tools, model verification code corresponding to each of the multiple model verification tools will be generated separately.
[0100] Step S3023: Check the code to determine if it meets the formal proof requirements. Specifically, the model verification tool plugin can be used to check the model description code, attribute specification description code, and / or model verification code to identify potential problems. If the code is problem-free, import the model verification code into the model verification tool of the formal proof module 130 (step S3024); if there are obvious problems, the code can be modified independently, or feedback based on the problems can be submitted to the formal modeling module 110 for modeling experts to optimize and modify the model, generating modified model description code and attribute specification description code (step S3025). This is a continuous optimization and feedback process; the optimized and modified model description code and attribute specification description code are then re-imported into the workspace.
[0101] Step S303: Formal proof module 130 performs formal proof based on model verification code. Specifically, Figure 6 A schematic diagram illustrating the code execution steps of a formal proof method based on a large language model according to at least one embodiment of the present disclosure is shown.
[0102] Step S3031: Start the model verification tool. For example, determine the model verification tool based on the model identifier in the model verification request, and start the tool.
[0103] Step S3032: Input the instruction to perform formal proof based on the model verification code.
[0104] Step S3033: Verify if the model code executes correctly. If it executes correctly, proceed to step S3034; if it fails to execute correctly, proceed to step S3035.
[0105] Step S3034: Return the proof result, indicating that the attribute to be proved is TRUE or FALSE, and the proof is complete.
[0106] In step S3035, the model verification code execution reports an error. Based on the error message and error type, choose to return to the formal modeling module 110 or the code editing module 120 to regenerate the code. That is, if the error comes from the generation process of the model description code and the attribute specification description code, return to the formal modeling module 110; if the error comes from the generation process of the model verification code, return to the code editing module 120.
[0107] This disclosure discloses an expert model for modeling obtained through fine-tuning training of a large language model. The expert model is then used to generate model description code and attribute reduction description code, improving the capability and efficiency of model and attribute description while reducing errors and risks. In addition to the above benefits, since different detection objects involve different model verification tools, the large language model enables the integration of various formal proof methods, further enhancing the capability and efficiency of formal proof.
[0108] It should be noted that the above application scenarios are merely exemplary, intended to describe one or more aspects of this disclosure in specific scenarios. However, these aspects are not essential, and various modifications can be made to the application scenario. It is readily understood that the specific application scenarios described in this disclosure are not limited.
[0109] At least some embodiments of this disclosure also provide an electronic device. Figure 7 A schematic diagram of an electronic device 700 according to at least one embodiment of the present disclosure is shown.
[0110] like Figure 7 As shown, the electronic device 700 includes one or more processors 710 and a memory 720. The memory 720 includes one or more computer program modules 721. These computer program modules 721 are stored in the memory 720 and are executed by the processor 710. Each computer program module 721 includes instructions for executing the formal proof method 300 based on a large language model according to at least one embodiment of the present disclosure and its additional aspects. When executed by the processor 710, it can perform one or more steps of the formal proof method 300 based on a large language model according to at least one embodiment of the present disclosure and its additional aspects. The memory 720 and the processor 710 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown). For example, the bus can be a Peripheral Component Interconnect Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0111] For example, processor 710 may be a central processing unit (CPU), a digital signal processor (DSP), or other processing unit with data processing and / or program execution capabilities, such as a field-programmable gate array (FPGA). Processor 710 may be a general-purpose processor or a special-purpose processor, capable of controlling other components in electronic device 700 to perform desired functions.
[0112] Exemplarily, memory 720 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules 721 may be stored on the computer-readable storage medium, and processor 710 may run one or more computer program modules 721 to implement various functions of electronic device 700. The computer program modules include multiple computer-executable instructions. Various application programs and various data, as well as various data used and / or generated by the application programs, may also be stored in the computer-readable storage medium.
[0113] For example, electronic device 700 may also include input devices such as touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, and gyroscopes; output devices such as liquid crystal displays, speakers, and vibrators; storage devices such as magnetic tapes and hard disks (HDDs or SDDs); and communication devices such as network interface cards like LAN cards and modems. The communication devices allow electronic device 700 to communicate wirelessly or wiredly with other devices to exchange data and perform communication processing via networks such as the Internet. A drive is connected to the I / O interface as needed. Removable storage media, such as disks, optical disks, magneto-optical disks, and semiconductor memories, are installed on the drive as needed so that computer programs read from them can be installed into the storage device as required.
[0114] For example, the electronic device 700 may further include a peripheral interface (not shown in the figure). This peripheral interface can be of various types, such as a USB interface, a Lightning interface, etc. The communication device can communicate wirelessly with networks and other devices, such as the Internet, intranets and / or wireless networks such as cellular telephone networks, wireless local area networks (LANs) and / or metropolitan area networks (MANs). Wireless communication can use any of a variety of communication standards, protocols, and technologies, including but not limited to Global System for Mobile Communications (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (W-CDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Bluetooth, Wi-Fi (e.g., based on IEEE 802.11a, IEEE 802.11b, IEEE 802.11g, and / or IEEE 802.11n standards), Voice over Internet Protocol (VoIP), Wi-MAX, protocols for email, instant messaging, and / or Short Message Service (SMS), or any other suitable communication protocol.
[0115] The electronic device 700 can be, for example, a system-on-a-chip (SOC) or a device including the SOC. For instance, it can be any device such as a mobile phone, tablet computer, laptop computer, e-reader, game console, television, digital photo frame, navigator, home appliance, communication base station, industrial controller, server, etc., or any combination of data processing devices and hardware. The embodiments of this disclosure do not limit this. The specific functions and technical effects of the electronic device 700 can be found in the foregoing description of the formal proof method 300 based on a large language model according to at least one embodiment of this disclosure and its additional aspects, and will not be repeated here.
[0116] Figure 8 A schematic diagram of a readable storage medium 800 according to at least one embodiment of the present disclosure is shown.
[0117] like Figure 8 As shown, a computer program 810 is stored on a readable storage medium 800, which is a computer-readable storage medium. When the computer program 810 is executed by a processor, it performs one or more steps of the formal proof method 300 based on a large language model and its additional aspects as described above.
[0118] For example, when the program code is read by a computer, the computer can execute the program code stored in the computer storage medium to perform one or more steps to implement, for example, the formal proof method 300 based on a large language model and its additional aspects according to at least one embodiment of the present disclosure.
[0119] For example, the readable storage medium may include a memory card of a smartphone, a storage component of a tablet computer, a hard disk of a personal computer, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), flash memory, and other readable storage media or any combination thereof. The readable storage medium 800 may be a non-transitory readable storage medium.
[0120] At least some of the embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other.
[0121] It should be noted that, in this disclosure, relational terms such as "first," "second," etc., are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0122] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved; that is, the preceding or following operations are not necessarily executed precisely in sequence. Instead, various steps may be processed in reverse order or simultaneously as needed. Furthermore, other operations may be added to these processes, or one or more operations may be removed from these processes.
[0123] The units described in the embodiments of this disclosure can be implemented in software or hardware. The described units can also be located in a processor. The names of these units do not, in some cases, constitute a limitation on the unit itself.
[0124] The following points should be noted regarding this disclosure:
[0125] (1) The accompanying drawings of the embodiments of this disclosure only involve the structures involved in the embodiments of this disclosure. Other structures can be referred to the general design.
[0126] (2) Where there is no conflict, the embodiments of this disclosure and the features in the embodiments can be combined with each other to obtain new embodiments.
[0127] The above description is merely an exemplary embodiment of this disclosure and is not intended to limit the scope of protection of this disclosure, which is determined by the appended claims.
Claims
1. A formal verification apparatus based on a large language model, characterized in that, The device comprises a formal modeling module, a code editing module and a formal proof module, the formal modeling module comprises a modeling expert model obtained based on fine-tuning training of a large language model, wherein: The formal modeling module is configured to, in response to a model verification request for formal proof, generate model description code and property specification description code based on the modeling expert model; The code editing module is configured to generate model verification code based on the model description code and the property specification description code according to the code format requirements of the formal proof module; The formal proof module is configured to perform formal proof based on the model verification code.
2. The apparatus of claim 1, wherein, The formal modeling module comprises one or more modeling expert models, and the formal proof module comprises one or more model verification tools, the modeling expert model and the model verification tool are one-to-one corresponding through a model identifier.
3. The apparatus of claim 2, wherein, The model verification request comprises the model identifier; The formal modeling module is further configured to determine the modeling expert model to be used according to the model identifier, so as to generate the model description code and the property specification description code; The formal proof module is further configured to perform formal proof based on the model verification tool corresponding to the model identifier.
4. The apparatus of one of claims 1-3, wherein, The data set of the fine-tuning training comprises one or more of the following: model verification tool coding modeling data set, model verification property specification data set, model verification example data set, and abstract and refined advanced modeling technology data set.
5. The apparatus of one of claims 1-3, wherein, The model verification request comprises formal proof requirements and attribute description keywords; The formal proof requirements and attribute description keywords are selected from a keyword library of formal proof requirements and attribute description.
6. The apparatus of claim 5, wherein, The model verification request further comprises attribute description heuristic prompt words to generate the property specification description code through the emergence ability of the modeling expert model; And / or; The model verification request further comprises path quantifier and timing modal words of attribute description; And / or; The keywords in the model verification request are protected by keywords.
7. The apparatus of one of claims 1-3, wherein, The code editing module further comprises a model verification tool plug-in to check the model description code, the property specification description code and / or the model verification code.
8. A formal verification method based on a large language model, characterized in that, The method comprises: In response to a model verification request for formal proof, generating model description code and property specification description code based on a modeling expert model, wherein the formal modeling module comprises the modeling expert model obtained based on fine-tuning training of a large language model; Generating model verification code based on the model description code and the property specification description code according to the code format requirements of the formal proof module; Performing formal proof based on the model verification code.
9. An electronic device, comprising: Comprise: One or more processors; Storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method of claim 8.
10. A computer readable medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the method of claim 8.