A rule self-expanding reasoning method and system based on second-order entity grammar

CN122529095APending Publication Date: 2026-08-07BEIJING YIGAI INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING YIGAI INTELLIGENT TECHNOLOGY CO LTD
Filing Date
2026-05-22
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

但在复杂任务中,待推理对象往往由多个具有层级包含关系、属性传递关系和跨域约束关系的实体共同构成,传统规则系统通常只能依据已有规则进行单域或预设关系推导,难以发现多个子实体域在联合推导过程中产生的新增结构化结果,也难以将该结果进一步转化为可复用的新规则

Benefits of technology

[0042]1、本发明通过将待推理任务转换为包含实体类型、属性集合、关系集合和子实体引用集合的实体数据结构,并设置实体推导层和规则自扩展层,使系统不仅能够基于已有产生式规则进行确定性推导,还能够根据推导链和候选涌现实体生成新的候选产生式规则。相比依赖人工维护规则库或基于样本统计学习规则的方式,本发明能够将新规则的来源直接关联到具体推导链,使规则的输入条件、输出结构、变量绑定关系和适用约束具有明确依据,提高规则自扩展过程的可解释性和可验证性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122529095A_ABST
    Figure CN122529095A_ABST
Patent Text Reader

Abstract

The application discloses a rule self-expansion reasoning method and system based on a second-order entity grammar, and relates to the fields of knowledge engineering and automatic reasoning. The method converts structured input data of a to-be-reasoned task into an entity data structure, performs deterministic matching derivation based on a current rule set and records a derivation chain; multiple sub-entity domains are divided according to entity hierarchical reference relations, and a joint entity space is formed in combination with cross-domain constraints; derivation is performed on the joint entity space and each sub-entity domain respectively, and candidate emerging entities are determined according to structural differences of derivation results; candidate production rules are generated according to derivation chains corresponding to the candidate emerging entities, and rule legality verification, rule conflict detection and effective expansion verification are performed; when effective expansion conditions are met, the candidate production rules are enabled to the current rule set and a reasoning result is output. The application can improve traceability, stability and reliability of a rule self-expansion process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of knowledge engineering and automated reasoning, and in particular to a rule-based self-expanding reasoning method and system based on second-order entity grammar. Background Technology

[0002] With the development of knowledge engineering, automated reasoning, and rule learning technologies, rule-based reasoning systems have been widely applied in scenarios such as intelligent decision-making, task planning, fault diagnosis, and knowledge graph reasoning. Existing rule-based reasoning systems typically rely on pre-built rule bases to generate reasoning conclusions based on the matching results of input data and rule triggering conditions, offering advantages such as interpretable reasoning processes and traceable results. However, in complex tasks, the object to be reasoned about often consists of multiple entities with hierarchical inclusion relationships, attribute transitive relationships, and cross-domain constraint relationships. Traditional rule systems can usually only perform single-domain or preset relationship derivations based on existing rules, making it difficult to discover the newly added structured results generated during the joint derivation of multiple sub-entity domains, and also difficult to further transform these results into reusable new rules.

[0003] Existing rule learning methods, such as inductive logic programming, association rule mining, knowledge graph rule completion, and neural symbolic rule learning, can discover new rules to some extent, but they typically rely on positive and negative examples, statistical correlations, manual annotation, or externally trained models. The correspondence between generated rules and the original derivation chain is not clear enough, and the addition of new rules may lead to duplication, conflict, or circular derivations. While existing multi-source knowledge fusion methods can compare inference differences between different knowledge sources or rule bases, their focus is usually on knowledge inconsistency detection, rather than constructing sub-entity domains based on hierarchical reference relationships within entities and identifying cross-domain emergent results through inference differences of the same rule set in the joint entity space and the independent spaces of each sub-entity domain. Therefore, this paper proposes a rule-based self-expanding inference method and system based on second-order entity grammar. Summary of the Invention

[0004] The main objective of this invention is to provide a rule-based self-expanding reasoning method and system based on second-order entity syntax, which can effectively solve the problems in the background art.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0006] A rule-based self-expanding reasoning method based on second-order entity grammar includes the following steps:

[0007] Step S1: Obtain the structured input data corresponding to the task to be reasoned, convert the structured input data into an entity data structure, and establish the current entity space based on the entity data structure; the structured input data includes at least one of task objects, object attributes, object relationships, and task constraints; the second-order entity grammar includes an entity derivation layer and a rule self-expansion layer, the entity derivation layer is used to derive the entity data structure based on production rules, and the rule self-expansion layer is used to generate new production rules based on the derivation chain and candidate emergent entities;

