A formal automatic theorem proving method based on explicit mode node search tree

By using an explicit pattern node search tree method, the problem of the separation between high-level proof strategies and low-level tactic prediction in existing technologies is solved. This method enables collaborative learning of pattern selection, action generation, and tactic prediction, thereby improving the efficiency and effectiveness of formal theorem proving.

CN122114094APending Publication Date: 2026-05-29EAST CHINA NORMAL UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
EAST CHINA NORMAL UNIV
Filing Date
2026-04-21
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing formal automatic theorem proving methods based on large language models lack explicit differentiation between different proof modes, resulting in a disconnect between high-level proof strategies and low-level tactic predictions, making unified learning difficult. Furthermore, the lack of a multi-granularity supervised sample construction mechanism makes it difficult to improve the ability to select proof modes, generate actions, and predict fine-grained tactic predictions.

Method used

The explicit pattern node search tree method is adopted to extend the formal theorem proof process into a two-layer decision-making approach. By constructing an explicit pattern node search tree and building a unified search organization and training update method around the distinction, collaborative learning of pattern selection, action generation and tactic prediction is achieved, and joint training is carried out using multi-granularity supervised samples.

Benefits of technology

It enhances the structured expression of the proof process, improves the model's adaptability to different proof states, and enhances the solution capability and scalability of complex formal theorem proof tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122114094A_ABST
    Figure CN122114094A_ABST
Patent Text Reader

Abstract

The application discloses a formal automatic theorem proving method based on an explicit mode node search tree, and has the characteristics that the method comprises the following steps: 1) formal theorem data acquisition and processing; 2) mode marking and training sample construction; 3) unified proving model training and candidate action probability under a selected proving mode; 4) construction of an explicit mode node search tree and generation of a candidate action under the selected proving mode; 5) execution and verification of a formal theorem prover; 6) updating of the unified proving model; and 7) use of the updated unified proving model for theorem proving tasks of higher difficulty levels and the like. Compared with the prior art, the application has the advantages of improving the adaptability of the model to different proving states, the solving capability in complex formal theorem proving tasks and the coordination between different levels of proving decisions, retaining high-level proving mode information in the search process, enhancing the structural expression capability of the proving process, and having good expansibility and application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of formal verification and artificial intelligence, specifically a formal automatic theorem proof method based on explicit pattern node search tree and multi-granularity supervised learning. Background Technology

[0002] Formal methods are a class of techniques that use rigorous mathematical language to describe systems, programs, or propositions, and prove their satisfaction of predetermined properties through logical reasoning or mechanical verification. They have significant application value in fields such as mathematical theorem verification, program correctness verification, and software and hardware system security analysis. Theorem proving, as one of the core technologies in formal methods, enables the step-by-step derivation and formal verification of the proposition to be proved through interactive or automated theorem provers, thereby ensuring the rigorous correctness of the proof process and results. Existing formal theorem proving typically relies on interactive theorem proving environments such as Lean, Isabelle, Coq, and HOL Light. While these environments provide high-reliability formal verification capabilities, in practice, users still need strong logical reasoning and formal language writing skills. They also require manual work such as proof strategy design, auxiliary lemma construction, target transformation, and proof script debugging. Therefore, the usage threshold is high, and the proof cost is significant, limiting the further promotion and application of formal verification technology.

