Mathematical knowledge reasoning verification method and system based on mathematical text formalization
By converting English mathematical text into a formal formula list and performing logical reasoning verification, the problem of automatic formal representation and verification of mathematical text is solved, and an efficient and reliable mathematical knowledge reasoning process is achieved.
Patent Information
- Application Number
- CN202510577009.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-06
- Publication Date
- 2025-08-01
AI Technical Summary
The prior art is difficult to efficiently automate the formal representation and verification of mathematical texts, especially in terms of logical rigor and interpretability, and methods that rely on large language models cannot guarantee correctness.
By converting English mathematical text into a computer-recognizable list of formal formulas, including automated processing of premises, theorems, inference steps and conclusions, a standardized syntax tree is generated using Stanford CoreNLP and LaTeX grammar analysis methods, and logical reasoning and algebraic calculation verification are performed based on predicate logic mapping.
Automatic mathematical text analysis without data set training is realized, the generated formal formulas are expressed in a complete and accurate semantic manner, and the logical reasoning process is visualized, and the reliability and transparency are significantly improved.
Smart Images

Figure CN120409699A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of mathematical knowledge reasoning and checking, and particularly relates to a method and system for verifying mathematical knowledge reasoning based on mathematical text formalization. Background Art
[0002] Text is an important way to record mathematical knowledge, and the vast majority of human mathematical knowledge is recorded in text form. A large amount of mathematical knowledge recording, calculation, and proof are involved in mathematical texts. Verifying the accuracy and correctness of this mathematical knowledge often requires a great deal of energy and time of professional mathematicians. Traditionally, people verify and check the accuracy of mathematical text descriptions through manual methods such as peer review and editorial proofreading. With the progress of automated reasoning and computer-aided proof technologies, people have begun to use methods such as automated reasoning, symbolic calculation, or interactive theorem proving to assist in the reasoning, verification, and calculation of mathematical knowledge. These methods require professionals to first manually convert mathematical knowledge into a formal mathematical language or programming language that can be recognized by a computer, which depends on the formalization work of professionals. In recent years, with the development of artificial intelligence technology, formal representation models and reasoning models based on large language models have also been used to promote the automation and intelligence of mathematical research. However, directly using a large language model for mathematical reasoning cannot strictly guarantee its correctness, and using formal representation models and reasoning models requires a large amount of formalized text corresponding to natural language text as training data for the models. Due to the characteristics of mathematical knowledge such as professionalism and rigor, the data annotation and formal representation of relevant texts have relatively high requirements, which makes high-quality formalized mathematical text data extremely scarce.
[0003] Full-automated verification of mathematical texts still lacks difficulties such as corpus or relying on a large amount of manpower. For this reason, many researchers in the fields of mathematics and computer science have begun to attempt to solve the problem of formal representation of mathematical texts described in natural language. Therefore, how to solve the automated formal representation and verification of texts has become an urgent problem to be solved, thus greatly promoting the development of mathematical formalization, automation, and intelligence work. Summary of the Invention
[0004] To solve the above technical problems, the present invention provides a method for verifying mathematical knowledge reasoning based on mathematical text formalization, including the following steps:
[0005] Step S1: Convert the input English text describing mathematical knowledge into a list of formalized formulas that can be recognized and processed by a computer; wherein, the English text describing mathematical knowledge includes: a premise set, a theorem set, a reasoning step set, and a conclusion set to be verified; the list of formalized formulas includes: a premise list, a theorem list, a reasoning step list, and a conclusion list;
[0006] Step S2: Perform logical reasoning verification and algebraic calculation verification on the formalized formula to determine the correctness of the reasoning process and conclusion.
[0007] Advantageous effects:
[0008] 1. The present invention proposes a method for automatically formalizing mathematical texts without relying on datasets and model training, which can achieve automatic parsing and conversion of mathematical texts and directly generate formalized formulas recognizable and processable by computers. Compared with existing formal languages, this method has a higher degree of automation, does not require manual participation and data annotation, and the generated formalized formulas have higher integrity and accuracy in semantic expression ability, effectively overcoming the deficiencies of traditional formal languages in semantic expression.
[0009] 2. The present invention proposes a method for automatically reasoning and verifying mathematical knowledge based on a formal language. Compared with the reasoning and verification method that directly processes natural language relying on a large language model (LLM), this method has significant advantages in logical rigor and interpretability. During the reasoning and verification process, all reasoning steps are visualized and traceable, and the error positions in the reasoning process can be accurately located, thus significantly improving the reliability and transparency of mathematical knowledge reasoning and verification. Description of the drawings
[0010] Figure 1 It is a schematic flowchart of a method for reasoning and verifying mathematical knowledge based on the formalization of mathematical texts according to the present invention;
[0011] Figure 2 It is a schematic flowchart for converting a sentence into a formalized formula;
[0012] Figure 3 It is a schematic flowchart for converting a sentence into a syntactic structure parsing tree;
[0013] Figure 4 It is a schematic diagram of a syntactic structure parsing tree;
[0014] Figure 5 It is a schematic diagram of the standardized grammar tree structure of a simple sentence;
[0015] Figure 6 It is a schematic diagram of the standardized grammar tree structure of a subject clause;
[0016] Figure 7 It is a schematic diagram of the standardized grammar tree structure of an object / predicative clause;
[0017] Figure 8 It is a schematic diagram of the standardized grammar tree structure of an attributive clause;
[0018] Figure 9 It is a schematic diagram of the standardized grammar tree structure of an adverbial clause;
[0019] Figure 10 Schematic diagram of the standardized syntax tree structure for compound sentences;
[0020] Figure 11 Schematic diagram of the process for analyzing clauses in the syntactic structure parse tree;
[0021] Figure 12 For converting Figure 4 the syntactic structure parse tree into a standardized syntax tree;
[0022] Figure 13 Schematic diagram of the flowchart for generating a standardized syntax tree;
[0023] Figure 14 Schematic diagram of the process for generating a formal formula module;
[0024] Figure 15 Schematic diagram of the verification process based on symbolic calculation;
[0025] Figure 16 Schematic diagram of the verification process based on logical reasoning;
[0026] Figure 17 Schematic diagram of the process for inference verification based on logical reasoning;
[0027] Figure 18 Schematic diagram of the overall process of the mathematical knowledge inference verification method based on the formalization of mathematical texts according to the present invention. Detailed implementation manners
[0028] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0029] Embodiment 1
[0030] As Figure 1 shown, a mathematical knowledge inference verification method based on the formalization of mathematical texts provided by an embodiment of the present invention includes the following steps:
[0031] Step S1: Convert the input English text describing mathematical knowledge into a list of formal formulas recognizable and processable by a computer; wherein, the English text describing mathematical knowledge includes: a premise set, a theorem set, an inference step set, and a conclusion set to be verified; the list of formal formulas includes: a premise list, a theorem list, an inference step list, and a conclusion list;
[0032] Step S2: Perform logical reasoning verification and algebraic calculation verification on the formal formula to determine the correctness of the reasoning process and conclusion.
[0033] In one embodiment, the above-mentioned step S1: Convert the input English text describing mathematical knowledge into a list of formal formulas that can be recognized and processed by a computer, specifically including:
[0034] Step S11: Define atomic formulas and well-formed formulas based on predicate logic:
[0035] Atomic formulas are used to formalize simple sentences, and the structure of their formulas is:
[0036] ;
[0037] Among them, represents a predicate, which consists of a verb phrase and a set of noun phrases ; The symbol indicates the existence of one or more sub-components, and is used to represent unary predicates or multiary predicates;
[0038] The structure of the verb phrase is defined as follows:
[0039] ;
[0040] Among them, represents the verb prototype of the core predicate verb, represents the auxiliary verb, represents the adverbial modifying the core predicate verb, and respectively represent the part-of-speech tags of the core predicate verb and the auxiliary verb, and are used to represent part-of-speech information such as tense and voice. The symbol indicates the existence of zero or more sub-components;
[0041] The structure of the noun phrase is as follows:
[0042] ;
[0043] Among them, represents the core noun or the predicative adjective, represents the attribute or other related attributes modifying the core noun or the predicative adjective;
[0044] Well-formed formulas are obtained by expanding the structure of atomic formulas by introducing connection symbols and recursive structures, and are used to formalize compound sentences, including: sentence relationships of negation, disjunction, conjunction, implication, equivalence, time sequence, and contrast;
[0045] Step S12: Use the syntactic parsing method of Stanford CoreNLP and the LaTeX syntax analysis method to parse the syntactic structure of the input English text describing mathematical knowledge, and generate the corresponding syntactic structure parse tree;
[0046] Among them, the English text describing mathematical knowledge includes: premise set premise, theorem set theorem, reasoning step set reasoningStep, and conclusion set conclusion to be verified.
[0047] Step S13: Perform clause analysis and sentence component analysis on the syntactic structure parse tree, extract clause information and sentence component information, and generate a standardized grammar tree;
[0048] Step S14: Define the mapping rules between the standardized grammar tree and the formal formula. According to this rule, through recursive processing of the standardized grammar tree, generate a list of formal formulas;
[0049] Among them, the list of formal formulas includes: premise formal formula list premiseFFList, theorem formal formula list theoremFFList, reasoning step formal formula list reasoningStepFFList, and conclusion formal formula list conclusionFFList.
[0050] As Figure 2 shown, it shows a schematic flow chart for converting an English sentence describing mathematical knowledge into a formal formula.
[0051] In one embodiment, the above Step S12: Use the syntactic parsing method of Stanford CoreNLP and the LaTeX syntax analysis method for each sentence in the input English text describing mathematical knowledge to complete the syntactic structure parsing and generate the corresponding syntactic structure parse tree, specifically including:
[0052] Step S121: First, check whether the sentence in the English text contains LaTeX format information identifiers (strings separated by $ or $$): If the sentence text does not contain LaTeX format information, go to Step S122; otherwise, go to Step S123;
[0053] Step S122: First, configure the Properties object of Stanford CoreNLP to set task parameters (such as word segmentation, part-of-speech tagging, syntactic analysis, etc.); then, encapsulate the sentence to be processed as an Annotation object and execute the task; finally, extract the syntactic structure parse tree of the sentence from the processed document and go to Step S126;
[0054] Step S123: Replace the LaTeX-formatted mathematical formulas in the sentence with symbols ; then, based on the words or symbols directly adjacent in the sentence, determine whether the clause where it is located contains a predicate verb. Specifically:
[0055] First, split the sentence into words and symbols as units, and extract the two elements before and after directly adjacent to . If the part-of-speech tags of these two elements do not start with the verb-related tag "VB", and their contents are all conjunctions, guiding words, or symbols, then it is considered that the clause where it is located lacks a predicate verb; otherwise, it is considered that the clause does not lack a predicate verb. For example, in the sentence "Because , we have .", the clause where it is located lacks a predicate verb, while the clause where it is located does not lack a predicate verb. For a clause lacking a predicate verb, the verb "holds" needs to be added after to indicate that the mathematical formula holds;
[0056] Step S124: Perform the same operation as in Step S122 to convert the sentence processed in Step S123 into a syntactic structure parse tree;
[0057] Step S125: For each symbol in the syntactic structure parse tree, convert the LaTeX-formatted mathematical formula corresponding to into a formula structure tree. The specific steps are as follows:
[0058] Step S1251: Determine the precedence of the operators in the formula, initialize the bracket depth to 0, and then traverse the mathematical formula corresponding to from left to right based on the bracket depth and the basic precedence of the operators in Table 1. When encountering a left bracket (such as "{", "(", or "["), increase the bracket depth by 1; when encountering a right bracket (such as "}", ")", or "]"), decrease the bracket depth by 1; when encountering an operator, record the operator and its current bracket depth in operatorDepthMap;
[0059] Step S1252: Select the operator with the minimum bracket depth and the highest priority from the operatorDepthMap as the root node of the formula structure tree. The strings on the left and right sides of the operator or the strings within two consecutive brackets on the right side of the operator are the components for the operator's operation. Based on the operation components of the operator, the left and right subtrees can be constructed: If the operation components of the operator do not contain an operator, directly construct a node based on this component; if an operator is included, recursively call Step S125 to construct the tree structure of the sub-formula until the parsing of the formula structure tree is completed;
[0060] Step S126: Return the syntactic structure parsing tree and end.
[0061] Table 1 Basic priorities of bracket depth and operators
[0062] Figure 3 The figure shows a schematic flow chart for converting an English sentence describing mathematical knowledge into a syntactic structure parsing tree.
[0063] Figure 4 The figure shows a schematic diagram of a syntactic structure parsing tree. The syntactic structure parsing tree presents the relationship and hierarchical structure among the components of a sentence in a tree diagram. Its nodes are syntactic components representing noun phrases, verb phrases, etc. that generate syntax, and the edges represent the structural relationships of the tree.
[0064] Although the syntactic structure parsing tree generated using the Stanford CoreNLP tool contains multi-faceted information such as part-of-speech tags and phrase tags, its tree structure is relatively complex and diverse, making it difficult to directly extract relevant information from the tree to construct a formula representation of the text. Therefore, the present invention introduces a more concise and clear standardized grammar tree structure as an intermediate structure for the conversion from a syntactic structure parsing tree to a formalized formula. Specifically: For each sentence, perform clause analysis and sentence component analysis, extract clause information and sentence component information, and then, according to the definition of the standardized grammar tree, layer by layer, convert the syntactic structure parsing tree into a standardized grammar tree according to the conversion rules.
[0065] In one embodiment, the above Step S13: Perform clause analysis and sentence component analysis on the syntactic structure parsing tree, extract clause information and sentence component information, and generate a standardized grammar tree, specifically including:
[0066] Step S131: Define the structure body of the basic nodes of the standardized grammar tree and the structure bodies of sentence component information and clause information;
[0067] The structure definitions of each node are as follows:
[0068] VerbNode {
[0069] String coreVerb; / / Core verb
[0070] String posVerb; / / Part-of-speech tag of the core verb
[0071] String modalVerb; / / Modal verb
[0072] String beVerb; / / Auxiliary verb of the be series
[0073] String haveVerb; / / Auxiliary verb of the have series
[0074] String doVerb; / / Auxiliary verb of the do series
[0075] }
[0076] NounNode {
[0077] String coreNoun; / / Core noun
[0078] AdjNode adjNode; / / Adjective used as a predicative
[0079] String article; / / Determiner
[0080] }
[0081] AdjNode {
[0082] String adjective; / / Adjective
[0083] String pp; / / Prepositional phrase
[0084] }
[0085] AdvNode {
[0086] String adverb; / / Adverb
[0087] String pp; / / Prepositional phrase
[0088] }
[0089] CcNode {
[0090] String coreWord; / / Conjunction or linker
[0091] }
[0092] SNode / SbarNode {
[0093] VerbNode verbNode; / / When SNode / SbarNode represents a compound sentence, this node is empty
[0094] List <nounnode>nounNodeList; / / When SNode / SbarNode represents a complex sentence, this node is empty
[0095] List <adjnode>adjNodeList; / / When SNode / SbarNode represents a compound sentence, this node is empty
[0096] List <advnode>advNodeList; / / When SNode / SbarNode represents a compound sentence, this node is empty
[0097] ClauseInfo clauseInfo;
[0098] SenComInfo senComInfo; / / When SNode / SbarNode represents a compound sentence, this node is empty
[0099] SbarNode sbarNode1; / / When SNode / SbarNode represents a simple sentence, this node is empty
[0100] SbarNode sbarNode2; / / When SNode / SbarNode represents a simple sentence, this node is empty
[0101] }
[0102] The structure definitions of the clause information ClauseInfo and the sentence component information SenComInfo are as follows:
[0103] ClauseInfo {
[0104] String sentenceType; / / Sentence type
[0105] String ccWord; / / Conjunction or guiding word
[0106] Node sRoot; / / Root node of the syntactic structure parsing tree
[0107] Node subRoot1; / / Root node of the subtree
[0108] Node subRoot2; / / Root node of the subtree
[0109] }
[0110] SenComInfo{
[0111] String subject; / / Subject
[0112] String predicate; / / Predicate
[0113] String linkVerb; / / Linking verb
[0114] String auxiliaryVerb; / / Auxiliary verb
[0115] List <string>objectList; / / Object, there may be cases of double objects
[0116] String predicative; / / Predicative
[0117] Map<String, List <steing>> attributiveMap; / / The key is a noun, and the value is a list of attributives modifying the noun
[0118] Map<String, List <steing>> adverbialMap; / / The key is the verb, and the value is the list of attributives modifying the verb
[0119] }
[0120] Step S132: Convert the syntactic structure parse tree into a standardized grammar tree in a recursive manner, specifically including:
[0121] Step S1321: Analyze the clauses of the current syntactic structure parse tree to obtain the clause information clauseInfo of the current syntactic structure parse tree;
[0122] Step S1322: Process according to the sentence type recorded in the current clauseInfo: If the sentence corresponding to the current syntactic structure parse is a simple sentence, go to Step S1323; if the sentence corresponding to the current syntactic structure parse is a noun clause or a predicative clause, go to Step S1324; if the sentence corresponding to the current syntactic structure parse is an attributive clause, go to Step S1325; if the sentence corresponding to the current syntactic structure parse is an adverbial clause, go to Step S1326; if the sentence corresponding to the current syntactic structure parse is a compound sentence, go to Step S1327;
[0123] Step S1323: Convert the syntactic structure parse tree of the current simple sentence type into a standardized grammar tree. The specific steps are as follows:
[0124] Step S13231: Analyze the sentence components of the current syntactic structure parse tree to obtain the sentence component information senComInfo of the current syntactic structure parse tree;
[0125] Step S13232: Create nodes in the corresponding standardized grammar tree of the current syntactic structure parse tree according to the sentence component information in the current senComInfo: Create a variable nounNode of type NounNode according to the variables subject, objectList or predicative; create a variable verbNode of type VerbNode according to the variable auxiliaryVerb plus predicate or linkVerb; create a variable adjNode of type AdjNode modifying a certain nounNode according to the variable attributiveMap; create a variable advNode of type AdvNode modifying a certain verbNode according to the variable adverbialMap;
[0126] Step S13233: Based on the current senComInfo, clauseInfo, and the already constructed standardized syntax tree nodes, construct the variables sNode / sbarNode of type SNode / SbarNode in the standardized syntax tree corresponding to the current syntactic structure parse tree;
[0127] Step S13234: Combine sNode / sbarNode, verbNode, nounNode, adjNode, and advNode according to the Figure 5 structure to obtain the standardized syntax tree SGT corresponding to the current syntactic structure parse tree; Go to step S1328;
[0128] Step S1324: Convert the current syntactic structure parse tree of a noun clause or a predicative clause into a standardized syntax tree. The specific steps are as follows:
[0129] S13241: Obtain the root node sRoot of the current syntactic structure parse tree and the root node subRoot1 of its sub-clause according to the current clauseInfo, and replace the SBAR node in subRoot1 in the syntactic structure parse tree with the root node sRoot with the NP node;
[0130] S13242: Recursively execute step S132 on the syntactic structure parse trees with sRoot and subRoot1 as the root nodes respectively to obtain the standardized syntax trees SGT1 and SGT2;
[0131] S13243: Based on the current clauseInfo, sbarNode in SGT1, and sbarNode in SGT2, construct the variables sNode / sbarNode of type SNode / SbarNode in the standardized syntax corresponding to the current syntactic structure parse tree;
[0132] S13244: Combine sNode / sbarNode, SGT1, and SGT2 according to the Figure 6 or Figure 7 structure to obtain the standardized syntax tree SGT corresponding to the current syntactic structure parse tree; Go to step S1328;
[0133] Step S1325: Convert the current syntactic structure parse tree of an attributive clause into a standardized syntax tree. The specific steps are as follows:
[0134] Step S13251: Obtain the root node sRoot of the current syntactic structure parse tree and the root node subRoot1 of the sub-clause according to the current clauseInfo, and delete the SBAR node in subRoot1 in the syntactic structure parse tree with the root node sRoot;
[0135] Step S13252: Perform the same operations as in Steps S13242 - S13243 to obtain sNode / sbarNode, SGT1, and SGT2; combine sNode / sbarNode, SGT1, and SGT2 according to Figure 8 the structure to obtain the standardized grammar tree SGT corresponding to the current syntactic structure parse tree; go to Step S1328;
[0136] Step S1326: Convert the syntactic structure parse tree of the current adverbial clause type into a standardized grammar tree. The specific steps are as follows:
[0137] Step S13261: Obtain the root node sRoot of the current syntactic structure parse tree and the root node subRoot1 of the clause according to the current clauseInfo, and delete the SBAR node in subRoot1 of the syntactic structure parse tree with sRoot as the root node;
[0138] Step S13262: Recursively execute Step 3.2 on the syntactic structure parse trees with sRoot and subRoot1 as the root nodes respectively to obtain the standardized grammar trees SGT1 and SGT2;
[0139] Step S13263: Based on the current clauseInfo, the sbarNode in SGT1, and the sbarNode in SGT2, construct the variable sNode / sbarNode of type SNode / SbarNode in the standardized grammar corresponding to the current syntactic structure parse tree;
[0140] Step S13264: Construct the variable ccNode of type CcNode according to the ccWord in the current clauseInfo; then combine ccNode, sNode / sbarNode, SGT1, and SGT2 according to Figure 9 the structure to obtain the standardized grammar tree SGT; go to Step S1328;
[0141] Step S1327: Convert the syntactic structure parse tree of the current coordinate clause type into a standardized grammar tree. The specific steps are as follows:
[0142] Step S13271: Obtain subRoot1 and subRoot2 according to the current clauseInfo, and recursively execute Step S132 on the syntactic structure parse trees with subRoot1 and subRoot2 as the root nodes respectively to obtain the standardized grammar trees SGT1 and SGT2;
[0143] Step S13272: Perform the same operations as in step S13263 to obtain variables sNode / sbarNode of type SNode / SbarNode in the standardized grammar corresponding to the current syntactic structure parse tree;
[0144] Step S13273: Construct a variable ccNode of type CcNode based on the ccWord in the current clauseInfo; then combine ccNode, sNode / sbarNode, SGT1, and SGT2 according to the Figure 10 structure to obtain the standardized syntax tree SGT; go to step S1328;
[0145] Step S1328: Output SGT and end;
[0146] Step S133: Perform clause analysis on the syntactic structure parse tree. The specific steps are as follows:
[0147] Step S1331: Define a variable clauseInfo of type ClauseInfo to store the clause information of all subtrees in the current syntactic structure parse tree; store the root node of the current syntactic structure parse tree in sRoot of clauseInfo;
[0148] Step S1332: Define a queue nodeQueue and add the root node of the current syntactic structure parse tree to the queue nodeQueue;
[0149] Step S1333: Take out the first node firstNode of the queue nodeQueue and add the child nodes of firstNode to nodeQueue;
[0150] Step S1334: If firstNode is marked as S / SBAR, go to step S13341; otherwise, go to step S1335;
[0151] Step S13341: If the child nodes of firstNode contain both an SBAR node and a VP node, and the SBAR node is on the left side of the VP node, the sentence type is a subject clause. Store the subject clause, the content in the SBAR node, and the content in the first child node of the SBAR node in sentenceType, subRoot1, and ccWord of clauseInfo respectively, and go to step S1339; otherwise, go to step S13342;
[0152] Step S13342: If the children nodes of firstNode contain both a CC node and an S / SBAR node, and the CC node is located between the two S / SBAR nodes, then the sentence type is a compound sentence. Store the content of the compound sentence, the two S / SBAR nodes, and the CC node into the sentenceType, subRoot1, subRoot2, and ccWord of clauseInfo respectively, and go to Step S1339; otherwise, go to Step S13343;
[0153] Step S13343: If firstNode is marked as SBAR, then the sentence type is an adverbial clause. Store the content of the adverbial clause, the SBAR node, and the content of the first child node of the SBAR node into the sentenceType, subRoot1, and ccWord of clauseInfo respectively, and go to Step S1339; otherwise, go to Step S1337;
[0154] Step S1335: If firstNode is marked as NP, go to Step S13351; otherwise, go to Step S1336;
[0155] Step S13351: If the children nodes of firstNode contain both an NP node and an SBAR node, and the NP node is on the right side of the SBAR node, then the sentence type is an attributive clause. Store the content of the attributive clause, the SBAR node, and the content of the first child node of the SBAR node into the sentenceType, subRoot1, and ccWord of clauseInfo respectively, and go to Step S1339; otherwise, go to Step S1337;
[0156] Step S1336: If firstNode is marked as VP, go to Step S13361; otherwise, go to Step S1337;
[0157] Step S13361: If the children nodes of firstNode contain both a node representing a verb and an SBAR node, and the SBAR node is on the right side of the verb node, go to Step S13362; otherwise, go to Step S1337;
[0158] Step S13362: If the core verb is a lexical verb, the sentence type is an object clause; if the core verb is a linking verb, the sentence type is a predicative clause. Store the content of the object / predicative clause, the SBAR node, and the content of the first child node of the SBAR node into the sentenceType, subRoot1, and ccWord of clauseInfo respectively, and go to Step S1339;
[0159] Step S1337: If nodeQueue is not empty, go to step S1333; otherwise, go to step S1338;
[0160] Step S1338: Store the simple sentence into the sentenceType of clauseInfo;
[0161] Step S1339: Output clauseInfo and end.
[0162] Step S134: For the clauses of simple sentence type in simple sentences and compound sentences, perform sentence component analysis. The specific steps are as follows:
[0163] Step S1341: Define the determination criteria for sentence component information in the sentence according to the node labels and the position information of the nodes, including subject, predicate, copula, object, predicative, attributive, and adverbial. The specific determination criteria are as follows:
[0164] (1) The subject is usually located in the child nodes of the S node in the syntactic structure parsing tree. Among its child nodes, the first node labeled as NP is the subject.
[0165] (2) The predicate verb or copula is usually located in the child nodes of the first VP node in the child nodes of the S node in the syntactic structure parsing tree. If the child nodes of the VP node do not include a VP node, the predicate verb or copula is the first node labeled starting with VB among the child nodes; otherwise, it is necessary to find the deepest VP node, and the predicate verb or copula is the first node labeled starting with VB among the child nodes of this VP node. The word between the subject and the predicate verb or copula is the auxiliary verb.
[0166] (3) The object and predicative are usually located in the child nodes of the deepest VP node and are sibling nodes with the predicate verb node. If the child node is labeled as ADJP, this node is the predicative; if the child node is labeled as NP and the part of speech of the core verb is a lexical verb, this node is the object; if the child node is labeled as NP and the part of speech of the core verb is a copula, this node is the predicative.
[0167] (4) In the syntactic structure parsing tree, the attributive and adverbial are usually located around the modified word and are sibling nodes with the modified word. If the node is labeled as JJ or ADJP, the node is the attributive; if the node is labeled as RB or ADVP, the node is the adverbial; if the node is labeled as PP and the modified word is a noun, the node is the attributive; if the node is labeled as PP and the modified word is a verb, the node is the adverbial
[0168] Step S1342: Define a variable senComInfo of type SenComInfo. Based on the determination criteria, traverse the current syntactic structure parsing tree, sequentially identify the information of sentence components such as the subject and predicate in the sentence, and save them in senComInfo.
[0169] Figure 11 Shows a schematic diagram of the process of clause analysis for the syntactic structure parsing tree.
[0170] Figure 12 To convert Figure 4 the syntactic structure parsing tree into a standardized grammar tree schematic diagram.
[0171] Figure 13 Shows a flowchart schematic diagram of generating a standardized grammar tree.
[0172] Although the standardized grammar tree can show the clause relationships and various sentence components in a sentence in a clearer way, this structure is not suitable for automatic processing by a computer. For this reason, the present invention constructs a set of formal formula systems based on predicate logic. By converting the standardized grammar tree into a formal formula, the mathematical text has the characteristics of being computable and inferable, and then realizes automatic processing.
[0173] In one embodiment, the above step S14: Define the mapping rules between the standardized grammar tree and the formal formula. According to these rules, through recursive processing of the standardized grammar tree, a list of formal formulas is generated, specifically including:
[0174] Step S141: Define the mapping rules from the standardized grammar tree to the formal formula, including the mapping rules of sentences and the mapping rules of sentence components, specifically including:
[0175] Step S1411: Define the mapping rules of sentences, including: the corresponding relationships between the standardized grammar tree structures and the formal formula structures of simple sentences, subject clauses, object clauses, predicative clauses, attributive clauses, adverbial clauses or compound sentences; based on the sentence types, the corresponding relationships between the standardized grammar tree structures and the formal formula structures are shown in Table 2 as follows.
[0176] Table 2 Corresponding relationships between the standardized grammar tree structures and the formal formula structures
[0177] Step S1412: Define the mapping rules of sentence components, including the corresponding relationships between each node in the standardized grammar tree and the nodes in the formal formula; specifically: The V< POSV > and AV< POSAV > in can be obtained from VerbNode, and ADV can be obtained from the child node AdvNode of VerbNode; similarly, The core noun N in it can be obtained from NounNode, and ADJ can be obtained from the child node AdjNode of NounNode. In compound sentences and adverbial clauses, their connecting symbols are determined by CcNode. The corresponding relationships between common conjunctions or guiding words in CcNode and connecting symbols are shown in Table 3 below:
[0178] Table 3 Corresponding relationships between connecting symbols and conjunctions / guiding words
[0179] Step S142: Convert the standardized syntax tree into a formal formula. The specific steps are as follows:
[0180] Step S1421: Determine the sentence type according to clauseInfo in the sNode / sbarNode node of the current standardized syntax tree. If the tree is the standardized syntax tree of a simple sentence, go to Step S1422; if the tree is the standardized syntax tree of a compound sentence, go to Step S1423;
[0181] Step S1422: Obtain the formal formula structure corresponding to the current standardized syntax tree based on the mapping rules of the sentence; replace the components in the formal formula structure with the specific information in the nodes of the current standardized syntax tree based on the mapping rules of sentence components, so as to generate the formal formula FF corresponding to the simple sentence; go to Step S1424;
[0182] Step S1423: Obtain the formal formula structure corresponding to the current standardized syntax tree based on the mapping rules of the sentence; obtain the standardized syntax tree of the clause according to sbarNode in the sNode / sbarNode node of the current standardized syntax tree, and recursively execute Step S142 for each standardized syntax subtree of the clause to generate the corresponding formal formulas subFF1 and subFF2 of its subtrees, and then replace the components in the formal formula structure corresponding to the current standardized syntax tree with subFF1 and subFF2 to obtain the formal formula FF corresponding to the current standardized syntax tree;
[0183] Step S1424: Output the formal formula FF and end.
[0184] The function of Step S14 is to convert the standardized syntax tree into a formal formula, which can facilitate subsequent reasoning and verification based on the formal formula. Based on Step 14, the standardized syntax tree as shown in Figure 12 can be converted into the formal formula "be <vbp>(the limits[left right],equal)→exist <vbp>(the limit)”.
[0185] Figure 14 Schematic diagram of the module flow for generating formal formulas.
[0186] In one embodiment, the above step S2: performing logical reasoning verification and algebraic calculation verification on the formalized formula to determine the correctness of the reasoning process and conclusion, specifically includes:
[0187] Step S21: for each formalized formula in the formalized formula list, simplify the formalized formula by removing auxiliary verbs and part-of-speech tags to obtain a simplified formalized formula set;
[0188] Specifically: In the formal formula, information such as part-of-speech tags and auxiliary verbs is located in the first "< >" and "[ ]" after the core verb. The formal formula can be simplified directly based on this rule.
[0189] Step S22: Traverse the simplified reasoning step list reasoningStepFFList, perform logic verification or formal formula verification on each formal formula in the list, and add the formulas with correct verification results to the verified step list verifiedSteps. The specific steps are as follows:
[0190] Step S221: Define the atomic formal formula list atoFormulas and the connector list conSymbols. If it is a well-formed formula connected by a connection symbol, the atomic formula and the connection symbol need to be added to atoFormulas and conSymbols respectively; if If it is an atomic formula, it is directly added to the list atoFormulas;
[0191] Step S222: Get atoFormulas ,like Indicates subject or object For mathematical formulas that are algebraic calculations, they are verified by symbolic calculations. The verification process based on symbolic calculations is as follows: Figure 15 As shown, go to step S223; otherwise, verify by logical reasoning. The verification process based on logical reasoning is as follows: Figure 16 As shown, go to step S227;
[0192] Step S223: From Extract the algebraic calculation formula mathFormula to be verified;
[0193] Step S224: Traverse the premise list premiseFFList, perform variable substitution on the unknown variables in mathFormula to obtain an executable algebraic expression;
[0194] Step S225: Decompose the structure of mathFormula according to operators (such as "=", "≠", ">", "<", etc.) to generate an arithmetic formula sequence formulaList and a symbol sequence operatorsList;
[0195] Step S226: Based on the symbolic calculation function provided by Sympy, evaluate and compare adjacent arithmetic formulas in formulaList one by one to verify whether their calculation results are consistent with the semantics of the corresponding operators in operatorsList. If all arithmetic formula pairs satisfy the operator constraints, then is marked as a valid reasoning step, and go to Step S229; otherwise, it is marked as an invalid reasoning step and go to Step S2210;
[0196] Step S227: Judge Whether it is directly included in premisesFFList. If it exists, it means that is a known premise or has been proven, and is marked as a valid reasoning step, and go to Step S229; if it does not exist, go to Step S228;
[0197] Step S228: Traverse each theorem in the theorem list theoremsFFList If there exists a certain theorem whose contains and this theorem is included in the existing premise list premisesFFList, then is marked as a valid reasoning step, and go to Step S229; if after traversing the list theoremsFFList, no that meets the conditions is found, then
[0198] is marked as an invalid reasoning step and go to Step S2210; is added to the lists verifiedSteps and premisesFFList;
[0199] Step S2210: If the list atoFormulas has not been processed yet, go to Step S222; otherwise, go to Step S2211;
[0200] Step S2211: After verifying all atomic formulas After that, according to the connection symbol list conSymbols and the synthesis rules of predicate logic, verify the validity of the whole. If it is true, add it to the lists verifiedSteps and premisesFFList;
[0201] Step S23: After verifying each formal formula in the reasoningStepFFList After all are completed, the list verifiedSteps contains all the atomic formulas and well-formed formulas of valid inferences; if the list verifiedSteps contains all the formal formulas in the list reasoningStepFFList, it is considered that the reasoning steps are correct; otherwise, it is determined that there is an error in the reasoning process. If the list verifiedSteps contains all the formal formulas in the conclusionFFList, it is considered that the conclusion is correct; otherwise, the conclusion is considered wrong.
[0202] Figure 17 It is a schematic flow chart of reasoning verification based on logical reasoning.
[0203] Figure 18 It is a schematic flow chart of the method for reasoning verification of mathematical knowledge based on the formalization of mathematical texts in the present invention.
[0204] Embodiment 2
[0205] The embodiment of the present invention provides a mathematical knowledge reasoning verification system based on the formalization of mathematical texts, including the following modules:
[0206] The automatic formalization module 31 of mathematical texts, which is used to convert the input English text describing mathematical knowledge into a list of formal formulas that can be recognized and processed by a computer;
[0207] The reasoning verification module 32 based on formal formulas, which is used to perform logical reasoning verification and algebraic calculation verification on formal formulas to judge the correctness of the reasoning process and conclusion.
[0208] A mathematical knowledge reasoning verification device based on the formalization of mathematical texts includes one or more electronic devices, and one or more of the electronic devices are used to implement the method, system and device for reasoning verification of mathematical knowledge based on the formalization of mathematical texts.
[0209] An electronic device includes: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method, system and device for reasoning verification of mathematical knowledge based on the formalization of mathematical texts.
[0210] A computer-readable storage medium stores executable instructions thereon. When the instructions are executed by a processor, the processor implements a method, a system, and a device for mathematical knowledge reasoning and verification based on mathematical text formalization.
[0211] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present invention will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.< / vbp> < / vbp> < / steing> < / steing> < / string> < / advnode> < / adjnode> < / nounnode>
Claims
1. A method for reasoning and verifying mathematical knowledge based on the formalization of mathematical texts, characterized in that Including: Step S1: Convert the input English text describing mathematical knowledge into a list of formal formulas that can be recognized and processed by a computer. Among them, the English text describing mathematical knowledge includes: a set of premises, a set of theorems, a set of reasoning steps, and a conclusion set to be verified. The list of formal formulas includes: a list of premise formal formulas, a list of theorem formal formulas, a list of reasoning step formal formulas, and a list of conclusion formal formulas. Step S2: Perform logical reasoning verification and algebraic calculation verification on the formal formulas to judge the correctness of the reasoning process and conclusion.
2. The method for reasoning and verifying mathematical knowledge based on mathematical text formalization according to claim 1, wherein The said Step S1: Convert the input English text describing mathematical knowledge into a list of formal formulas that can be recognized and processed by a computer, specifically including: Step S11: Define atomic formulas and well-formed formulas based on predicate logic: The atomic formula is used to formalize simple sentences, and the structure of its formula is: ; Among them, represents a predicate, which consists of a verb phrase and a set of noun phrases ; the symbol indicates that there is one or more sub-components, which are used to represent unary predicates or multi-ary predicates; The verb phrase is defined as follows: ; Among them, represents the verb prototype of the core predicate verb, represents the auxiliary verb, represents the adverbial modifying the core predicate verb, and respectively represent the part-of-speech tags of the core predicate verb and the auxiliary verb, used to represent part-of-speech information such as tense and voice, and the symbol indicates that there are zero or more sub-components; The said noun phrase has the following structure: ; Among them, represents the core noun or the predicative adjective, represents the attributive or other relevant attributes modifying the core noun or the predicative adjective; The well-formed formula is an expansion of the atomic formula structure by introducing connection symbols and recursive structures to formalize compound sentences, including: sentence relations of negation, disjunction, conjunction, implication, equivalence, temporal sequence, and comparison. Step S12: Use the syntactic parsing method of Stanford CoreNLP and the LaTeX syntax analysis method for each sentence in the input English text describing mathematical knowledge to complete the parsing of the syntactic structure and generate the corresponding syntactic structure parsing tree. Step S13: Perform clause analysis and sentence component analysis on the syntactic structure parsing tree, extract clause information and sentence component information, and generate a standardized syntax tree. Step S14: Define the mapping rules between the standardized syntax tree and the formal formula. According to this rule, through recursive processing of the standardized syntax tree, generate a list of formal formulas.
3. The method for reasoning and verifying mathematical knowledge based on the formalization of mathematical texts according to claim 2, characterized in that The said Step S12: Use the syntactic parsing method of Stanford CoreNLP and the LaTeX syntax analysis method for each sentence in the input English text describing mathematical knowledge to complete the parsing of the syntactic structure and generate the corresponding syntactic structure parsing tree, specifically including: Step S121: First, check whether the sentence in the English text contains LaTeX format information identifiers. If the sentence text does not contain LaTeX format information, go to Step S122; otherwise, go to Step S123. Step S122: First, configure the Properties object of Stanford CoreNLP to set task parameters. Then, encapsulate the sentence to be processed as an Annotation object and execute the task. Finally, extract the syntactic structure parsing tree of the sentence from the processed document and go to Step S126. Step S123: Replace the mathematical formulas in LaTex format in the sentence with symbols ; Then, according to the words or symbols directly adjacent to each other in the sentence, judge whether the clause where it is located contains a predicate verb; Step S124: Perform the same operations as in Step S122 to convert the sentence processed in Step S123 into a syntactic structure parsing tree. Step S125: For each symbol in the syntactic structure parsing tree , convert the corresponding LaTeX-formatted mathematical formula into a formula structure tree. The specific steps are as follows: Step S1251: Determine the precedence of operators in the formula, initialize the bracket depth to 0, and then traverse from left to right based on the bracket depth and the basic precedence of the operators for the corresponding mathematical formula. When a left bracket is encountered, increment the bracket depth by 1; when a right bracket is encountered, decrement the bracket depth by 1; when an operator is encountered, record the operator and its current bracket depth in the operatorDepthMap; Step S1252: Select the operator with the minimum bracket depth and the highest priority from the operatorDepthMap as the root node of the formula structure tree. The strings on the left and right of the operator or the strings in two consecutive brackets on the right of the operator are the components operated on by the operator. Based on the components operated on by the operator, left and right subtrees can be constructed: If the components operated on by the operator do not contain operators, directly construct nodes based on these components; if they contain operators, recursively call Step S125 to construct the tree structure of the sub-formula until the parsing of the formula structure tree ends. Step S126: Return the syntactic structure parsing tree and end.
4. The method for reasoning and verifying mathematical knowledge based on the formalization of mathematical texts according to claim 2, characterized in that, The said Step S13: Conduct clause analysis and sentence component analysis on the syntactic structure parsing tree, extract clause information and sentence component information, and generate a standardized grammar tree, specifically including: Step S131: Define the structure body of the basic node of the standardized grammar tree and the structure bodies of sentence component information and clause information. Step S132: Convert the syntactic structure parsing tree into a standardized grammar tree in a recursive manner, specifically including: Step S1321: Conduct clause analysis on the current syntactic structure parsing tree to obtain the clause type information clauseInfo of the current syntactic structure parsing tree. Step S1322: Process according to the sentence type recorded in the current clauseInfo: If the sentence corresponding to the current syntactic structure parsing is a simple sentence, go to Step S1323; if the sentence corresponding to the current syntactic structure parsing is a noun clause, go to Step S1324; if the sentence corresponding to the current syntactic structure parsing is an attributive clause, go to Step S1325; if the sentence corresponding to the current syntactic structure parsing is an adverbial clause, go to Step S1326; if the sentence corresponding to the current syntactic structure parsing is a compound sentence, go to Step S1327. Step S1323: Convert the syntactic structure parsing tree of the current simple sentence type into a standardized grammar tree. The specific steps are as follows: Step S13231: Conduct sentence component analysis on the current syntactic structure parsing tree to obtain the sentence component information senComInfo of the current syntactic structure parsing tree. Step S13232: Nodes corresponding to the current syntactic structure parsing tree in the standardized grammar tree can be created according to the sentence component information in the current senComInfo: Create a variable nounNode of type NounNode according to the variables subject, objectList or predicative; create a variable verbNode of type VerbNode according to the variable auxiliaryVerb plus predicate or linkVerb; create a variable adjNode of type AdjNode modifying a certain nounNode according to the variable attributiveMap; create a variable advNode of type AdvNode modifying a certain verbNode according to the variable adverbialMap. Step S13233: Based on the current senComInfo, clauseInfo, and the already constructed standardized syntax tree nodes, construct the variables sNode / sbarNode of type SNode / SbarNode in the standardized syntax tree corresponding to the current syntactic structure parse tree; Step S13234: Combine sNode / sbarNode, verbNode, nounNode, adjNode, and advNode to obtain the standardized syntax tree SGT corresponding to the current syntactic structure parse tree; Go to step S1328; Step S1324: Convert the syntactic structure parse tree of the current noun clause type into a standardized syntax tree. The specific steps are as follows: S13241: Obtain the root node sRoot of the current syntactic structure parse tree and the root node subRoot1 of the clause therein according to the current clauseInfo, and replace the SBAR node in subRoot1 in the syntactic structure parse tree with the root node sRoot with an NP node; S13242: Recursively execute step S132 on the syntactic structure parse trees with sRoot and subRoot1 as the root nodes respectively to obtain the standardized syntax trees SGT1 and SGT2; S13243: Based on the current clauseInfo, the sbarNode in SGT1, and the sbarNode in SGT2, construct the variables sNode / sbarNode of type SNode / SbarNode in the standardized syntax corresponding to the current syntactic structure parse tree; S13244: Combine sNode / sbarNode, SGT1, and SGT2 to obtain the standardized syntax tree SGT corresponding to the current syntactic structure parse tree; Go to step S1328; Step S1325: Convert the syntactic structure parse tree of the current attributive clause type into a standardized syntax tree. The specific steps are as follows: Step S13251: Obtain the root node sRoot of the current syntactic structure parse tree and the root node subRoot1 of the clause according to the current clauseInfo, and delete the SBAR node in subRoot1 in the syntactic structure parse tree with sRoot as the root node; Step S13252: Perform the same operations as steps S13242 - S13243 to obtain sNode / sbarNode, SGT1, and SGT2; Combine sNode / sbarNode, SGT1, and SGT2 to obtain the standardized syntax tree SGT corresponding to the current syntactic structure parse tree; Go to step S1328; Step S1326: Convert the syntactic structure parse tree of the current adverbial clause type into a standardized syntax tree. The specific steps are as follows: Step S13261: Obtain the root node sRoot of the current syntactic structure parse tree and the root node subRoot1 of the clause according to the current clauseInfo, and delete the SBAR nodes in subRoot1 in the syntactic structure parse tree with sRoot as the root node; Step S13262: Recursively execute Step 3.2 on the syntactic structure parse trees with sRoot and subRoot1 as the root nodes respectively to obtain the standardized grammar trees SGT1 and SGT2; Step S13263: Based on the current clauseInfo, the sbarNode in SGT1, and the sbarNode in SGT2, construct the variables sNode / sbarNode of type SNode / SbarNode in the standardized grammar corresponding to the current syntactic structure parse tree; Step S13264: Construct a variable ccNode of type CcNode according to the ccWord in the current clauseInfo; then combine ccNode, sNode / sbarNode, SGT1, and SGT2 to obtain the standardized grammar tree SGT; go to Step S1328; Step S1327: Convert the syntactic structure parse tree of the current coordinate sentence type into a standardized grammar tree. The specific steps are as follows: Step S13271: Obtain subRoot1 and subRoot2 according to the current clauseInfo, and recursively execute Step S132 on the syntactic structure parse trees with subRoot1 and subRoot2 as the root nodes respectively to obtain the standardized grammar trees SGT1 and SGT2; Step S13272: Perform the same operations as in Step S13263 to obtain the variables sNode / sbarNode of type SNode / SbarNode in the standardized grammar corresponding to the current syntactic structure parse tree; Step S13273: Construct a variable ccNode of type CcNode according to the ccWord in the current clauseInfo; then combine ccNode, sNode / sbarNode, SGT1, and SGT2 to obtain the standardized grammar tree SGT; go to Step S1328; Step S1328: Output SGT and end; Step S133: Perform clause analysis on the syntactic structure parse tree. The specific steps are as follows: Step S1331: Define a variable clauseInfo of type ClauseInfo to save the clause information of all subtrees in the current syntactic structure parse tree; store the root node of the current syntactic structure parse tree in sRoot of clauseInfo; Step S1332: Define a queue nodeQueue and add the root node of the current syntactic structure parse tree to the queue nodeQueue; Step S1333: Take out the first node firstNode of the queue nodeQueue and add the child nodes of firstNode to nodeQueue; Step S1334: If firstNode is marked as S / SBAR, go to Step S13341; otherwise, go to Step S1335; Step S13341: If the children nodes of firstNode contain both an SBAR node and a VP node, and the SBAR node is on the left side of the VP node, then the sentence type is a subject clause. Store the content of the subject clause, the SBAR node, and the first child node of the SBAR node into sentenceType, subRoot1, and ccWord of clauseInfo respectively, and go to Step S1339; otherwise, go to Step S13342; Step S13342: If the children nodes of firstNode contain both a CC node and an S / SBAR node, and the CC node is between the two S / SBAR nodes, then the sentence type is a compound sentence. Store the content of the compound sentence, the two S / SBAR nodes, and the CC node into sentenceType, subRoot1, subRoot2, and ccWord of clauseInfo respectively, and go to Step S1339; otherwise, go to Step S13343; Step S13343: If firstNode is marked as SBAR, then the sentence type is an adverbial clause. Store the content of the adverbial clause, the SBAR node, and the first child node of the SBAR node into sentenceType, subRoot1, and ccWord of clauseInfo respectively, and go to Step S1339; otherwise, go to Step S1337; Step S1335: If firstNode is marked as NP, go to Step S13351; otherwise, go to Step S1336; Step S13351: If the children nodes of firstNode contain both an NP node and an SBAR node, and the NP node is on the right side of the SBAR node, then the sentence type is an attributive clause. Store the content of the attributive clause, the SBAR node, and the first child node of the SBAR node into sentenceType, subRoot1, and ccWord of clauseInfo respectively, and go to Step S1339; otherwise, go to Step S1337; Step S1336: If firstNode is marked as VP, go to Step S13361; otherwise, go to Step S1337; Step S13361: If the children nodes of firstNode contain both a node representing a verb and an SBAR node, and the SBAR node is on the right side of the verb node, go to Step S13362; otherwise, go to Step S1337; Step S13362: If the core verb is a lexical verb, the sentence type is an object clause; if the core verb is a copular verb, the sentence type is a predicative clause. Store the content in the object / predicative clause, the SBAR node, and the first child node of the SBAR node into the sentenceType, subRoot1, and ccWord of clauseInfo respectively, and go to Step S1339; Step S1337: If nodeQueue is not empty, go to Step S1333; otherwise, go to Step S1338; Step S1338: Store the simple sentence into the sentenceType of clauseInfo; Step S1339: Output clauseInfo and end; Step S134: For the simple sentences and the simple-sentence-type clauses in the complex sentences, perform sentence component analysis. The specific steps are as follows: Step S1341: Define the criteria for determining sentence component information in the sentence based on the node labels and the position information of the nodes, including subject, predicate, copular verb, object, predicative, attributive, and adverbial; Step S1342: Define a variable senComInfo of type SenComInfo. Based on the above criteria, traverse the current syntactic structure parse tree, and sequentially identify the sentence component information such as the subject and predicate in the sentence, and save them in senComInfo.
5. The method for reasoning and verifying mathematical knowledge based on mathematical text formalization according to claim 4, wherein The said Step S14: Define the mapping rules between the standardized grammar tree and the formal formula. According to these rules, through recursive processing of the standardized grammar tree, generate a list of formal formulas, specifically including: Step S141: Define the mapping rules from the standardized grammar tree to the formal formula, including the mapping rules of sentences and the mapping rules of sentence components, specifically including: Step S1411: Define the mapping rules of sentences, including the corresponding relationships between the standardized grammar tree structures and the formal formula structures of simple sentences, subject clauses, object clauses, predicative clauses, attributive clauses, adverbial clauses, or compound sentences; Step S1412: Define the mapping rules of sentence components, including the corresponding relationships between each node in the standardized grammar tree and the nodes in the formal formula; Step S142: Convert the standardized grammar tree into a formal formula. The specific steps are as follows: Step S1421: Judge the sentence type according to the clauseInfo in the sNode / sbarNode node of the current standardized grammar tree. If the tree is the standardized grammar tree of a simple sentence, go to Step S1422; if the tree is the standardized grammar tree of a complex sentence, go to Step S1423; Step S1422: Obtain the formal formula structure corresponding to the current standardized grammar tree based on the mapping rules of sentences; replace the components in the formal formula structure with the specific information in the nodes of the current standardized grammar tree based on the mapping rules of sentence components, so as to generate the formal formula FF corresponding to the simple sentence. Go to Step S1424; Step S1423: Obtain the formal formula structure corresponding to the current normalized syntax tree based on the mapping rules of the sentence; obtain the normalized syntax tree of the clause from the sbarNode in the sNode / sbarNode nodes in the current normalized syntax tree, and recursively execute Step S142 for the normalized syntax subtrees of each clause to generate the corresponding formal formulas subFF1 and subFF2 for their subtrees, and then replace the components in the formal formula structure corresponding to the current normalized syntax tree with subFF1 and subFF2 to obtain the formal formula FF corresponding to the current normalized syntax tree; Step S1424: Output the formal formula FF and end.
6. The method for reasoning and verifying mathematical knowledge based on mathematical text formalization according to claim 4, wherein The said Step S2: Conduct logical reasoning verification and algebraic calculation verification on the formal formula to judge the correctness of the reasoning process and conclusion, specifically including: Step S21: For each formal formula in the formal formula list, simplify the formal formula by removing auxiliary verbs and part-of-speech tags to obtain a set of simplified formal formulas; Step S22: Traverse the simplified reasoning step list reasoningStepFFList, conduct logical verification or formal formula verification on each formal formula in the list, and add the formulas with correct verification results to the verified steps list verifiedSteps. The specific steps are as follows: Step S221: Define a list of atomic formal formulas atoFormulas and a list of connectives conSymbols. For a formal formula , if it is a well-formed formula connected by connective symbols, the atomic formula and the connective symbol need to be added to atoFormulas and conSymbols respectively; if itself is an atomic formula, it is directly added to the list atoFormulas; Step S222: Take from atoFormulas , if representing the subject or object in is a mathematical formula for algebraic calculation, then perform verification by symbolic calculation and go to step S223; otherwise, perform verification by logical reasoning and go to step S227; Step S223: Extract the algebraic calculation formula mathFormula to be verified from ; Step S224: Traverse the premise list premiseFFList, perform variable substitution on the unknown variables in mathFormula to obtain an executable algebraic expression; Step S225: Decompose the structure of mathFormula according to the operators to generate an arithmetic expression sequence formulaList and a symbol sequence operatorsList; Step S226: Based on the symbolic calculation function provided by Sympy, evaluate and compare adjacent arithmetic expressions in formulaList one by one to verify whether their calculation results are consistent with the semantics of the corresponding operators in operatorsList. If all arithmetic expression pairs satisfy the operator constraints, then is marked as a valid reasoning step and proceed to Step S229; otherwise, it is marked as an invalid reasoning step and proceed to Step S2210; Step S227: Determine whether is directly included in premisesFFList. If it exists, it means that is a known premise or has been proven, and mark as a valid inference step, and go to step S229; if it does not exist, go to step S228; Step S228: Traverse each theorem in the theorem list theoremsFFList , if there exists a certain theorem that contains and this theorem is contained in the existing premise list premisesFFList, then mark as a valid inference step and go to step S229; if after traversing the list theoremsFFList, no meeting the conditions is found, then mark as an invalid inference step and go to step S2210; Step S229: Add to the lists verifiedSteps and premisesFFList; Step S2210: If the list atoFormulas has not been processed completely, go to Step S222; otherwise, go to Step S2211; Step S2211: After verifying all atomic formulas and according to the connective list conSymbols and the synthesis rules of predicate logic, verify the overall validity. If it is true, add it to the lists verifiedSteps and premisesFFList; Step S23: For each formal formula in reasoningStepFFList After all verifications are completed, the list verifiedSteps contains all atomic formulas and well-formed formulas of valid inferences; if the list verifiedSteps contains all the formal formulas in the list reasoningStepFFList, the inference steps are considered correct; otherwise, it is determined that there is an error in the inference process. If the list verifiedSteps contains all the formal formulas in the conclusion conclusionFFList, the conclusion is considered correct; otherwise, the conclusion is considered incorrect.
7. A mathematical knowledge reasoning and verification system based on the formalization of mathematical texts, characterized in that, Including the following modules: An automatic formalization module for mathematical texts, which is used to convert the input English text describing mathematical knowledge into a list of formal formulas that can be recognized and processed by a computer; A reasoning verification module based on formal formulas, which is used to conduct logical reasoning verification and algebraic calculation verification on the formal formulas to judge the correctness of the reasoning process and conclusion.
8. A mathematical knowledge reasoning and verification device based on the formalization of mathematical texts, characterized in that, Including one or more electronic devices, wherein the one or more electronic devices are used to implement the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, Including: One or more processors; A memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that, An executable instruction is stored thereon, and when the instruction is executed by a processor, the processor is caused to implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Chinese knowledge inference method based on ontology inference
CN104376110A