[0008] Step S2: Perform deterministic matching derivation on the current entity space based on the production rules in the current rule set, generate the derivation result and record the derivation chain;

[0009] Step S3: Divide the entity data structure into multiple sub-entity domains according to the hierarchical reference relationship, and form a joint entity space based on the multiple sub-entity domains and the cross-domain constraint part involving different sub-entity domains in the task constraints.

[0010] Step S4: Perform rule derivation on the joint entity space and each sub-entity domain respectively to obtain the globally derivable entity set and the independently derivable entity set. Based on the structural differences between the globally derivable entity set and the independently derivable entity set, as well as the number of different sub-entity domains involved in the derivation chain, determine the candidate emerging entities.

[0011] Step S5: Generate candidate production rules based on the derivation chain corresponding to the candidate emerging entity. The candidate production rules are used as extension rules to be added to the current rule set.

[0012] Step S6: Perform rule validity verification and rule conflict detection on the candidate production rules;

[0013] Step S7: After the candidate production rule passes the rule validity verification and rule conflict detection, the candidate production rule is effectively extended and verified based on the verification sample entity set.

[0014] Step S8: When the candidate production rule meets the valid expansion condition, the candidate production rule is enabled in the current rule set, and the inference result is output based on the enabled rule set.

[0015] Furthermore, the entity data structure includes an entity identifier, entity type, attribute set, relation set, sub-entity reference set, and entity status identifier; the production rule includes a left-side matching template, a right-side construction template, variable binding conditions, applicable constraints, and rule priority; the entity derivation layer uses the entity data structure as the operation object to generate entity derivation results based on existing production rules; the rule self-expansion layer uses the derivation chain, candidate emergent entities, and production rules as the operation objects to extract new production rules from the entity derivation results; the variables in the production rule include at least one of entity type variables, attribute variables, and relation type variables.

[0016] Furthermore, in step S2, the deterministic matching derivation includes: searching for input entities in the current entity space that meet the matching requirements in terms of entity type, attribute conditions, and relation conditions according to the left-hand matching template of the production rule; when the input entity meets the applicable constraints, binding the attribute values, relation identifiers, or sub-entity references in the input entity to the right-hand construction template according to the variable binding conditions; generating an output entity or updating entity relations according to the right-hand construction template; when multiple production rules simultaneously meet the matching requirements, determining the execution order according to a preset fixed rule priority, and executing rules with the same priority in a preset fixed order; each rule execution forms a derivation record, which includes a rule identifier, input entity, output entity, variable binding result, constraint condition satisfaction result, and execution result, and multiple derivation records constitute the derivation chain in the execution order.

[0017] Furthermore, in steps S3 and S4, the sub-entity domains are recursively determined based on the sub-entity reference set in the entity data structure. Each sub-entity domain corresponds to a root entity and all entities directly or indirectly referenced by the root entity through the sub-entity reference set. When there is an entity relationship, attribute transitive relationship, or task constraint association between at least two sub-entity domains, the entities in the at least two sub-entity domains and their cross-domain relationships and cross-domain constraints are merged to form a joint entity space. Based on the current rule set, a globally deducible entity set is obtained by performing derivation on the joint entity space. Based on the current rule set, derivation is performed on each sub-entity domain and merged to obtain an independently deducible entity set. The candidate difference entity set is determined according to the following relationship:

[0018]

[0019] in, Represents the set of candidate differing entities. Represents a globally inferable set of entities. Represents an independent and derivable set of entities. Representing entities With entity A structural equivalence match cannot be formed. Representing entities The set of sub-entity domains that participate in the input in the corresponding derivation chain;

[0020] The entities in the candidate differential entity set are selected as candidates for emerging entities.

[0021] Furthermore, the structural equivalence matching includes entity type equivalence, key attribute change equivalence, and relation change equivalence; when the candidate difference entity satisfies the complete and valid derivation chain condition and the rule novelty condition, it is determined as a candidate emergent entity; the complete and valid derivation chain condition includes: each step of the derivation chain corresponding to the candidate difference entity has a corresponding production rule, input entity, output entity, variable binding result, and constraint condition satisfaction result, and there is a reference relationship between the output entity and the input entity between adjacent derivation records; the rule novelty condition includes: there is no existing production rule in the current rule set that can directly generate the same entity type, key attribute change, and relation change as the candidate difference entity through a single production rule under the same combination of input entity types.