[0003] With the development of large language models, formal automated theorem proving using large language models has gradually become an important research direction. Compared with traditional automated theorem proving methods that rely on manual rules or heuristic search, large language models can learn proof patterns, goal transformation methods, and common reasoning paths from a large amount of existing formal proof corpora, thereby improving the automation level of theorem proving to a certain extent. Furthermore, the proof results generated by large language models can be further verified by formal theorem provers. Therefore, even if the model has linguistic uncertainties, its final output can still be checked for syntax and semantics by formal verifiers to ensure the credibility of the results. However, existing formal automated theorem proving methods based on large language models still have significant shortcomings. One existing method directly predicts individual tactics step by step based on the current proof state and completes the entire proof process through continuous combination of tactics. This type of method has certain advantages in generating fine-grained proof steps and can adapt well to local goal transformation tasks. However, its proof process is usually modeled as a single-layer "state-to-action" mapping, making it difficult to explicitly represent high-level proof strategies. This leads to the model struggling to balance overall structural planning and local detailed reasoning when facing complex theorems, easily resulting in the problem of valid local decisions but unreasonable global proof paths. Another type of existing method generates complete proof code at once, or generates multiple lines of proof code at once, and then submits them to the theorem prover for verification. This type of method can utilize the long-range planning capabilities of large language models to some extent, but since a complete proof contains many detailed reasoning steps, if there are syntactic errors, semantic errors, or policy errors in any of the local steps, the entire proof may fail verification. Therefore, it has low fault tolerance and requires high overall generation stability of the model. In addition, in existing methods, even if a search mechanism is introduced to assist the proof process, it usually focuses mainly on whether the search results themselves can complete the theorem proof, and lacks a mechanism to uniformly transform the decision information obtained from different levels during the search process into training samples. In particular, existing methods typically lack a unified supervised learning framework for multi-layered decision-making information during the proof process, such as "which proof mode should be adopted in the current state," "what specific actions should be taken under the selected proof mode," and "further expanding local actions into a fine-grained tactic sequence." This leads to a disconnect between high-level decision learning and low-level tactic learning, making it difficult to simultaneously improve the model's overall policy capability and local reasoning ability. Furthermore, in complex formal theorem proof tasks, the proof process is often not simply about continuously applying goal transformation operations to the current objective; rather, it requires flexibly switching proof methods at different stages. For example, in some states, it is necessary to first introduce auxiliary propositions, intermediate conclusions, or bridging lemmas to expand the preceding contextual information; while in other states, it is more suitable to directly perform goal transformation operations such as rewriting, reduction, decomposition, induction, or classification discussion on the current objective.Existing methods typically fail to explicitly distinguish between the two different types of proof behaviors mentioned above, nor do they establish corresponding search organization methods and training sample construction methods around this distinction. Therefore, they struggle to fully utilize the high-level structural information in the proof process. Furthermore, when feeding back training data from the search trajectory, existing methods often only use complete proof results or single-step tactic results as supervision objects, lacking a multi-granularity sample construction mechanism capable of simultaneously constructing pattern-level, action-level, and tactic-level samples. This makes it difficult for the model to achieve unified and synergistic improvements across the three levels: high-level pattern selection, in-pattern action generation, and low-level tactic prediction.

[0004] In summary, existing theorem proving techniques lack a formal automated theorem proving method that can explicitly distinguish different proof modes during the formal theorem proving process, construct multi-granularity supervised samples using search results, and jointly train mode selection, action generation, and tactic prediction through a unified supervised learning mechanism. Furthermore, formal automated theorem proving methods based on large language models typically only model the proof process as a direct mapping from the current proof state to a single tactic, leading to a disconnect between high-level proof strategies and low-level tactic predictions, making unified learning difficult. Simultaneously, while existing search-driven proof methods can generate search trajectories, they generally lack a mechanism to uniformly transform decision information from different levels during the search process into supervised training samples, making it difficult to simultaneously improve proof mode selection, in-mode action generation, and fine-grained tactic prediction capabilities. Moreover, existing methods typically fail to explicitly distinguish between the fundamentally different proof behaviors of "introducing auxiliary propositions or intermediate conclusions" and "directly transforming the current goal," and do not establish corresponding search organization methods and training update methods around this distinction. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies by providing a formal automatic theorem proof method based on an explicit pattern node search tree. This method explicitly introduces proof pattern nodes into the search tree, extending the formal theorem proof process from a single-layer "state to tactic" decision-making approach to a two-layer "state to pattern, pattern to action" approach. This preserves high-level proof pattern information during the search process, thereby enhancing the structured expressiveness of the proof process. This method clearly distinguishes between context enhancement and target transformation behaviors, and constructs a unified search organization and training update method around this distinction. This allows high-level proof pattern selection and low-level specific action generation to be carried out collaboratively within the same framework, improving the model's adaptability to different proof states. By extracting pattern-level, action-level, and tactic-level samples from the highest-reward trajectory, the automatic conversion of search results into multi-granularity supervised training data is achieved, enabling pattern learning, action learning, and fine-grained tactic learning to be optimized together in a unified training process. This invention uses a unified proof model to generate corresponding actions under different pattern conditions, ensuring consistent state representation and training sources between pattern selection, intra-pattern action generation, and tactic prediction, which improves the coordination between different levels of proof decisions. By executing and verifying candidate actions through a formal theorem prover, the search trajectory and the constructed supervised samples are both based on real, executable formal proof state transitions, thus ensuring the reliability of training data sources and enhancing the effectiveness of model training. This addresses the problem that formal automatic theorem proving methods based on large language models typically only model the proof process as a direct mapping from the current proof state to a single tactic, leading to a disconnect between high-level proof strategies and low-level tactic predictions, making unified learning difficult. Furthermore, while existing search-driven proof methods can generate search trajectories, they often lack a mechanism to uniformly transform decision information from different levels during the search process into supervised training samples, making it difficult to simultaneously improve proof pattern selection, in-pattern action generation, and fine-grained tactic prediction capabilities. This invention combines difficulty grading, search backflow, and iterative methods of joint supervised training to gradually improve the model's solution capabilities in complex formal theorem proving tasks, demonstrating good scalability and application value.

