Method and application for organizing knowledge bases to support non-monotonic reasoning

By organizing the knowledge base and defining the direct leading-edge subsequent relationship of rules, the problem that non-monotonic reasoning is difficult to achieve in the existing technology is solved, and the practical application of non-monotonic reasoning and the improvement of deduction theory is achieved.

CN119047552APending Publication Date: 2024-11-29胡煜州
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410980650.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

Existing research lacks appropriate knowledge representation when implementing non-monotonic reasoning, and cannot technically implement non-monotonic logical reasoning, especially in the classical logic framework, it is difficult to support the practical application of non-monotonic reasoning.

Method used

By organizing the knowledge base, defining the direct predecessor of the rules, updating the native knowledge base, derived knowledge base and associated knowledge base when adding or deleting rules, using default logic and closed world assumptions to achieve non-monotonic logic inference support.

Benefits of technology

It has realized the practical application of non-monotonic reasoning, and the leap from theory to practical application, and has improved the deduction theory to support the application of non-monotonic reasoning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SMS_3
    Figure SMS_3
Patent Text Reader

Abstract

The invention discloses a method for organizing a knowledge base in order to support non-monotonic reasoning and application, and belongs to the technical field of logical reasoning. Comprising the following steps: when a rule r is added, acquiring a direct precursor-subsequent association relationship set preAndPostPairSet of the r; whether the preAndPostPairSet is 0 or not is judged; if yes, r is directly inserted into the native knowledge base; if not, r is inserted into the native knowledge base, and the derived knowledge base and the associated knowledge base are updated respectively; when the r is deleted, obtaining lt from the associated knowledge base; r, r, preAndPostPairSetgt, r, judging whether the return value is empty or not; if yes, directly deleting r in the native knowledge base; and if not, deleting r from the native knowledge base, and updating the derived knowledge base and the associated knowledge base. According to the method, the deduction lattice theory is perfected, and the deduction lattice also supports non-monotonic reasoning. And the practical application of non-monotonic reasoning is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of logical reasoning, and in particular relates to a method and application for organizing a knowledge base to support non-monotonic reasoning. Background Art

[0002] Non-monotonic reasoning is an important theory and method in the field of artificial intelligence based on logic, which solves the branching problem (Ramification Problem) in knowledge representation. Non-monotonic reasoning was proposed in the 1970s and is an important reasoning method in artificial intelligence. The so-called non-monotonic reasoning refers to the fact that adding a correct axiom to theory T will make some of the conclusions obtained in advance invalid. Seeking invalid conclusions is a problem that does not exist in monotone logic. In this sense, non-monotonic reasoning is obviously more complicated than monotone reasoning.

[0003] Generally speaking, classical logic mainly refers to formal logic or deductive logic. The reasoning form of classical logic is deductive and monotonic. Deductiveness and monotonicity are manifested in that reasoning based on existing knowledge will inevitably obtain new knowledge. In other words, under the premise of ensuring that the existing knowledge is true, the new knowledge obtained by reasoning must also be true. From this, we can see that the advantage of classical logic lies in ensuring the rigor of reasoning in terms of morphology and the validity of reasoning in terms of semantics. It is only necessary to ensure that the premise part is true to obtain true new knowledge. However, in daily contexts, this situation does not always occur. What often occurs is that new knowledge conflicts with existing knowledge. When necessary, people will modify existing knowledge to adapt to the interpretation of new situations. This reflects the limitations of monotonic reasoning. In order to solve this problem and meet the requirements of common sense reasoning, non-monotonic reasoning came into being. Non-monotonic reasoning is different from monotonic reasoning not only in form and function, but also in the standard of reasoning validity. The validity of monotonic reasoning refers to semantic fidelity, while the validity of non-monotonic reasoning mainly refers to the rationality of conforming to actual conditions. In other words, as long as the premise of monotonic reasoning is true, the conclusion must be true. In contrast, non-monotonic reasoning requires a reasonable explanation of the actual situation.

[0004] The ultimate goal of non-monotonic reasoning is to achieve rationality of reasoning. Rationality here mainly refers to general situations that conform to common sense, or can reasonably explain the actual situation, etc.

[0005] People follow the following process in discovering scientific knowledge: discovering phenomena, proposing hypotheses, conducting experiments, conducting verification, verifying the validity of the results, giving explanations, reaching consensus, promoting applications, long-term verification, and discovering exceptions. Once an exception is found, it needs to be excluded from the consensus that has been formed, and excluding exceptions requires the support of non-monotonic logic. In addition to the above scenarios, the monism of clinical thinking in medical diagnosis also requires the support of non-monotonic logic, so non-monotonic reasoning support is required to achieve machine reasoning.

[0006] There are generally two approaches to the study of non-monotonic reasoning: (1) It is believed that the use of classical logic to study non-monotonic reasoning is obviously insufficient, and a new semantic mechanism and logic system need to be established, such as Reiter's default logic and Moore's automatic cognitive logic, as well as extended logic programs.

[0007] (2) Study non-monotonic reasoning within the framework of classical logic, such as the closed world hypothesis, McCarthy’s circumscription, and Poole’s default reasoning.

[0008] People have adopted the above two approaches in studying non-monotonic logic, which only solves theoretical problems. However, in fact, due to the lack of appropriate knowledge representation, these two approaches cannot technically realize non-monotonic logical reasoning. Summary of the invention

[0009] In order to solve the above problems, an embodiment of the present invention provides a method and application for organizing a knowledge base to support non-monotonic reasoning. The solution is as follows: In one aspect, an embodiment of the present invention provides a method for organizing a knowledge base to support non-monotonic reasoning, the method comprising: When adding rule r, obtain r's direct predecessor and successor association relationship set preAndPostPairSet; determine whether |preAndPostPairSet| is 0; if so, insert r directly into the native knowledge base; if not, insert r into the native knowledge base and update the derived knowledge base and the associated knowledge base respectively.