[0022] Further, in step S5, generating candidate production rules based on the derivation chains corresponding to candidate emerging entities includes: selecting the derivation chain with the fewest derivation steps and satisfying the condition of complete and valid derivation chains from one or more derivation chains corresponding to candidate emerging entities as the rule extraction chain; determining the entity type combination of the input entities at the head of the chain in the rule extraction chain as the main body of the left matching template; determining the key attribute conditions in the input entities at the head of the chain that are passed to the candidate emerging entities and whose values ​​remain unchanged as the condition part of the left matching template; determining the relationship conditions between the input entities at the head of the chain as the connection part of the left matching template; determining the entity type of the candidate emerging entity as the main body of the right construction template; and determining the candidate emerging entity's entity type as the main body of the right construction template. The attributes, relationships, and sub-entity references that are added or changed by the real entity relative to the input entity corresponding to the left-hand matching template are determined as the construction part of the right-hand construction template; the constant attribute values, relationship identifiers, and sub-entity references in the rule extraction chain are generalized, and constants with corresponding relationships between the input and output entities are replaced with variables, while retaining the entity type constraints, attribute value boundaries, and relationship direction constraints corresponding to the variables; wherein, when the constant corresponds to at least two different specific values ​​in the verification sample entity set and can still generate structurally equivalent candidate emergent entities, the constant is generalized as a variable; otherwise, the constant is retained as part of the applicable constraints; the candidate production rule is expressed as:

[0023]

[0024] in, Indicates the left-side matching template. Indicates the applicable constraints. Indicates the variable binding condition. This indicates the template for constructing the right side. The initial priority of the candidate production rule is indicated; the initial priority is determined based on at least one of the following: the number of derivation steps of the rule extraction chain, the frequency of occurrence of candidate emerging entities, or a preset default priority.

[0025] Furthermore, in step S6, the rule validity verification includes: verifying whether the entity type declared in the left-hand matching template of the candidate production rule has a matching specific entity instance in the current entity space or the verification sample entity set; verifying whether all variables in the candidate production rule have input source positions and output reference positions; verifying whether the output entity type generated by the right-hand construction template of the candidate production rule belongs to the preset entity type set; verifying whether the output entity generated by the candidate production rule is consistent with the candidate emergent entity in terms of entity type, key attribute changes, and relationship changes; rule conflict detection includes template duplication detection, mutually exclusive output detection, and circular derivation detection.

[0026] The mutual exclusion output detection is used to determine whether, under the same combination of input entity types and the same applicable constraints, the candidate production rule and the existing production rule generate output entities with the same entity type but contradictory key attribute values, or whether they generate output entities with the same relation type but conflicting relation directions, relation objects, or relation states. The loop derivation detection is used to determine whether the output entity generated by the candidate production rule can re-trigger the candidate production rule itself, or re-trigger the left-side matching template of the candidate production rule through the existing production rule.

[0027] Further, in step S7, the effective expansion verification includes: performing derivation on the verification sample entity set based on the current rule set to obtain a baseline derivable entity set; performing derivation on the same verification sample entity set using only candidate production rules to obtain a candidate rule contributing entity set; when at least one entity in the candidate rule contributing entity set cannot form a structurally equivalent match with any entity in the baseline derivable entity set, and the candidate production rule does not have a circular dependency that directly or indirectly triggers itself, it is determined that the candidate production rule satisfies the effective expansion condition; the effective expansion condition is expressed as:

[0028]

[0029]

[0030] in, This represents the benchmark derivable entity set derived from the validation sample entity set based on the current rule set. This indicates that only candidate rules derived from the same validation sample entity set are used to contribute to the entity set. Representing entities With entity A structural equivalence match cannot be formed. This represents the set of valid new entities generated by the candidate production rule.

[0031] A rule-based self-expanding reasoning system based on second-order entity grammar, comprising:

[0032] The entity structure construction module is used to acquire the structured input data corresponding to the task to be reasoned, convert the structured input data into an entity data structure, and establish the current entity space based on the entity data structure.

[0033] The deterministic derivation module is used to perform deterministic matching derivation on the current entity space based on the production rules in the current rule set, generate derivation results and record the derivation chain;

[0034] The sub-entity domain construction module is used to divide multiple sub-entity domains according to the hierarchical reference relationship in the entity data structure, and to form a joint entity space based on the multiple sub-entity domains and cross-domain constraints.

[0035] The emergent entity detection module is used to perform rule derivation on the joint entity space and each sub-entity domain respectively, and determine candidate emergent entities based on the structural differences between the derivation results of the two.