[0006] The specific technical solution to achieve the purpose of this invention is: a formal automatic theorem proof method based on an explicit pattern node search tree, characterized by the following steps:

[0007] 1) Obtain formal theorem data, clean, standardize, and classify the data according to difficulty to obtain a formal theorem sample set for training and searching.

[0008] 2) Based on the existing formal proof trajectory, the proof steps are pattern-labeled and supervised training samples are constructed. The patterns include at least context-enhanced patterns and target transformation patterns. The supervised training samples include pattern-level samples, action-level samples and tactic-level samples.

[0009] 3) Train a unified proof model using supervised training samples so that the unified proof model can output the probability of the proof mode corresponding to the current proof state, as well as the probability of the candidate action under the selected proof mode.

[0010] 4) In the process of solving the theorem to be proved, an explicit pattern node search tree is constructed for the current proof state. The search tree includes state nodes, pattern nodes and action nodes. Under each state node, the pattern node is first expanded, and then the corresponding action node is expanded under each pattern node.

[0011] 5) During the search process, the current proof mode is selected based on the mode probability output by the unified proof model; when the context enhancement mode is selected, candidate actions corresponding to auxiliary propositions, intermediate conclusions or bridge lemmas are generated; when the target transformation mode is selected, candidate actions for rewriting, reducing, decomposing, summarizing, classifying and discussing or closing the current target are generated.

[0012] 6) Input the candidate actions into the formal theorem prover for execution and verification, obtain a new proof state, and evaluate the search trajectory for rewards based on the verification results.

[0013] 7) After completing a search, select the trajectory with the highest cumulative return from the multiple candidate trajectories obtained, and extract pattern-level samples, action-level samples, and tactic-level samples from the trajectory.

[0014] 8) Use pattern-level samples, action-level samples, and tactic-level samples to jointly supervise the training of the unified proof model, and use the updated model for the next round of search or theorem proof tasks of higher difficulty level.

[0015] The context enhancement mode is used to expand the context of the current proof by introducing auxiliary propositions, intermediate conclusions or bridging lemmas; the target transformation mode is used to directly rewrite, reduce, decompose or close the current target to be proved.

[0016] The reward evaluation rule for the search trajectory is as follows: when all targets are closed after the action is executed, a reward of 1 is assigned; when a new probable state is formed after the action is executed, a reward of 0 is assigned; when the action fails, is invalid, or does not produce effective progress, a reward of -1 is assigned.

[0017] The unified proof model includes pattern selection output, action generation output under pattern conditions, and tactic prediction output; the joint supervised training updates the output based on pattern-level samples, action-level samples, and tactic-level samples, respectively.

[0018] Compared with the prior art, the present invention has the following beneficial technical effects and significant technical progress:

[0019] 1) This invention expands the formal theorem proof process from the traditional single-layer "state to tactic" decision-making method to a two-layer "state to pattern, pattern to action" decision-making method by explicitly introducing proof pattern nodes in the search tree. This can preserve high-level proof pattern information during the search process, thereby enhancing the structured expressive power of the proof process.

[0020] 2) This invention clearly distinguishes between context enhancement behavior and target transformation behavior, and builds a unified search organization method and training update method around this distinction, so that the selection of high-level proof mode and the generation of low-level specific actions can be carried out in the same framework, which is conducive to improving the model's adaptability to different proof states.

[0021] 3) This invention achieves automatic conversion of search results into multi-granularity supervised training data by extracting pattern-level samples, action-level samples and tactic-level samples from the highest-return trajectory, enabling pattern learning, action learning and fine-grained tactic learning to be optimized together in a unified training process.

[0022] 4) This invention uses a unified proof model to generate corresponding actions under different mode conditions, so that the state representation and training source are consistent between mode selection, in-mode action generation and tactic prediction, which is conducive to improving the coordination between different levels of proof decisions.

[0023] 5) This invention executes and verifies candidate actions through a formal theorem prover, so that the search trajectory and the supervised samples constructed are based on real executable formal proof state transitions, thereby ensuring the reliability of training data sources and enhancing the effectiveness of model training.

[0024] 6) This invention combines difficulty grading, search backflow, and joint supervised training in an iterative manner, which can gradually improve the model's ability to solve complex formal theorem proof tasks, and has good scalability and application value. Attached Figure Description

[0025] Figure 1 This is a flowchart of the present invention. Detailed Implementation

[0026] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. It should be understood that the following embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. Based on the disclosure of this invention, all equivalent substitutions, modifications, and improvements made by those skilled in the art without inventive effort should fall within the scope of protection of this invention.

[0027] Example 1

[0028] This embodiment is designed for the Lean4 formal theorem proving environment. It models the proof process as a two-layer decision-making process of "current proof state - proof mode - specific action - new proof state" and constructs mode-level, action-level and tactic-level supervised samples by combining search trajectory backflow to achieve iterative training of the unified proof model.

[0029] See Figure 1 A formalized automatic theorem method based on explicit pattern node search tree mainly includes the following steps: data preprocessing and difficulty division, pattern labeling and initial supervised training, explicit pattern node search tree construction, candidate action verification, highest reward trajectory selection, multi-granularity supervised sample construction, and joint supervised training.

[0030] (1) Formal theorem data preprocessing and difficulty classification

[0031] 1-1: Constructing a formal theorem proof dataset

[0032] The dataset can be derived from existing theorems and corresponding proofs in Lean4 and its mathematical library, or from formal proof corpora accumulated within the project. For the original data, sample deduplication, erroneous sample removal, dependency missing sample removal, and proof corruption sample removal are performed first to ensure that each sample can be verified in the target Lean4 environment.

[0033] 1-2: Standardize the format of theorem, proof, and context, remove redundant spaces, comments, and irrelevant tags, and retain the theorem statement, proof code, and proof state information generated during execution.

[0034] 1-3: After data cleaning, a difficulty score is calculated for each sample. The difficulty score is based on four features: theorem statement length, reference proof length, maximum number of sub-goals, and dependency theorems. The theorem statement length represents the number of tokens in the theorem statement; the reference proof length represents the total number of steps in the tactic in the proof; the maximum number of sub-goals represents the maximum number of unsolved sub-goals at any time during the execution of the reference proof; and the dependency theorem number represents the number of lemmas, theorems, haves, or suffices explicitly called in the proof.

[0035] After performing min-max normalization on the above four features, the overall difficulty score is calculated according to the following formula:

[0036]

[0037] in, This represents the normalized value of the length of the theorem statement. This represents the normalized value of the reference proof length. This represents the normalized value indicating the maximum number of sub-objectives. This represents the normalized value of the theorem-dependent number.

[0038] 1-4: Based on the quantile position of the overall difficulty score of all samples, the samples are divided into ten difficulty levels from L1 to L10, where L1-L4 are low-difficulty samples, L5-L6 are medium-difficulty samples, and L7-L10 are high-difficulty samples. Subsequent training and search adopt a progressive approach from low to high difficulty.