[0010] When deleting rule r, obtain<r,preAndPostPairSet> , determine whether the return value is empty; if so, delete r directly from the native knowledge base; if not, delete r from the native knowledge base and update the derived knowledge base, ∀i∈{1,…, |preAndPostPairSet|},(r i pre ,r i post)∈preAndPostPairSet, and call AdjustPreAndPostPairSetforDeletion(r i pre , r, r i post )Update the associated knowledge base.

[0011] in, (Γ->X)∧(Γ⊂Γ')->Γ'->X(Ⅰ); r: A->C(Ⅱ); Γ->X(III); Γ'->X'(Ⅳ); Γ''->X''(V); Among them, Γ represents known information, X represents conclusion, r represents rule, Γ', Γ'' and A represent feature sets, F(r) represents the premise of rule r, and C represents the conclusion of rule r; Definition: Γ->X and satisfies Γ⊂Γ', γ=Γ'-Γ≠∅, Γ'→ X' and X≠X', then Γ'->X' with the above properties is a non-monotonic logic of Γ->X; Definition: If there exist formulas III, IV and V, and X≠X'≠X'' and Γ⊂Γ'⊂Γ'', then formula V is the non-monotonic logic of formulas IV and III, and formula IV is the non-monotonic logic of formula III; All rules similar to formulas Ⅰ, Ⅱ, Ⅲ, and Ⅳ are native rules, and the knowledge base composed of native rules is the native knowledge base; In the knowledge base, if there exists r1: Γ->X and r2: Γ'->X' and Γ⊂Γ' and X≠X', and there does not exist Γ''->X'' in the knowledge base, and Γ''⊂Γ', Γ⊂Γ'' and X≠X'≠X'', then Γ'->X' is a direct non-monotone rule of Γ->X; r1 is the direct predecessor of r2, and r2 is the direct successor of r1; In the native knowledge base, if there exists r1:Γ'->X' as the direct successor of r2:Γ->X, let G = Γ'-Γ, according to the default logic and closed world assumption, then ∀γ∈2 G -∅-G, Γ∪γ->X, Γ∪∅->X and Γ∪G->X'; ∀γ∈2 G -∅-G, Γ∪γ->X is the rule set of non-monotonic derivation of r2 with respect to r1; In the native knowledge base, if there exists r1:Γ'->X' as a direct predecessor of r2:Γ->X, let H = Γ-Γ'. According to the default logic and closed world assumption, we have ∀γ∈2 H -∅-H, Γ'∪γ->X; and Γ'∪∅->X', Γ'∪H->X; In the native knowledge base, if there exists r1: Γ'->X', there is also a direct predecessor r2: Γ->X and a direct successor r3: Γ''->X'', let J = Γ'-Γ, M = Γ''-Γ', according to the default logic and closed world assumption, then ∀γ1∈2 J -∅-J, Γ∪γ1->X, and ∀γ2∈2 M -∅-M,Γ'∪γ2->X'; Definition: In the native knowledge base, if there exists Γ'->X' in the native knowledge base as a direct successor of Γ->X, let K = Γ'-Γ, then ∀γ∈2 K -∅-K, Γ∪γ->X, then Γ∪γ->X is called the derived rule derived from Γ and Γ', and the knowledge base composed of all derived rules is called the derived knowledge base; Definition: r pre is the direct predecessor of r, r post is the direct successor of r, (r pre ,r post ) is the direct predecessor and successor pair of r, and preAndPostPairSet is the direct predecessor and successor pair that may exist in rule r (r pre ,r post )<r,preAndPostPairSet> is the direct predecessor-successor relationship between rule r and preAndPostPairSet.<r,preAndPostPairSet> Form a related knowledge base.

[0012] Among them, if |preAndPostPairSet|=0, it means that r has neither direct predecessor nor direct successor; If |preAndPostPairSet|≠0, then ∀i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet, there are the following situations: Case (1): If r i pre =null, r is said to be relative to r i post There is no direct predecessor, then ∀j∈{1,…,|preAndPostPairSet|}, i≠j, r i post ⊄r j post , r j post ⊄r ipost ; Case (2): If r i post =null, r is said to be relative to r i pre There is no direct successor, then ∀j∈{1,…,|preAndPostPairSet|}, i≠j, r i pre ⊄r j pre , r j pre ⊄r i pre ; Case (3): If r i pre and r i post When both are not null, r is relative to (r i pre , r i pre ) has both a direct predecessor and a direct successor; then ∀j∈j∈{1,…,|preAndPostPairSet|}, i≠j, r i post ⊄r j post , r j post ⊄r i post , r i pre ⊄r j pre , r j pre ⊄r i pre .

[0013] The operations of adding rule r include: Determine whether rule r is repeated, conflicting, or non-monotonic in the native knowledge base; If there is duplication or conflict, a prompt will be given and the adding operation will be abandoned; If a non-monotonic situation occurs, obtain preAndPostPairSet=PreAndPostPairSet(r) and determine whether |preAndPostPairSet| is zero; If it is zero, then directly insert rule r into the native knowledge base and it is done; If it is not zero, insert rule r into the native knowledge base and insert a rule into the associated knowledge base.<r,preAndPostPairSet> Record; ∀i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet r of associated pairs i pre With r i post When it is not completely empty, it can be divided into the following three situations, and the derived knowledge base and the associated knowledge base are updated respectively. The following are the three situations: r i pre ≠null and r i post ≠null; r i pre =null and r i post ≠null; r i pre ≠null and r i post =null.

[0014] Specifically, updating the derived knowledge base and the associated knowledge base respectively includes: For i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet; If r i pre ≠null and r i post ≠null; delete the derived knowledge base with r i pre Direct front drive and r i post Regenerate all the derived rules that follow directly, starting with r i pre is the direct predecessor and r is the direct successor of the derived rule set A, and generates r as the direct predecessor and r as the direct successor of the derived rule set A. i post is the direct successor derived rule set B, C i =A∪B, ∀j∈{1,…,|preAndPostPairSet|},j≠i, will (rj pre , r j post ) in accordance with F(r j pre )⊇F(r j pre ) All derivation rules from C j Delete the new C j , then all C j Insert into the derived knowledge base; call AdjustPreAndPostPairSetforAddition(r i pre , r, r i post ) Update the associated knowledge base; If r i pre =null and r i post ≠null, generates a sequence with r as the immediate predecessor and r as the i post The derived rule set C is the direct successor i and insert it into the derived knowledge base, calling AdjustPreAndPostPairSetforAddition(null, r, r i post ) Update the associated knowledge base; If r i pre ≠null and r i post =null, generate i pre The derived rule set C with r as the direct predecessor and r as the direct successor i , ∀j∈{1,…,|preAndPostPairSet|},j≠i, will (r j pre, r j post ) in accordance with F(r j pre )⊇F(r j pre ) All derivation rules from C j Delete the new C j , and all C j Insert into the derived knowledge base; call AdjustPreAndPostPairSetforAddition(r i pre , r, null) to update the associated knowledge base.

[0015] The operation of deleting rule r includes: Query records from the associated knowledge base<r,preAndPostPairSet> , determine whether the return value is empty; If it is empty, delete rule r directly and complete; If not empty, ∀i∈{1,…,|PreAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet, obviously r i pre With r i post Not all are null; the derived knowledge base and the associated knowledge base are updated according to the following three situations: r i pre ≠null and r i post ≠null; r i pre =null and r i post ≠null; r i pre ≠null and r i post =null.

[0016] Specifically, the updating of the derived knowledge base and the associated knowledge base respectively according to the following three situations includes: ∀i∈{1,…,|PreAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet; If r i pre ≠null and r i post ≠null, delete the derived knowledge base with r i pre All derived rules with r as the direct predecessor and r as the direct successor are deleted. i post All derived rules with r as the direct successor are generated with r as the direct predecessor. i pre Direct front drive and r i postThe direct successor derived rule set is inserted into the derived knowledge base; call AdjustPreAndPostPairSetforDeletion(r i pre , r, r i post ) Update the associated knowledge base; If r i pre =null and r i post ≠null, delete the tree with r as the direct predecessor and r as the direct predecessor from the derived knowledge base. i post For the direct successor derivation rule; call AdjustPreAndPostPairSetforDeletion (null, r, r i post ) Update the associated knowledge base; If r i pre ≠null and r i post =null, then delete the derived knowledge base with r i pre is the derived rule set with r as the immediate predecessor and r as the immediate successor; call AdjustPreAndPostPairSetforDeletion(r i pre , r, null) updates the associated knowledge base.

[0017] The method for generating a derived rule set with r as the direct predecessor and r' as the direct successor is: F(r)⊂F(r'), first find N=F(r')-F(r), then find 2 N and ∀γ∈2 N -∅-N, generate rules with F(r)∪γ as premise and r as conclusion. The set of all such rules is the derived rule set.

[0018] On the other hand, an embodiment of the present invention provides an application that supports a non-monotonic reasoning knowledge base, merges a native knowledge base and a derived knowledge base as a knowledge base of a deduction lattice, and adds an intermediate node as a default type to each non-leaf node; if all child node conditions of the current node are not met, the default type intermediate node of the current node points to empty.

[0019] The method of merging the native knowledge base and the derived knowledge base is as follows: input condition x, the form of the rule in the knowledge base is r: x1∧x2∧,…, ∧x n ->c, where x1, x2, …, xn as a prerequisite; find the rule set A whose premise contains x in the native knowledge base, and find the rule set B whose premise contains x in the derived knowledge base; calculate rules = A + B.

[0020] The beneficial effects of the technical solution provided by the embodiment of the present invention are as follows: the patent improves the deduction lattice theory, allowing the deduction lattice to also support non-monotonic reasoning, and realizes the practical application of non-monotonic reasoning, a leap from theory to practical application. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in further detail below.

[0022] Example 1 Embodiment 1 provides a method for organizing a knowledge base to support non-monotonic reasoning, the method comprising: Organize the native knowledge base, derived knowledge base and associated knowledge base, as defined in Example 2.

[0023] When adding rule r, obtain the direct predecessor and successor association relationship set preAndPostPairSet of r in the associated knowledge base. Determine whether |preAndPostPairSet| is 0; if so, insert r directly into the native knowledge base; if not, insert r into the native knowledge base and update the derived knowledge base and the associated knowledge base (through AdjustPreAndPostPairSetforAddition) respectively.

[0024] When deleting rule r, obtain<r,preAndPostPairSet> , determine whether the return value is empty; if so, delete r directly from the native knowledge base; if not, delete r from the native knowledge base and update the derived knowledge base, ∀i∈{1,…, |preAndPostPairSet|},(r i pre ,r i post )∈preAndPostPairSet, and call AdjustPreAndPostPairSetforDeletion(r i pre , r, r i post )Update the associated knowledge base.

[0025] When modifying rule r, first delete r and then add r'.

[0026] When updating the derived knowledge base and the associated knowledge base, different methods are used according to the following three situations: r i pre ≠null and r i post ≠null; r i pre =null and r i post ≠null; r i pre ≠null and r i post =null.

[0027] The above three situations have the following meanings: Case (1): If r i pre =null, r is said to be relative to r i post There is no direct predecessor, then ∀j∈{1,…,|preAndPostPairSet|}, i≠j, r i post ⊄r j post , r j post ⊄r i post .

[0028] Case (2): If r i post =null, r is said to be relative to r i pre There is no direct successor, then ∀j∈{1,…,|preAndPostPairSet|}, i≠j, r i pre ⊄r j pre , r j pre ⊄r i pre .

[0029] Case (3): If r i pre and r i post When both are not null, r is relative to (r i pre , r i pre) has both a direct predecessor and a direct successor; then ∀j∈j∈{1,…,|preAndPostPairSet|}, i≠j, r i post ⊄r j post , r j post ⊄r i post , r i pre ⊄r j pre , r j pre ⊄r i pre .

[0030] Example 2 Embodiment 2 provides a method for organizing a knowledge base to support non-monotonic reasoning, as follows: 1. Definition of non-monotonic logic 1. Monotonic logic The reasoning model of classical logic is deductive and monotonic. Deduction and monotonicity express the same connotation and are essentially the same. Both deduction and monotonicity show linear characteristics. See Witold Lukaszewicz, 1990, Non-Monotonic Reasoning, Formalization of Commonsense Reasoning, Ellis HorWood; monotonic reasoning can be expressed by formula (1) as: (Γ->X)∧(Γ⊂Γ')->Γ'->X(1); The above formula means: if we can get the conclusion Χ from the known information Γ, and the connotation of the known information Γ is contained in the connotation of the new information Γ', then we can conclude that the new information Γ' can lead to the conclusion Χ. In other words, as the conditions in the premise increase, the conclusion does not change. However, in real life, the reasoning problems people encounter often face complex or unpredictable situations, not simple linear reasoning problems.

[0031] 2. Non-monotonic logic Under the support of default logic and closed world assumption, non-monotonic logic is not monotonic and presents the characteristics of non-monotonicity. Inductive reasoning, fuzzy reasoning and probabilistic reasoning all have the characteristics of non-monotonicity.

[0032] According to patent CN201910456567.2, the rules are converted into the following form: r:A->C(2).

[0033] Among them, Γ represents known information; Χ represents the conclusion; r represents the rule, Γ', Γ'' and A represent the feature set; F(r) represents the premise of rule r, that is, the premise set of r; C represents the conclusion of the rule.

[0034] Definition 1: Γ->X and satisfies Γ⊂Γ', γ=Γ'-Γ≠∅, Γ'→ X' and X≠X', then Γ'->X' with the above properties is the non-monotonic logic of Γ->X.

[0035] According to Definition 1, non-monotonic logic is relative, that is, when there is Γ->X(3); Γ'->X'(4); Γ''->X''(5); And X≠X'≠X'' and Γ⊂Γ'⊂Γ'', then equation (5) is called the non-monotonic logic of equations (4) and (3), and (4) is the non-monotonic logic of (3).

[0036] Definition 2: All rules similar to (1), (2), (3), and (4) are called native rules.

[0037] We call the knowledge base composed of native rules the native knowledge base. The native knowledge base is a finite domain that conforms to the closed world hypothesis theory and is also a non-monotonic relationship formed by all the rules in the native knowledge base.

[0038] Definition 3: In the knowledge base, if there exists r1: Γ->X and r2: Γ'->X' with Γ⊂Γ' and X≠X', and there does not exist Γ''->X'' in the knowledge base, and Γ''⊂Γ', Γ⊂Γ'' and X≠X'≠X'', then Γ'->X' is a direct non-monotone rule (direct non-monotone rule predecessor) of Γ->X; r1 is the direct predecessor of r2, and r2 is the direct successor of r1 (direct non-monotone rule successor).

[0039] In the native knowledge base, if there exists r1:Γ'->X' as the direct successor of r2:Γ->X, let G = Γ'-Γ, according to the default logic and closed world assumption, then ∀γ∈2 G -∅-G, Γ∪γ->X, Γ∪∅->X and Γ∪G->X'; ∀γ∈2 G -∅-G, Γ∪γ->X is the set of rules for the non-monotonic derivation of r2 with respect to r1.

[0040] In the native knowledge base, if there exists r1:Γ'->X' as a direct predecessor of r2:Γ->X, let H = Γ-Γ'. According to the default logic and closed world assumption, we have ∀γ∈2 H -∅-H, Γ'∪γ->X; and Γ'∪∅->X', Γ'∪H->X.

[0041] In the native knowledge base, if there exists r1: Γ'->X', there is also a direct predecessor r2: Γ->X and a direct successor r3: Γ''->X'', let J = Γ'-Γ, M = Γ''-Γ', according to the default logic and closed world assumption, then ∀γ1∈2 J -∅-J, Γ∪γ1->X, and ∀γ2∈2 M -∅-M, Γ'∪ γ2->X'.

[0042] Definition: In the native knowledge base, if there exists Γ'->X' in the native knowledge base as a direct successor of Γ->X, let K = Γ'-Γ, then ∀γ∈2 K -∅-K, Γ∪γ->X, then Γ∪γ->X is called the derived rule derived from Γ and Γ', and the knowledge base composed of all derived rules is called the derived knowledge base.

[0043] Definition: r pre is the direct predecessor of r, r post is the direct successor of r, (r pre ,r post ) is the direct predecessor and successor pair of r, and preAndPostPairSet is the direct predecessor and successor pair that may exist in rule r (r pre ,r post )<r,preAndPostPairSet> is the direct predecessor-successor relationship between rule r and preAndPostPairSet.<r,preAndPostPairSet> Form a related knowledge base.

[0044] If |preAndPostPairSet|=0, it means that r has neither a direct predecessor nor a direct successor.

[0045] If |preAndPostPairSet|≠0, then ∀i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet, there are the following situations: Case (1): If r i pre =null, r is said to be relative to r i post There is no direct predecessor, then ∀j∈{1,…,|preAndPostPairSet|}, i≠j, r i post ⊄r jpost , r j post ⊄r i post .

[0046] Case (2): If r i post =null, r is said to be relative to r i pre There is no direct successor, then ∀j∈{1,…,|preAndPostPairSet|}, i≠j, r i pre ⊄r j pre , r j pre ⊄r i pre .

[0047] Case (3): If r i pre and r i post When both are not null, r is relative to (r i pre , r i pre ) has both a direct predecessor and a direct successor; then ∀j∈j∈{1,…,|preAndPostPairSet|}, i≠j, r i post ⊄r j post , r j post ⊄r i post , r i pre ⊄r j pre , r j pre ⊄r i pre .

[0048] 2. Knowledge Base In order to support non-monotonic reasoning in the deductive system, it is necessary to organize the native knowledge base, derived knowledge base and associated knowledge base. The operations of the knowledge base can be divided into four operations: add, delete, modify and query. The query does not change the content of the knowledge base, and the implementation of the modification can be decomposed into deleting the rules first and then adding the corresponding rules. The purpose of the associated knowledge base is to query the associated knowledge base first when adding or deleting rules, and perform corresponding processing and updates according to the direct predecessor and successor association relationship set of the query to maintain the corresponding association relationship reflected by the associated knowledge base, while maintaining the native knowledge base and the derived knowledge base.

[0049] 3. Knowledge Base Operation 3.1 Add rules When adding a new rule r, it is necessary to determine whether there are duplications, conflicts or non-monotonic situations in the native knowledge base. For duplications and conflicts, prompts are given and the addition of rules is abandoned.

[0050] If a non-monotonic situation occurs, obtain preAndPostPairSet=PreAndPostPairSet(r) from the associated knowledge base and determine whether |preAndPostPairSet| is zero. If it is zero, it means that the newly added rule r does not have a non-monotonic relationship with the existing rules, so directly insert rule r into the native knowledge base to complete.

[0051] If it is not zero, insert rule r into the native knowledge base and insert a rule into the associated knowledge base.<r,preAndPostPairSet> Record; ∀i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet r of associated pairs i pre With r i post When not all are empty, it is processed in the following three situations: For i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet.

[0052] If r i pre ≠null and r i post ≠null; delete the derived knowledge base with r i pre Direct front drive and r i post Regenerate all the derived rules that follow directly, starting with r i pre is the direct predecessor and r is the direct successor of the derived rule set A, and generates r as the direct predecessor and r as the direct successor of the derived rule set A. i post is the direct successor derived rule set B, C i =A∪B, ∀j∈{1,…,|preAndPostPairSet|},j≠i, will (r jpre , r j post ) in accordance with F(r j pre )⊇F(r j pre ) All derivation rules from C j Delete the new C j , then all C j Insert into the derived knowledge base; call AdjustPreAndPostPairSetforAddition(r i pre , r, r i post )Update the associated knowledge base.

[0053] If r i pre =null and r i post ≠null, generates a sequence with r as the immediate predecessor and r as the i post The derived rule set C is the direct successor i and insert it into the derived knowledge base, calling AdjustPreAndPostPairSetforAddition(null, r, r i post )Update the associated knowledge base.

[0054] If r i pre ≠null and r i post =null, generate i pre The derived rule set C with r as the direct predecessor and r as the direct successor i , ∀j∈{1,…,|preAndPostPairSet|},j≠i, will (r j pre, r j post ) in accordance with F(r j pre )⊇F(r j pre ) All derivation rules from C j Delete the new C j , and all C j Insert into the derived knowledge base; call AdjustPreAndPostPairSetforAddition(r i pre , r, null) to update the associated knowledge base.

[0055] 3.2 Deletion Rules The operations to delete a rule include: Query records from the associated knowledge base<r,preAndPostPairSet> , determine whether the return value is empty. If it is empty, it means that there is no non-monotonic relationship between rule r and the rules in the native knowledge base, then directly delete rule r in the native knowledge base, and complete.

[0056] If not empty, ∀i∈{1,…,|PreAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet, obviously r i pre With r i post Not all are null; the derived knowledge base and associated knowledge base are updated according to the following three situations: ∀i∈{1,…,|PreAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet.

[0057] If r i pre ≠null and r i post ≠null, delete the derived knowledge base with r i pre All derived rules with r as the direct predecessor and r as the direct successor are deleted. i post All derived rules with r as the direct successor are generated with r as the direct predecessor. i pre Direct front drive and r i post The direct successor derived rule set is inserted into the derived knowledge base; call AdjustPreAndPostPairSetforDeletion(r i pre , r, r i post )Update the associated knowledge base.

[0058] If r i pre =null and r i post≠null, delete the tree with r as the direct predecessor and r as the direct predecessor from the derived knowledge base. i post For the direct successor derivation rule; call AdjustPreAndPostPairSetforDeletion (null, r, r i post ) Update the associated knowledge base; If r i pre ≠null and r i post =null, then delete the derived knowledge base with r i pre is the derived rule set with r as the immediate predecessor and r as the immediate successor; call AdjustPreAndPostPairSetforDeletion(r i pre , r, null) updates the associated knowledge base.

[0059] 3.3 To change r to r', first delete r and then add r'.

[0060] 4. Given a rule r, find the direct predecessor and direct successor pair set of r. PreAndPostPairSet method, input rule r, output direct predecessor and direct successor pair set, the number of pairs is i: Initialize i=0; preAndPostPairSet = null; rpre[i]=null; rpost[i]=null; { rules=findAllRulesByFeature(f), { if(F(r)⊂F(rule)){ for(int j = 0; j++; j <i+1){ if(rpost[j]==null&&F(rpre[j])⊂F(r)) {rpost[j] = rule; break;} if(F(rule)⊂F(rpost[j])) { rpost[j] =rule; break; } } if (j == i +1){ i ++; rpre[i]=null; rpost[i]= rule; } } if(F(rule)⊂F(r)){ for(int j = 0; j++; j <i+1){ if(rpre[j]==null&&F(r)⊂F(rpost[j] ) {rpre[j] = rule; break;} if(F(rule)⊂F(rpre[j])) { rpre[j] = rule; break; } } if (j == i +1){ i ++; rpre[i]=rule; [i]= null; } } } if(i==0) return ∅; for(j =0; j <i;j++) preAndPostPairSet.add((rpre[j],rpost[j])); return preAndPostPairSet; } }.

[0061] 5. Generate a derived rule set with r as the direct predecessor and r' as the direct successor: Obviously F(r)⊂F(r'), first find G=F(r')-F(r), then find 2 N ,∀γ∈2 N -∅-N, generate rules with F(r)∪γ as premise and r as conclusion. The set of all such rules is the set of non-monotonic derived rules of the required rule r' relative to r.

[0062] 6. When inserting rule r, find its associated predecessor and successor rule pair set PreAndPostPairSet according to the algorithm PreAndPostPairSet(r). When inserting r, each pair of direct predecessor and direct successor (r pre , r post) The associated knowledge base needs to be adjusted. The adjustment algorithm when adding rules is AdjustPreAndPostPairSetforAddition (r Pre , r, r post ); When deleting rule r, the direct predecessor and direct successor of the corresponding rules affected by the deletion of r also need to be adjusted. The adjustment method triggered by deleting rule r is AdjustPreAndPostPairSetforDeletetion. The following is the corresponding algorithm for adjusting the associated knowledge base when adding and deleting rules.

[0063] The algorithm for adjusting PreAndPostPairSet when adding rule r is as follows: AdjustPreAndPostPairSetforAddition(rpre, r, rpost) { newPrePairSet = null; newPostPairSet = null; if(rpre!=null&&rpost!=null){ if(rpre !=null) prePairSet=findPreAndPostPairSet(rpre); if(rpost!=null) postPairSet = findPreAndPostPairSet(rpost); for((r1,r2) in prePairSet){ if(r2!=rpost) newPrePairSet.add((r1,r2)); else newPrePairSet.add((r1,r)); if(r1!=rpre) newPrePairSet.add((r1,r2)); else newPrePairSet.add((r,rpost)); } if (rpre=null&&rpost !=null){ postPairSet = findPreAndPostPairSet(rpost); newPostPairSet= newPostPairSet + postPairSet ; newPostPairSet . add ( ( r , rpost ) ) ; }} if (rpre!=null&&rpost ==null){ prePairSet = findPreAndPostPairSet(rpost); newPrePairSet= newPrePairSet + prePairSet ; newPrePairSet . add ( ( r , rpost ) ) ; }} if ( newPrePairSet ! = null ) upsertAssociateKnowledge(rpre,newPrePairSet); if ( newPostPairSet ! = null ) upsertAssociateKnowledge ( rPost , newPostPairSet ) ; }} Remove PreAndPostPairSet Packaging: AdjustPreAndPostPairSetForDeletion(rpre,r,rpost){ newPrePairSet = null; newPostPairSet = null; if ( rpre ! = null ) prePairSet = findPreAndPostPairSet ( rpe ) ; if ( rpost ! = null ) postPostPairSet = findPreAndPostPairSet ( rpost ) ; if ( rpre != null && rpost != null ) { for ( ( r1 , r2 ) in prePairSet ) { if ( r1 ! = null ) { if( r2 != r){ newPrePairSet.add((r1,r2)); else { for((r3,r4) in postPairSet) if(r3!=null) { if(r3==r&&F(rpre) in F(rpost)) { newPrePairSet.add((r1,rpost)); newPostPairSet.add((rpre, r4)); } else { if(r3 !=null) postPairSet.add((r3,r4)) } } } } } else { if(r1==null) if(r2!=r) newPrePairSet.add((r1,r2)); } if(newPrePairSet == null) deleteAssociateSet(rpre); else upsertPreAndPostPairSet(rpre,newPrePairSet); if(newPostPairSet == null) deleteAssociateSet(rpost); else upsertPreAndPostPiarSet(rpost,newPostPairSet); }。

[0064] The above method deleteAssociateSet(r) deletes the direct predecessor and direct successor pair set of rule r in the associated knowledge base, and upsertPreAndPostPairSet(r, preAndPostPairSet) updates or inserts the direct predecessor and direct successor pair set preAndPostPairSet of rule r.

[0065] Example 3 Example 3 discloses a deduction lattice. Patent application number CN201610985211.4 discloses a deduction lattice and a reasoning method based on the deduction lattice. This embodiment is based on the patent.

[0066] The deduction grid of this patent only supports monotonic reasoning. If you need to support non-monotonic reasoning, you need to modify the deduction grid and add an intermediate node as the default type to each non-leaf node. If the conditions of all the child nodes of the current node are not met, it means that there is no rule that meets the conditions. At this time, the default type intermediate node of the current node points to null, indicating the above situation; in another case, the node points to the conclusion of the matched rule. Therefore, when the conditions corresponding to all the current child nodes are not met, two situations are matched: when the default type intermediate node of the current node points to null, it means that no rule can be matched; when it is not empty, it matches a rule in the knowledge base.

[0067] The deduction grid is a grid structure that satisfies the following characteristics: the deduction grid consists of a root node, intermediate nodes, and leaf nodes, and the root node is the symptom x; for any non-leaf node Node, assume that the number of child nodes of the Node is k, which are C1, C2, ..., C k , C1 is the first child node of the Node, C2 is the second, and so on. TreeSet (C i ) is C i is the root node and C i The node set consisting of the subsequent intermediate nodes is counted as TreeSet (C i ), excluding leaf nodes, C i satisfy:

[0068] The steps for reasoning using the improved deduction grid are as follows: Generate a lattice (1) Input condition x, the form of the rule in the knowledge base is r: x1∧x2∧,…, ∧x n ->c, where x1, x2, …, x n is the premise, also called feature, and c is the conclusion.

[0069] a) Find a rule set A in the native knowledge base whose premise contains x; b) Find a rule set B whose rule premise contains x in the non-monotonic derived knowledge base; c) Calculate rules = A + B.

[0070] (2) Initialization: leaf node set Leafs = null; task queue taskQueue = null; ruleSet = rules.

[0071] For the subsequent process, please refer to application number CN2024104964993.

[0072] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for organizing a knowledge base to support non-monotonic reasoning, characterized in that: The method comprises: When adding rule r, obtain r's direct predecessor and successor association relationship set preAndPostPairSet; determine whether |preAndPostPairSet| is 0; if so, directly insert r into the native knowledge base; if not, insert r into the native knowledge base and update the derived knowledge base and the associated knowledge base respectively; When deleting rule r, obtain<r,preAndPostPairSet> , determine whether the return value is empty; if so, delete r directly from the native knowledge base; if not, delete r from the native knowledge base and update the derived knowledge base, ∀i∈{1,…, |preAndPostPairSet|},(r i pre ,r i post )∈preAndPostPairSet, and call AdjustPreAndPostPairSetforDeletion(r i pre , r, r i post ) Update the associated knowledge base.

2. The method for organizing a knowledge base to support non-monotonic reasoning according to claim 1, characterized in that: (Γ->X)∧(Γ⊂Γ')-> Γ'->X(Ⅰ); r: A->C(Ⅱ); Γ->X(III); Γ'->X'(Ⅳ); Γ''->X''(V); Among them, Γ represents known information, X represents conclusion, r represents rule, Γ', Γ'' and A represent feature sets, F(r) represents the premise of rule r, and C represents the conclusion of rule r; Definition: Γ->X and satisfies Γ⊂Γ', γ=Γ'-Γ≠∅, Γ'→ X' and X≠X', then Γ'->X' with the above properties is a non-monotonic logic of Γ->X; Definition: If there exist formulas III, IV and V, and X≠X'≠X'' and Γ⊂Γ'⊂Γ'', then formula V is the non-monotonic logic of formulas IV and III, and formula IV is the non-monotonic logic of formula III; All rules similar to formulas Ⅰ, Ⅱ, Ⅲ, and Ⅳ are native rules, and the knowledge base composed of native rules is the native knowledge base; In the knowledge base, if there exists r1: Γ->X and r2: Γ'->X' and Γ⊂Γ' and X≠X', and there does not exist Γ''->X'' in the knowledge base, and Γ''⊂Γ', Γ⊂Γ'' and X≠X'≠X'', then Γ'->X' is a direct non-monotone rule of Γ->X; r1 is the direct predecessor of r2, and r2 is the direct successor of r1; In the native knowledge base, if there exists r1:Γ'->X' as the direct successor of r2:Γ->X, let G = Γ'-Γ, according to the default logic and closed world assumption, then ∀γ∈2 G -∅-G, Γ∪γ->X, Γ∪∅->X and Γ∪G->X'; ∀γ∈2 G -∅-G, Γ∪γ->X is the rule set of non-monotonic derivation of r2 with respect to r1; In the native knowledge base, if there exists r1:Γ'->X' as a direct predecessor of r2:Γ->X, let H = Γ-Γ'. According to the default logic and closed world assumption, we have ∀γ∈2 H -∅-H, Γ'∪γ->X; and Γ'∪∅->X', Γ'∪H->X; In the native knowledge base, if there exists r1: Γ'->X', there is also a direct predecessor r2: Γ->X and a direct successor r3: Γ''->X'', let J = Γ'-Γ, M = Γ''-Γ', according to the default logic and closed world assumption, then ∀γ1∈2 J -∅-J, Γ∪γ1->X, and ∀γ2∈2 M -∅-M,Γ'∪γ2->X'; Definition: In the native knowledge base, if there exists Γ'->X' in the native knowledge base as a direct successor of Γ->X, let K = Γ'-Γ, then ∀γ∈2 K -∅-K, Γ∪γ->X, then Γ∪γ->X is called the derived rule derived from Γ and Γ', and the knowledge base composed of all derived rules is called the derived knowledge base; Definition: r pre is the direct predecessor of r, r post is the direct successor of r, (r pre ,r post ) is the direct predecessor and successor pair of r, and preAndPostPairSet is the direct predecessor and successor pair that may exist in rule r (r pre ,r post )<r,preAndPostPairSet> is the direct predecessor-successor relationship between rule r and preAndPostPairSet.<r,preAndPostPairSet> Form a related knowledge base.

3. The method for organizing a knowledge base to support non-monotonic reasoning according to claim 2, characterized in that: If |preAndPostPairSet|=0, it means r has neither direct predecessor nor direct successor; If |preAndPostPairSet|≠0, then ∀i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet, there are the following situations: Case (1): If r i pre =null, r is said to be relative to r i post There is no direct predecessor, then ∀j∈{1,…,|preAndPostPairSet|}, i≠j, r i post ⊄r j post , r j post ⊄r i post ; Case (2): If r i post =null, r is said to be relative to r i pre There is no direct successor, then ∀j∈{1,…,|preAndPostPairSet|}, i≠j, r i pre ⊄r j pre , r j pre ⊄r i pre ; Case (3): If r i pre and r i post When both are not null, r is relative to (r i pre , r i pre ) has both a direct predecessor and a direct successor; then ∀j∈j∈{1,…,|preAndPostPairSet|}, i≠j, r i post ⊄r j post , r j post ⊄r i post , r i pre ⊄r j pre , r j pre ⊄r i pre .

4. The method for organizing a knowledge base to support non-monotonic reasoning according to claim 3, characterized in that: Adding rule r operations include: Determine whether rule r is repeated, conflicting, or non-monotonic in the native knowledge base; If there is duplication or conflict, a prompt will be given and the adding operation will be abandoned; If a non-monotonic situation occurs, obtain preAndPostPairSet=PreAndPostPairSet(r) and determine whether |preAndPostPairSet| is zero; If it is zero, then directly insert rule r into the native knowledge base and it is done; If it is not zero, insert rule r into the native knowledge base and insert a rule into the associated knowledge base.<r,preAndPostPairSet> Record; ∀i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet r of associated pairs i pre With r i post When it is not completely empty, it is divided into the following three situations, and the derived knowledge base and the associated knowledge base are updated respectively. The following are the three situations: r i pre ≠null and r i post ≠null; r i pre =null and r i post ≠null; r i pre ≠null and r i post =null.

5. The method for organizing a knowledge base to support non-monotonic reasoning according to claim 4, characterized in that: The updating of the derived knowledge base and the associated knowledge base respectively includes: For i∈{1,…,|preAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet; If r i pre ≠null and r i post ≠null; delete the derived knowledge base with r i pre Direct front drive and r i post Regenerate all the derived rules that follow directly, starting with r i pre is the direct predecessor and r is the direct successor of the derived rule set A, and generates r as the direct predecessor and r as the direct successor of the derived rule set A. i post is the direct successor derived rule set B, C i =A∪B, ∀j∈{1,…,|preAndPostPairSet|},j≠i, will (r j pre , r j post ) in accordance with F(r j pre )⊇F(r j pre ) All derivation rules from C j Delete the new C j , then all C j Insert into the derived knowledge base; call AdjustPreAndPostPairSetforAddition(r i pre , r, r i post ) Update the associated knowledge base; If r i pre =null and r i post ≠null, generates a sequence with r as the immediate predecessor and r as the i post The derived rule set C is the direct successor i and insert it into the derived knowledge base, calling AdjustPreAndPostPairSetforAddition(null, r, r i post ) Update the associated knowledge base; If r i pre ≠null and r i post =null, generate i pre The derived rule set C with r as the direct predecessor and r as the direct successor i , ∀j∈{1,…,|preAndPostPairSet|},j≠i, will (r j pre, r j post ) in accordance with F(r j pre )⊇F(r j pre ) All derivation rules from C j Delete the new C j , and all C j Insert into the derived knowledge base; call AdjustPreAndPostPairSetforAddition(r i pre , r, null) to update the associated knowledge base.

6. The method for organizing a knowledge base to support non-monotonic reasoning according to claim 5, characterized in that: The operations to delete a rule include: Query records from the associated knowledge base<r,preAndPostPairSet> , determine whether the return value is empty; If it is empty, delete rule r directly and complete; If not empty, ∀i∈{1,…,|PreAndPostPairSet|}, (r i pre , r i post )∈preAndPostPairSet, obviously r i pre With r i post Not all are null; the derived knowledge base and the associated knowledge base are updated according to the following three situations: r i pre ≠null and r i post ≠null; r i pre =null and r i post ≠null; r i pre ≠null and r i post =null.

7. The method for organizing a knowledge base to support non-monotonic reasoning according to claim 6, characterized in that: The updating of the derived knowledge base and the associated knowledge base respectively according to the following three situations includes: ∀i∈{1,…,|PreAndPostPairSet|},(r i pre ,r i post )∈preAndPostPairSet; If r i pre ≠null and r i post ≠null, delete the derived knowledge base with r i pre All derived rules with r as the direct predecessor and r as the direct successor are deleted. i post All derived rules with r as the direct successor are generated with r as the direct predecessor. i pre Direct front drive and r i post The direct successor derived rule set is inserted into the derived knowledge base; call AdjustPreAndPostPairSetforDeletion(r i pre , r, r i post ) Update the associated knowledge base; If r i pre =null and r i post ≠null, delete the tree with r as the direct predecessor and r as the direct predecessor from the derived knowledge base. i post For the direct successor derivation rule; call AdjustPreAndPostPairSetforDeletion (null, r, r i post ) Update the associated knowledge base; If r i pre ≠null and r i post = null, then delete the derived knowledge base with r i pre is the derived rule set with r as the immediate predecessor and r as the immediate successor; call AdjustPreAndPostPairSetforDeletion(r i pre , r, null) updates the associated knowledge base.

8. The method for organizing a knowledge base to support non-monotonic reasoning according to claim 7, characterized in that: The method to generate a derived rule set with r as the direct predecessor and r' as the direct successor is: F(r)⊂F(r'), first find N=F(r')-F(r), then find 2 N and ∀γ∈2 N -∅-N, generate rules with F(r)∪γ as premise and r as conclusion. The set of all such rules is the derived rule set.

9. Support the application of non-monotonic reasoning knowledge base, characterized by: The native knowledge base and the derived knowledge base are merged as the knowledge base of the deduction grid, and an intermediate node of the default type is added to each non-leaf node; if all the child node conditions of the current node are not met, the intermediate node of the default type of the current node points to empty.

10. The use according to claim 9, characterized in that: The method of merging the native knowledge base and the derived knowledge base is as follows: input condition x, the form of the rule in the knowledge base is r: x1∧x2∧,…, ∧x n ->c, where x1, x2, …, x n as a prerequisite; find the rule set A whose premise contains x in the native knowledge base, and find the rule set B whose premise contains x in the derived knowledge base; calculate rules = A + B.

Citation Information

Cited By

  • Knowledge base and large model based document generation system, method, device and medium

    CN122711811A