[0036] The candidate rule generation module is used to generate candidate production rules based on the derivation chain corresponding to the candidate emergent entity;

[0037] The rule verification module is used to verify the legality of the candidate production rules and detect rule conflicts.

[0038] An effective extended verification module is used to perform effective extended verification of candidate production rules that have passed rule validity verification and rule conflict detection based on the verification sample entity set;

[0039] The inference output module is used to enable the candidate production rule to the current rule set when the candidate production rule meets the valid expansion condition, and output the inference result based on the enabled rule set.

[0040] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method steps.

[0041] Compared with the prior art, the present invention has the following beneficial effects:

[0042] 1. This invention transforms the reasoning task into an entity data structure containing entity types, attribute sets, relation sets, and sub-entity reference sets. It also establishes an entity derivation layer and a rule self-expansion layer, enabling the system to not only perform deterministic derivation based on existing production rules but also generate new candidate production rules based on the derivation chain and candidate emergent entities. Compared to methods relying on manually maintained rule bases or learning rules based on sample statistics, this invention directly links the source of new rules to specific derivation chains, providing clear evidence for the rule's input conditions, output structure, variable binding relationships, and applicable constraints, thus improving the interpretability and verifiability of the rule self-expansion process.

[0043] 2. This invention recursively divides multiple sub-entity domains based on hierarchical reference relationships in the entity data structure, and forms a joint entity space by combining cross-domain constraints. By comparing the globally inferable entity set under the joint entity space with the independently inferable entity sets obtained from each sub-entity domain, candidate emergent entities that appear only in cross-domain joint inference are identified. This method differs from ordinary knowledge source difference detection, more accurately discovering structurally new inference results generated collaboratively by multiple sub-entity domains, and providing a more reliable basis for candidate rule generation.

[0044] 3. This invention incorporates rule validity verification, rule conflict detection, and effective expansion verification before candidate rules are activated. This allows for checks on variable sources, output structure, template duplication, mutually exclusive outputs, and circular derivations, and verifies whether candidate rules can generate valid new entities that the current rule set cannot. Therefore, new rules are not directly added to the rule base but are activated only after passing multiple verifications, reducing invalid, duplicate, and conflicting rules, and improving the stability of the expanded rule set and the reliability of the inference results. Attached Figure Description

[0045] Figure 1 This is a schematic diagram of the method flow of the present invention;

[0046] Figure 2 This is a schematic diagram of the system modules of the present invention. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0048] Example 1

[0049] like Figure 1-2As shown, this invention provides a rule-based self-expanding reasoning method and system based on second-order entity grammar, applicable to rule reasoning scenarios with hierarchical entity structures and cross-domain constraints, such as equipment status judgment, task planning, fault diagnosis, knowledge graph reasoning, or process compliance verification. The basic idea is as follows: First, the task to be reasoned is converted into an entity data structure, and deterministic derivation is performed using existing production rules; then, multiple sub-entity domains are divided according to the hierarchical reference relationships between entities, and the results obtained from independent derivation in the joint entity space and each sub-entity domain are compared to identify candidate emergent entities generated in the cross-domain derivation; finally, candidate production rules are generated based on the derivation chains corresponding to the candidate emergent entities, and after verification, they are added to the current rule set.

[0050] In one implementation, the system acquires structured input data corresponding to the task to be reasoned. This structured input data may include task objects, object attributes, object relationships, and task constraints. Taking device state reasoning as an example, the input data may include device entities, temperature sensing units, cooling execution units, environmental states, and control and constraint relationships between these entities. The system converts this data into entity data structures. Each entity data structure includes an entity identifier, entity type, attribute set, relationship set, sub-entity reference set, and entity state identifier. The entity type distinguishes object categories such as devices, components, states, or constraints; the attribute set records parameters such as temperature, response status, and operating status; the relationship set records control, dependency, connection, or constraint relationships; and the sub-entity reference set represents the hierarchical inclusion relationship between entities.

[0051] For example, a device entity can be the root entity, and a temperature sensing unit, a cooling execution unit, and an environmental state unit can be its child entities. The temperature sensing unit has a "temperature trend" attribute, the cooling execution unit has a "response status" attribute, and the environmental state unit has an "ambient temperature" attribute. Through these entities, their attributes, relationships, and child entity references, the system establishes the current entity space.