[0039] (2) Proof of pattern labeling and construction of supervised training samples

[0040] To train a unified proof model, supervised training samples need to be automatically constructed from existing proof trajectories. This embodiment divides proof modes into two categories: context enhancement mode and goal transformation mode. Context enhancement mode is used to expand the current proof context by introducing auxiliary propositions, intermediate conclusions, or bridging lemmas in the current proof state, without directly transforming the current main goal. Goal transformation mode is used to directly rewrite, reduce, decompose, summarize, classify, or close the current main goal in the current proof state to drive the proof forward.

[0041] The specific annotation rules for the proof mode are as follows: 1) When a certain proof action belongs to have, suffices, introduction of auxiliary propositions, introduction of bridge lemmas, or introduction of intermediate conclusions, the step is marked as context enhancement mode; 2) When a certain proof action belongs to rw, simp, apply, refine, constructor, cases, induction, exact, or automatic solution tactic, the step is marked as target transformation mode.

[0042] Based on the above pattern annotation rules, three types of supervised training samples are constructed from the reference proof trajectory. The first type is pattern-level samples, denoted as... ,in Indicates the current proof status. The first category represents the pattern label corresponding to the state; the second category represents action-level samples, denoted as... ,in Indicates in pattern The specific actions to be taken; the third category is tactic-level samples, if the action If it is a single tactic, then construct it directly. Sample, if action If the action is a local tactic sequence, it is further broken down into internal tactic sequences, and the intermediate states of each internal step are recorded during execution, thereby constructing multiple tactic-level samples. .

[0043] In this embodiment, the current proof status It is composed of the current context Γ, the set of currently unresolved targets G, the sequence of historical actions H, and the current search depth d, and can be expressed as follows:

[0044] s = (Γ, G, H, d).

[0045] Where Γ includes local variables, assumptions, introduced conclusions, and the currently available local environment; G represents the set of main objectives and unresolved sub-objectives; H represents the sequence of actions from the initial state to the current state; and d represents the search depth of the current node.

[0046] (3) Training of the unified proof model

[0047] Based on the above supervised training samples, the unified proof model is initially trained. The unified proof model can use a large language model with code generation capabilities as the base model and be trained using a supervised fine-tuning method. The training data should preferably be low-difficulty samples, i.e. L1-L4 level data, so that the model can first master the basic formal proof capabilities.

[0048] The unified proof model includes three output parts. The first part is the mode selection output, which is used to select the mode given the current proof state. The probability distribution of the context-enhanced mode and the target conversion mode is output in real time. The second part is the action generation output, used to generate the action given the current proof state s and the selected mode. The probability distribution of the candidate actions is output in time, i.e. The third part is the tactic prediction output, used to output the probability distribution of candidate tactics at a fine-grained level, i.e. .

[0049] During the training phase, pattern-level samples are used to supervise pattern selection output, action-level samples are used to supervise action generation output under pattern conditions, and tactic-level samples are used to supervise fine-grained tactic prediction output. The unified proof model training uses the joint supervision loss function shown in the following formula:

[0050] .

[0051] in, For pattern-level cross-entropy loss, For action-level cross-entropy loss, The cross-entropy loss is tactic level.

[0052] In this embodiment, the training data of the unified proof model is divided into a training set and a validation set according to a ratio of 95% and 5%. Training is stopped when the loss of the validation set reaches the minimum and no longer decreases, so as to obtain the initial proof model.

[0053] (4) Construction of explicit pattern node search tree

[0054] In the process of solving the theorem to be proved, an explicit pattern node search tree is constructed based on the current proof state. This search tree adopts a two-level expansion structure, and its node organization is shown in the following formula:

[0055] .

[0056] in, Indicates the current state node. Represents the pattern node, Indicates an action node. This represents the new state node after the action is performed.

[0057] Under each state node, two mode nodes are fixed and expanded, corresponding to the context enhancement mode respectively. and target conversion model Then, expand the corresponding action node for each pattern node. If the currently expanded node is a context-enhanced pattern node, call the context-enhanced action generator to generate a set of candidate actions. If the currently expanded node is the target conversion mode node, then the target conversion action generator is invoked to generate a set of candidate actions. .