[0052] After the current entity space is established, the system performs deterministic matching derivation based on the production rules in the current rule set. Production rules include a left-hand matching template, a right-hand construction template, variable binding conditions, applicable constraints, and rule priorities. The left-hand matching template is used to match the type, attributes, and relationships of the input entities; the right-hand construction template is used to generate output entities or update entity relationships; variable binding conditions are used to pass attribute values ​​or relationship identifiers from the input entities to the output entities; applicable constraints are used to limit the rule triggering conditions; and rule priorities are used to determine the execution order when multiple rules are satisfied simultaneously.

[0053] For example, the current rule set may include: generating a thermal state abnormal entity when the temperature trend of the temperature sensing unit is continuously rising; and generating an execution state abnormal entity when the response status of the cooling execution unit is unresponsive. When the system executes the above rules, it records the rule identifier, input entity, output entity, variable binding result, constraint satisfaction result, and execution result used in each derivation step, and these derivation records form a derivation chain.

[0054] Subsequently, the system recursively divides the entity data structure into multiple sub-entity domains based on the set of sub-entity references. A sub-entity domain can consist of a root entity and all sub-entities directly or indirectly referenced by that root entity. For example, entities related to temperature sensing can be divided into the first sub-entity domain, entities related to cooling execution into the second sub-entity domain, and entities related to environmental constraints into the third sub-entity domain. When there are entity relationships, attribute transitive relationships, or task constraint associations between at least two sub-entity domains, the system merges the related sub-entity domains and their cross-domain relationships and cross-domain constraints to form a joint entity space.

[0055] The system performs rule derivation on the joint entity space and each sub-entity domain separately. Derivation on the joint entity space yields a globally derivable entity set, while derivation on each sub-entity domain is performed separately and then merged to obtain an independently derivable entity set. If an entity in the globally derivable entity set cannot form a structurally equivalent match with any entity in the independently derivable entity set, and the derivation chain corresponding to this entity involves at least two different sub-entity domains, then it is considered a candidate differential entity. The candidate differential entity set can be represented as:

[0056]

[0057] in, Represents the set of candidate differing entities. Represents a globally inferable set of entities. Represents an independent and derivable set of entities. Representing entities With entity A structural equivalence match cannot be formed. Representing entities This corresponds to the set of sub-entity domains that participate in the input in the derivation chain. Structural equivalence matching includes entity type equivalence, key attribute change equivalence, and relation change equivalence.

[0058] For example, in the joint entity space, the system can generate a "cooling anomaly risk" entity based on both "continuous temperature increase" and "cooling execution unit not responding"; however, when each sub-entity domain is deduced independently, only "thermal state anomaly" and "execution state anomaly" entities can be obtained separately, and the "cooling anomaly risk" entity cannot be obtained. In this case, the "cooling anomaly risk" entity can be identified as a candidate difference entity.

[0059] After obtaining candidate difference entities, the system further determines whether they meet the conditions for complete and valid derivation chains and rule novelty. The condition for complete and valid derivation chains means that each step in the derivation chain corresponding to the candidate difference entity has a corresponding production rule, input entity, output entity, variable binding result, and constraint satisfaction result, and that adjacent derivation records have a reference relationship between the output entity and the input entity. The condition for rule novelty means that there are no existing rules in the current rule set that can directly generate rules with the same entity type, key attribute changes, and relationship changes as the candidate difference entity using a single production rule, under the same combination of input entity types. Candidate difference entities that meet the above conditions are identified as candidate emergent entities.

[0060] Once candidate emerging entities are identified, the system generates candidate production rules based on their corresponding derivation chains. Specifically, the system selects the derivation chain with the fewest derivation steps and satisfying the condition of complete and valid derivation chains from one or more derivation chains corresponding to the candidate emerging entity as the rule extraction chain. The system determines the entity type combination of the input entity at the head of the rule extraction chain as the main body of the left-hand matching template, the key attribute conditions of the input entity at the head of the chain that are passed to the candidate emerging entity and whose values ​​remain unchanged as the condition part of the left-hand matching template, and the relationship conditions between the input entities at the head of the chain as the connection part of the left-hand matching template. At the same time, the entity type of the candidate emerging entity is determined as the main body of the right-hand construction template, and its newly added or changed attributes, relationships, and sub-entity references are determined as the construction part of the right-hand construction template.

[0061] For example, for the candidate emergent entity of "cooling anomaly risk", the candidate production rule can be summarized as follows: when the temperature sensing unit under the same device is in a continuously rising state and the cooling execution unit is in an unresponsive state, a cooling anomaly risk entity for that device is generated. The left-hand matching template of this rule includes the temperature sensing unit, the cooling execution unit, and the relationship condition that the two belong to the same device; the right-hand construction template includes the cooling anomaly risk entity and its corresponding device reference relationship.

[0062] During candidate rule generation, the system can also generalize constant attribute values, relation identifiers, and sub-entity references in the rule extraction chain. If a constant corresponds to at least two different specific values ​​in the validation sample entity set, and can still generate structurally equivalent candidate emergent entities, then the constant is generalized as a variable; otherwise, the constant is retained as part of the applicable constraints. Candidate production rules can be expressed as:

[0063]

[0064] in, Indicates the left-side matching template. Indicates the applicable constraints. Indicates the variable binding condition. This indicates the template for constructing the right side. This indicates the initial priority of the candidate production rule. The initial priority can be determined based on the number of derivation steps in the rule extraction chain, the frequency of occurrence of candidate emergent entities, or a preset default priority.

[0065] After candidate production rules are generated, the system performs rule validity verification and rule conflict detection. Rule validity verification includes: checking if there are matching entity instances in the entity types of the left-hand matching template; checking if all variables have input source positions and output reference positions; checking if the output entity types generated by the right-hand construction template belong to the preset entity type set; and checking if the output entities generated by the candidate rules are consistent with the candidate emergent entities in terms of entity type, key attribute changes, and relationship changes. Rule conflict detection includes template duplication detection, mutually exclusive output detection, and loop derivation detection. Mutually exclusive output detection is used to determine whether candidate rules generate contradictory output entities or conflicting entity relationships with existing rules under the same input conditions; loop derivation detection is used to determine whether the output entities generated by candidate rules will directly or indirectly re-trigger the candidate rule itself.

[0066] After the candidate rule passes the above verification, the system performs effective expansion verification based on the verification sample entity set. Specifically, the system first performs derivation on the verification sample entity set based on the current rule set to obtain the baseline derivable entity set; then, it performs derivation on the same verification sample entity set using only the candidate production rules to obtain the candidate rule contributing entity set. When at least one entity in the candidate rule contributing entity set cannot form a structurally equivalent match with any entity in the baseline derivable entity set, and the candidate rule does not have any circular dependencies that directly or indirectly trigger itself, the candidate rule is determined to meet the effective expansion condition. The effective newly added entity set can be represented as:

[0067]

[0068]

[0069] in, This represents the benchmark derivable entity set derived from the validation sample entity set based on the current rule set. This indicates that only candidate rules derived from the same validation sample entity set are used to contribute to the entity set. Representing entities With entity A structural equivalence match cannot be formed. This represents the set of valid new entities generated by the candidate production rule.

[0070] When a candidate production rule meets the valid expansion conditions, the system adds it to the current rule set and outputs the inference result based on the added rule set. If a candidate production rule fails the validation, it is not added to the current rule set and can be retained in the candidate rule pool for review or further validation with subsequent samples.

[0071] This invention can also be implemented through a rule-based self-expanding reasoning system based on second-order entity grammar. This system includes a processor and a memory, the memory storing a computer program, which the processor executes to implement the above-described method steps. Through these embodiments, this invention can automatically generate new rules based on candidate emergent entities formed during cross-domain derivation, while preserving the interpretability and traceability of rule reasoning, and activate them after verification, thereby improving the reliability and stability of rule set expansion.

[0072] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.

Claims

1. A rule-based self-expanding reasoning method based on second-order entity grammar, characterized in that, Includes the following steps: Step S1: Obtain the structured input data corresponding to the task to be reasoned, convert the structured input data into an entity data structure, and establish the current entity space based on the entity data structure; The structured input data includes at least one of task objects, object attributes, object relationships, and task constraints; the second-order entity grammar includes an entity derivation layer and a rule self-expansion layer. The entity derivation layer is used to derive the entity data structure based on production rules, and the rule self-expansion layer is used to generate new production rules based on the derivation chain and candidate emergent entities. Step S2: Perform deterministic matching derivation on the current entity space based on the production rules in the current rule set, generate the derivation result and record the derivation chain; Step S3: Divide the entity data structure into multiple sub-entity domains according to the hierarchical reference relationship, and form a joint entity space based on the multiple sub-entity domains and the cross-domain constraint part involving different sub-entity domains in the task constraints. Step S4: Perform rule derivation on the joint entity space and each sub-entity domain respectively to obtain the globally derivable entity set and the independently derivable entity set. Based on the structural differences between the globally derivable entity set and the independently derivable entity set, as well as the number of different sub-entity domains involved in the derivation chain, determine the candidate emerging entities. Step S5: Generate candidate production rules based on the derivation chain corresponding to the candidate emerging entity. The candidate production rules are used as extension rules to be added to the current rule set. Step S6: Perform rule validity verification and rule conflict detection on the candidate production rules; Step S7: After the candidate production rule passes the rule validity verification and rule conflict detection, the candidate production rule is effectively extended and verified based on the verification sample entity set. Step S8: When the candidate production rule meets the valid expansion condition, the candidate production rule is enabled in the current rule set, and the inference result is output based on the enabled rule set.