[0058] In this embodiment, the context-enhanced action generator and the target transformation action generator are not two completely independent models, but rather condition generation interfaces of the same unified proof model under different mode label conditions. That is, the unified proof model is input with the state. and pattern tags At that time, output context-enhanced action candidates; input the state into the unified proof model. and pattern tags At that time, output the target transformation action candidate. This can be defined by the following formulas:

[0059] ;

[0060] .

[0061] in, Represents a unified proof model. This indicates a context-enhanced action generator. This represents the target transformation action generator.

[0062] (5) Search node selection and candidate action expansion

[0063] 5-1: During the search process, it is necessary to first select the proof mode under the state node, and then select the specific action under the selected mode. For the selection of the mode node, this embodiment uses the following selection formula:

[0064] .

[0065] in, Indicates the cumulative value of the pattern nodes. This represents the pattern prior probability given by the unified proof model. This indicates the number of times the status node has been accessed. Indicates the number of times the pattern node has been accessed. These are the exploration coefficients for the pattern layer.

[0066] 5-2: After selecting a pattern node, select an action node under that pattern node. The action node is selected using the following formula:

[0067] .

[0068] in, This represents the cumulative value of the action nodes. Indicates in pattern Prior probabilities of the following actions This indicates the number of times the action node has been accessed. For the action layer exploration coefficient.

[0069] 5-3: In the context enhancement mode, the candidate actions may include at least one of the following: auxiliary proposition introduction action, bridge lemma introduction action, intermediate conclusion introduction action, and local conclusion construction action; in the target transformation mode, the candidate actions may include at least one of the following: rewriting action, simplification action, application action, decomposition action, classification discussion action, induction action, and automatic proof action.

[0070] (6) Candidate action verification and state transition

[0071] Select the action node Then, the action is input into the Lean4 theorem prover for execution. Lean4 performs syntactic and semantic verification on the action in the current proof state and returns a new state. When the selected mode is the context enhancement mode, the result of the action execution is usually that the current context Γ is expanded, for example, a new legal auxiliary proposition, intermediate conclusion or bridge lemma is introduced. The main objective may remain unchanged, or a new local objective to be proved may be added. When the selected mode is the objective transformation mode, the result of the action execution is usually that the current objective is rewritten, reduced, decomposed, summarized or closed, the set of unsolved sub-objectives G changes, and all state transitions are based on the execution result of Lean4.

[0072] (7) Reward assessment and cumulative return calculation

[0073] To evaluate the quality of the search trajectory, this embodiment adopts a fixed three-value reward rule for each action execution result. If all objectives are closed after the action is executed, it is recorded as a proof completed and a reward of 1 is assigned. If, although not all proofs are completed after the action is executed, any of the following conditions are met, it is recorded as a valid advancement and a reward of 0 is assigned: 1) the number of unsolved sub-objectives decreases; 2) the current main objective expression undergoes a legal change; 3) a new legal auxiliary proposition is added and a new state that can continue to be proven is formed. If the action fails, is illegal, the state does not change effectively, or enters a repeated no-advancement state, it is recorded as invalid or failed and a reward of -1 is assigned.

[0074] During a search, multiple actions form a complete trajectory τ, and the cumulative reward of the trajectory is the sum of the immediate rewards for each step. After the search ends, the value of the action nodes is updated. Model Node Value and the number of visits to the corresponding node , , .

[0075] (8) Selection of the highest return trajectory

[0076] For a single search of the same theorem to be proved, multiple candidate trajectories are typically generated. The cumulative reward is calculated for each candidate trajectory, and the trajectory with the highest cumulative reward is selected as the supervision backflow trajectory. If multiple trajectories have the same cumulative reward, the shorter trajectory is preferred; if the trajectory lengths are still the same, the trajectory that reached the cumulative reward first is selected.

[0077] (9) Construction of multi-granularity supervised sample reflux

[0078] From the highest-return trajectory τ*, construct pattern-level, action-level, and tactic-level supervision samples. The pattern-level supervision samples are directly composed of state nodes and corresponding pattern nodes in the trajectory, as expressed by the following formula:

[0079] .

[0080] in, Indicates the first step in the estimated trajectory chain. A proof state, Indicates the first in the trajectory chain Each mode.

[0081] The action-level supervised sample consists of state nodes, pattern nodes, and action nodes in the trajectory, as expressed by the following formula:

[0082] .

[0083] in Indicates the first in the trajectory chain One strategy.

[0084] The construction of the tactic-level supervised samples, if a certain action If it is a single tactic, then it is directly constructed into a tactic-level sample. If a certain action If it is a local tactic sequence, then it is expanded into an internal tactic sequence. And record the corresponding internal intermediate states. This leads to the construction of tactic-level samples, which can be expressed as follows:

[0085] .

[0086] In this way, high-level pattern information, mid-level action information, and low-level tactic information in the search trajectory can be extracted and fed back to the supervised training phase.

[0087] (10) Joint supervised training and iterative updates

[0088] The pattern-level, action-level, and tactic-level supervised samples extracted in step (9) are merged and used as the supervised training data for the next round to update the unified proof model. The pattern-level supervised samples are used to update the pattern selection output; the action-level supervised samples are used to update the action generation output under the pattern conditions; and the tactic-level supervised samples are used to update the fine-grained tactic prediction output. After training is completed, the updated unified proof model is reapplied to the theorem search to be proved, and a new explicit pattern node search is performed.

[0089] This embodiment employs a course-based progressive training approach. The first stage involves initial training and searching on samples at difficulty levels L1-L4; the second stage expands to samples L5-L6; the third stage expands to samples L7-L8; and the fourth stage expands to samples L9-L10. Each stage repeats the closed loop of "search—selection of the highest reward trajectory—construction of multi-granularity samples—joint supervised training" until the model reaches the preset number of training rounds at the corresponding difficulty level, before moving on to the next difficulty level.

[0090] The above embodiments are merely illustrative of the present invention and are not intended to limit the scope of the present invention. All equivalent implementations of the present invention should be included within the scope of the claims of the present invention.

Claims

1. A formal automatic theorem proof method based on explicit schema node search trees, characterized in that, The method includes the following steps: 1) Obtain formal theorem data and preprocess it to obtain a formal theorem sample set; 2) Mark the proof steps according to the existing formal proof trajectory and construct supervised training samples. 3) Train the unified proof model using supervised training samples, so that the unified proof model outputs the probability of the proof mode corresponding to the current proof state, and the probability of candidate actions under the selected proof mode; 4) Construct an explicit mode node search tree under the current proof state of the theorem to be proved, and select the proof mode first according to the unified proof model, and then generate candidate actions under the selected proof mode; 5) Input the candidate actions into the formal theorem prover for execution and verification, obtain a new proof state, and evaluate the reward of the search trajectory; 6) Select the trajectory with the highest cumulative reward from the candidate trajectories obtained from the search, extract supervised training samples, and update the unified proof model using supervised training samples. Iterate the updated unified proof model from low to high difficulty level, first perform search and supervised training on low difficulty samples, and then use the updated unified proof model for theorem proof tasks on higher difficulty level samples.

2. The formal automatic theorem proof method based on explicit pattern node search tree according to claim 1, characterized in that, The preprocessing in step 1) includes: sample deduplication, removal of erroneous samples, removal of samples with missing dependencies, removal of samples with corrupted proofs, and standardization of theorem, proof, and context formats. The theorem statement length, reference proof length, maximum number of subobjectives, and number of dependent theorems for each sample are extracted, normalized, and a comprehensive difficulty score is calculated. Based on the quantile of the comprehensive difficulty score in all samples, the samples are divided into ten difficulty levels.