2. The rule-based self-expanding reasoning method based on second-order entity grammar according to claim 1, characterized in that, The entity data structure includes an entity identifier, entity type, attribute set, relation set, sub-entity reference set, and entity status identifier; the production rule includes a left-side matching template, a right-side construction template, variable binding conditions, applicable constraints, and rule priority; the entity derivation layer uses the entity data structure as its operation object to generate entity derivation results based on existing production rules; the rule self-expansion layer uses the derivation chain, candidate emergent entities, and production rules as its operation objects to extract new production rules from the entity derivation results; the variables in the production rule include at least one of entity type variables, attribute variables, and relation type variables.

3. The rule-based self-expanding reasoning method based on second-order entity grammar according to claim 1, characterized in that, In step S2, the deterministic matching derivation includes: searching for input entities in the current entity space that meet the matching requirements in terms of entity type, attribute conditions, and relation conditions according to the left-hand matching template of the production rule; when the input entity meets the applicable constraints, binding the attribute values, relation identifiers, or sub-entity references in the input entity to the right-hand construction template according to the variable binding conditions; generating an output entity or updating entity relations according to the right-hand construction template; when multiple production rules simultaneously meet the matching requirements, determining the execution order according to a preset fixed rule priority, and executing rules with the same priority in a preset fixed order; each rule execution forms a derivation record, which includes a rule identifier, input entity, output entity, variable binding result, constraint condition satisfaction result, and execution result, and multiple derivation records constitute the derivation chain in the execution order.

4. The rule-based self-expanding reasoning method based on second-order entity grammar according to claim 1, characterized in that, In steps S3 and S4, the sub-entity domains are recursively determined based on the sub-entity reference set in the entity data structure. Each sub-entity domain corresponds to a root entity and all entities directly or indirectly referenced by the root entity through the sub-entity reference set. When there is an entity relationship, attribute transitive relationship, or task constraint association between at least two sub-entity domains, the entities in the at least two sub-entity domains and their cross-domain relationships and cross-domain constraints are merged to form a joint entity space. Based on the current rule set, a globally inferable entity set is obtained by performing derivation on the joint entity space. Based on the current rule set, derivation is performed on each sub-entity domain and merged to obtain an independently inferable entity set. The candidate difference entity set is determined according to the following relationship: in, Represents the set of candidate differing entities. Represents a globally inferable set of entities. Represents an independent and derivable set of entities. Representing entities With entity A structural equivalence match cannot be formed. Representing entities The set of sub-entity domains that participate in the input in the corresponding derivation chain; The entities in the candidate differential entity set are selected as candidates for emerging entities.

5. The rule-based self-expanding reasoning method based on second-order entity grammar according to claim 4, characterized in that, The structural equivalence matching includes entity type equivalence, key attribute change equivalence, and relation change equivalence. When a candidate differential entity satisfies the conditions for a complete and valid derivation chain and rule novelty, it is determined as a candidate emergent entity. The conditions for a complete and valid derivation chain include: each step in the derivation chain corresponding to the candidate differential entity has a corresponding production rule, input entity, output entity, variable binding result, and constraint condition satisfaction result, and there is a reference relationship between the output entity and the input entity between adjacent derivation records. The conditions for rule novelty include: there is no existing production rule in the current rule set that can directly generate a single production rule with the same entity type, key attribute change, and relation change as the candidate differential entity under the same combination of input entity types.

6. The rule-based self-expanding reasoning method based on second-order entity grammar according to claim 1, characterized in that, In step S5, generating candidate production rules based on the derivation chains corresponding to candidate emerging entities includes: selecting the derivation chain with the fewest derivation steps and satisfying the condition of complete and valid derivation chains from one or more derivation chains corresponding to candidate emerging entities as the rule extraction chain; determining the entity type combination of the input entities at the head of the chain in the rule extraction chain as the main body of the left matching template; determining the key attribute conditions in the input entities at the head of the chain that are passed to the candidate emerging entities and whose values ​​remain unchanged as the condition part of the left matching template; determining the relationship conditions between the input entities at the head of the chain as the connection part of the left matching template; determining the entity type of the candidate emerging entity as the main body of the right construction template; and determining the candidate emerging entity... The attributes, relationships, and sub-entity references that are added or changed relative to the input entity corresponding to the left-hand matching template are determined as the construction part of the right-hand construction template; the constant attribute values, relationship identifiers, and sub-entity references in the rule extraction chain are generalized, and constants with corresponding relationships between the input and output entities are replaced with variables, while retaining the entity type constraints, attribute value boundaries, and relationship direction constraints corresponding to the variables; wherein, when the constant corresponds to at least two different specific values ​​in the verification sample entity set and can still generate structurally equivalent candidate emergent entities, the constant is generalized as a variable; otherwise, the constant is retained as part of the applicable constraints; the candidate production rule is expressed as: in, Indicates the left-side matching template. Indicates the applicable constraints. Indicates the variable binding condition. This indicates the template for constructing the right side. The initial priority of the candidate production rule is indicated; the initial priority is determined based on at least one of the following: the number of derivation steps of the rule extraction chain, the frequency of occurrence of candidate emerging entities, or a preset default priority.

7. The rule-based self-expanding reasoning method based on second-order entity grammar according to claim 1, characterized in that, In step S6, rule validity verification includes: verifying whether the entity type declared in the left-hand matching template of the candidate production rule has a matching specific entity instance in the current entity space or the verification sample entity set; verifying whether all variables in the candidate production rule have input source positions and output reference positions; verifying whether the output entity type generated by the right-hand construction template of the candidate production rule belongs to the preset entity type set; verifying whether the output entity generated by the candidate production rule is consistent with the candidate emergent entity in terms of entity type, key attribute changes, and relationship changes; rule conflict detection includes template duplication detection, mutually exclusive output detection, and circular derivation detection. The mutual exclusion output detection is used to determine whether, under the same combination of input entity types and the same applicable constraints, the candidate production rule and the existing production rule generate output entities with the same entity type but contradictory key attribute values, or whether they generate output entities with the same relation type but conflicting relation directions, relation objects, or relation states. The loop derivation detection is used to determine whether the output entity generated by the candidate production rule can re-trigger the candidate production rule itself, or re-trigger the left-side matching template of the candidate production rule through the existing production rule.

8. The rule-based self-expanding reasoning method based on second-order entity grammar according to claim 1, characterized in that, In step S7, the effective expansion verification includes: performing derivation on the verification sample entity set based on the current rule set to obtain a baseline derivable entity set; performing derivation on the same verification sample entity set using only candidate production rules to obtain a candidate rule contributing entity set; when at least one entity in the candidate rule contributing entity set cannot form a structurally equivalent match with any entity in the baseline derivable entity set, and the candidate production rule does not have a circular dependency that directly or indirectly triggers itself, the candidate production rule is determined to satisfy the effective expansion condition; the effective expansion condition is expressed as: in, This represents the benchmark derivable entity set derived from the validation sample entity set based on the current rule set. This indicates that only candidate rules derived from the same validation sample entity set are used to contribute to the entity set. Representing entities With entity A structural equivalence match cannot be formed. This represents the set of valid new entities generated by the candidate production rule.

9. A rule-based self-expanding reasoning system based on second-order entity grammar, characterized in that, include: The entity structure construction module is used to acquire the structured input data corresponding to the task to be reasoned, convert the structured input data into an entity data structure, and establish the current entity space based on the entity data structure. The deterministic derivation module is used to perform deterministic matching derivation on the current entity space based on the production rules in the current rule set, generate derivation results and record the derivation chain; The sub-entity domain construction module is used to divide multiple sub-entity domains according to the hierarchical reference relationship in the entity data structure, and to form a joint entity space based on the multiple sub-entity domains and cross-domain constraints. The emergent entity detection module is used to perform rule derivation on the joint entity space and each sub-entity domain respectively, and determine candidate emergent entities based on the structural differences between the derivation results of the two. The candidate rule generation module is used to generate candidate production rules based on the derivation chain corresponding to the candidate emergent entity; The rule verification module is used to verify the legality of the candidate production rules and detect rule conflicts. An effective extended verification module is used to perform effective extended verification of candidate production rules that have passed rule validity verification and rule conflict detection based on the verification sample entity set; The inference output module is used to enable the candidate production rule to the current rule set when the candidate production rule meets the valid expansion condition, and output the inference result based on the enabled rule set.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method described in any one of claims 1 to 8.