3. The formal automatic theorem proof method based on explicit pattern node search tree according to claim 1, characterized in that, The pattern annotation in step 2) includes: context-enhanced pattern annotation and target transformation pattern annotation; wherein, have, suffices, auxiliary proposition introduction, intermediate conclusion introduction, and bridge lemma introduction are labeled as context-enhanced patterns, and rw, simp, apply, refine, constructor, cases, induction, exact, and automatic solution tactic are labeled as target transformation patterns; the supervised training samples include: pattern-level supervised samples, action-level supervised samples, and tactic-level supervised samples; wherein, pattern-level supervised samples are denoted as Action-level supervised samples are denoted as tactic-level supervised samples are denoted as Or obtained from the development of local actions .

4. The formal automatic theorem proof method based on explicit pattern node search tree according to claim 1, characterized in that, The unified proof model in step 3) includes: mode selection output, action generation output under mode conditions, and tactic prediction output. The mode selection output is used to output the probability distribution of the current proof state belonging to the context enhancement mode or the target transformation mode. The action generation output is used to output the probability distribution of candidate actions under the selected proof mode. The tactic prediction output is used to output the probability distribution of fine-grained tactic. The proof modes include: context enhancement mode and target transformation mode. The context enhancement mode is used to expand the current proof context by introducing auxiliary propositions, intermediate conclusions, or bridge lemmas. The target transformation mode is used to directly rewrite, reduce, decompose, summarize, classify, or close the current target to be proved.

5. The formal automatic theorem proof method based on explicit pattern node search tree according to claim 1, characterized in that, The explicit pattern node search tree in step 4) satisfies the state transition relationship shown in the following equation: ;in, This is the current proof state node; For pattern nodes; For action nodes; This is the new proof state node after the action is performed.

6. The formal automatic theorem proof method based on explicit pattern node search tree according to claim 1, characterized in that, The candidate actions generated under the selected proof mode in step 4) include: when the context enhancement mode is selected, at least one candidate action is generated from the following: auxiliary proposition introduction action, bridge lemma introduction action, intermediate conclusion introduction action, or local conclusion construction action; when the target transformation mode is selected, at least one candidate action is generated from the following: rewriting action, simplification action, application action, decomposition action, classification discussion action, induction action, or automatic proof action.

7. The formal automatic theorem proof method based on an explicit pattern node search tree according to claim 1 or claim 4, characterized in that, The unified proof model generates corresponding candidate actions under different proof modes. Specifically, when the current proof state and context enhancement mode label are input into the unified proof model, context enhancement action candidates are output; when the current proof state and target transformation mode label are input into the unified proof model, target transformation action candidates are output.

8. The formal automatic theorem proof method based on explicit pattern node search tree according to claim 1, characterized in that, The reward evaluation of the search trajectory in step 5) adopts the following three-value reward rule: 1) When all targets are closed after the action is executed, a reward of 1 is assigned; 2) When a new state that can be proven is formed after the action is executed, a reward of 0 is assigned; 3) When the action fails, is invalid, or does not produce effective progress, a reward of -1 is assigned.

9. The formal automatic theorem proof method based on explicit pattern node search tree according to claim 1, characterized in that, Step 6) Selecting the trajectory with the highest cumulative return from the candidate trajectories obtained from the search involves: calculating the cumulative return for each candidate trajectory and selecting the trajectory with the highest cumulative return as the supervision backflow trajectory; when the cumulative returns are the same, the trajectory with the shorter trajectory length is selected first. When the trajectory lengths are still the same, select the trajectory that reaches the cumulative reward first; the supervised training sample extraction in step 6) specifically includes: 1) extracting pattern-level samples from the state nodes and corresponding pattern nodes in the highest reward trajectory; 2) Extract action-level samples from the state nodes, pattern nodes, and action nodes in the highest-return trajectory; 3) Expand the local actions corresponding to the action-level samples into tactic sequences, and construct tactic-level samples by combining the intermediate states corresponding to each tactic.

10. The formal automatic theorem proof method based on explicit pattern node search tree according to claim 1, characterized in that, The unified proof model in step 6) is updated using a joint supervised training method, and its joint loss function is expressed by the following formula: ;in, For pattern-level supervision loss; Loss due to action-level supervision; For tactical level supervision loss; As a preset weight, its ; The pattern-level supervision loss, action-level supervision loss, and tactic-level supervision loss all employ cross-entropy loss.